Code

Added smarty 3 rc
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jan 2010 16:03:58 +0000 (16:03 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jan 2010 16:03:58 +0000 (16:03 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15339 594d385d-05f5-0310-b6e9-bd551577e9d8

181 files changed:
gosa-core/include/smarty/Smarty.class.php [new file with mode: 0644]
gosa-core/include/smarty/debug.tpl [new file with mode: 0644]
gosa-core/include/smarty/plugins/block.php.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/block.render.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/block.t.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/block.textformat.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.counter.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.cycle.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.fetch.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.html_checkboxes.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.html_image.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.html_options.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.html_radios.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.html_select_date.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.html_select_time.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.html_table.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.mailto.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.math.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.msgPool.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.popup.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/function.popup_init.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.capitalize.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.cat.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.count_characters.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.count_paragraphs.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.count_sentences.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.count_words.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.date_format.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.debug_print_var.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.default.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.escape.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.indent.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.lower.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.noprint.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.regex_replace.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.replace.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.spacify.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.string_format.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.strip.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.strip_tags.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.truncate.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.upper.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/modifier.wordwrap.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/shared.escape_special_chars.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/shared.make_timestamp.php [new file with mode: 0644]
gosa-core/include/smarty/plugins/variablefilter.htmlspecialchars.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_cacheresource_file.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_append.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_assign.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_block.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_call.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_capture.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_config_load.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_debug.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_eval.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_extends.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_for.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_foreach.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_if.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_include.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_include_php.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_insert.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_ldelim.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_nocache.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_block_plugin.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_function_plugin.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_modifier.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_object_block_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_object_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_print_expression.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_registered_block.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_registered_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_special_variable.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_rdelim.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_section.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compile_while.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_compilebase.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_config.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_config_file_compiler.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_configfilelexer.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_configfileparser.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_data.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_debug.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_filter_handler.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_function_call_handler.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_resource_extends.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_resource_file.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_resource_php.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_resource_registered.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_resource_stream.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_resource_string.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_security_handler.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_smartytemplatecompiler.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_template.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_templatecompilerbase.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_templatelexer.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_templateparser.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_internal_write_file.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method__get_filter_name.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_addpluginsdir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_clear_all_assign.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_clear_all_cache.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_clear_assign.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_clear_cache.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_clear_compiled_tpl.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_clear_config.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_compile_directory.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disablecachemodifycheck.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disablecaching.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disablecompilecheck.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disableconfigbooleanize.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disableconfigoverwrite.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disableconfigreadhidden.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disabledebugging.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disabledebuggingurlctrl.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disabledefaulttimezone.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disableforcecompile.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_disablevariablefilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enablecachemodifycheck.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enablecompilecheck.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enableconfigbooleanize.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enableconfigoverwrite.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enableconfigreadhidden.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enabledebugging.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enabledebuggingurlctrl.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enabledefaulttimezone.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enableforcecompile.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_enablevariablefilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_get_config_vars.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_get_global.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_get_registered_object.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_get_template_vars.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_getcachedir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_getcachelifetime.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_getcompiledir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_getconfigdir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_getdebugtemplate.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_getpluginsdir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_gettemplatedir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_getvariablefilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_iscachemodifycheck.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_iscaching.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_iscompilecheck.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_isconfigbooleanize.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_isconfigoverwrite.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_isconfigreadhidden.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_isdebugging.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_isdebuggingurlctrl.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_isdefaulttimezone.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_isforcecompile.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_load_filter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_block.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_compiler_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_modifier.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_object.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_outputfilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_postfilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_prefilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_resource.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_register_variablefilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_registerdefaultpluginhandler.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_registerdefaulttemplatehandler.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_setconfigdir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_setdebugtemplate.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_setpluginsdir.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_template_exists.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_test.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_block.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_compiler_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_function.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_modifier.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_object.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_outputfilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_postfilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_prefilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_resource.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_method_unregister_variablefilter.php [new file with mode: 0644]
gosa-core/include/smarty/sysplugins/smarty_security.php [new file with mode: 0644]

diff --git a/gosa-core/include/smarty/Smarty.class.php b/gosa-core/include/smarty/Smarty.class.php
new file mode 100644 (file)
index 0000000..6f28857
--- /dev/null
@@ -0,0 +1,545 @@
+<?php
+
+/**
+* Project:     Smarty: the PHP compiling template engine
+* File:        Smarty.class.php
+* SVN:         $Id: Smarty.class.php 3420 2009-12-29 20:12:11Z Uwe.Tews $
+* 
+* 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 2.1 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 
+* @package Smarty
+* @version 3-SVN$Rev: 3286 $
+*/
+
+/**
+* define shorthand directory separator constant
+*/
+if (!defined('DS')) {
+    define('DS', DIRECTORY_SEPARATOR);
+} 
+
+/**
+* set SMARTY_DIR to absolute path to Smarty library files.
+* Sets SMARTY_DIR only if user application has not already defined it.
+*/
+if (!defined('SMARTY_DIR')) {
+    define('SMARTY_DIR', dirname(__FILE__) . DS);
+} 
+
+/**
+* set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.
+* Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it.
+*/
+if (!defined('SMARTY_SYSPLUGINS_DIR')) {
+    define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DS);
+} 
+if (!defined('SMARTY_PLUGINS_DIR')) {
+    define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);
+} 
+if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
+    define('SMARTY_RESOURCE_CHAR_SET', 'UTF-8');
+} 
+if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
+    define('SMARTY_RESOURCE_DATE_FORMAT', '%b %e, %Y');
+} 
+
+/**
+* define variable scopes
+*/
+define('SMARTY_LOCAL_SCOPE', 0);
+define('SMARTY_PARENT_SCOPE', 1);
+define('SMARTY_ROOT_SCOPE', 2);
+define('SMARTY_GLOBAL_SCOPE', 3);
+
+/**
+* define caching modes
+*/
+define('SMARTY_CACHING_OFF', 0);
+define('SMARTY_CACHING_LIFETIME_CURRENT', 1);
+define('SMARTY_CACHING_LIFETIME_SAVED', 2);
+
+/**
+* This determines how Smarty handles "<?php ... ?>" tags in templates.
+* possible values:
+*/
+define('SMARTY_PHP_PASSTHRU', 0); //-> print tags as plain text
+define('SMARTY_PHP_QUOTE', 1); //-> escape tags as entities
+define('SMARTY_PHP_REMOVE', 2); //-> escape tags as entities
+define('SMARTY_PHP_ALLOW', 3); //-> escape tags as entities
+
+/**
+* register the class autoloader
+*/
+if (!defined('SMARTY_SPL_AUTOLOAD')) {
+    define('SMARTY_SPL_AUTOLOAD', 0);
+} 
+
+if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) {
+    $registeredAutoLoadFunctions = spl_autoload_functions();
+    if (!isset($registeredAutoLoadFunctions['spl_autoload'])) {
+        spl_autoload_register();
+    } 
+} else {
+    spl_autoload_register('smartyAutoload');
+} 
+
+/**
+* This is the main Smarty class
+*/
+class Smarty extends Smarty_Internal_Data {
+    // smarty version
+    const SMARTY_VERSION = 'Smarty3-b7'; 
+    // auto literal on delimiters with whitspace
+    public $auto_literal = true; 
+    // display error on not assigned variables
+    public $error_unassigned = false; 
+    // template directory
+    public $template_dir = null; 
+    // default template handler
+    public $default_template_handler_func = null; 
+    // compile directory
+    public $compile_dir = null; 
+    // plugins directory
+    public $plugins_dir = null; 
+    // cache directory
+    public $cache_dir = null; 
+    // config directory
+    public $config_dir = null; 
+    // force template compiling?
+    public $force_compile = false; 
+    // check template for modifications?
+    public $compile_check = true; 
+    // use sub dirs for compiled/cached files?
+    public $use_sub_dirs = false; 
+    // compile_error?
+    public $compile_error = false; 
+    // caching enabled
+    public $caching = false; 
+    // merge compiled includea
+    public $merge_compiled_includes = false; 
+    // cache lifetime
+    public $cache_lifetime = 3600; 
+    // force cache file creation
+    public $force_cache = false; 
+    // cache_id
+    public $cache_id = null; 
+    // compile_id
+    public $compile_id = null; 
+    // template delimiters
+    public $left_delimiter = "{";
+    public $right_delimiter = "}"; 
+    // security
+    public $security_class = 'Smarty_Security';
+    public $php_handling = SMARTY_PHP_PASSTHRU;
+    public $allow_php_tag = false;
+    public $allow_php_templates = false;
+    public $security = false;
+    public $security_policy = null;
+    public $security_handler = null;
+    public $direct_access_security = true; 
+    // debug mode
+    public $debugging = false;
+    public $debugging_ctrl = 'URL';
+    public $smarty_debug_id = 'SMARTY_DEBUG';
+    public $debug_tpl = null; 
+    // When set, smarty does uses this value as error_reporting-level.
+    public $error_reporting = null; 
+    // config var settings
+    public $config_overwrite = true; //Controls whether variables with the same name overwrite each other.
+    public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean
+    public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file.                                              
+    // config vars
+    public $config_vars = array(); 
+    // assigned tpl vars
+    public $tpl_vars = array(); 
+    // assigned global tpl vars
+    public $global_tpl_vars = array(); 
+    // dummy parent object
+    public $parent = null; 
+    // global template functions
+    public $template_functions = array(); 
+    // resource type used if none given
+    public $default_resource_type = 'file'; 
+    // caching type
+    public $caching_type = 'file'; 
+    // internal cache resource types
+    public $cache_resource_types = array('file'); 
+    // config type
+    public $default_config_type = 'file'; 
+    // exception handler: array('ExceptionClass','ExceptionMethod');
+    public $exception_handler = null; 
+    // cached template objects
+    public $template_objects = null; 
+    // check If-Modified-Since headers
+    public $cache_modified_check = false; 
+    // registered plugins
+    public $registered_plugins = array(); 
+    // plugin search order
+    public $plugin_search_order = array('function', 'block', 'compiler', 'class'); 
+    // registered objects
+    public $registered_objects = array(); 
+    // registered filters
+    public $registered_filters = array(); 
+    // autoload filter
+    public $autoload_filters = array(); 
+    // status of filter on variable output
+    public $variable_filter = true; 
+    // global internal smarty  vars
+    public $_smarty_vars = array(); 
+    // start time for execution time calculation
+    public $start_time = 0; 
+    // default file permissions
+    public $_file_perms = 0644; 
+    // default dir permissions
+    public $_dir_perms = 0771; 
+    // smarty object reference
+    public $smarty = null;
+
+    /**
+    * Class constructor, initializes basic smarty properties
+    */
+    public function __construct() {
+        // self reference needed by other classes methods
+        $this->smarty = $this;
+
+        if (is_callable('mb_internal_encoding')) {
+            mb_internal_encoding(SMARTY_RESOURCE_CHAR_SET);
+        } 
+        $this->start_time = $this->_get_time(); 
+        // set exception handler
+        if (!empty($this->exception_handler))
+        set_exception_handler($this->exception_handler); 
+        // set default dirs
+        $this->template_dir = array('.' . DS . 'templates' . DS);
+        $this->compile_dir = '.' . DS . 'templates_c' . DS;
+        $this->plugins_dir = array(SMARTY_PLUGINS_DIR);
+        $this->cache_dir = '.' . DS . 'cache' . DS;
+        $this->config_dir = '.' . DS . 'configs' . DS;
+        $this->debug_tpl = SMARTY_DIR . 'debug.tpl';
+        if (!$this->debugging && $this->debugging_ctrl == 'URL') {
+            if (isset($_SERVER['QUERY_STRING'])) {
+                $_query_string = $_SERVER['QUERY_STRING'];
+            } 
+            else {
+                $_query_string = '';
+            } 
+            if (false !== strpos($_query_string, $this->smarty_debug_id)) {
+                if (false !== strpos($_query_string, $this->smarty_debug_id . '=on')) {
+                    // enable debugging for this browser session
+                    setcookie('SMARTY_DEBUG', true);
+                    $this->debugging = true;
+                } 
+                elseif (false !== strpos($_query_string, $this->smarty_debug_id . '=off')) {
+                    // disable debugging for this browser session
+                    setcookie('SMARTY_DEBUG', false);
+                    $this->debugging = false;
+                } 
+                else {
+                    // enable debugging for this page
+                    $this->debugging = true;
+                } 
+            } 
+            else {
+                if (isset($_COOKIE['SMARTY_DEBUG'])) {
+                    $this->debugging = true;
+                } 
+            } 
+        } 
+        $this->assign_global('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
+    } 
+
+    /**
+    * Class destructor
+    */
+    public function __destruct() {
+        // restore to previous exception handler, if any
+        if (!empty($this->exception_handler))
+        restore_exception_handler();
+    } 
+
+    /**
+    * fetches a rendered Smarty template
+    * 
+    * @param string $template the resource handle of the template file or template object
+    * @param mixed $cache_id cache id to be used with this template
+    * @param mixed $compile_id compile id to be used with this template
+    * @param object $ |null $parent next higher level of Smarty variables
+    * @return string rendered template output
+    */
+    public function fetch($template, $cache_id = null, $compile_id = null, $parent = null) {
+        if (is_object($cache_id)) {
+            $parent = $cache_id;
+            $cache_id = null;
+        } 
+        if ($parent === null) {
+            // get default Smarty data object
+            $parent = $this;
+        } 
+        // create template object if necessary
+        ($template instanceof $this->template_class)? $_template = $template :
+        $_template = $this->createTemplate ($template, $cache_id, $compile_id, $parent);
+        $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
+            ? $this->error_reporting : error_reporting() &~E_NOTICE); 
+        // return redered template
+        if (isset($this->autoload_filters['output']) || isset($this->registered_filters['output'])) {
+            $_output = Smarty_Internal_Filter_Handler::runFilter('output', $_template->getRenderedTemplate(), $this);
+        } 
+        else {
+            $_output = $_template->getRenderedTemplate();
+        } 
+        $_template->rendered_content = null;
+        error_reporting($_smarty_old_error_level);
+        return $_output;
+    } 
+
+    /**
+    * displays a Smarty template
+    * 
+    * @param string $ |object $template the resource handle of the template file  or template object
+    * @param mixed $cache_id cache id to be used with this template
+    * @param mixed $compile_id compile id to be used with this template
+    * @param object $parent next higher level of Smarty variables
+    */
+    public function display($template, $cache_id = null, $compile_id = null, $parent = null) {
+        // display template
+        echo $this->fetch ($template, $cache_id, $compile_id, $parent); 
+        // debug output
+        if ($this->debugging) {
+            Smarty_Internal_Debug::display_debug($this);
+        } 
+        return true;
+    } 
+
+    /**
+    * test if cache i valid
+    * 
+    * @param string $ |object $template the resource handle of the template file or template object
+    * @param mixed $cache_id cache id to be used with this template
+    * @param mixed $compile_id compile id to be used with this template
+    * @return boolean cache status
+    */
+    public function is_cached($template, $cache_id = null, $compile_id = null) {
+        if (!($template instanceof $this->template_class)) {
+            $template = $this->createTemplate ($template, $cache_id, $compile_id, $this);
+        } 
+        // return cache status of template
+        return $template->isCached();
+    } 
+
+    /**
+    * Loads security class and enables security
+    */
+    public function enableSecurity() {
+        if (isset($this->security_class)) {
+            $this->security_policy = new $this->security_class;
+            $this->security_handler = new Smarty_Internal_Security_Handler($this);
+            $this->security = true;
+        } 
+        else {
+            throw new Exception('Property security_class is not defined');
+        } 
+    } 
+
+    /**
+    * Set template directory
+    * 
+    * @param string $ |array $template_dir folder(s) of template sorces
+    */
+    public function setTemplateDir($template_dir) {
+        $this->template_dir = (array)$template_dir;
+        return;
+    } 
+    /**
+    * Adds template directory(s) to existing ones
+    * 
+    * @param string $ |array $template_dir folder(s) of template sources
+    */
+    public function addTemplateDir($template_dir) {
+        $this->template_dir = array_merge((array)$this->template_dir, (array)$template_dir);
+        $this->template_dir = array_unique($this->template_dir);
+        return;
+    } 
+    /**
+    * Set compile directory
+    * 
+    * @param string $compile_dir folder of compiled template sources
+    */
+    public function setCompileDir($compile_dir) {
+        $this->compile_dir = $compile_dir;
+        return;
+    } 
+    /**
+    * Set cache directory
+    * 
+    * @param string $cache_dir folder of cache files
+    */
+    public function setCacheDir($cache_dir) {
+        $this->cache_dir = $cache_dir;
+        return;
+    } 
+    /**
+    * Enable Caching
+    */
+    public function enableCaching() {
+        $this->caching = SMARTY_CACHING_LIFETIME_CURRENT;
+        return;
+    } 
+    /**
+    * Set caching life time
+    * 
+    * @param integer $lifetime lifetime of cached file in seconds
+    */
+    public function setCacheLifetime($lifetime) {
+        $this->cache_lifetime = $lifetime;
+        return;
+    } 
+    /**
+    * Takes unknown classes and loads plugin files for them
+    * class name format: Smarty_PluginType_PluginName
+    * plugin filename format: plugintype.pluginname.php
+    * 
+    * @param string $plugin_name class plugin name to load
+    * @return string|boolean filepath of loaded file or false
+    */
+    public function loadPlugin($plugin_name, $check = true) {
+        // if function or class exists, exit silently (already loaded)
+        if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false)))
+        return true; 
+        // Plugin name is expected to be: Smarty_[Type]_[Name]
+        $_plugin_name = strtolower($plugin_name);
+        $_name_parts = explode('_', $_plugin_name, 3); 
+        // class name must have three parts to be valid plugin
+        if (count($_name_parts) < 3 || $_name_parts[0] !== 'smarty') {
+            throw new Exception("plugin {$plugin_name} is not a valid name format");
+            return false;
+        } 
+        // if type is "internal", get plugin from sysplugins
+        if ($_name_parts[1] == 'internal') {
+            $file = SMARTY_SYSPLUGINS_DIR . $_plugin_name . '.php';
+            if (file_exists($file)) {
+                require_once($file);
+                return $file;
+            } 
+            else {
+                return false;
+            } 
+        } 
+        // plugin filename is expected to be: [type].[name].php
+        $_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php"; 
+        // loop through plugin dirs and find the plugin
+        foreach((array)$this->plugins_dir as $_plugin_dir) {
+            if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
+                $_plugin_dir .= DS;
+            } 
+            $file = $_plugin_dir . $_plugin_filename;
+            if (file_exists($file)) {
+                require_once($file);
+                return $file;
+            } 
+        } 
+        // no plugin loaded
+        return false;
+    } 
+
+    /**
+    * Sets the exception handler for Smarty.
+    * 
+    * @param mixed $handler function name or array with object/method names
+    * @return string previous exception handler
+    */
+    public function setExceptionHandler($handler) {
+        $this->exception_handler = $handler;
+        return set_exception_handler($handler);
+    } 
+
+    /**
+    * Loads cache resource.
+    * 
+    * @return object of cache resource
+    */
+    public function loadCacheResource($type = null) {
+        if (!isset($type)) {
+            $type = $this->caching_type;
+        } 
+        // already loaded?
+        if (isset($this->cache_resource_objects[$type])) {
+            return $this->cache_resource_objects[$type];
+        } 
+        if (in_array($type, $this->cache_resource_types)) {
+            $cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
+            return $this->cache_resource_objects[$type] = new $cache_resource_class($this);
+        } 
+        else {
+            // try plugins dir
+            $cache_resource_class = 'Smarty_CacheResource_' . ucfirst($type);
+            if ($this->loadPlugin($cache_resource_class)) {
+                return $this->cache_resource_objects[$type] = new $cache_resource_class($this);
+            } 
+            else {
+                throw new Exception("Unable to load cache resource '{$type}'");
+            } 
+        } 
+    } 
+
+    /**
+    * trigger Smarty error
+    * 
+    * @param string $error_msg 
+    * @param integer $error_type 
+    */
+    public function trigger_error($error_msg, $error_type = E_USER_WARNING) {
+        throw new Exception("Smarty error: $error_msg");
+    } 
+
+    /**
+    * Takes unknown class methods and lazy loads sysplugin files for them
+    * class name format: Smarty_Method_MethodName
+    * plugin filename format: method.methodname.php
+    * 
+    * @param string $name unknown methode name
+    * @param array $args aurgument array
+    */
+    public function __call($name, $args) {
+        $name = strtolower($name);
+        if ($name == 'smarty') {
+            throw new Exception('Please use parent::__construct() to call parent constuctor');
+        } 
+        $function_name = 'smarty_method_' . $name;
+        if (!is_callable($function_name)) {
+            if (!file_exists(SMARTY_SYSPLUGINS_DIR . $function_name . '.php')) {
+                throw new Exception('Undefined Smarty method "' . $name . '"');
+            } 
+            require_once(SMARTY_SYSPLUGINS_DIR . $function_name . '.php');
+        } 
+        return call_user_func_array($function_name, array_merge(array($this), $args));
+    } 
+} 
+
+function smartyAutoload($class) {
+    $_class = strtolower($class);
+    if (substr($_class, 0, 16) === 'smarty_internal_' || $_class == 'smarty_security') {
+        include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/debug.tpl b/gosa-core/include/smarty/debug.tpl
new file mode 100644 (file)
index 0000000..9fd46b1
--- /dev/null
@@ -0,0 +1,136 @@
+{capture assign=debug_output}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+    <title>Smarty Debug Console</title>
+<style type="text/css">
+{literal}
+body, h1, h2, td, th, p {
+    font-family: sans-serif;
+    font-weight: normal;
+    font-size: 0.9em;
+    margin: 1px;
+    padding: 0;
+}
+
+h1 {
+    margin: 0;
+    text-align: left;
+    padding: 2px;
+    background-color: #f0c040;
+    color:  black;
+    font-weight: bold;
+    font-size: 1.2em;
+ }
+
+h2 {
+    background-color: #9B410E;
+    color: white;
+    text-align: left;
+    font-weight: bold;
+    padding: 2px;
+    border-top: 1px solid black;
+}
+
+body {
+    background: black; 
+}
+
+p, table, div {
+    background: #f0ead8;
+} 
+
+p {
+    margin: 0;
+    font-style: italic;
+    text-align: center;
+}
+
+table {
+    width: 100%;
+}
+
+th, td {
+    font-family: monospace;
+    vertical-align: top;
+    text-align: left;
+    width: 50%;
+}
+
+td {
+    color: green;
+}
+
+.odd {
+    background-color: #eeeeee;
+}
+
+.even {
+    background-color: #fafafa;
+}
+
+.exectime {
+    font-size: 0.8em;
+    font-style: italic;
+}
+
+#table_assigned_vars th {
+    color: blue;
+}
+
+#table_config_vars th {
+    color: maroon;
+}
+{/literal}
+</style>
+</head>
+<body>
+
+<h1>Smarty Debug Console  -  Total Time {$execution_time|string_format:"%.5f"}</h1>
+
+<h2>included templates &amp; config files (load time in seconds)</h2>
+
+<div>
+{foreach $template_data as $template}
+  <font color=brown>{$template.name}</font>
+  <span class="exectime">
+   (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
+  </span>
+  <br>
+{/foreach}
+</div>
+
+<h2>assigned template variables</h2>
+
+<table id="table_assigned_vars">
+    {foreach $assigned_vars as $vars}
+       <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">   
+       <th>${$vars@key|escape:'html'}</th>
+       <td>{$vars|debug_print_var}</td></tr>
+    {/foreach}
+</table>
+
+<h2>assigned config file variables (outer template scope)</h2>
+
+<table id="table_config_vars">
+    {foreach $config_vars as $vars}
+       <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">   
+       <th>{$vars@key|escape:'html'}</th>
+       <td>{$vars|debug_print_var}</td></tr>
+    {/foreach}
+
+</table>
+</body>
+</html>
+{/capture}
+<script type="text/javascript">
+{literal}    if ( self.name == '' ) {
+       var title = 'Console';
+      }
+    else {
+       var title = 'Console_' + self.name;
+      }{/literal}
+    _smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
+    _smarty_console.document.write("{$debug_output|escape:'javascript'}");
+    _smarty_console.document.close();
+</script>
diff --git a/gosa-core/include/smarty/plugins/block.php.php b/gosa-core/include/smarty/plugins/block.php.php
new file mode 100644 (file)
index 0000000..d1de740
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+* Smarty plugin to execute PHP code
+* 
+* @package Smarty
+* @subpackage PluginsBlock
+* @author Uwe Tews 
+*/
+
+/**
+* Smarty {php}{/php} block plugin
+* 
+* @param string $content contents of the block
+* @param object $smarty Smarty object
+* @param boolean $ &$repeat repeat flag
+* @param object $template template object
+* @return string content re-formatted
+*/
+function smarty_block_php($params, $content, $smarty, &$repeat, $template)
+{ 
+    if (!$smarty->allow_php_tag) {
+        throw new Exception("{php} is deprecated, set allow_php_tag = true to enable");
+    } 
+    eval($content);
+    return '';
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/block.render.php b/gosa-core/include/smarty/plugins/block.render.php
new file mode 100644 (file)
index 0000000..83a8fea
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+
+function smarty_block_render($params, $text, &$smarty)
+{
+       /* Skip closing tag </render> */        
+       if(empty($text)) {
+               return("");
+       }
+
+       /* Get acl parameter */
+       $acl = "";
+       if (isset($params['acl'])) {
+               $acl = $params['acl'];
+       }
+
+       /* Debug output */
+       if (session::is_set('DEBUGLEVEL') && session::get('DEBUGLEVEL') & DEBUG_ACL ){
+               echo "<font color='blue' size='2'>&nbsp;".$acl."</font>";
+       }
+
+
+
+       /* Parameter : checkbox, checked
+     *  If the parameter 'checkbox' is given, we create a html checkbox in front 
+     *   of the current object. 
+     * The parameter 'checked' specifies whether the box is checked or not.
+     *  The checkbox disables or enables the current object.
+     */
+       if(isset($params['checkbox']) && $params['checkbox']){
+
+               /* Detect name and id of the current object */
+               $use_text = preg_replace("/\n/"," ",$text);
+               $name = preg_replace('/^.* name[ ]*=[ ]*("|\')([^\"\' ]*).*$/i',"\\2",$use_text);       
+
+               /* Detect id */
+               if(preg_match("/ id=(\"|')[^\"']*(\"|')/i",$text)){
+                       $id = preg_replace('/^.* id[ ]*=[ ]*("|\')([^\"\' ]*).*$/i',"\\2",$use_text);   
+               }else{
+                       $id = "";
+               }
+               
+               /* Is the box checked? */
+               isset($params['checked'])&&$params['checked'] ? $check = " checked " : $check = "";
+
+               /* If name isset, we have a html input field */ 
+               if(!empty($name)){
+
+                       /* Print checkbox */
+                       echo "<input type='checkbox' name='use_".$name."' ".$check." 
+                                       onClick=\"changeState('".$name."');\" class='center'>";
+
+                       /* Disable current object, if checkbox isn't checked */
+                       if($check == ""){
+                               $text = preg_replace("/name=/i"," disabled name=",$text);
+                       }
+                       
+                       /* Add id to current entry, if it is missing */
+                       if($id == ""){
+                               $text = preg_replace("/name=/i"," id=\"".$name."\" name=",$text);
+                       }
+               }
+       }
+
+
+       /* Read / Write*/
+       if(preg_match("/w/i",$acl)){
+               return ($text);
+       }
+
+       $text = preg_replace ("/\n/","GOSA_LINE_BREAK",$text);
+
+       /* Disable objects, but keep those active that have mode=read_active */
+       if(!(isset($params['mode']) && ($params['mode']=='read_active') && preg_match("/(r|w)/",$acl))){
+
+               /* Disable options && greyout divlists */
+               $from   = array("/class=['\"]list1nohighlight['\"]/i",
+                               "/class=['\"]list0['\"]/i",
+                               "/class=['\"]list1['\"]/i",
+                               "/class=['\"]sortableListItem[^'\"]*['\"]/i");
+               $to     = array("class='list1nohighlightdisabled'",
+                               "class='list1nohighlightdisabled'",
+                               "class='list1nohighlightdisabled'",
+                               "class='sortableListItemDisabled'");
+                               
+               if(!preg_match("/ disabled /",$text)){
+                       $from [] = "/name=/i" ;
+                       $to   [] = "disabled name=";
+               }
+
+               $text   = preg_replace($from,$to,$text);
+
+               /* Replace picture if object is disabled */
+               if(isset($params['disable_picture'])){
+                       $syn = "/src=['\"][^\"']*['\"]/i";
+                       $new = "src=\"".$params['disable_picture']."\"";
+                       $text = preg_replace($syn,$new,$text);
+               }
+       }               
+
+       /* Read only */
+       if(preg_match("/r/i",$acl)){
+               return(preg_replace("/GOSA_LINE_BREAK/","\n",$text));   
+       }
+
+       /* No acls */   
+       if(preg_match("/type['\"= ].*submit/",$text)){
+               $text = preg_replace("/submit/","button",$text);
+       }else{
+               $text = preg_replace("/value=['\"][^\"']*['\"]/","",$text);
+       }
+
+       /* Remove select options */
+       $from   = array("#<option.*<\/option>#i",
+                       "/(<textarea.*>).*(<\/textarea>)/i",
+                       "/^(.*<input.*)checked(.*>.*)$/i");
+
+       $to     = array(" ",
+                       "\\1\\2",
+                       "\\1 \\2");
+       $text   = preg_replace($from,$to,$text);
+       $text = preg_replace("/GOSA_LINE_BREAK/","\n",$text);
+
+       return $text;
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/block.t.php b/gosa-core/include/smarty/plugins/block.t.php
new file mode 100644 (file)
index 0000000..ca7382a
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+/**
+ * block.t.php - Smarty gettext block plugin
+ *
+ * ------------------------------------------------------------------------- *
+ * 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 2.1 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 *
+ * ------------------------------------------------------------------------- *
+ *
+ * Installation: simply copy this file to the smarty plugins directory.
+ *
+ * @package    smarty-gettext
+ * @version    $Id: block.t.php,v 1.1 2005/07/27 17:58:56 sagi Exp $
+ * @link       http://smarty-gettext.sourceforge.net/
+ * @author     Sagi Bashari <sagi@boom.org.il>
+ * @copyright 2004-2005 Sagi Bashari
+ */
+/**
+ * Replaces arguments in a string with their values.
+ * Arguments are represented by % followed by their number.
+ *
+ * @param      string  Source string
+ * @param      mixed   Arguments, can be passed in an array or through single variables.
+ * @returns    string  Modified string
+ */
+function smarty_gettext_strarg($str)
+{
+       $tr = array();
+       $p = 0;
+
+       for ($i=1; $i < func_num_args(); $i++) {
+               $arg = func_get_arg($i);
+               
+               if (is_array($arg)) {
+                       foreach ($arg as $aarg) {
+                               $tr['%'.++$p] = $aarg;
+                       }
+               } else {
+                       $tr['%'.++$p] = $arg;
+               }
+       }
+       
+       return strtr($str, $tr);
+}
+
+/**
+ * Smarty block function, provides gettext support for smarty.
+ *
+ * The block content is the text that should be translated.
+ *
+ * Any parameter that is sent to the function will be represented as %n in the translation text, 
+ * where n is 1 for the first parameter. The following parameters are reserved:
+ *   - escape - sets escape mode:
+ *       - 'html' for HTML escaping, this is the default.
+ *       - 'js' for javascript escaping.
+ *       - 'url' for url escaping.
+ *       - 'no'/'off'/0 - turns off escaping
+ *   - plural - The plural version of the text (2nd parameter of ngettext())
+ *   - count - The item count for plural mode (3rd parameter of ngettext())
+ */
+function smarty_block_t($params, $text, &$smarty)
+{
+       $text = stripslashes($text);
+       
+       // set escape mode
+       if (isset($params['escape'])) {
+               $escape = $params['escape'];
+               unset($params['escape']);
+       }
+       
+       // set plural version
+       if (isset($params['plural'])) {
+               $plural = $params['plural'];
+               unset($params['plural']);
+               
+               // set count
+               if (isset($params['count'])) {
+                       $count = $params['count'];
+                       unset($params['count']);
+               }
+       }
+       
+       // use plural if required parameters are set
+       if (isset($count) && isset($plural)) {
+               $text = ngettext($text, $plural, $count);
+       } else { // use normal
+               $text = gettext($text);
+       }
+
+       // run strarg if there are parameters
+       if (count($params)) {
+               $text = smarty_gettext_strarg($text, $params);
+       }
+
+       if (!isset($escape) || $escape == 'html') { // html escape, default
+          $text = nl2br(htmlspecialchars($text));
+   } elseif (isset($escape)) {
+               switch ($escape) {
+                       case 'javascript':
+                       case 'js':
+                               // javascript escape
+                               $text = str_replace('\'', '\\\'', stripslashes($text));
+                               break;
+                       case 'url':
+                               // url escape
+                               $text = urlencode($text);
+                               break;
+               }
+       }
+       
+       return $text;
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/block.textformat.php b/gosa-core/include/smarty/plugins/block.textformat.php
new file mode 100644 (file)
index 0000000..f578bfb
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+/**
+* Smarty plugin to format text blocks
+*
+* @package Smarty
+* @subpackage PluginsBlock
+*/
+
+/**
+* Smarty {textformat}{/textformat} block plugin
+* 
+* Type:     block function<br>
+* Name:     textformat<br>
+* Purpose:  format text a certain way with preset styles
+*            or custom wrap/indent settings<br>
+* 
+* @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat}
+       (Smarty online manual)
+* @param array $params parameters
+* <pre>
+* Params:   style: string (email)
+*            indent: integer (0)
+*            wrap: integer (80)
+*            wrap_char string ("\n")
+*            indent_char: string (" ")
+*            wrap_boundary: boolean (true)
+* </pre>
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $content contents of the block
+* @param object $smarty Smarty object
+* @param boolean &$repeat repeat flag
+* @param object $template template object
+* @return string content re-formatted
+*/
+function smarty_block_textformat($params, $content, $smarty, &$repeat, $template)
+{
+    if (is_null($content)) {
+        return;
+    } 
+
+    $style = null;
+    $indent = 0;
+    $indent_first = 0;
+    $indent_char = ' ';
+    $wrap = 80;
+    $wrap_char = "\n";
+    $wrap_cut = false;
+    $assign = null;
+
+    foreach ($params as $_key => $_val) {
+        switch ($_key) {
+            case 'style':
+            case 'indent_char':
+            case 'wrap_char':
+            case 'assign':
+                $$_key = (string)$_val;
+                break;
+
+            case 'indent':
+            case 'indent_first':
+            case 'wrap':
+                $$_key = (int)$_val;
+                break;
+
+            case 'wrap_cut':
+                $$_key = (bool)$_val;
+                break;
+
+            default:
+                $smarty->trigger_error("textformat: unknown attribute '$_key'");
+        } 
+    } 
+
+    if ($style == 'email') {
+        $wrap = 72;
+    } 
+    // split into paragraphs
+    $_paragraphs = preg_split('![\r\n][\r\n]!', $content);
+    $_output = '';
+
+    for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) {
+        if ($_paragraphs[$_x] == '') {
+            continue;
+        } 
+        // convert mult. spaces & special chars to single space
+        $_paragraphs[$_x] = preg_replace(array('!\s+!', '!(^\s+)|(\s+$)!'), array(' ', ''), $_paragraphs[$_x]); 
+        // indent first line
+        if ($indent_first > 0) {
+            $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x];
+        } 
+        // wordwrap sentences
+        $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut); 
+        // indent lines
+        if ($indent > 0) {
+            $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]);
+        } 
+    } 
+    $_output = implode($wrap_char . $wrap_char, $_paragraphs);
+    
+    return $assign ? $template->assign($assign, $_output) : $_output;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.counter.php b/gosa-core/include/smarty/plugins/function.counter.php
new file mode 100644 (file)
index 0000000..88e49d8
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
+
+
+/**
+ * Smarty {counter} function plugin
+ *
+ * Type:     function<br>
+ * Name:     counter<br>
+ * Purpose:  print out a counter value
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @link http://smarty.php.net/manual/en/language.function.counter.php {counter}
+ *       (Smarty online manual)
+ * @param array $params parameters
+ * @param object $smarty Smarty object
+ * @param object $template template object
+ * @return string|null
+ */
+function smarty_function_counter($params, $smarty, $template)
+{
+
+    $name = (isset($params['name'])) ? $params['name'] : 'default';
+    if (!isset($template->plugin_data['counter'][$name])) {
+        $template->plugin_data['counter'][$name] = array(
+            'start'=>1,
+            'skip'=>1,
+            'direction'=>'up',
+            'count'=>1
+            );
+    }
+    $counter = &$template->plugin_data['counter'][$name];
+
+    if (isset($params['start'])) {
+        $counter['start'] = $counter['count'] = (int)$params['start'];
+    }
+
+    if (!empty($params['assign'])) {
+        $counter['assign'] = $params['assign'];
+    }
+
+    if (isset($counter['assign'])) {
+        $template->assign($counter['assign'], $counter['count']);
+    }
+    
+    if (isset($params['print'])) {
+        $print = (bool)$params['print'];
+    } else {
+        $print = empty($counter['assign']);
+    }
+
+    if ($print) {
+        $retval = $counter['count'];
+    } else {
+        $retval = null;
+    }
+
+    if (isset($params['skip'])) {
+        $counter['skip'] = $params['skip'];
+    }
+    
+    if (isset($params['direction'])) {
+        $counter['direction'] = $params['direction'];
+    }
+
+    if ($counter['direction'] == "down")
+        $counter['count'] -= $counter['skip'];
+    else
+        $counter['count'] += $counter['skip'];
+    
+    return $retval;
+    
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.cycle.php b/gosa-core/include/smarty/plugins/function.cycle.php
new file mode 100644 (file)
index 0000000..f1cb46b
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
+
+/**
+ * Smarty {cycle} function plugin
+ *
+ * Type:     function<br>
+ * Name:     cycle<br>
+ * Date:     May 3, 2002<br>
+ * Purpose:  cycle through given values<br>
+ *
+ * Examples:<br>
+ * <pre>
+ * {cycle values="#eeeeee,#d0d0d0d"}
+ * {cycle name=row values="one,two,three" reset=true}
+ * {cycle name=row}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author credit to Mark Priatel <mpriatel@rogers.com>
+ * @author credit to Gerard <gerard@interfold.com>
+ * @author credit to Jason Sweat <jsweat_php@yahoo.com>
+ * @param array $params parameters
+ * Input:
+ *         - name = name of cycle (optional)
+ *         - values = comma separated list of values to cycle,
+ *                    or an array of values to cycle
+ *                    (this can be left out for subsequent calls)
+ *         - reset = boolean - resets given var to true
+ *         - print = boolean - print var or not. default is true
+ *         - advance = boolean - whether or not to advance the cycle
+ *         - delimiter = the value delimiter, default is ","
+ *         - assign = boolean, assigns to template var instead of
+ *                    printed.
+ * @param object $smarty Smarty object
+ * @param object $template template object
+ * @return string|null
+ */
+function smarty_function_cycle($params, $smarty, $template)
+{
+    $name = (empty($params['name'])) ? 'default' : $params['name'];
+    $print = (isset($params['print'])) ? (bool)$params['print'] : true;
+    $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true;
+    $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false;
+            
+    if (!in_array('values', array_keys($params))) {
+        if(!isset($template->plugin_data['cycle'][$name]['values'])) {
+            trigger_error("cycle: missing 'values' parameter",E_USER_WARNING);
+            return;
+        }
+    } else {
+        if(isset($template->plugin_data['cycle'][$name]['values'])
+            && $template->plugin_data['cycle'][$name]['values'] != $params['values'] ) {
+            $template->plugin_data['cycle'][$name]['index'] = 0;
+        }
+        $template->plugin_data['cycle'][$name]['values'] = $params['values'];
+    }
+
+    if (isset($params['delimiter'])) {
+      $template->plugin_data['cycle'][$name]['delimiter'] = $params['delimiter'];
+    } elseif (!isset($template->plugin_data['cycle'][$name]['delimiter'])) {
+      $template->plugin_data['cycle'][$name]['delimiter'] = ',';
+    }
+    
+    if(is_array($template->plugin_data['cycle'][$name]['values'])) {
+        $cycle_array = $template->plugin_data['cycle'][$name]['values'];
+    } else {
+        $cycle_array = explode($template->plugin_data['cycle'][$name]['delimiter'],$template->plugin_data['cycle'][$name]['values']);
+    }
+    
+    if(!isset($template->plugin_data['cycle'][$name]['index']) || $reset ) {
+        $template->plugin_data['cycle'][$name]['index'] = 0;
+    }
+    
+    if (isset($params['assign'])) {
+        $print = false;
+        $template->assign($params['assign'], $cycle_array[$template->plugin_data['cycle'][$name]['index']]);
+    }
+        
+    if($print) {
+        $retval = $cycle_array[$template->plugin_data['cycle'][$name]['index']];
+    } else {
+        $retval = null;
+    }
+
+    if($advance) {
+        if ( $template->plugin_data['cycle'][$name]['index'] >= count($cycle_array) -1 ) {
+            $template->plugin_data['cycle'][$name]['index'] = 0;
+        } else {
+            $template->plugin_data['cycle'][$name]['index']++;
+        }
+    }
+    
+    return $retval;
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/function.fetch.php b/gosa-core/include/smarty/plugins/function.fetch.php
new file mode 100644 (file)
index 0000000..391ff1b
--- /dev/null
@@ -0,0 +1,217 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
+
+
+/**
+ * Smarty {fetch} plugin
+ *
+ * Type:     function<br>
+ * Name:     fetch<br>
+ * Purpose:  fetch file, web or ftp data and display results
+ * @link http://smarty.php.net/manual/en/language.function.fetch.php {fetch}
+ *       (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @param array $params parameters
+ * @param object $smarty Smarty object
+ * @param object $template template object
+ * @return string|null if the assign parameter is passed, Smarty assigns the
+ *                     result to a template variable
+ */
+function smarty_function_fetch($params, $smarty, $template)
+{
+    if (empty($params['file'])) {
+        trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE);
+        return;
+    }
+
+    $content = '';
+    if ($template->security && !preg_match('!^(http|ftp)://!i', $params['file'])) {
+        if(!$smarty->security_handler->isTrustedResourceDir($params['file'])) {
+            return;
+        }
+        
+        // fetch the file
+        if($fp = @fopen($params['file'],'r')) {
+            while(!feof($fp)) {
+                $content .= fgets ($fp,4096);
+            }
+            fclose($fp);
+        } else {
+            trigger_error('[plugin] fetch cannot read file \'' . $params['file'] . '\'',E_USER_NOTICE);
+            return;
+        }
+    } else {
+        // not a local file
+        if(preg_match('!^http://!i',$params['file'])) {
+            // http fetch
+            if($uri_parts = parse_url($params['file'])) {
+                // set defaults
+                $host = $server_name = $uri_parts['host'];
+                $timeout = 30;
+                $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
+                $agent = "Smarty Template Engine ".$smarty->_version;
+                $referer = "";
+                $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
+                $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
+                $_is_proxy = false;
+                if(empty($uri_parts['port'])) {
+                    $port = 80;
+                } else {
+                    $port = $uri_parts['port'];
+                }
+                if(!empty($uri_parts['user'])) {
+                    $user = $uri_parts['user'];
+                }
+                if(!empty($uri_parts['pass'])) {
+                    $pass = $uri_parts['pass'];
+                }
+                // loop through parameters, setup headers
+                foreach($params as $param_key => $param_value) {
+                    switch($param_key) {
+                        case "file":
+                        case "assign":
+                        case "assign_headers":
+                            break;
+                        case "user":
+                            if(!empty($param_value)) {
+                                $user = $param_value;
+                            }
+                            break;
+                        case "pass":
+                            if(!empty($param_value)) {
+                                $pass = $param_value;
+                            }
+                            break;
+                        case "accept":
+                            if(!empty($param_value)) {
+                                $accept = $param_value;
+                            }
+                            break;
+                        case "header":
+                            if(!empty($param_value)) {
+                                if(!preg_match('![\w\d-]+: .+!',$param_value)) {
+                                    trigger_error("[plugin] invalid header format '".$param_value."'",E_USER_NOTICE);
+                                    return;
+                                } else {
+                                    $extra_headers[] = $param_value;
+                                }
+                            }
+                            break;
+                        case "proxy_host":
+                            if(!empty($param_value)) {
+                                $proxy_host = $param_value;
+                            }
+                            break;
+                        case "proxy_port":
+                            if(!preg_match('!\D!', $param_value)) {
+                                $proxy_port = (int) $param_value;
+                            } else {
+                                trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
+                                return;
+                            }
+                            break;
+                        case "agent":
+                            if(!empty($param_value)) {
+                                $agent = $param_value;
+                            }
+                            break;
+                        case "referer":
+                            if(!empty($param_value)) {
+                                $referer = $param_value;
+                            }
+                            break;
+                        case "timeout":
+                            if(!preg_match('!\D!', $param_value)) {
+                                $timeout = (int) $param_value;
+                            } else {
+                                trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
+                                return;
+                            }
+                            break;
+                        default:
+                            trigger_error("[plugin] unrecognized attribute '".$param_key."'",E_USER_NOTICE);
+                            return;
+                    }
+                }
+                if(!empty($proxy_host) && !empty($proxy_port)) {
+                    $_is_proxy = true;
+                    $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
+                } else {
+                    $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
+                }
+
+                if(!$fp) {
+                    trigger_error("[plugin] unable to fetch: $errstr ($errno)",E_USER_NOTICE);
+                    return;
+                } else {
+                    if($_is_proxy) {
+                        fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
+                    } else {
+                        fputs($fp, "GET $uri HTTP/1.0\r\n");
+                    }
+                    if(!empty($host)) {
+                        fputs($fp, "Host: $host\r\n");
+                    }
+                    if(!empty($accept)) {
+                        fputs($fp, "Accept: $accept\r\n");
+                    }
+                    if(!empty($agent)) {
+                        fputs($fp, "User-Agent: $agent\r\n");
+                    }
+                    if(!empty($referer)) {
+                        fputs($fp, "Referer: $referer\r\n");
+                    }
+                    if(isset($extra_headers) && is_array($extra_headers)) {
+                        foreach($extra_headers as $curr_header) {
+                            fputs($fp, $curr_header."\r\n");
+                        }
+                    }
+                    if(!empty($user) && !empty($pass)) {
+                        fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
+                    }
+
+                    fputs($fp, "\r\n");
+                    while(!feof($fp)) {
+                        $content .= fgets($fp,4096);
+                    }
+                    fclose($fp);
+                    $csplit = preg_split("!\r\n\r\n!",$content,2);
+
+                    $content = $csplit[1];
+
+                    if(!empty($params['assign_headers'])) {
+                        $template->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0]));
+                    }
+                }
+            } else {
+                trigger_error("[plugin fetch] unable to parse URL, check syntax",E_USER_NOTICE);
+                return;
+            }
+        } else {
+            // ftp fetch
+            if($fp = @fopen($params['file'],'r')) {
+                while(!feof($fp)) {
+                    $content .= fgets ($fp,4096);
+                }
+                fclose($fp);
+            } else {
+                trigger_error('[plugin] fetch cannot read file \'' . $params['file'] .'\'',E_USER_NOTICE);
+                return;
+            }
+        }
+
+    }
+
+
+    if (!empty($params['assign'])) {
+        $template->assign($params['assign'],$content);
+    } else {
+        return $content;
+    }
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.html_checkboxes.php b/gosa-core/include/smarty/plugins/function.html_checkboxes.php
new file mode 100644 (file)
index 0000000..ac72f3f
--- /dev/null
@@ -0,0 +1,145 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
+
+
+/**
+ * Smarty {html_checkboxes} function plugin
+ *
+ * File:       function.html_checkboxes.php<br>
+ * Type:       function<br>
+ * Name:       html_checkboxes<br>
+ * Date:       24.Feb.2003<br>
+ * Purpose:    Prints out a list of checkbox input types<br>
+ * Examples:
+ * <pre>
+ * {html_checkboxes values=$ids output=$names}
+ * {html_checkboxes values=$ids name='box' separator='<br>' output=$names}
+ * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names}
+ * </pre>
+ * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
+ *      (Smarty online manual)
+ * @author     Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @version    1.0
+ * @param array $params parameters
+ * Input:<br>
+ *           - name       (optional) - string default "checkbox"
+ *           - values     (required) - array
+ *           - options    (optional) - associative array
+ *           - checked    (optional) - array default not set
+ *           - separator  (optional) - ie <br> or &nbsp;
+ *           - output     (optional) - the output next to each checkbox
+ *           - assign     (optional) - assign the output as an array to this variable
+ * @param object $smarty Smarty object
+ * @param object $template template object
+ * @return string
+ * @uses smarty_function_escape_special_chars()
+ */
+function smarty_function_html_checkboxes($params, $smarty, $template)
+{
+    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
+    //$smarty->loadPlugin('Smarty_shared_escape_special_chars');
+
+    $name = 'checkbox';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $output = null;
+
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch($_key) {
+            case 'name':
+            case 'separator':
+                $$_key = $_val;
+                break;
+
+            case 'labels':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'checked':
+            case 'selected':
+                $selected = array_map('strval', array_values((array)$_val));
+                break;
+
+            case 'checkboxes':
+                trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if(!is_array($_val)) {
+                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+                } else {
+                    trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                }
+                break;
+        }
+    }
+
+    if (!isset($options) && !isset($values))
+        return ''; /* raise error here? */
+
+    settype($selected, 'array');
+    $_html_result = array();
+
+    if (isset($options)) {
+
+        foreach ($options as $_key=>$_val)
+            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+
+
+    } else {
+        foreach ($values as $_i=>$_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+        }
+
+    }
+
+    if(!empty($params['assign'])) {
+        $template->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n",$_html_result);
+    }
+
+}
+
+function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) {
+    $_output = '';
+    if ($labels) $_output .= '<label>';
+    $_output .= '<input type="checkbox" name="'
+        . smarty_function_escape_special_chars($name) . '[]" value="'
+        . smarty_function_escape_special_chars($value) . '"';
+
+    if (in_array((string)$value, $selected)) {
+        $_output .= ' checked="checked"';
+    }
+    $_output .= $extra . ' />' . $output;
+    if ($labels) $_output .= '</label>';
+    $_output .=  $separator;
+
+    return $_output;
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.html_image.php b/gosa-core/include/smarty/plugins/function.html_image.php
new file mode 100644 (file)
index 0000000..3f031dc
--- /dev/null
@@ -0,0 +1,139 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFunction
+*/
+
+/**
+* Smarty {html_image} function plugin
+* 
+* Type:     function<br>
+* Name:     html_image<br>
+* Date:     Feb 24, 2003<br>
+* Purpose:  format HTML tags for the image<br>
+* Examples: {html_image file="/images/masthead.gif"}
+* Output:   <img src="/images/masthead.gif" width=400 height=23>
+* 
+* @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image}
+      (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @author credits to Duda <duda@big.hu> 
+* @version 1.0
+* @param array $params parameters
+* Input:<br>
+*          - file = file (and path) of image (required)
+*          - height = image height (optional, default actual height)
+*          - width = image width (optional, default actual width)
+*          - basedir = base directory for absolute paths, default
+*                      is environment variable DOCUMENT_ROOT
+*          - path_prefix = prefix for path output (optional, default empty)
+* @param object $smarty Smarty object
+* @param object $template template object
+* @return string 
+* @uses smarty_function_escape_special_chars()
+*/
+function smarty_function_html_image($params, $smarty, $template)
+{
+    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
+    //$smarty->loadPlugin('Smarty_shared_escape_special_chars');
+
+    $alt = '';
+    $file = '';
+    $height = '';
+    $width = '';
+    $extra = '';
+    $prefix = '';
+    $suffix = '';
+    $path_prefix = '';
+    $server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
+    $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : '';
+    foreach($params as $_key => $_val) {
+        switch ($_key) {
+            case 'file':
+            case 'height':
+            case 'width':
+            case 'dpi':
+            case 'path_prefix':
+            case 'basedir':
+                $$_key = $_val;
+                break;
+
+            case 'alt':
+                if (!is_array($_val)) {
+                    $$_key = smarty_function_escape_special_chars($_val);
+                } else {
+                    throw new Exception ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                } 
+                break;
+
+            case 'link':
+            case 'href':
+                $prefix = '<a href="' . $_val . '">';
+                $suffix = '</a>';
+                break;
+
+            default:
+                if (!is_array($_val)) {
+                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
+                } else {
+                    throw new Exception ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                } 
+                break;
+        } 
+    } 
+
+    if (empty($file)) {
+        trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
+        return;
+    } 
+
+    if (substr($file, 0, 1) == '/') {
+        $_image_path = $basedir . $file;
+    } else {
+        $_image_path = $file;
+    } 
+
+    if (!isset($params['width']) || !isset($params['height'])) {
+        if (!$_image_data = @getimagesize($_image_path)) {
+            if (!file_exists($_image_path)) {
+                trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
+                return;
+            } else if (!is_readable($_image_path)) {
+                trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
+                return;
+            } else {
+                trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
+                return;
+            } 
+        } 
+        if ($template->security) {
+            if (!$smarty->security_handler->isTrustedResourceDir($_image_path)) {
+                return;
+            } 
+        } 
+
+        if (!isset($params['width'])) {
+            $width = $_image_data[0];
+        } 
+        if (!isset($params['height'])) {
+            $height = $_image_data[1];
+        } 
+    } 
+
+    if (isset($params['dpi'])) {
+        if (strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) {
+            $dpi_default = 72;
+        } else {
+            $dpi_default = 96;
+        } 
+        $_resize = $dpi_default / $params['dpi'];
+        $width = round($width * $_resize);
+        $height = round($height * $_resize);
+    } 
+
+    return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $extra . ' />' . $suffix;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.html_options.php b/gosa-core/include/smarty/plugins/function.html_options.php
new file mode 100644 (file)
index 0000000..69f56e8
--- /dev/null
@@ -0,0 +1,122 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFunction
+*/
+
+/**
+* Smarty {html_options} function plugin
+* 
+* Type:     function<br>
+* Name:     html_options<br>
+* Purpose:  Prints the list of <option> tags generated from
+*            the passed parameters
+* 
+* @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image}
+      (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param array $params parameters
+* Input:<br>
+*            - name       (optional) - string default "select"
+*            - values     (required if no options supplied) - array
+*            - options    (required if no values supplied) - associative array
+*            - selected   (optional) - string default not set
+*            - output     (required if not options supplied) - array
+* @param object $smarty Smarty object
+* @param object $template template object
+* @return string 
+* @uses smarty_function_escape_special_chars()
+*/
+
+function smarty_function_html_options($params, $smarty, $template)
+{
+    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
+    //$smarty->loadPlugin('Smarty_shared_escape_special_chars');
+
+    $name = null;
+    $values = null;
+    $options = null;
+    $selected = array();
+    $output = null;
+
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch ($_key) {
+            case 'name':
+                $$_key = (string)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'selected':
+                $$_key = array_map('strval', array_values((array)$_val));
+                break;
+
+            default:
+                if (!is_array($_val)) {
+                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
+                } else {
+                    trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                } 
+                break;
+        } 
+    } 
+
+    if (!isset($options) && !isset($values))
+        return '';
+    /* raise error here? */
+
+    $_html_result = '';
+
+    if (isset($options)) {
+        foreach ($options as $_key => $_val)
+        $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+    } else {
+        foreach ($values as $_i => $_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
+        } 
+    } 
+
+    if (!empty($name)) {
+        $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
+    } 
+
+    return $_html_result;
+} 
+
+function smarty_function_html_options_optoutput($key, $value, $selected)
+{
+    if (!is_array($value)) {
+        $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
+        smarty_function_escape_special_chars($key) . '"';
+        if (in_array((string)$key, $selected))
+            $_html_result .= ' selected="selected"';
+        $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
+    } else {
+        $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
+    } 
+    return $_html_result;
+} 
+
+function smarty_function_html_options_optgroup($key, $values, $selected)
+{
+    $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
+    foreach ($values as $key => $value) {
+        $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
+    } 
+    $optgroup_html .= "</optgroup>\n";
+    return $optgroup_html;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.html_radios.php b/gosa-core/include/smarty/plugins/function.html_radios.php
new file mode 100644 (file)
index 0000000..c7f72bf
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFunction
+*/
+
+/**
+* Smarty {html_radios} function plugin
+* 
+* File:       function.html_radios.php<br>
+* Type:       function<br>
+* Name:       html_radios<br>
+* Date:       24.Feb.2003<br>
+* Purpose:    Prints out a list of radio input types<br>
+* Examples:
+* <pre>
+* {html_radios values=$ids output=$names}
+* {html_radios values=$ids name='box' separator='<br>' output=$names}
+* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
+* </pre>
+* 
+* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
+      (Smarty online manual)
+* @author Christopher Kvarme <christopher.kvarme@flashjab.com> 
+* @author credits to Monte Ohrt <monte at ohrt dot com> 
+* @version 1.0
+* @param array $params parameters
+* Input:<br>
+*            - name       (optional) - string default "radio"
+*            - values     (required) - array
+*            - options    (optional) - associative array
+*            - checked    (optional) - array default not set
+*            - separator  (optional) - ie <br> or &nbsp;
+*            - output     (optional) - the output next to each radio button
+*            - assign     (optional) - assign the output as an array to this variable
+* @param object $smarty Smarty object
+* @param object $template template object
+* @return string 
+* @uses smarty_function_escape_special_chars()
+*/
+function smarty_function_html_radios($params, $smarty, $template)
+{
+    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
+    //$smarty->loadPlugin('Smarty_shared_escape_special_chars');
+
+    $name = 'radio';
+    $values = null;
+    $options = null;
+    $selected = null;
+    $separator = '';
+    $labels = true;
+    $label_ids = false;
+    $output = null;
+    $extra = '';
+
+    foreach($params as $_key => $_val) {
+        switch ($_key) {
+            case 'name':
+            case 'separator':
+                $$_key = (string)$_val;
+                break;
+
+            case 'checked':
+            case 'selected':
+                if (is_array($_val)) {
+                    trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
+                } else {
+                    $selected = (string)$_val;
+                } 
+                break;
+
+            case 'labels':
+            case 'label_ids':
+                $$_key = (bool)$_val;
+                break;
+
+            case 'options':
+                $$_key = (array)$_val;
+                break;
+
+            case 'values':
+            case 'output':
+                $$_key = array_values((array)$_val);
+                break;
+
+            case 'radios':
+                trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING);
+                $options = (array)$_val;
+                break;
+
+            case 'assign':
+                break;
+
+            default:
+                if (!is_array($_val)) {
+                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
+                } else {
+                    trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                } 
+                break;
+        } 
+    } 
+
+    if (!isset($options) && !isset($values))
+        return '';
+    /* raise error here? */
+
+    $_html_result = array();
+
+    if (isset($options)) {
+        foreach ($options as $_key => $_val)
+        $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
+    } else {
+        foreach ($values as $_i => $_key) {
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
+            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
+        } 
+    } 
+
+    if (!empty($params['assign'])) {
+        $template->assign($params['assign'], $_html_result);
+    } else {
+        return implode("\n", $_html_result);
+    } 
+} 
+
+function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids)
+{
+    $_output = '';
+    if ($labels) {
+        if ($label_ids) {
+            $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+            $_output .= '<label for="' . $_id . '">';
+        } else {
+            $_output .= '<label>';
+        } 
+    } 
+    $_output .= '<input type="radio" name="'
+     . smarty_function_escape_special_chars($name) . '" value="'
+     . smarty_function_escape_special_chars($value) . '"';
+
+    if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
+
+    if ((string)$value == $selected) {
+        $_output .= ' checked="checked"';
+    } 
+    $_output .= $extra . ' />' . $output;
+    if ($labels) $_output .= '</label>';
+    $_output .= $separator;
+
+    return $_output;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.html_select_date.php b/gosa-core/include/smarty/plugins/function.html_select_date.php
new file mode 100644 (file)
index 0000000..7001f88
--- /dev/null
@@ -0,0 +1,333 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFunction
+*/
+
+/**
+* Smarty {html_select_date} plugin
+* 
+* Type:     function<br>
+* Name:     html_select_date<br>
+* Purpose:  Prints the dropdowns for date selection.
+* 
+* ChangeLog:<br>
+*            - 1.0 initial release
+*            - 1.1 added support for +/- N syntax for begin
+*                 and end year values. (Monte)
+*            - 1.2 added support for yyyy-mm-dd syntax for
+*                 time value. (Jan Rosier)
+*            - 1.3 added support for choosing format for
+*                 month values (Gary Loescher)
+*            - 1.3.1 added support for choosing format for
+*                 day values (Marcus Bointon)
+*            - 1.3.2 support negative timestamps, force year
+*              dropdown to include given date unless explicitly set (Monte)
+*            - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
+*              of 0000-00-00 dates (cybot, boots)
+* 
+* @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date}
+      (Smarty online manual)
+* @version 1.3.4
+* @author Andrei Zmievski 
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param array $params parameters
+* @param object $smarty Smarty object
+* @param object $template template object
+* @return string 
+*/
+function smarty_function_html_select_date($params, $smarty, $template)
+{
+    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
+    require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
+    require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php');
+    //$smarty->loadPlugin('Smarty_shared_escape_special_chars');
+    //$smarty->loadPlugin('Smarty_shared_make_timestamp');
+    //$smarty->loadPlugin('Smarty_function_html_options');
+
+    /* Default values. */
+    $prefix = "Date_";
+    $start_year = strftime("%Y");
+    $end_year = $start_year;
+    $display_days = true;
+    $display_months = true;
+    $display_years = true;
+    $month_format = "%B";
+    /* Write months as numbers by default  GL */
+    $month_value_format = "%m";
+    $day_format = "%02d";
+    /* Write day values using this format MB */
+    $day_value_format = "%d";
+    $year_as_text = false;
+    /* Display years in reverse order? Ie. 2000,1999,.... */
+    $reverse_years = false;
+    /* Should the select boxes be part of an array when returned from PHP?
+       e.g. setting it to "birthday", would create "birthday[Day]",
+       "birthday[Month]" & "birthday[Year]". Can be combined with prefix */
+    $field_array = null;
+    /* <select size>'s of the different <select> tags.
+       If not set, uses default dropdown. */
+    $day_size = null;
+    $month_size = null;
+    $year_size = null;
+    /* Unparsed attributes common to *ALL* the <select>/<input> tags.
+       An example might be in the template: all_extra ='class ="foo"'. */
+    $all_extra = null;
+    /* Separate attributes for the tags. */
+    $day_extra = null;
+    $month_extra = null;
+    $year_extra = null;
+    /* Order in which to display the fields.
+       "D" -> day, "M" -> month, "Y" -> year. */
+    $field_order = 'MDY';
+    /* String printed between the different fields. */
+    $field_separator = "\n";
+    $time = time();
+    $all_empty = null;
+    $day_empty = null;
+    $month_empty = null;
+    $year_empty = null;
+    $extra_attrs = '';
+
+    foreach ($params as $_key => $_value) {
+        switch ($_key) {
+            case 'prefix':
+            case 'time':
+            case 'start_year':
+            case 'end_year':
+            case 'month_format':
+            case 'day_format':
+            case 'day_value_format':
+            case 'field_array':
+            case 'day_size':
+            case 'month_size':
+            case 'year_size':
+            case 'all_extra':
+            case 'day_extra':
+            case 'month_extra':
+            case 'year_extra':
+            case 'field_order':
+            case 'field_separator':
+            case 'month_value_format':
+            case 'month_empty':
+            case 'day_empty':
+            case 'year_empty':
+                $$_key = (string)$_value;
+                break;
+
+            case 'all_empty':
+                $$_key = (string)$_value;
+                $day_empty = $month_empty = $year_empty = $all_empty;
+                break;
+
+            case 'display_days':
+            case 'display_months':
+            case 'display_years':
+            case 'year_as_text':
+            case 'reverse_years':
+                $$_key = (bool)$_value;
+                break;
+
+            default:
+                if (!is_array($_value)) {
+                    $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
+                } else {
+                    trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+                } 
+                break;
+        } 
+    } 
+
+    if (preg_match('!^-\d+$!', $time)) {
+        // negative timestamp, use date()
+        $time = date('Y-m-d', $time);
+    } 
+    // If $time is not in format yyyy-mm-dd
+    if (preg_match('/^(\d{0,4}-\d{0,2}-\d{0,2})/', $time, $found)) {
+        $time = $found[1];
+    } else {
+        // use smarty_make_timestamp to get an unix timestamp and
+        // strftime to make yyyy-mm-dd
+        $time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
+    } 
+    // Now split this in pieces, which later can be used to set the select
+    $time = explode("-", $time); 
+    // make syntax "+N" or "-N" work with start_year and end_year
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
+        if ($match[1] == '+') {
+            $end_year = strftime('%Y') + $match[2];
+        } else {
+            $end_year = strftime('%Y') - $match[2];
+        } 
+    } 
+    if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
+        if ($match[1] == '+') {
+            $start_year = strftime('%Y') + $match[2];
+        } else {
+            $start_year = strftime('%Y') - $match[2];
+        } 
+    } 
+    if (strlen($time[0]) > 0) {
+        if ($start_year > $time[0] && !isset($params['start_year'])) {
+            // force start year to include given date if not explicitly set
+            $start_year = $time[0];
+        } 
+        if ($end_year < $time[0] && !isset($params['end_year'])) {
+            // force end year to include given date if not explicitly set
+            $end_year = $time[0];
+        } 
+    } 
+
+    $field_order = strtoupper($field_order);
+
+    $html_result = $month_result = $day_result = $year_result = "";
+
+    $field_separator_count = -1;
+    if ($display_months) {
+        $field_separator_count++;
+        $month_names = array();
+        $month_values = array();
+        if (isset($month_empty)) {
+            $month_names[''] = $month_empty;
+            $month_values[''] = '';
+        } 
+        for ($i = 1; $i <= 12; $i++) {
+            $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
+            $month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
+        } 
+
+        $month_result .= '<select name=';
+        if (null !== $field_array) {
+            $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"';
+        } else {
+            $month_result .= '"' . $prefix . 'Month"';
+        } 
+        if (null !== $month_size) {
+            $month_result .= ' size="' . $month_size . '"';
+        } 
+        if (null !== $month_extra) {
+            $month_result .= ' ' . $month_extra;
+        } 
+        if (null !== $all_extra) {
+            $month_result .= ' ' . $all_extra;
+        } 
+        $month_result .= $extra_attrs . '>' . "\n";
+
+        $month_result .= smarty_function_html_options(array('output' => $month_names,
+                'values' => $month_values,
+                'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
+                'print_result' => false),
+            $smarty, $template);
+        $month_result .= '</select>';
+    } 
+
+    if ($display_days) {
+        $field_separator_count++;
+        $days = array();
+        if (isset($day_empty)) {
+            $days[''] = $day_empty;
+            $day_values[''] = '';
+        } 
+        for ($i = 1; $i <= 31; $i++) {
+            $days[] = sprintf($day_format, $i);
+            $day_values[] = sprintf($day_value_format, $i);
+        } 
+
+        $day_result .= '<select name=';
+        if (null !== $field_array) {
+            $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"';
+        } else {
+            $day_result .= '"' . $prefix . 'Day"';
+        } 
+        if (null !== $day_size) {
+            $day_result .= ' size="' . $day_size . '"';
+        } 
+        if (null !== $all_extra) {
+            $day_result .= ' ' . $all_extra;
+        } 
+        if (null !== $day_extra) {
+            $day_result .= ' ' . $day_extra;
+        } 
+        $day_result .= $extra_attrs . '>' . "\n";
+        $day_result .= smarty_function_html_options(array('output' => $days,
+                'values' => $day_values,
+                'selected' => $time[2],
+                'print_result' => false),
+            $smarty, $template);
+        $day_result .= '</select>';
+    } 
+
+    if ($display_years) {
+        $field_separator_count++;
+        if (null !== $field_array) {
+            $year_name = $field_array . '[' . $prefix . 'Year]';
+        } else {
+            $year_name = $prefix . 'Year';
+        } 
+        if ($year_as_text) {
+            $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"';
+            if (null !== $all_extra) {
+                $year_result .= ' ' . $all_extra;
+            } 
+            if (null !== $year_extra) {
+                $year_result .= ' ' . $year_extra;
+            } 
+            $year_result .= ' />';
+        } else {
+            $years = range((int)$start_year, (int)$end_year);
+            if ($reverse_years) {
+                rsort($years, SORT_NUMERIC);
+            } else {
+                sort($years, SORT_NUMERIC);
+            } 
+            $yearvals = $years;
+            if (isset($year_empty)) {
+                array_unshift($years, $year_empty);
+                array_unshift($yearvals, '');
+            } 
+            $year_result .= '<select name="' . $year_name . '"';
+            if (null !== $year_size) {
+                $year_result .= ' size="' . $year_size . '"';
+            } 
+            if (null !== $all_extra) {
+                $year_result .= ' ' . $all_extra;
+            } 
+            if (null !== $year_extra) {
+                $year_result .= ' ' . $year_extra;
+            } 
+            $year_result .= $extra_attrs . '>' . "\n";
+            $year_result .= smarty_function_html_options(array('output' => $years,
+                    'values' => $yearvals,
+                    'selected' => $time[0],
+                    'print_result' => false),
+                $smarty, $template);
+            $year_result .= '</select>';
+        } 
+    } 
+    // Loop thru the field_order field
+    for ($i = 0; $i <= 2; $i++) {
+        $c = substr($field_order, $i, 1);
+        switch ($c) {
+            case 'D':
+                $html_result .= $day_result;
+                break;
+
+            case 'M':
+                $html_result .= $month_result;
+                break;
+
+            case 'Y':
+                $html_result .= $year_result;
+                break;
+        } 
+        // Add the field seperator
+        if ($i < $field_separator_count) {
+            $html_result .= $field_separator;
+        } 
+    } 
+
+    return $html_result;
+} 
+?>
diff --git a/gosa-core/include/smarty/plugins/function.html_select_time.php b/gosa-core/include/smarty/plugins/function.html_select_time.php
new file mode 100644 (file)
index 0000000..51d307a
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFunction
+*/
+
+/**
+* Smarty {html_select_time} function plugin
+* 
+* Type:     function<br>
+* Name:     html_select_time<br>
+* Purpose:  Prints the dropdowns for time selection
+* 
+* @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time}
+          (Smarty online manual)
+* @author Roberto Berto <roberto@berto.net> 
+* @credits Monte Ohrt <monte AT ohrt DOT com>
+* @param array $params parameters
+* @param object $smarty Smarty object
+* @param object $template template object
+* @return string 
+* @uses smarty_make_timestamp()
+*/
+function smarty_function_html_select_time($params, $smarty, $template)
+{
+    require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
+    require_once(SMARTY_PLUGINS_DIR . 'function.html_options.php');
+    //$smarty->loadPlugin('Smarty_shared_make_timestamp');
+    //$smarty->loadPlugin('Smarty_function_html_options');
+
+    /* Default values. */
+    $prefix = "Time_";
+    $time = time();
+    $display_hours = true;
+    $display_minutes = true;
+    $display_seconds = true;
+    $display_meridian = true;
+    $use_24_hours = true;
+    $minute_interval = 1;
+    $second_interval = 1;
+    /* Should the select boxes be part of an array when returned from PHP?
+       e.g. setting it to "birthday", would create "birthday[Hour]",
+       "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
+       Can be combined with prefix. */
+    $field_array = null;
+    $all_extra = null;
+    $hour_extra = null;
+    $minute_extra = null;
+    $second_extra = null;
+    $meridian_extra = null;
+
+    foreach ($params as $_key => $_value) {
+        switch ($_key) {
+            case 'prefix':
+            case 'time':
+            case 'field_array':
+            case 'all_extra':
+            case 'hour_extra':
+            case 'minute_extra':
+            case 'second_extra':
+            case 'meridian_extra':
+                $$_key = (string)$_value;
+                break;
+
+            case 'display_hours':
+            case 'display_minutes':
+            case 'display_seconds':
+            case 'display_meridian':
+            case 'use_24_hours':
+                $$_key = (bool)$_value;
+                break;
+
+            case 'minute_interval':
+            case 'second_interval':
+                $$_key = (int)$_value;
+                break;
+
+            default:
+                trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING);
+        } 
+    } 
+
+    $time = smarty_make_timestamp($time);
+
+    $html_result = '';
+
+    if ($display_hours) {
+        $hours = $use_24_hours ? range(0, 23) : range(1, 12);
+        $hour_fmt = $use_24_hours ? '%H' : '%I';
+        for ($i = 0, $for_max = count($hours); $i < $for_max; $i++)
+        $hours[$i] = sprintf('%02d', $hours[$i]);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Hour"';
+        } 
+        if (null !== $hour_extra) {
+            $html_result .= ' ' . $hour_extra;
+        } 
+        if (null !== $all_extra) {
+            $html_result .= ' ' . $all_extra;
+        } 
+        $html_result .= '>' . "\n";
+        $html_result .= smarty_function_html_options(array('output' => $hours,
+                'values' => $hours,
+                'selected' => strftime($hour_fmt, $time),
+                'print_result' => false),
+            $smarty, $template);
+        $html_result .= "</select>\n";
+    } 
+
+    if ($display_minutes) {
+        $all_minutes = range(0, 59);
+        for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i += $minute_interval)
+        $minutes[] = sprintf('%02d', $all_minutes[$i]);
+        $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Minute"';
+        } 
+        if (null !== $minute_extra) {
+            $html_result .= ' ' . $minute_extra;
+        } 
+        if (null !== $all_extra) {
+            $html_result .= ' ' . $all_extra;
+        } 
+        $html_result .= '>' . "\n";
+
+        $html_result .= smarty_function_html_options(array('output' => $minutes,
+                'values' => $minutes,
+                'selected' => $selected,
+                'print_result' => false),
+            $smarty, $template);
+        $html_result .= "</select>\n";
+    } 
+
+    if ($display_seconds) {
+        $all_seconds = range(0, 59);
+        for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i += $second_interval)
+        $seconds[] = sprintf('%02d', $all_seconds[$i]);
+        $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval);
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Second"';
+        } 
+
+        if (null !== $second_extra) {
+            $html_result .= ' ' . $second_extra;
+        } 
+        if (null !== $all_extra) {
+            $html_result .= ' ' . $all_extra;
+        } 
+        $html_result .= '>' . "\n";
+
+        $html_result .= smarty_function_html_options(array('output' => $seconds,
+                'values' => $seconds,
+                'selected' => $selected,
+                'print_result' => false),
+            $smarty, $template);
+        $html_result .= "</select>\n";
+    } 
+
+    if ($display_meridian && !$use_24_hours) {
+        $html_result .= '<select name=';
+        if (null !== $field_array) {
+            $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"';
+        } else {
+            $html_result .= '"' . $prefix . 'Meridian"';
+        } 
+
+        if (null !== $meridian_extra) {
+            $html_result .= ' ' . $meridian_extra;
+        } 
+        if (null !== $all_extra) {
+            $html_result .= ' ' . $all_extra;
+        } 
+        $html_result .= '>' . "\n";
+
+        $html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'),
+                'values' => array('am', 'pm'),
+                'selected' => strtolower(strftime('%p', $time)),
+                'print_result' => false),
+            $smarty, $template);
+        $html_result .= "</select>\n";
+    } 
+
+    return $html_result;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.html_table.php b/gosa-core/include/smarty/plugins/function.html_table.php
new file mode 100644 (file)
index 0000000..198b03c
--- /dev/null
@@ -0,0 +1,176 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFunction
+*/
+
+/**
+* Smarty {html_table} function plugin
+* 
+* Type:     function<br>
+* Name:     html_table<br>
+* Date:     Feb 17, 2003<br>
+* Purpose:  make an html table from an array of data<br>
+* 
+* 
+* Examples:
+* <pre>
+* {table loop=$data}
+* {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
+* {table loop=$data cols="first,second,third" tr_attr=$colors}
+* </pre>
+* 
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @author credit to Messju Mohr <messju at lammfellpuschen dot de> 
+* @author credit to boots <boots dot smarty at yahoo dot com> 
+* @version 1.1
+* @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table}
+          (Smarty online manual)
+* @param array $params parameters
+* Input:<br>
+*          - loop = array to loop through
+*          - cols = number of columns, comma separated list of column names
+*                   or array of column names
+*          - rows = number of rows
+*          - table_attr = table attributes
+*          - th_attr = table heading attributes (arrays are cycled)
+*          - tr_attr = table row attributes (arrays are cycled)
+*          - td_attr = table cell attributes (arrays are cycled)
+*          - trailpad = value to pad trailing cells with
+*          - caption = text for caption element 
+*          - vdir = vertical direction (default: "down", means top-to-bottom)
+*          - hdir = horizontal direction (default: "right", means left-to-right)
+*          - inner = inner loop (default "cols": print $loop line by line,
+*                    $loop will be printed column by column otherwise)
+* @param object $smarty Smarty object
+* @param object $template template object
+* @return string 
+*/
+function smarty_function_html_table($params, $smarty, $template)
+{
+    $table_attr = 'border="1"';
+    $tr_attr = '';
+    $th_attr = '';
+    $td_attr = '';
+    $cols = $cols_count = 3;
+    $rows = 3;
+    $trailpad = '&nbsp;';
+    $vdir = 'down';
+    $hdir = 'right';
+    $inner = 'cols';
+    $caption = '';
+
+    if (!isset($params['loop'])) {
+        trigger_error("html_table: missing 'loop' parameter",E_USER_WARNING);
+        return;
+    } 
+
+    foreach ($params as $_key => $_value) {
+        switch ($_key) {
+            case 'loop':
+                $$_key = (array)$_value;
+                break;
+
+            case 'cols':
+                if (is_array($_value) && !empty($_value)) {
+                    $cols = $_value;
+                    $cols_count = count($_value);
+                } elseif (!is_numeric($_value) && is_string($_value) && !empty($_value)) {
+                    $cols = explode(',', $_value);
+                    $cols_count = count($cols);
+                } elseif (!empty($_value)) {
+                    $cols_count = (int)$_value;
+                } else {
+                    $cols_count = $cols;
+                } 
+                break;
+
+            case 'rows':
+                $$_key = (int)$_value;
+                break;
+
+            case 'table_attr':
+            case 'trailpad':
+            case 'hdir':
+            case 'vdir':
+            case 'inner':
+            case 'caption':
+                $$_key = (string)$_value;
+                break;
+
+            case 'tr_attr':
+            case 'td_attr':
+            case 'th_attr':
+                $$_key = $_value;
+                break;
+        } 
+    } 
+
+    $loop_count = count($loop);
+    if (empty($params['rows'])) {
+        /* no rows specified */
+        $rows = ceil($loop_count / $cols_count);
+    } elseif (empty($params['cols'])) {
+        if (!empty($params['rows'])) {
+            /* no cols specified, but rows */
+            $cols_count = ceil($loop_count / $rows);
+        } 
+    } 
+
+    $output = "<table $table_attr>\n";
+
+    if (!empty($caption)) {
+        $output .= '<caption>' . $caption . "</caption>\n";
+    } 
+
+    if (is_array($cols)) {
+        $cols = ($hdir == 'right') ? $cols : array_reverse($cols);
+        $output .= "<thead><tr>\n";
+
+        for ($r = 0; $r < $cols_count; $r++) {
+            $output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
+            $output .= $cols[$r];
+            $output .= "</th>\n";
+        } 
+        $output .= "</tr></thead>\n";
+    } 
+
+    $output .= "<tbody>\n";
+    for ($r = 0; $r < $rows; $r++) {
+        $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
+        $rx = ($vdir == 'down') ? $r * $cols_count : ($rows-1 - $r) * $cols_count;
+
+        for ($c = 0; $c < $cols_count; $c++) {
+            $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count-1 - $c;
+            if ($inner != 'cols') {
+                /* shuffle x to loop over rows*/
+                $x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
+            } 
+
+            if ($x < $loop_count) {
+                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[$x] . "</td>\n";
+            } else {
+                $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n";
+            } 
+        } 
+        $output .= "</tr>\n";
+    } 
+    $output .= "</tbody>\n";
+    $output .= "</table>\n";
+
+    return $output;
+} 
+
+function smarty_function_html_table_cycle($name, $var, $no)
+{
+    if (!is_array($var)) {
+        $ret = $var;
+    } else {
+        $ret = $var[$no % count($var)];
+    } 
+
+    return ($ret) ? ' ' . $ret : '';
+} 
+?>
diff --git a/gosa-core/include/smarty/plugins/function.mailto.php b/gosa-core/include/smarty/plugins/function.mailto.php
new file mode 100644 (file)
index 0000000..29a87c6
--- /dev/null
@@ -0,0 +1,157 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFunction
+*/
+
+/**
+* Smarty {mailto} function plugin
+* 
+* Type:     function<br>
+* Name:     mailto<br>
+* Date:     May 21, 2002
+* Purpose:  automate mailto address link creation, and optionally
+*            encode them.<br>
+* 
+* Examples:
+* <pre>
+* {mailto address="me@domain.com"}
+* {mailto address="me@domain.com" encode="javascript"}
+* {mailto address="me@domain.com" encode="hex"}
+* {mailto address="me@domain.com" subject="Hello to you!"}
+* {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
+* {mailto address="me@domain.com" extra='class="mailto"'}
+* </pre>
+* 
+* @link http://smarty.php.net/manual/en/language.function.mailto.php {mailto}
+          (Smarty online manual)
+* @version 1.2
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @author credits to Jason Sweat (added cc, bcc and subject functionality) 
+* @param array $params parameters
+* Input:<br>
+*          - address = e-mail address
+*          - text = (optional) text to display, default is address
+*          - encode = (optional) can be one of:
+*                 * none : no encoding (default)
+*                 * javascript : encode with javascript
+*                 * javascript_charcode : encode with javascript charcode
+*                 * hex : encode with hexidecimal (no javascript)
+*          - cc = (optional) address(es) to carbon copy
+*          - bcc = (optional) address(es) to blind carbon copy
+*          - subject = (optional) e-mail subject
+*          - newsgroups = (optional) newsgroup(s) to post to
+*          - followupto = (optional) address(es) to follow up to
+*          - extra = (optional) extra tags for the href link
+* @param object $smarty Smarty object
+* @param object $template template object
+* @return string 
+*/
+function smarty_function_mailto($params, $smarty, $template)
+{
+    $extra = '';
+
+    if (empty($params['address'])) {
+        trigger_error("mailto: missing 'address' parameter",E_USER_WARNING);
+        return;
+    } else {
+        $address = $params['address'];
+    } 
+
+    $text = $address; 
+    // netscape and mozilla do not decode %40 (@) in BCC field (bug?)
+    // so, don't encode it.
+    $search = array('%40', '%2C');
+    $replace = array('@', ',');
+    $mail_parms = array();
+    foreach ($params as $var => $value) {
+        switch ($var) {
+            case 'cc':
+            case 'bcc':
+            case 'followupto':
+                if (!empty($value))
+                    $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
+                break;
+
+            case 'subject':
+            case 'newsgroups':
+                $mail_parms[] = $var . '=' . rawurlencode($value);
+                break;
+
+            case 'extra':
+            case 'text':
+                $$var = $value;
+
+            default:
+        } 
+    } 
+
+    $mail_parm_vals = '';
+    for ($i = 0; $i < count($mail_parms); $i++) {
+        $mail_parm_vals .= (0 == $i) ? '?' : '&';
+        $mail_parm_vals .= $mail_parms[$i];
+    } 
+    $address .= $mail_parm_vals;
+
+    $encode = (empty($params['encode'])) ? 'none' : $params['encode'];
+    if (!in_array($encode, array('javascript', 'javascript_charcode', 'hex', 'none'))) {
+        trigger_error("mailto: 'encode' parameter must be none, javascript or hex",E_USER_WARNING);
+        return;
+    } 
+
+    if ($encode == 'javascript') {
+        $string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
+
+        $js_encode = '';
+        for ($x = 0; $x < strlen($string); $x++) {
+            $js_encode .= '%' . bin2hex($string[$x]);
+        } 
+
+        return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>';
+    } elseif ($encode == 'javascript_charcode') {
+        $string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
+
+        for($x = 0, $y = strlen($string); $x < $y; $x++) {
+            $ord[] = ord($string[$x]);
+        } 
+
+        $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n";
+        $_ret .= "<!--\n";
+        $_ret .= "{document.write(String.fromCharCode(";
+        $_ret .= implode(',', $ord);
+        $_ret .= "))";
+        $_ret .= "}\n";
+        $_ret .= "//-->\n";
+        $_ret .= "</script>\n";
+
+        return $_ret;
+    } elseif ($encode == 'hex') {
+        preg_match('!^(.*)(\?.*)$!', $address, $match);
+        if (!empty($match[2])) {
+            trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.",E_USER_WARNING);
+            return;
+        } 
+        $address_encode = '';
+        for ($x = 0; $x < strlen($address); $x++) {
+            if (preg_match('!\w!', $address[$x])) {
+                $address_encode .= '%' . bin2hex($address[$x]);
+            } else {
+                $address_encode .= $address[$x];
+            } 
+        } 
+        $text_encode = '';
+        for ($x = 0; $x < strlen($text); $x++) {
+            $text_encode .= '&#x' . bin2hex($text[$x]) . ';';
+        } 
+
+        $mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
+        return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
+    } else {
+        // no encoding
+        return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/function.math.php b/gosa-core/include/smarty/plugins/function.math.php
new file mode 100644 (file)
index 0000000..d7ac9f8
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Smarty plugin
+ *
+ * This plugin is only for Smarty2 BC
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
+
+
+/**
+ * Smarty {math} function plugin
+ *
+ * Type:     function<br>
+ * Name:     math<br>
+ * Purpose:  handle math computations in template<br>
+ * @link http://smarty.php.net/manual/en/language.function.math.php {math}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array $params parameters
+ * @param object $smarty Smarty object
+ * @param object $template template object
+ * @return string|null
+ */
+function smarty_function_math($params, $smarty, $template)
+{
+    // be sure equation parameter is present
+    if (empty($params['equation'])) {
+        trigger_error("math: missing equation parameter",E_USER_WARNING);
+        return;
+    }
+
+    $equation = $params['equation'];
+
+    // make sure parenthesis are balanced
+    if (substr_count($equation,"(") != substr_count($equation,")")) {
+        trigger_error("math: unbalanced parenthesis",E_USER_WARNING);
+        return;
+    }
+
+    // match all vars in equation, make sure all are passed
+    preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
+    $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
+                           'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
+    
+    foreach($match[1] as $curr_var) {
+        if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
+            trigger_error("math: function call $curr_var not allowed",E_USER_WARNING);
+            return;
+        }
+    }
+
+    foreach($params as $key => $val) {
+        if ($key != "equation" && $key != "format" && $key != "assign") {
+            // make sure value is not empty
+            if (strlen($val)==0) {
+                trigger_error("math: parameter $key is empty",E_USER_WARNING);
+                return;
+            }
+            if (!is_numeric($val)) {
+                trigger_error("math: parameter $key: is not numeric",E_USER_WARNING);
+                return;
+            }
+            $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
+        }
+    }
+
+    eval("\$smarty_math_result = ".$equation.";");
+
+    if (empty($params['format'])) {
+        if (empty($params['assign'])) {
+            return $smarty_math_result;
+        } else {
+            $template->assign($params['assign'],$smarty_math_result);
+        }
+    } else {
+        if (empty($params['assign'])){
+            printf($params['format'],$smarty_math_result);
+        } else {
+            $template->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
+        }
+    }
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/function.msgPool.php b/gosa-core/include/smarty/plugins/function.msgPool.php
new file mode 100644 (file)
index 0000000..c9c0275
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+function smarty_function_msgPool($params, &$smarty)
+{
+       if(class_available("msgPool") && isset($params['type'])){
+               $parameter = array();
+               foreach($params as $para => $value){
+                       if(!preg_match("/^type$/i",$para)){
+                               $parameter[$para] = $value;
+                       }
+               }
+               if(is_callable("msgPool::".$params['type'])){
+                       echo call_user_func_array(array("msgPool",$params['type']), $parameter);
+               }else{
+                       trigger_error("Unknown msgPool function ".$params['type']);
+               }
+       }else{
+               trigger_error("Unknown class msgPool.");
+       }
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/function.popup.php b/gosa-core/include/smarty/plugins/function.popup.php
new file mode 100644 (file)
index 0000000..e683556
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
+
+
+/**
+ * Smarty {popup} function plugin
+ *
+ * Type:     function<br>
+ * Name:     popup<br>
+ * Purpose:  make text pop up in windows via overlib
+ * @link http://smarty.php.net/manual/en/language.function.popup.php {popup}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array $params parameters
+ * @param object $smarty Smarty object
+ * @param object $template template object
+ * @return string
+ */
+function smarty_function_popup($params, $smarty, $template)
+{
+    $append = '';
+    foreach ($params as $_key=>$_value) {
+        switch ($_key) {
+            case 'text':
+            case 'trigger':
+            case 'function':
+            case 'inarray':
+                $$_key = (string)$_value;
+                if ($_key == 'function' || $_key == 'inarray')
+                    $append .= ',' . strtoupper($_key) . ",'$_value'";
+                break;
+
+            case 'caption':
+            case 'closetext':
+            case 'status':
+                $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'";
+                break;
+
+            case 'fgcolor':
+            case 'bgcolor':
+            case 'textcolor':
+            case 'capcolor':
+            case 'closecolor':
+            case 'textfont':
+            case 'captionfont':
+            case 'closefont':
+            case 'fgbackground':
+            case 'bgbackground':
+            case 'caparray':
+            case 'capicon':
+            case 'background':
+            case 'frame':
+                $append .= ',' . strtoupper($_key) . ",'$_value'";
+                break;
+
+            case 'textsize':
+            case 'captionsize':
+            case 'closesize':
+            case 'width':
+            case 'height':
+            case 'border':
+            case 'offsetx':
+            case 'offsety':
+            case 'snapx':
+            case 'snapy':
+            case 'fixx':
+            case 'fixy':
+            case 'padx':
+            case 'pady':
+            case 'timeout':
+            case 'delay':
+                $append .= ',' . strtoupper($_key) . ",$_value";
+                break;
+
+            case 'sticky':
+            case 'left':
+            case 'right':
+            case 'center':
+            case 'above':
+            case 'below':
+            case 'noclose':
+            case 'autostatus':
+            case 'autostatuscap':
+            case 'fullhtml':
+            case 'hauto':
+            case 'vauto':
+            case 'mouseoff':
+            case 'followmouse':
+            case 'closeclick':
+            case 'wrap':
+                if ($_value) $append .= ',' . strtoupper($_key);
+                break;
+
+            default:
+                trigger_error("[popup] unknown parameter $_key", E_USER_WARNING);
+        }
+    }
+
+    if (empty($text) && !isset($inarray) && empty($function)) {
+        trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required",E_USER_WARNING);
+        return false;
+    }
+
+    if (empty($trigger)) { $trigger = "onmouseover"; }
+
+    $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!",'!"!',"![\r\n]!"),array("\'","\'",'\r'),$text).'\'';
+    $retval .= $append . ');"';
+    if ($trigger == 'onmouseover')
+       $retval .= ' onmouseout="nd();"';
+
+
+    return $retval;
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/function.popup_init.php b/gosa-core/include/smarty/plugins/function.popup_init.php
new file mode 100644 (file)
index 0000000..ae58037
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsFunction
+ */
+
+
+/**
+ * Smarty {popup_init} function plugin
+ *
+ * Type:     function<br>
+ * Name:     popup_init<br>
+ * Purpose:  initialize overlib
+ * @link http://smarty.php.net/manual/en/language.function.popup.init.php {popup_init}
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param array $params parameters
+ * @param object $smarty Smarty object
+ * @param object $template template object
+ * @return string 
+ */
+function smarty_function_popup_init($params, $smarty, $template)
+{
+    $zindex = 1000;
+    
+    if (!empty($params['zindex'])) {
+        $zindex = $params['zindex'];
+    }
+    
+    if (!empty($params['src'])) {
+        return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n"
+         . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n";
+    } else {
+        trigger_error("popup_init: missing src parameter",E_USER_WARNING);
+    }
+}
+
+/* vim: set expandtab: */
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.capitalize.php b/gosa-core/include/smarty/plugins/modifier.capitalize.php
new file mode 100644 (file)
index 0000000..acff0bc
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty capitalize modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     capitalize<br>
+ * Purpose:  capitalize words in the string
+ * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
+ *      capitalize (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_capitalize($string, $uc_digits = false)
+{
+    smarty_modifier_capitalize_ucfirst(null, $uc_digits);
+    return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string);
+}
+
+function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
+{
+    static $_uc_digits = false;
+    
+    if(isset($uc_digits)) {
+        $_uc_digits = $uc_digits;
+        return;
+    }
+    
+    if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits)
+        return ucfirst($string[0]);
+    else
+        return $string[0];
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.cat.php b/gosa-core/include/smarty/plugins/modifier.cat.php
new file mode 100644 (file)
index 0000000..1b932d0
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty cat modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     cat<br>
+ * Date:     Feb 24, 2003
+ * Purpose:  catenate a value to a variable
+ * Input:    string to catenate
+ * Example:  {$var|cat:"foo"}
+ * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
+ *          (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @version 1.0
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_cat($string, $cat)
+{
+    return $string . $cat;
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.count_characters.php b/gosa-core/include/smarty/plugins/modifier.count_characters.php
new file mode 100644 (file)
index 0000000..6d52465
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty count_characters modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_characteres<br>
+ * Purpose:  count the number of characters in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php
+ *          count_characters (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string $string input string
+ * @param boolean $include_spaces include whitespace in the character count
+ * @return integer number of characters
+ */
+function smarty_modifier_count_characters($string, $include_spaces = false)
+{
+    if ($include_spaces)
+       return(strlen($string));
+
+    return preg_match_all("/[^\s]/",$string, $match);
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.count_paragraphs.php b/gosa-core/include/smarty/plugins/modifier.count_paragraphs.php
new file mode 100644 (file)
index 0000000..441da09
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty count_paragraphs modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_paragraphs<br>
+ * Purpose:  count the number of paragraphs in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
+ *          count_paragraphs (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_paragraphs($string)
+{
+    // count \r or \n characters
+    return count(preg_split('/[\r\n]+/', $string));
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.count_sentences.php b/gosa-core/include/smarty/plugins/modifier.count_sentences.php
new file mode 100644 (file)
index 0000000..7783c92
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty count_sentences modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_sentences
+ * Purpose:  count the number of sentences in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
+ *          count_sentences (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_sentences($string)
+{
+    // find periods with a word before but not after.
+    return preg_match_all('/[^\s]\.(?!\w)/', $string, $match);
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.count_words.php b/gosa-core/include/smarty/plugins/modifier.count_words.php
new file mode 100644 (file)
index 0000000..1079d8f
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty count_words modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     count_words<br>
+ * Purpose:  count the number of words in a text
+ * @link http://smarty.php.net/manual/en/language.modifier.count.words.php
+ *          count_words (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return integer
+ */
+function smarty_modifier_count_words($string)
+{
+    return str_word_count($string);
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.date_format.php b/gosa-core/include/smarty/plugins/modifier.date_format.php
new file mode 100644 (file)
index 0000000..950a195
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty date_format modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     date_format<br>
+* Purpose:  format datestamps via strftime<br>
+* Input:<br>
+*          - string: input date string
+*          - format: strftime format for output
+*          - default_date: default date if $string is empty
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $ 
+* @param string $ 
+* @param string $ 
+* @return string |void
+* @uses smarty_make_timestamp()
+*/
+function smarty_modifier_date_format($string, $format = SMARTY_RESOURCE_DATE_FORMAT, $default_date = '',$formatter='auto')
+{
+    /**
+    * Include the {@link shared.make_timestamp.php} plugin
+    */
+    require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
+    if ($string != '') {
+        $timestamp = smarty_make_timestamp($string);
+    } elseif ($default_date != '') {
+        $timestamp = smarty_make_timestamp($default_date);
+    } else {
+        return;
+    } 
+    if($formatter=='strftime'||($formatter=='auto'&&strpos($format,'%')!==false)) {
+        if (DS == '\\') {
+            $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
+            $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
+            if (strpos($format, '%e') !== false) {
+                $_win_from[] = '%e';
+                $_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
+            } 
+            if (strpos($format, '%l') !== false) {
+                $_win_from[] = '%l';
+                $_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
+            } 
+            $format = str_replace($_win_from, $_win_to, $format);
+        } 
+        return strftime($format, $timestamp);
+    } else {
+        return date($format, $timestamp);
+    }
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.debug_print_var.php b/gosa-core/include/smarty/plugins/modifier.debug_print_var.php
new file mode 100644 (file)
index 0000000..f0f83d2
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage Debug
+*/
+
+/**
+* Smarty debug_print_var modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     debug_print_var<br>
+* Purpose:  formats variable contents for display in the console
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php debug_print_var (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param array $ |object
+* @param integer $ 
+* @param integer $ 
+* @return string 
+*/
+function smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40)
+{
+    $_replace = array("\n" => '<i>\n</i>',
+        "\r" => '<i>\r</i>',
+        "\t" => '<i>\t</i>'
+        );
+
+    switch (gettype($var)) {
+        case 'array' :
+            $results = '<b>Array (' . count($var) . ')</b>';
+            foreach ($var as $curr_key => $curr_val) {
+                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
+                 . '<b>' . strtr($curr_key, $_replace) . '</b> =&gt; '
+                 . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+                $depth--;
+            } 
+            break;
+        case 'object' :
+            $object_vars = get_object_vars($var);
+            $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
+            foreach ($object_vars as $curr_key => $curr_val) {
+                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2)
+                 . '<b> -&gt;' . strtr($curr_key, $_replace) . '</b> = '
+                 . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+                $depth--;
+            } 
+            break;
+        case 'boolean' :
+        case 'NULL' :
+        case 'resource' :
+            if (true === $var) {
+                $results = 'true';
+            } elseif (false === $var) {
+                $results = 'false';
+            } elseif (null === $var) {
+                $results = 'null';
+            } else {
+                $results = htmlspecialchars((string) $var);
+            } 
+            $results = '<i>' . $results . '</i>';
+            break;
+        case 'integer' :
+        case 'float' :
+            $results = htmlspecialchars((string) $var);
+            break;
+        case 'string' :
+            $results = strtr($var, $_replace);
+            if (strlen($var) > $length) {
+                $results = substr($var, 0, $length - 3) . '...';
+            } 
+            $results = htmlspecialchars('"' . $results . '"');
+            break;
+        case 'unknown type' :
+        default :
+            $results = strtr((string) $var, $_replace);
+            if (strlen($results) > $length) {
+                $results = substr($results, 0, $length - 3) . '...';
+            } 
+            $results = htmlspecialchars($results);
+    } 
+
+    return $results;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.default.php b/gosa-core/include/smarty/plugins/modifier.default.php
new file mode 100644 (file)
index 0000000..2622d07
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty default modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     default<br>
+ * Purpose:  designate default value for empty variables
+ * @link http://smarty.php.net/manual/en/language.modifier.default.php
+ *          default (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string
+ * @return string
+ */
+function smarty_modifier_default($string, $default = '')
+{
+    if (!isset($string) || $string === '')
+        return $default;
+    else
+        return $string;
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.escape.php b/gosa-core/include/smarty/plugins/modifier.escape.php
new file mode 100644 (file)
index 0000000..0e58d8b
--- /dev/null
@@ -0,0 +1,111 @@
+<?php
+
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty escape modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     escape<br>
+* Purpose:  escape string for output
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $string input string
+* @param string $esc_type escape type
+* @param string $char_set character set
+* @return string escaped input string
+*/
+function smarty_modifier_escape($string, $esc_type = 'html', $char_set = SMARTY_RESOURCE_CHAR_SET)
+{
+    switch ($esc_type) {
+        case 'html':
+            return htmlspecialchars($string, ENT_QUOTES, $char_set);
+
+        case 'htmlall':
+            return htmlentities($string, ENT_QUOTES, $char_set);
+
+        case 'url':
+            return rawurlencode($string);
+
+        case 'urlpathinfo':
+            return str_replace('%2F', '/', rawurlencode($string));
+
+        case 'quotes': 
+            // escape unescaped single quotes
+            return preg_replace("%(?<!\\\\)'%", "\\'", $string);
+
+        case 'hex': 
+            // escape every character into hex
+            $return = '';
+            for ($x = 0; $x < strlen($string); $x++) {
+                $return .= '%' . bin2hex($string[$x]);
+            } 
+            return $return;
+
+        case 'hexentity':
+            $return = '';
+            for ($x = 0; $x < strlen($string); $x++) {
+                $return .= '&#x' . bin2hex($string[$x]) . ';';
+            } 
+            return $return;
+
+        case 'decentity':
+            $return = '';
+            for ($x = 0; $x < strlen($string); $x++) {
+                $return .= '&#' . ord($string[$x]) . ';';
+            } 
+            return $return;
+
+        case 'javascript': 
+            // escape quotes and backslashes, newlines, etc.
+            return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\/'));
+
+        case 'mail': 
+            // safe way to display e-mail address on a web page
+            if ($smarty->has_mb) {
+                return mb_str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);
+            } else {
+                return str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);
+            } 
+
+        case 'nonstd': 
+            // escape non-standard chars, such as ms document quotes
+            $_res = '';
+            for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
+                $_ord = ord(substr($string, $_i, 1)); 
+                // non-standard char, escape it
+                if ($_ord >= 126) {
+                    $_res .= '&#' . $_ord . ';';
+                } else {
+                    $_res .= substr($string, $_i, 1);
+                } 
+            } 
+            return $_res;
+
+        default:
+            return $string;
+    } 
+    if (!function_exists("mb_str_replace")) {
+        // simulate the missing PHP mb_str_replace function
+        function mb_str_replace($needle, $replacement, $haystack)
+        {
+            $needle_len = mb_strlen($needle);
+            $replacement_len = mb_strlen($replacement);
+            $pos = mb_strpos($haystack, $needle, 0);
+            while ($pos !== false) {
+                $haystack = mb_substr($haystack, 0, $pos) . $replacement
+                 . mb_substr($haystack, $pos + $needle_len);
+                $pos = mb_strpos($haystack, $needle, $pos + $replacement_len);
+            } 
+            return $haystack;
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.indent.php b/gosa-core/include/smarty/plugins/modifier.indent.php
new file mode 100644 (file)
index 0000000..4f2f9d8
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty indent modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     indent<br>
+ * Purpose:  indent lines of text
+ * @link http://smarty.php.net/manual/en/language.modifier.indent.php
+ *          indent (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @return string
+ */
+function smarty_modifier_indent($string,$chars=4,$char=" ")
+{
+    return preg_replace('!^!m',str_repeat($char,$chars),$string);
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.lower.php b/gosa-core/include/smarty/plugins/modifier.lower.php
new file mode 100644 (file)
index 0000000..34a609e
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty lower modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     lower<br>
+* Purpose:  convert string to lowercase
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $ 
+* @return string 
+*/
+function smarty_modifier_lower($string)
+{
+    if (function_exists('mb_strtolower')) {
+        return mb_strtolower($string);
+    } else {
+        return strtolower($string);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.noprint.php b/gosa-core/include/smarty/plugins/modifier.noprint.php
new file mode 100644 (file)
index 0000000..3e9df06
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty noprint modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     noprint<br>
+ * Purpose:  return an empty string
+ * @author   Uwe Tews
+ * @param string
+ * @return string
+ */
+function smarty_modifier_noprint($string)
+{
+    return '';
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.regex_replace.php b/gosa-core/include/smarty/plugins/modifier.regex_replace.php
new file mode 100644 (file)
index 0000000..100b58c
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty regex_replace modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     regex_replace<br>
+ * Purpose:  regular expression search/replace
+ * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
+ *          regex_replace (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param string|array
+ * @param string|array
+ * @return string
+ */
+function smarty_modifier_regex_replace($string, $search, $replace)
+{
+    if(is_array($search)) {
+      foreach($search as $idx => $s)
+        $search[$idx] = _smarty_regex_replace_check($s);
+    } else {
+      $search = _smarty_regex_replace_check($search);
+    }       
+
+    return preg_replace($search, $replace, $string);
+}
+
+function _smarty_regex_replace_check($search)
+{
+    if (($pos = strpos($search,"\0")) !== false)
+      $search = substr($search,0,$pos);
+    if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
+        /* remove eval-modifier from $search */
+        $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
+    }
+    return $search;
+}
+
+/* vim: set expandtab: */
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.replace.php b/gosa-core/include/smarty/plugins/modifier.replace.php
new file mode 100644 (file)
index 0000000..5f70979
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty replace modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     replace<br>
+* Purpose:  simple search/replace
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @author Uwe Tews 
+* @param string $ 
+* @param string $ 
+* @param string $ 
+* @return string 
+*/
+function smarty_modifier_replace($string, $search, $replace)
+{
+    if (!function_exists("mb_str_replace")) {
+        // simulate the missing PHP mb_str_replace function
+        function mb_str_replace($needle, $replacement, $haystack)
+        {
+            $needle_len = mb_strlen($needle);
+            $replacement_len = mb_strlen($replacement);
+            $pos = mb_strpos($haystack, $needle, 0);
+            while ($pos !== false) {
+                $haystack = mb_substr($haystack, 0, $pos) . $replacement
+                 . mb_substr($haystack, $pos + $needle_len);
+                $pos = mb_strpos($haystack, $needle, $pos + $replacement_len);
+            } 
+            return $haystack;
+        } 
+    } 
+    if (function_exists('mb_substr')) {
+        return mb_str_replace($search, $replace, $string);
+    } else {
+        return str_replace($search, $replace, $string);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.spacify.php b/gosa-core/include/smarty/plugins/modifier.spacify.php
new file mode 100644 (file)
index 0000000..d2593ec
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty spacify modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     spacify<br>
+* Purpose:  add spaces between characters in a string
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $ 
+* @param string $ 
+* @return string 
+*/
+function smarty_modifier_spacify($string, $spacify_char = ' ')
+{
+    return implode($spacify_char, preg_split('//', $string, -1));
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.string_format.php b/gosa-core/include/smarty/plugins/modifier.string_format.php
new file mode 100644 (file)
index 0000000..fd96c8b
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty string_format modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     string_format<br>
+* Purpose:  format strings via sprintf
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $string input string 
+* @param string $format format string 
+* @return string formatted string
+*/
+    function smarty_modifier_string_format($string, $format)
+    {
+        return sprintf($format, $string);
+    } 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.strip.php b/gosa-core/include/smarty/plugins/modifier.strip.php
new file mode 100644 (file)
index 0000000..39f0f9f
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty strip modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     strip<br>
+* Purpose:  Replace all repeated spaces, newlines, tabs
+*             with a single space or supplied replacement string.<br>
+* Example:  {$var|strip} {$var|strip:"&nbsp;"}
+* Date:     September 25th, 2002
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @version 1.0
+* @param string $ 
+* @param string $ 
+* @return string 
+*/
+function smarty_modifier_strip($text, $replace = ' ')
+{
+        return preg_replace('!\s+!', $replace, $text);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.strip_tags.php b/gosa-core/include/smarty/plugins/modifier.strip_tags.php
new file mode 100644 (file)
index 0000000..6af08b2
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty strip_tags modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     strip_tags<br>
+* Purpose:  strip html tags from text
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $ 
+* @param boolean $ 
+* @return string 
+*/
+function smarty_modifier_strip_tags($string, $replace_with_space = true)
+{
+    if ($replace_with_space) {
+            return preg_replace('!<[^>]*?>!', ' ', $string);
+    } else {
+        return strip_tags($string);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.truncate.php b/gosa-core/include/smarty/plugins/modifier.truncate.php
new file mode 100644 (file)
index 0000000..943a8ab
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty truncate modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     truncate<br>
+* Purpose:  Truncate a string to a certain length if necessary,
+*             optionally splitting in the middle of a word, and
+*             appending the $etc string or inserting $etc into the middle.
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $string input string
+* @param integer $length lenght of truncated text
+* @param string $etc end string
+* @param boolean $break_words truncate at word boundary
+* @param boolean $middle truncate in the middle of text
+* @return string truncated string
+*/
+function smarty_modifier_truncate($string, $length = 80, $etc = '...',
+    $break_words = false, $middle = false)
+{
+    if ($length == 0)
+        return '';
+
+    if (is_callable('mb_strlen')) {
+        if (mb_strlen($string) > $length) {
+            $length -= min($length, mb_strlen($etc));
+            if (!$break_words && !$middle) {
+                $string = mb_ereg_replace('/\s+?(\S+)?$/', '', mb_substr($string, 0, $length + 1), 'p');
+            } 
+            if (!$middle) {
+                return mb_substr($string, 0, $length) . $etc;
+            } else {
+                return mb_substr($string, 0, $length / 2) . $etc . mb_substr($string, - $length / 2);
+            } 
+        } else {
+            return $string;
+        } 
+    } else {
+        if (strlen($string) > $length) {
+            $length -= min($length, strlen($etc));
+            if (!$break_words && !$middle) {
+                $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
+            } 
+            if (!$middle) {
+                return substr($string, 0, $length) . $etc;
+            } else {
+                return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2);
+            } 
+        } else {
+            return $string;
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.upper.php b/gosa-core/include/smarty/plugins/modifier.upper.php
new file mode 100644 (file)
index 0000000..fefa854
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsModifier
+*/
+
+/**
+* Smarty upper modifier plugin
+* 
+* Type:     modifier<br>
+* Name:     upper<br>
+* Purpose:  convert string to uppercase
+* 
+* @link http://smarty.php.net/manual/en/language.modifier.upper.php upper (Smarty online manual)
+* @author Monte Ohrt <monte at ohrt dot com> 
+* @param string $ 
+* @return string 
+*/
+function smarty_modifier_upper($string)
+{
+    if (function_exists('mb_strtoupper')) {
+        return mb_strtoupper($string);
+    } else {
+        return strtoupper($string);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/plugins/modifier.wordwrap.php b/gosa-core/include/smarty/plugins/modifier.wordwrap.php
new file mode 100644 (file)
index 0000000..92a79de
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsModifier
+ */
+
+
+/**
+ * Smarty wordwrap modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     wordwrap<br>
+ * Purpose:  wrap a string of text at a given length
+ * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php
+ *          wordwrap (Smarty online manual)
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @param integer
+ * @param string
+ * @param boolean
+ * @return string
+ */
+function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
+{
+    return wordwrap($string,$length,$break,$cut);
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php b/gosa-core/include/smarty/plugins/outputfilter.trimwhitespace.php
new file mode 100644 (file)
index 0000000..ce5fde9
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage PluginsFilter
+ */
+
+/**
+ * Smarty trimwhitespace outputfilter plugin
+ *
+ * File:     outputfilter.trimwhitespace.php<br>
+ * Type:     outputfilter<br>
+ * Name:     trimwhitespace<br>
+ * Date:     Jan 25, 2003<br>
+ * Purpose:  trim leading white space and blank lines from
+ *           template source after it gets interpreted, cleaning
+ *           up code and saving bandwidth. Does not affect
+ *           <<PRE>></PRE> and <SCRIPT></SCRIPT> blocks.<br>
+ * Install:  Drop into the plugin directory, call
+ *           <code>$smarty->load_filter('output','trimwhitespace');</code>
+ *           from application.
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
+ * @version  1.3
+ * @param string $source input string
+ * @param object &$smarty Smarty object
+ * @return string filtered output
+ */
+function smarty_outputfilter_trimwhitespace($source, $smarty)
+{
+    // Pull out the script blocks
+    preg_match_all("!<script[^>]*?>.*?</script>!is", $source, $match);
+    $_script_blocks = $match[0];
+    $source = preg_replace("!<script[^>]*?>.*?</script>!is",
+                           '@@@SMARTY:TRIM:SCRIPT@@@', $source);
+
+    // Pull out the pre blocks
+    preg_match_all("!<pre[^>]*?>.*?</pre>!is", $source, $match);
+    $_pre_blocks = $match[0];
+    $source = preg_replace("!<pre[^>]*?>.*?</pre>!is",
+                           '@@@SMARTY:TRIM:PRE@@@', $source);
+    
+    // Pull out the textarea blocks
+    preg_match_all("!<textarea[^>]*?>.*?</textarea>!is", $source, $match);
+    $_textarea_blocks = $match[0];
+    $source = preg_replace("!<textarea[^>]*?>.*?</textarea>!is",
+                           '@@@SMARTY:TRIM:TEXTAREA@@@', $source);
+
+    // remove all leading spaces, tabs and carriage returns NOT
+    // preceeded by a php close tag.
+    $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source));
+
+    // replace textarea blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source);
+
+    // replace pre blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source);
+
+    // replace script blocks
+    smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source);
+
+    return $source;
+}
+
+function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) {
+    $_len = strlen($search_str);
+    $_pos = 0;
+    for ($_i=0, $_count=count($replace); $_i<$_count; $_i++)
+        if (($_pos=strpos($subject, $search_str, $_pos))!==false)
+            $subject = substr_replace($subject, $replace[$_i], $_pos, $_len);
+        else
+            break;
+
+}
+
+?>
diff --git a/gosa-core/include/smarty/plugins/shared.escape_special_chars.php b/gosa-core/include/smarty/plugins/shared.escape_special_chars.php
new file mode 100644 (file)
index 0000000..f7142f9
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Smarty shared plugin
+ * @package Smarty
+ * @subpackage PluginsShared
+ */
+
+
+/**
+ * escape_special_chars common function
+ *
+ * Function: smarty_function_escape_special_chars<br>
+ * Purpose:  used by other smarty functions to escape
+ *           special chars except for already escaped ones
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string
+ * @return string
+ */
+function smarty_function_escape_special_chars($string)
+{
+    if(!is_array($string)) {
+        $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
+        $string = htmlspecialchars($string);
+        $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
+    }
+    return $string;
+}
+
+/* vim: set expandtab: */
+
+?>
diff --git a/gosa-core/include/smarty/plugins/shared.make_timestamp.php b/gosa-core/include/smarty/plugins/shared.make_timestamp.php
new file mode 100644 (file)
index 0000000..4e652ad
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Smarty shared plugin
+ * @package Smarty
+ * @subpackage PluginsShared
+ */
+
+
+/**
+ * Function: smarty_make_timestamp<br>
+ * Purpose:  used by other smarty functions to make a timestamp
+ *           from a string.
+ * @author   Monte Ohrt <monte at ohrt dot com>
+ * @param string $string
+ * @return string
+ */
+function smarty_make_timestamp($string)
+{
+    if(empty($string)) {
+        // use "now":
+        $time = time();
+
+    } elseif (preg_match('/^\d{14}$/', $string)) {
+        // it is mysql timestamp format of YYYYMMDDHHMMSS?            
+        $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2),
+                       substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));
+        
+    } elseif (is_numeric($string)) {
+        // it is a numeric string, we handle it as timestamp
+        $time = (int)$string;
+        
+    } else {
+        // strtotime should handle it
+        $time = strtotime($string);
+        if ($time == -1 || $time === false) {
+            // strtotime() was not able to parse $string, use "now":
+            $time = time();
+        }
+    }
+    return $time;
+
+}
+?>
diff --git a/gosa-core/include/smarty/plugins/variablefilter.htmlspecialchars.php b/gosa-core/include/smarty/plugins/variablefilter.htmlspecialchars.php
new file mode 100644 (file)
index 0000000..08a5783
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage PluginsFilter
+*/
+
+/**
+* Smarty htmlspecialchars variablefilter plugin
+* 
+* @param string $source input string
+* @param object $ &$smarty Smarty object
+* @return string filtered output
+*/
+function smarty_variablefilter_htmlspecialchars($source, &$smarty)
+{
+    return htmlspecialchars($source, ENT_QUOTES);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_cacheresource_file.php b/gosa-core/include/smarty/sysplugins/smarty_internal_cacheresource_file.php
new file mode 100644 (file)
index 0000000..c2614c3
--- /dev/null
@@ -0,0 +1,184 @@
+<?php
+
+/**
+* Smarty Internal Plugin CacheResource File
+* 
+* Implements the file system as resource for the HTML cache
+* Version ussing nocache inserts
+* 
+* @package Smarty
+* @subpackage Cacher
+* @author Uwe Tews 
+*/
+
+/**
+* This class does contain all necessary methods for the HTML cache on file system
+*/
+class Smarty_Internal_CacheResource_File {
+    function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+    } 
+    /**
+    * Returns the filepath of the cached template output
+    * 
+    * @param object $_template current template
+    * @return string the cache filepath
+    */
+    public function getCachedFilepath($_template)
+    {
+        $_source_file_path = str_replace(':', '.', $_template->getTemplateFilepath());
+        $_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null;
+        $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null; 
+        $_filepath = $_template->templateUid; 
+        // if use_sub_dirs, break file into directories
+        if ($this->smarty->use_sub_dirs) {
+            $_filepath = substr($_filepath, 0, 2) . DS
+             . substr($_filepath, 2, 2) . DS
+             . substr($_filepath, 4, 2) . DS
+             . $_filepath;
+        } 
+        $_compile_dir_sep = $this->smarty->use_sub_dirs ? DS : '^';
+        if (isset($_cache_id)) {
+            $_cache_id = str_replace('|', $_compile_dir_sep, $_cache_id) . $_compile_dir_sep;
+        } else {
+            $_cache_id = '';
+        } 
+        if (isset($_compile_id)) {
+            $_compile_id = $_compile_id . $_compile_dir_sep;
+        } else {
+            $_compile_id = '';
+        } 
+        $_cache_dir = $this->smarty->cache_dir;
+        if (strpos('/\\', substr($_cache_dir, -1)) === false) {
+            $_cache_dir .= DS;
+        } 
+        return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';
+    } 
+
+    /**
+    * Returns the timpestamp of the cached template output
+    * 
+    * @param object $_template current template
+    * @return integer |booelan the template timestamp or false if the file does not exist
+    */
+    public function getCachedTimestamp($_template)
+    { 
+        // return @filemtime ($_template->getCachedFilepath());
+        return ($_template->getCachedFilepath() && file_exists($_template->getCachedFilepath())) ? filemtime($_template->getCachedFilepath()) : false ;
+    } 
+
+    /**
+    * Returns the cached template output
+    * 
+    * @param object $_template current template
+    * @return string |booelan the template content or false if the file does not exist
+    */
+    public function getCachedContents($_template)
+    {
+        ob_start();
+        $_smarty_tpl = $_template;
+        include $_template->getCachedFilepath();
+        return ob_get_clean();
+    } 
+
+    /**
+    * Writes the rendered template output to cache file
+    * 
+    * @param object $_template current template
+    * @return boolean status
+    */
+    public function writeCachedContent($_template, $content)
+    {
+        if (!$_template->resource_object->isEvaluated) {
+            if (Smarty_Internal_Write_File::writeFile($_template->getCachedFilepath(), $content, $this->smarty) === true) {
+                $_template->cached_timestamp = filemtime($_template->getCachedFilepath());
+                return true;
+            } 
+        } 
+        return false;
+    } 
+
+    /**
+    * Empty cache folder
+    * 
+    * @param integer $exp_time expiration time
+    * @return integer number of cache files deleted
+    */
+    public function clearAll($exp_time = null)
+    {
+        return $this->clear(null, null, null, $exp_time);
+    } 
+    /**
+    * Empty cache for a specific template
+    * 
+    * @param string $resource_name template name
+    * @param string $cache_id cache id
+    * @param string $compile_id compile id
+    * @param integer $exp_time expiration time
+    * @return integer number of cache files deleted
+    */
+    public function clear($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 = $this->smarty->use_sub_dirs ? '/' : '^';
+        $_compile_id_offset = $this->smarty->use_sub_dirs ? 3 : 0;
+        $_dir = rtrim($this->smarty->cache_dir, '/\\') . DS;
+        $_dir_length = strlen($_dir);
+        if (isset($_cache_id)) {
+            $_cache_id_parts = explode('|', $_cache_id);
+            $_cache_id_parts_count = count($_cache_id_parts);
+        } 
+        $_count = 0;
+        $_cacheDirs = new RecursiveDirectoryIterator($_dir);
+        $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
+        foreach ($_cache as $_file) {
+            if (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)) {
+                    $_filename_parts = explode('.', $_parts[$_parts_count-1]);
+                    $_resourcename_parts = explode('.', $resource_name . '.php');
+                    if (count($_filename_parts)-1 != count($_resourcename_parts)) {
+                        continue;
+                    } 
+                    for ($i = 0; $i < count($_resourcename_parts); $i++) {
+                        if ($_filename_parts[$i + 1] != $_resourcename_parts[$i]) continue 2;
+                    } 
+                }
+                // check compile id
+                if (isset($_compile_id) && $_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) && time() - @filemtime($_file) < $exp_time) {
+                    continue;
+                } 
+                $_count += @unlink((string) $_file) ? 1 : 0;
+            } 
+        } 
+        return $_count;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_append.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_append.php
new file mode 100644 (file)
index 0000000..d60d808
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Append
+* 
+* Compiles the {append} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Append Class
+*/
+class Smarty_Internal_Compile_Append extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {append} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('var', 'value');
+        $this->optional_attributes = array('scope', 'nocache', 'index');
+
+        $_nocache = 'null';
+        $_scope = 'null'; 
+        // check for nocache attribute before _get_attributes because
+        // it shall not controll caching of the compiled code, but is a parameter
+        if (isset($args['nocache'])) {
+            if ($args['nocache'] == 'true') {
+                $_nocache = 'true';
+                $_nocache_boolean = true;
+            } 
+            unset($args['nocache']);
+        } 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        if (isset($_attr['scope'])) {
+            if ($_attr['scope'] == '\'parent\'') {
+                $_scope = SMARTY_PARENT_SCOPE;
+            } elseif ($_attr['scope'] == '\'root\'') {
+                $_scope = SMARTY_ROOT_SCOPE;
+           } elseif ($_attr['scope'] == '\'global\'') {
+                $_scope = SMARTY_GLOBAL_SCOPE;
+            } 
+        } 
+        // compiled output
+        if (isset($_attr['index'])) {
+            return "<?php \$_smarty_tpl->append($_attr[var],array($_attr[index] => $_attr[value]),true,$_nocache,$_scope);?>";
+        } else {
+            return "<?php \$_smarty_tpl->append($_attr[var],$_attr[value],false,$_nocache,$_scope);?>";
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_assign.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_assign.php
new file mode 100644 (file)
index 0000000..57c4ce7
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Assign
+* 
+* Compiles the {assign} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Assign Class
+*/
+class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {assign} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('var', 'value');
+        $this->optional_attributes = array('scope', 'nocache', 'smarty_internal_index');
+
+        $_nocache = 'null';
+        $_scope = 'null'; 
+        // check for nocache attribute before _get_attributes because
+        // it shall not controll caching of the compiled code, but is a parameter
+        if (isset($args['nocache'])) {
+            if ($args['nocache'] == 'true') {
+                $_nocache = 'true';
+                $_nocache_boolean = true;
+            } 
+            unset($args['nocache']);
+        } 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        if (isset($_attr['scope'])) {
+            if ($_attr['scope'] == '\'parent\'') {
+                $_scope = SMARTY_PARENT_SCOPE;
+            } elseif ($_attr['scope'] == '\'root\'') {
+                $_scope = SMARTY_ROOT_SCOPE;
+           } elseif ($_attr['scope'] == '\'global\'') {
+                $_scope = SMARTY_GLOBAL_SCOPE;
+            } 
+        } 
+        // compiled output
+        if (isset($_attr['smarty_internal_index'])) {
+            if ($_attr['smarty_internal_index'] == '') {
+                return "<?php \$_smarty_tpl->append($_attr[var],$_attr[value],false,$_nocache,$_scope);?>";
+            } else {
+                return "<?php \$_tmp$_attr[smarty_internal_index] = $_attr[value]; \$_smarty_tpl->append($_attr[var],\$_tmp,true,$_nocache,$_scope); unset (\$_tmp);?>";
+            } 
+        } else {
+            return "<?php \$_smarty_tpl->assign($_attr[var],$_attr[value],$_nocache,$_scope);?>";
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_block.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_block.php
new file mode 100644 (file)
index 0000000..45bca20
--- /dev/null
@@ -0,0 +1,108 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Block
+* 
+* Compiles the {block}{/block} tags
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Block Class
+*/
+class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {block} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return boolean true
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('name');
+        $this->optional_attributes = array('assign','nocache'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+        $save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code, $this->compiler->nocache);
+        $this->_open_tag('block', $save);
+        if (isset($_attr['nocache'])) {
+            if ($_attr['nocache'] == 'true') {
+                $compiler->nocache = true;
+            } 
+        } 
+
+        $compiler->template->extract_code = true;
+        $compiler->template->extracted_compiled_code = '';
+        $compiler->has_code = false;
+        return true;
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile BlockClose Class
+*/
+class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/block} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->smarty = $compiler->smarty;
+        $this->compiler->has_code = true; 
+        // turn off block code extraction
+        $compiler->template->extract_code = false; 
+        // check and get attributes
+        $this->optional_attributes = array('name');
+        $_attr = $this->_get_attributes($args);
+        $saved_data = $this->_close_tag(array('block')); 
+        // if name does match to opening tag
+        if (isset($_attr['name']) && $saved_data[0]['name'] != $_attr['name']) {
+            $this->compiler->trigger_template_error('mismatching name attributes "' . $saved_data[0]['name'] . '" and "' . $_attr['name'] . '"');
+        } 
+        $_name = trim($saved_data[0]['name'], "\"'");
+        if (isset($this->smarty->block_data[$_name])) {
+            $_tpl = $this->smarty->createTemplate('string:' . $this->smarty->block_data[$_name]['source'], null, null, $compiler->template);
+            $_tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
+            $_tpl->template_filepath = $this->smarty->block_data[$_name]['file'];
+            if ($compiler->nocache) {
+                $_tpl->forceNocache = 2;
+            } else {
+                $_tpl->forceNocache = 1;
+            } 
+            $_tpl->suppressHeader = true;
+            $_tpl->suppressFileDependency = true;
+            if (strpos($this->smarty->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {
+                $_output = str_replace('%%%%SMARTY_PARENT%%%%', $compiler->template->extracted_compiled_code, $_tpl->getCompiledTemplate());
+            } elseif ($this->smarty->block_data[$_name]['mode'] == 'prepend') {
+                $_output = $_tpl->getCompiledTemplate() . $compiler->template->extracted_compiled_code;
+            } elseif ($this->smarty->block_data[$_name]['mode'] == 'append') {
+                $_output = $compiler->template->extracted_compiled_code . $_tpl->getCompiledTemplate();
+            } elseif (!empty($this->smarty->block_data[$_name])) {
+                $_output = $_tpl->getCompiledTemplate();
+            } 
+            $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']);
+            $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $_tpl->properties['function']);
+            $compiler->template->required_plugins['compiled'] = array_merge($compiler->template->required_plugins['compiled'], $_tpl->required_plugins['compiled']);
+            $compiler->template->required_plugins['cache'] = array_merge($compiler->template->required_plugins['cache'], $_tpl->required_plugins['cache']);
+            unset($_tpl);
+        } else {
+            $_output = $compiler->template->extracted_compiled_code;
+        } 
+        $compiler->template->extracted_compiled_code = $saved_data[1];
+        $compiler->template->extract_code = $saved_data[2];
+        $compiler->nocache = $saved_data[3]; 
+        // $_output content has already nocache code processed
+        $compiler->suppressNocacheProcessing = true;
+        return $_output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_call.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_call.php
new file mode 100644 (file)
index 0000000..6fd8aa8
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Function_Call
+* 
+* Compiles the calls of user defined tags defined by {function}
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Function_Call Class
+*/
+class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles the calls of user defined tags defined by {function}
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('name');
+        $this->optional_attributes = array('_any'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        // save posible attributes
+        if (isset($_attr['assign'])) {
+            // output will be stored in a smarty variable instead of beind displayed
+            $_assign = $_attr['assign'];
+        } 
+        // set flag (compiled code of {function} must be included in cache file
+        if ($this->compiler->nocache || $this->compiler->tag_nocache) {
+            $nocache = 'true';
+        } else {
+            $nocache = 'false';
+        } 
+        // create template object
+        $_output = "<?php \$_template = new Smarty_Internal_Function_Call_Handler ({$_attr['name']}, \$_smarty_tpl->smarty, \$_smarty_tpl, {$nocache});\n"; 
+        // delete {include} standard attributes
+        unset($_attr['name'], $_attr['assign']); 
+        // remaining attributes must be assigned as smarty variable
+        if (!empty($_attr)) {
+            // create variables
+            foreach ($_attr as $_key => $_value) {
+                $_output .= "\$_template->assign('$_key',$_value);\n";
+            } 
+        } 
+        // was there an assign attribute
+        if (isset($_assign)) {
+            $_output .= "\$_smarty_tpl->assign({$_assign},\$_template->getRenderedTemplate());\n";
+        } else {
+            $_output .= "echo \$_template->getRenderedTemplate();\n";
+        } 
+        $_output .= 'unset($_template);?>';
+        return $_output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_capture.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_capture.php
new file mode 100644 (file)
index 0000000..752cb3a
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Capture
+* 
+* Compiles the {capture} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Capture Class
+*/
+class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {capture} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->optional_attributes = array('name', 'assign', 'append'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        $buffer = isset($_attr['name']) ? $_attr['name'] : "'default'";
+        $assign = isset($_attr['assign']) ? $_attr['assign'] : null;
+        $append = isset($_attr['append']) ? $_attr['append'] : null;
+
+        $this->compiler->_capture_stack[] = array($buffer, $assign, $append);
+
+        $_output = "<?php ob_start(); ?>";
+
+        return $_output;
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Captureclose Class
+*/
+class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/capture} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        list($buffer, $assign, $append) = array_pop($this->compiler->_capture_stack);
+
+        $_output = "<?php ";
+        if (isset($assign)) {
+            $_output .= " \$_smarty_tpl->assign($assign, ob_get_contents());";
+        } 
+        if (isset($append)) {
+            $_output .= " \$_smarty_tpl->append($append, ob_get_contents());";
+        } 
+        $_output .= " \$_smarty_tpl->smarty->_smarty_vars['capture'][$buffer]=ob_get_clean();?>";
+        return $_output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_config_load.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_config_load.php
new file mode 100644 (file)
index 0000000..0dd1ba8
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Config Load
+* 
+* Compiles the {config load} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Config Load Class
+*/
+class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {config_load} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('file');
+        $this->optional_attributes = array('section', 'scope'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        // save posible attributes
+        $conf_file = $_attr['file'];
+        if (isset($_attr['section'])) {
+            $section = $_attr['section'];
+        } else {
+            $section = 'null';
+        } 
+        $scope = '$_smarty_tpl->smarty';
+        if (isset($_attr['scope'])) {
+            if ($_attr['scope'] == '\'local\'') {
+                $scope = '$_smarty_tpl';
+            } elseif ($_attr['scope'] == '\'parent\'') {
+                $scope = '$_smarty_tpl->parent';
+            } 
+        } 
+
+        // create config object
+        $_output = "<?php  \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);";
+        $_output .= "\$_config->loadConfigVars($section, $scope); ?>";
+        return $_output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_debug.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_debug.php
new file mode 100644 (file)
index 0000000..8ff9671
--- /dev/null
@@ -0,0 +1,34 @@
+<?php 
+/**
+* Smarty Internal Plugin Compile Debug
+*
+* Compiles the {debug} tag 
+* It opens a window the the Smarty Debugging Console
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+/**
+* Smarty Internal Plugin Compile Debug Class
+*/ 
+class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {debug} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        // display debug template
+        $_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl->smarty); ?>";
+        return $_output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_eval.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_eval.php
new file mode 100644 (file)
index 0000000..6f17de7
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Eval
+*
+* Compiles the {eval} tag 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+/**
+* Smarty Internal Plugin Compile Eval Class
+*/ 
+class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {eval} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        $this->required_attributes = array('var');
+        $this->optional_attributes = array('assign'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        if (isset($_attr['assign'])) {
+              // output will be stored in a smarty variable instead of beind displayed
+            $_assign = $_attr['assign'];
+        }
+  
+        // create template object
+        $_output = "\$_template = new {$compiler->smarty->template_class}('string:'.".$_attr['var'].", \$_smarty_tpl->smarty, \$_smarty_tpl);"; 
+        //was there an assign attribute? 
+        if (isset($_assign)) {
+            $_output .= "\$_smarty_tpl->assign($_assign,\$_template->getRenderedTemplate());";
+        } else {
+            $_output .= "echo \$_template->getRenderedTemplate();";
+        } 
+        return "<?php $_output ?>";
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_extends.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_extends.php
new file mode 100644 (file)
index 0000000..cf4a187
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile extend
+* 
+* Compiles the {extends} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile extend Class
+*/
+class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {extends} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->smarty = $compiler->smarty;
+        $this->_rdl = preg_quote($this->smarty->right_delimiter);
+        $this->_ldl = preg_quote($this->smarty->left_delimiter);
+        $this->required_attributes = array('file'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+        $_smarty_tpl = $compiler->template; 
+        // $include_file = '';
+        eval('$include_file = ' . $_attr['file'] . ';'); 
+        // create template object
+        $_template = new $compiler->smarty->template_class($include_file, $this->smarty, $compiler->template); 
+        // save file dependency
+        $compiler->template->properties['file_dependency'][sha1($_template->getTemplateFilepath())] = array($_template->getTemplateFilepath(), $_template->getTemplateTimestamp());
+        $_old_source = $compiler->template->template_source;
+        if (preg_match_all("!({$this->_ldl}block(.+?){$this->_rdl})!", $_old_source, $s, PREG_OFFSET_CAPTURE) !=
+                preg_match_all("!({$this->_ldl}/block(.*?){$this->_rdl})!", $_old_source, $c, PREG_OFFSET_CAPTURE)) {
+            $this->compiler->trigger_template_error('unmatched {block} {/block} pairs');
+        } 
+        $block_count = count($s[0]);
+        for ($i = 0; $i < $block_count; $i++) {
+            $block_content = str_replace($this->smarty->left_delimiter . '$smarty.parent' . $this->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',
+                substr($_old_source, $s[0][$i][1] + strlen($s[0][$i][0]), $c[0][$i][1] - $s[0][$i][1] - strlen($s[0][$i][0])));
+            $this->saveBlockData($block_content, $s[0][$i][0], $compiler->template);
+        } 
+        $compiler->template->template_source = $_template->getTemplateSource();
+        $compiler->template->template_filepath = $_template->getTemplateFilepath();
+        $compiler->abort_and_recompile = true;
+        return ' ';
+    } 
+
+    protected function saveBlockData($block_content, $block_tag, $template)
+    {
+        if (0 == preg_match("!(.?)(name=)(.*?)(?=(\s|{$this->_rdl}))!", $block_tag, $_match)) {
+            $this->compiler->trigger_template_error("\"" . $block_tag . "\" missing name attribute");
+        } else {
+            $_name = trim($_match[3], '\'"');
+            if (isset($this->smarty->block_data[$_name])) {
+                if (strpos($this->smarty->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {
+                    $this->smarty->block_data[$_name]['source'] =
+                    str_replace('%%%%SMARTY_PARENT%%%%', $block_content, $this->smarty->block_data[$_name]['source']);
+                } elseif ($this->smarty->block_data[$_name]['mode'] == 'prepend') {
+                    $this->smarty->block_data[$_name]['source'] .= $block_content;
+                } elseif ($this->smarty->block_data[$_name]['mode'] == 'append') {
+                    $this->smarty->block_data[$_name]['source'] = $block_content . $this->smarty->block_data[$_name]['source'];
+                } 
+            } else {
+                $this->smarty->block_data[$_name]['source'] = $block_content;
+            } 
+            if (preg_match('/(.?)(append)(.*)/', $block_tag, $_match) != 0) {
+                $this->smarty->block_data[$_name]['mode'] = 'append';
+            } elseif (preg_match('/(.?)(prepend)(.*)/', $block_tag, $_match) != 0) {
+                $this->smarty->block_data[$_name]['mode'] = 'prepend';
+            } else {
+                $this->smarty->block_data[$_name]['mode'] = 'replace';
+            } 
+            $this->smarty->block_data[$_name]['file'] = $template->getTemplateFilepath();
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_for.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_for.php
new file mode 100644 (file)
index 0000000..7b9889e
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+/**
+* Smarty Internal Plugin Compile For
+* 
+* Compiles the {for} {forelse} {/for} tags
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile For Class
+*/
+class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {for} tag
+    * 
+    * Smarty 3 does implement two different sytaxes:
+    * 
+    * - {for $var in $array}
+    * For looping over arrays or iterators
+    * 
+    * - {for $x=0; $x<$y; $x++}
+    * For general loops
+    * 
+    * The parser is gereration different sets of attribute by which this compiler can 
+    * determin which syntax is used.
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // {for $x=0; $x<$y; $x++} syntax
+        if (isset($args['ifexp'])) {
+            $this->required_attributes = array('ifexp', 'start', 'loop', 'varloop');
+        } else {
+            $this->required_attributes = array('start', 'to');
+            $this->optional_attributes = array('step', 'max');
+        } 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        $this->_open_tag('for', array('for', $this->compiler->nocache)); 
+        // maybe nocache because of nocache variables
+        $this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
+
+        $output = "<?php ";
+        if (isset($_attr['ifexp'])) {
+            foreach ($_attr['start'] as $_statement) {
+                $output .= " \$_smarty_tpl->tpl_vars[$_statement[var]] = new Smarty_Variable;";
+                $output .= " \$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value];\n";
+            } 
+            $output .= "  if ($_attr[ifexp]){ for (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$_attr[varloop]]->value$_attr[loop]){\n";
+        } else {
+            $_statement = $_attr['start'];
+            $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]] = new Smarty_Variable;";
+            if (isset($_attr['step'])) {
+                $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->step = $_attr[step];";
+            } else {
+                $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->step = ($_attr[to] - ($_statement[value]) < 0) ? -1 : 1;";
+            } 
+            if (isset($_attr['max'])) {
+                $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int)min(ceil((\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - $_statement[value] : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$_statement[var]]->step)),$_attr[max]);\n";
+            } else {
+                $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int)ceil((\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - $_statement[value] : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$_statement[var]]->step));\n";
+            } 
+            $output .= "if (\$_smarty_tpl->tpl_vars[$_statement[var]]->total > 0){\n";
+            $output .= "for (\$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value], \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration = 1;\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration <= \$_smarty_tpl->tpl_vars[$_statement[var]]->total;\$_smarty_tpl->tpl_vars[$_statement[var]]->value += \$_smarty_tpl->tpl_vars[$_statement[var]]->step, \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration++){\n";
+            $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->first = \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration == 1;";
+            $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->last = \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration == \$_smarty_tpl->tpl_vars[$_statement[var]]->total;";
+        } 
+        $output .= "?>"; 
+        // return compiled code
+        return $output;
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Forelse Class
+*/
+class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {forelse} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        list($_open_tag, $nocache) = $this->_close_tag(array('for'));
+        $this->_open_tag('forelse', array('forelse', $nocache));
+        return "<?php }} else { ?>";
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Forclose Class
+*/
+class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/for} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        // must endblock be nocache?
+        if ($this->compiler->nocache) {
+            $this->compiler->tag_nocache = true;
+        } 
+
+        list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('for', 'forelse'));
+        if ($_open_tag == 'forelse')
+            return "<?php }  ?>";
+        else
+            return "<?php }} ?>";
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_foreach.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_foreach.php
new file mode 100644 (file)
index 0000000..09801fd
--- /dev/null
@@ -0,0 +1,192 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Foreach
+* 
+* Compiles the {foreach} {foreachelse} {/foreach} tags
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Foreach Class
+*/
+class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {foreach} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('from', 'item');
+        $this->optional_attributes = array('name', 'key');
+        $tpl = $compiler->template; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        $this->_open_tag('foreach', array('foreach',$this->compiler->nocache));
+               // maybe nocache because of nocache variables
+               $this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
+
+        $from = $_attr['from'];
+        $item = $_attr['item'];
+
+        if (isset($_attr['key'])) {
+            $key = $_attr['key'];
+        } else {
+            $key = null;
+        } 
+
+        if (isset($_attr['name'])) {
+            $name = $_attr['name'];
+            $has_name = true;
+            $SmartyVarName = '$smarty.foreach.' . trim($name,'\'"') . '.';
+        } else {
+            $name = null;
+            $has_name = false;
+        } 
+        $ItemVarName = '$' . trim($item,'\'"') . '@';
+        // evaluates which Smarty variables and properties have to be computed
+        if ($has_name) {
+            $usesSmartyFirst = strpos($tpl->template_source, $SmartyVarName . 'first') !== false;
+            $usesSmartyLast = strpos($tpl->template_source, $SmartyVarName . 'last') !== false;
+            $usesSmartyIndex = strpos($tpl->template_source, $SmartyVarName . 'index') !== false;
+            $usesSmartyIteration = strpos($tpl->template_source, $SmartyVarName . 'iteration') !== false;
+            $usesSmartyShow = strpos($tpl->template_source, $SmartyVarName . 'show') !== false;
+            $usesSmartyTotal = $usesSmartyLast || strpos($tpl->template_source, $SmartyVarName . 'total') !== false;
+        } else {
+            $usesSmartyFirst = false;
+            $usesSmartyLast = false;
+            $usesSmartyTotal = false;
+        }
+
+        $usesPropFirst = $usesSmartyFirst || strpos($tpl->template_source, $ItemVarName . 'first') !== false;
+        $usesPropLast = $usesSmartyLast || strpos($tpl->template_source, $ItemVarName . 'last') !== false;
+        $usesPropIndex = $usesPropFirst || strpos($tpl->template_source, $ItemVarName . 'index') !== false;
+        $usesPropIteration = $usesPropLast || strpos($tpl->template_source, $ItemVarName . 'iteration') !== false;
+        $usesPropShow = strpos($tpl->template_source, $ItemVarName . 'show') !== false;
+        $usesPropTotal = $usesSmartyTotal || $usesPropLast || strpos($tpl->template_source, $ItemVarName . 'total') !== false; 
+        // generate output code
+        $output = "<?php ";
+        $output .= " \$_smarty_tpl->tpl_vars[$item] = new Smarty_Variable;\n";
+        if ($key != null) {
+            $output .= " \$_smarty_tpl->tpl_vars[$key] = new Smarty_Variable;\n";
+        } 
+        $output .= " \$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array');}\n";
+        if ($usesPropTotal) {
+            $output .= " \$_smarty_tpl->tpl_vars[$item]->total=count(\$_from);\n";
+        } 
+        if ($usesPropIteration) {
+            $output .= " \$_smarty_tpl->tpl_vars[$item]->iteration=0;\n";
+        } 
+        if ($usesPropIndex) {
+            $output .= " \$_smarty_tpl->tpl_vars[$item]->index=-1;\n";
+        } 
+        if ($has_name) {
+            if ($usesSmartyTotal) {
+                $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['total'] = \$_smarty_tpl->tpl_vars[$item]->total;\n";
+            } 
+            if ($usesSmartyIteration) {
+                $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['iteration']=0;\n";
+            } 
+            if ($usesSmartyIndex) {
+                $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['index']=-1;\n";
+            } 
+        } 
+        $output .= "if (count(\$_from) > 0){\n";
+        $output .= "    foreach (\$_from as \$_smarty_tpl->tpl_vars[$item]->key => \$_smarty_tpl->tpl_vars[$item]->value){\n";
+        if ($key != null) {
+            $output .= " \$_smarty_tpl->tpl_vars[$key]->value = \$_smarty_tpl->tpl_vars[$item]->key;\n";
+        } 
+        if ($usesPropIteration) {
+            $output .= " \$_smarty_tpl->tpl_vars[$item]->iteration++;\n";
+        } 
+        if ($usesPropIndex) {
+            $output .= " \$_smarty_tpl->tpl_vars[$item]->index++;\n";
+        } 
+        if ($usesPropFirst) {
+            $output .= " \$_smarty_tpl->tpl_vars[$item]->first = \$_smarty_tpl->tpl_vars[$item]->index === 0;\n";
+        } 
+        if ($usesPropLast) {
+            $output .= " \$_smarty_tpl->tpl_vars[$item]->last = \$_smarty_tpl->tpl_vars[$item]->iteration === \$_smarty_tpl->tpl_vars[$item]->total;\n";
+        } 
+        if ($has_name) {
+            if ($usesSmartyFirst) {
+                $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['first'] = \$_smarty_tpl->tpl_vars[$item]->first;\n";
+            } 
+            if ($usesSmartyIteration) {
+                $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['iteration']++;\n";
+            } 
+            if ($usesSmartyIndex) {
+                $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['index']++;\n";
+            } 
+            if ($usesSmartyLast) {
+                $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['last'] = \$_smarty_tpl->tpl_vars[$item]->last;\n";
+            } 
+        } 
+        $output .= "?>";
+
+        return $output;
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Foreachelse Class
+*/ 
+class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {foreachelse} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        list($_open_tag, $nocache) = $this->_close_tag(array('foreach'));
+        $this->_open_tag('foreachelse',array('foreachelse', $nocache));
+
+        return "<?php }} else { ?>";
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Foreachclose Class
+*/ 
+class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/foreach} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+               // must endblock be nocache?
+               if ($this->compiler->nocache) {
+               $this->compiler->tag_nocache = true;
+        }
+
+        list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('foreach', 'foreachelse'));
+
+        if ($_open_tag == 'foreachelse')
+            return "<?php } ?>";
+        else
+            return "<?php }} ?>";
+    } 
+}
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_function.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_function.php
new file mode 100644 (file)
index 0000000..23fc27d
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Function
+* 
+* Compiles the {function} {/function} tags
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Function Class
+*/
+class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {function} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return boolean true
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('name');
+        $this->optional_attributes = array('_any'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+        $save = array($_attr, $compiler->template->extracted_compiled_code, $compiler->template->extract_code,
+            $compiler->template->has_nocache_code, $compiler->template->required_plugins);
+        $this->_open_tag('function', $save);
+        $_name = trim($_attr['name'], "'\"");
+        unset($_attr['name']);
+        foreach ($_attr as $_key => $_data) {
+            $compiler->template->properties['function'][$_name]['parameter'][$_key] = $_data;
+        } 
+        // make function known for recursive calls
+        $this->compiler->smarty->template_functions[$_name]['compiled'] = ''; 
+        // Init temporay context
+        $compiler->template->required_plugins = array('compiled' => array(), 'cache' => array());
+        $compiler->template->extract_code = true;
+        $compiler->template->extracted_compiled_code = '';
+        $compiler->template->has_nocache_code = false;
+        $compiler->has_code = false;
+        return true;
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Functionclose Class
+*/
+class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/function} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return boolean true
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->compiler->has_code = false;
+        $_attr = $this->_get_attributes($args);
+        $saved_data = $this->_close_tag(array('function'));
+        $_name = trim($saved_data[0]['name'], "'"); 
+        // build plugin include code
+        $plugins_string = '';
+        if (!empty($compiler->template->required_plugins['compiled'])) {
+            $plugins_string = '<?php ';
+            foreach($compiler->template->required_plugins['compiled'] as $plugin_name => $data) {
+                $plugin = 'smarty_' . $data['type'] . '_' . $plugin_name;
+                $plugins_string .= "if (!is_callable('{$plugin}')) include '{$data['file']}';\n";
+            } 
+            $plugins_string .= '?>';
+        } 
+        if (!empty($compiler->template->required_plugins['cache'])) {
+            $plugins_string .= "<?php echo '/*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/<?php ";
+            foreach($compiler->template->required_plugins['cache'] as $plugin_name => $data) {
+                $plugin = 'smarty_' . $data['type'] . '_' . $plugin_name;
+                $plugins_string .= "if (!is_callable(\'{$plugin}\')) include \'{$data['file']}\';\n";
+            } 
+            $plugins_string .= "?>/*/%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/';?>\n";
+        } 
+        $compiler->template->properties['function'][$_name]['compiled'] = $plugins_string . $compiler->template->extracted_compiled_code;
+        $compiler->template->properties['function'][$_name]['nocache_hash'] = $compiler->template->properties['nocache_hash'];
+        $compiler->template->properties['function'][$_name]['has_nocache_code'] = $compiler->template->has_nocache_code;
+//        $compiler->template->properties['function'][$_name]['plugins'] = $compiler->template->required_plugins;
+        $this->compiler->smarty->template_functions[$_name] = $compiler->template->properties['function'][$_name];
+        // restore old compiler status
+        $compiler->template->extracted_compiled_code = $saved_data[1];
+        $compiler->template->extract_code = $saved_data[2];
+        $compiler->template->has_nocache_code = $saved_data[3];
+        $compiler->template->required_plugins = $saved_data[4];
+        return true;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_if.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_if.php
new file mode 100644 (file)
index 0000000..9d05f42
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+/**
+* Smarty Internal Plugin Compile If
+* 
+* Compiles the {if} {else} {elseif} {/if} tags
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile If Class
+*/
+class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {if} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('if condition'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+        $this->_open_tag('if',array(1,$compiler->tag_nocache));
+        if (is_array($args['if condition'])) {
+            $_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."])) \$_smarty_tpl->tpl_vars[".$args['if condition']['var']."] = new Smarty_Variable;";
+            $_output .= "if (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value']."){?>";
+            return $_output;
+        } else {
+            return "<?php if ({$args['if condition']}){?>";
+        } 
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Else Class
+*/
+class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {else} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'elseif'));
+        $this->_open_tag('else',array($nesting,$compiler->tag_nocache));
+
+        return "<?php }else{ ?>";
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile ElseIf Class
+*/
+class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {elseif} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('if condition'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'elseif'));
+
+        if (empty($this->compiler->prefix_code)) {
+            $this->_open_tag('elseif', array($nesting, $compiler->tag_nocache));
+            return "<?php }elseif({$args['if condition']}){?>";
+        } else {
+            $tmp = '';
+            foreach ($this->compiler->prefix_code as $code) $tmp .= $code;
+            $this->compiler->prefix_code = array();
+            $this->_open_tag('elseif', array($nesting + 1, $compiler->tag_nocache));
+            return "<?php }else{?>{$tmp}<?php if ({$args['if condition']}){?>";
+        } 
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Ifclose Class
+*/
+class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/if} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        list($nesting, $compiler->tag_nocache) = $this->_close_tag(array('if', 'else', 'elseif'));
+        $tmp = '';
+        for ($i = 0; $i < $nesting ; $i++) $tmp .= '}';
+        return "<?php {$tmp}?>";
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_include.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_include.php
new file mode 100644 (file)
index 0000000..f82f038
--- /dev/null
@@ -0,0 +1,145 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Include
+* 
+* Compiles the {include} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Include Class
+*/
+class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {include} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('file');
+        $this->optional_attributes = array('_any'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        // save posible attributes
+        $include_file = $_attr['file'];
+        $has_compiled_template = false;
+        if ($compiler->smarty->merge_compiled_includes || isset($_attr['inline'])) {
+            // check if compiled code can be merged (contains no variable part)
+            if (!$compiler->has_variable_string && (substr_count($include_file, '"') == 2 or substr_count($include_file, "'") == 2) and substr_count($include_file, '(') == 0) {
+                eval("\$tmp = $include_file;");
+                if ($this->compiler->template->template_resource != $tmp) {
+                    $tpl = $compiler->smarty->createTemplate ($tmp, $compiler->template->cache_id, $compiler->template->compile_id, $compiler->template);
+                    if ($this->compiler->template->caching) {
+                        // needs code for cached page but no cache file
+                        $tpl->caching = 9999;
+                    } 
+                    if ($tpl->resource_object->usesCompiler && $tpl->isExisting()) {
+                        // make sure that template is up to date and merge template properties
+                        $tpl->renderTemplate(); 
+                        // compiled code for {function} tags
+                        $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $tpl->properties['function']);
+                        // get compiled code
+                        $compiled_tpl = $tpl->getCompiledTemplate(); 
+                        // remove header code
+                        $compiled_tpl = preg_replace("/(<\?php \/\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\*\/(.+?)\/\*\/%%SmartyHeaderCode%%\*\/\?>\n)/s", '', $compiled_tpl);
+                        if ($tpl->has_nocache_code) {
+                            // replace nocache_hash
+                            $compiled_tpl = preg_replace("/{$tpl->properties['nocache_hash']}/", $compiler->template->properties['nocache_hash'], $compiled_tpl);
+                            $compiler->template->has_nocache_code = true;
+                        } 
+                        $has_compiled_template = true;
+                    } 
+                } 
+            } 
+        } 
+
+        if (isset($_attr['assign'])) {
+            // output will be stored in a smarty variable instead of beind displayed
+            $_assign = $_attr['assign'];
+        } 
+
+        $_parent_scope = SMARTY_LOCAL_SCOPE;
+        if (isset($_attr['scope'])) {
+            if ($_attr['scope'] == '\'parent\'') {
+                $_parent_scope = SMARTY_PARENT_SCOPE;
+            } elseif ($_attr['scope'] == '\'root\'') {
+                $_parent_scope = SMARTY_ROOT_SCOPE;
+            } elseif ($_attr['scope'] == '\'global\'') {
+                $_parent_scope = SMARTY_GLOBAL_SCOPE;
+            } 
+        } 
+        $_caching = 'null'; 
+        // default for included templates
+        if ($this->compiler->template->caching && !$this->compiler->nocache) {
+            $_caching = 9999;
+        } 
+        /*
+        * if the {include} tag provides individual parameter for caching
+        * it will not be included into the common cache file and treated like
+        * a nocache section
+        */
+        if (isset($_attr['cache_lifetime'])) {
+            $_cache_lifetime = $_attr['cache_lifetime'];
+            $this->compiler->tag_nocache = true;
+            $_caching = SMARTY_CACHING_LIFETIME_CURRENT;
+        } else {
+            $_cache_lifetime = 'null';
+        } 
+        if (isset($_attr['nocache'])) {
+            if ($_attr['nocache'] == 'true') {
+                $this->compiler->tag_nocache = true;
+                $_caching = SMARTY_CACHING_OFF;
+            } 
+        } 
+        if (isset($_attr['caching'])) {
+            if ($_attr['caching'] == 'true') {
+                $_caching = SMARTY_CACHING_LIFETIME_CURRENT;
+            } else {
+                $this->compiler->tag_nocache = true;
+                $_caching = SMARTY_CACHING_OFF;
+            } 
+        } 
+        // create template object
+        $_output = "<?php \$_template = new {$compiler->smarty->template_class}($include_file, \$_smarty_tpl->smarty, \$_smarty_tpl, \$_smarty_tpl->cache_id, \$_smarty_tpl->compile_id, $_caching, $_cache_lifetime);\n"; 
+        // delete {include} standard attributes
+        unset($_attr['file'], $_attr['assign'], $_attr['cache_lifetime'], $_attr['nocache'], $_attr['caching'], $_attr['scope'], $_attr['inline']); 
+        // remaining attributes must be assigned as smarty variable
+        if (!empty($_attr)) {
+            if ($_parent_scope == SMARTY_LOCAL_SCOPE) {
+                // create variables
+                foreach ($_attr as $_key => $_value) {
+                    $_output .= "\$_template->assign('$_key',$_value);";
+                } 
+            } else {
+                $this->compiler->trigger_template_error('variable passing not allowed in parent/global scope');
+            } 
+        } 
+        // was there an assign attribute
+        if (isset($_assign)) {
+            $_output .= "\$_smarty_tpl->assign($_assign,\$_template->getRenderedTemplate());?>";
+        } else {
+            if ($has_compiled_template && !($compiler->template->caching && ($this->compiler->tag_nocache || $this->compiler->nocache))) {
+                $_output .= "\$_template->properties['nocache_hash']  = '{$compiler->template->properties['nocache_hash']}';\n";
+                $_output .= "\$_tpl_stack[] = \$_smarty_tpl; \$_smarty_tpl = \$_template;?>\n";
+                $_output .= $compiled_tpl;
+                $_output .= "<?php \$_smarty_tpl->updateParentVariables($_parent_scope);?>\n";
+                $_output .= "<?php /*  End of included template \"" . $tpl->getTemplateFilepath() . "\" */ ?>\n";
+                $_output .= "<?php \$_smarty_tpl = array_pop(\$_tpl_stack);?>";
+            } else {
+                $_output .= " echo \$_template->getRenderedTemplate();?>";
+                $_output .= "<?php \$_template->updateParentVariables($_parent_scope);?>";
+            } 
+        } 
+        $_output .= "<?php unset(\$_template);?>\n";
+        return $_output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_include_php.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_include_php.php
new file mode 100644 (file)
index 0000000..e71f978
--- /dev/null
@@ -0,0 +1,68 @@
+<?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
+*/
+class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {include_php} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('file');
+        $this->optional_attributes = array('once', 'assign'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        $_output = '<?php '; 
+
+        $_smarty_tpl = $compiler->template; 
+        eval('$_file = ' . $_attr['file'] . ';'); 
+        
+        $_file = realpath($_file);
+
+        if ($this->compiler->smarty->security) {
+            $this->compiler->smarty->security_handler->isTrustedPHPDir($_file);
+        } 
+
+        if ($_file === false) {
+            $this->compiler->trigger_template_error('include_php: file "' . $_attr['file'] . '" is not readable');
+        } 
+
+        if ($this->compiler->smarty->security) {
+            $this->compiler->smarty->security_handler->isTrustedPHPDir($_file);
+        } 
+        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(); include{$_once} ('{$_file}'); \$_smarty_tpl->assign({$_assign},ob_get_contents()); ob_end_clean();?>";
+        } else {
+            return "<?php include{$_once} ('{$_file}');?>\n";
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_insert.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_insert.php
new file mode 100644 (file)
index 0000000..189fe6d
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Insert
+* 
+* Compiles the {insert} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Insert Class
+*/
+class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {insert} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('name');
+        $this->optional_attributes = array('_any'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        // this tag must not be cached
+        $this->compiler->tag_nocache = true;
+        $_smarty_tpl = $compiler->template;
+
+        $_output = '<?php '; 
+        // save posible attributes
+        eval('$_name = ' . $_attr['name'] . ';');
+        $_function = "insert_{$_name}";
+        if (isset($_attr['assign'])) {
+            // output will be stored in a smarty variable instead of beind displayed
+            $_assign = $_attr['assign']; 
+            // create variable to make shure that the compiler knows about its nocache status
+            $this->compiler->template->tpl_vars[trim($_attr['assign'], "'")] = new Smarty_Variable(null, true);
+        } 
+        if (isset($_attr['script'])) {
+            // script which must be included
+            $_smarty_tpl = $compiler->template;
+            eval('$_script = ' . $_attr['script'] . ';');
+            if (!file_exists($_script)) {
+                $this->compiler->trigger_template_error("{insert} missing script file '{$_script}'");
+            } 
+            // code for script file loading
+            $_output .= "require_once {$_script} ;";
+            require_once $_script;
+            if (!is_callable($_function)) {
+                $this->compiler->trigger_template_error(" {insert} function '{$_name}' is not callable");
+            } 
+        } else {
+            if (!is_callable($_function)) {
+                if (!$_function = $this->compiler->getPlugin($_name, 'insert')) {
+                    $this->compiler->trigger_template_error("{insert} no function or plugin found for '{$_name}'");
+                } 
+            } 
+        } 
+        // delete {insert} standard attributes
+        unset($_attr['name'], $_attr['assign'], $_attr['script']); 
+        // convert attributes into parameter array string
+        $_paramsArray = array();
+        foreach ($_attr as $_key => $_value) {
+            $_paramsArray[] = "'$_key' => $_value";
+        } 
+        $_params = 'array(' . implode(", ", $_paramsArray) . ')'; 
+        // call insert
+        if (isset($_assign)) {
+            $_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl), true);?>";
+        } else {
+            $this->compiler->has_output = true;
+            $_output .= "echo {$_function}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl);?>";
+        } 
+        return $_output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_ldelim.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_ldelim.php
new file mode 100644 (file)
index 0000000..c809990
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Ldelim
+*
+* Compiles the {ldelim} tag 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+/**
+* Smarty Internal Plugin Compile Ldelim Class
+*/ 
+class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {ldelim} tag
+    *
+    * This tag does output the left delimiter 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        $_attr = $this->_get_attributes($args);
+        // this tag does not return compiled code
+        $this->compiler->has_code = true;
+        return $this->compiler->smarty->left_delimiter;
+    } 
+} 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_nocache.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_nocache.php
new file mode 100644 (file)
index 0000000..ebeef9d
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Nocache
+*
+* Compiles the {nocache} {/nocache} tags 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+/**
+* Smarty Internal Plugin Compile Nocache Class
+*/ 
+class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {nocache} tag
+    *
+    * This tag does not generate compiled output. It only sets a compiler flag 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        $_attr = $this->_get_attributes($args);
+        // enter nocache mode
+        $this->compiler->nocache = true;
+        // this tag does not return compiled code
+        $this->compiler->has_code = false;
+        return true;
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Nocacheclose Class
+*/ 
+class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/nocache} tag
+    *
+    * This tag does not generate compiled output. It only sets a compiler flag 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        $_attr = $this->_get_attributes($args);
+        // leave nocache mode
+        $this->compiler->nocache = false;
+        // this tag does not return compiled code
+        $this->compiler->has_code = false;
+        return true;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_block_plugin.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_block_plugin.php
new file mode 100644 (file)
index 0000000..030f3a2
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Block Plugin
+* 
+* Compiles code for the execution of block plugin
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Block Plugin Class
+*/
+class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the execution of block plugin
+    * 
+    * @param array $args array with attributes from parser
+    * @param string $tag name of block function
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler, $tag, $function)
+    {
+        $this->compiler = $compiler;
+        if (strlen($tag) < 6 || substr_compare($tag, 'close', -5, 5) != 0) {
+            // opening tag of block plugin
+            $this->required_attributes = array();
+            $this->optional_attributes = array('_any'); 
+            // check and get attributes
+            $_attr = $this->_get_attributes($args); 
+            // convert attributes into parameter array string
+            $_paramsArray = array();
+            foreach ($_attr as $_key => $_value) {
+                if (is_int($_key)) {
+                    $_paramsArray[] = "$_key=>$_value";
+                } else {
+                    $_paramsArray[] = "'$_key'=>$_value";
+                } 
+            } 
+            $_params = 'array(' . implode(",", $_paramsArray) . ')';
+
+            $this->_open_tag($tag, array($_params, $this->compiler->nocache)); 
+            // maybe nocache because of nocache variables or nocache plugin
+            $this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache; 
+            // compile code
+            if (is_array($function)) {
+                $output = '<?php $_block_repeat=true; call_user_func_array(array(\'' . $function[0] . '\',\'' . $function[1] . '\'),(array(' . $_params . ', null, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl));while ($_block_repeat) { ob_start();?>';
+            } else {
+                $output = '<?php $_block_repeat=true; ' . $function . '(' . $_params . ', null, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl);while ($_block_repeat) { ob_start();?>';
+            } 
+        } else {
+            // must endblock be nocache?
+            if ($this->compiler->nocache) {
+                $this->compiler->tag_nocache = true;
+            } 
+            // closing tag of block plugin, restore nocache
+            list($_params, $this->compiler->nocache) = $this->_close_tag(substr($tag, 0, -5)); 
+            // This tag does create output
+            $this->compiler->has_output = true; 
+            // compile code
+            if (is_array($function)) {
+            var_dump('error');
+                $output = '<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo call_user_func_array(array(\'' . $function[0] . '\',\'' . $function[1] . '\'),(array(' . $_params . ', $_block_content, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl)); }?>';
+            } else {
+                $output = '<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo ' . $function . '(' . $_params . ', $_block_content, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl); }?>';
+            } 
+        } 
+        return $output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_function_plugin.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_function_plugin.php
new file mode 100644 (file)
index 0000000..129b5d7
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Function Plugin
+* 
+* Compiles code for the execution of function plugin
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Function Plugin Class
+*/
+class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the execution of function plugin
+    * 
+    * @param array $args array with attributes from parser
+    * @param string $tag name of function
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler, $tag, $function)
+    {
+        $this->compiler = $compiler; 
+        // This tag does create output
+        $this->compiler->has_output = true;
+
+        $this->required_attributes = array();
+        $this->optional_attributes = array('_any'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        // convert attributes into parameter array string
+        $_paramsArray = array();
+        foreach ($_attr as $_key => $_value) {
+            if (is_int($_key)) {
+                $_paramsArray[] = "$_key=>$_value";
+            } else {
+                $_paramsArray[] = "'$_key'=>$_value";
+            } 
+        } 
+        $_params = 'array(' . implode(",", $_paramsArray) . ')'; 
+        // compile code
+        if (is_array($function)) {
+            $output = '<?php echo call_user_func_array(array(\'' . $function[0] . '\',\'' . $function[1] . '\'),(array(' . $_params . ',$_smarty_tpl->smarty,$_smarty_tpl));?>';
+        } else {
+            $output = '<?php echo ' . $function . '(' . $_params . ',$_smarty_tpl->smarty,$_smarty_tpl);?>';
+        } 
+        return $output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_modifier.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_modifier.php
new file mode 100644 (file)
index 0000000..c4fbfa5
--- /dev/null
@@ -0,0 +1,59 @@
+<?php\r
+/**\r
+* Smarty Internal Plugin Compile Modifier\r
+* \r
+* Compiles code for modifier execution\r
+* \r
+* @package Smarty\r
+* @subpackage Compiler\r
+* @author Uwe Tews \r
+*/\r
+/**\r
+* Smarty Internal Plugin Compile Modifier Class\r
+*/\r
+class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase {\r
+    /**\r
+    * Compiles code for modifier execution\r
+    * \r
+    * @param array $args array with attributes from parser\r
+    * @param object $compiler compiler object\r
+    * @return string compiled code\r
+    */\r
+    public function compile($args, $compiler)\r
+    {\r
+        $this->compiler = $compiler;\r
+        $this->smarty = $this->compiler->smarty;\r
+        $this->required_attributes = array('modifier', 'params'); \r
+        // check and get attributes\r
+        $_attr = $this->_get_attributes($args); \r
+        // check for registered modifier\r
+        if (isset($compiler->smarty->registered_plugins['modifier'][$_attr['modifier']])) {\r
+            $function = $compiler->smarty->registered_plugins['modifier'][$_attr['modifier']][0];\r
+            if (!is_array($function)) {\r
+                $output = "{$function}({$_attr['params']})";\r
+            } else if (is_object($function[0])) {\r
+                $output = 'call_user_func_array($_smarty_tpl->smarty->registered_plugins[\'modifier\'][\'' . $_attr['modifier'] . '\'][0],array(' . $_attr['params'] . '))';\r
+            } else {\r
+                $output = 'call_user_func_array(array(\'' . $function[0] . '\',\'' . $function[1] . '\'),array(' . $_attr['params'] . '))';\r
+            } \r
+        // check for plugin modifier\r
+        } else if ($function = $this->compiler->getPlugin($_attr['modifier'], 'modifier')) {\r
+            if (!is_array($function)) {\r
+                $output = "{$function}({$_attr['params']})";\r
+            } else {\r
+                $output = 'call_user_func_array(array(\'' . $function[0] . '\',\'' . $function[1] . '\'),array(' . $_attr['params'] . '))';\r
+            } \r
+            // check if trusted PHP function\r
+        } else if (is_callable($_attr['modifier'])) {\r
+            // check if modifier allowed\r
+            if (!$this->compiler->template->security || $this->smarty->security_handler->isTrustedModifier($_attr['modifier'], $this->compiler)) {\r
+                $output = "{$_attr['modifier']}({$_attr['params']})";\r
+            } \r
+        } else {\r
+            $this->compiler->trigger_template_error ("unknown modifier \"" . $_attr['modifier'] . "\"");\r
+        } \r
+        return $output;\r
+    } \r
+} \r
+\r
+?>\r
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_object_block_function.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_object_block_function.php
new file mode 100644 (file)
index 0000000..03c2d34
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Object Block Function
+* 
+* Compiles code for registered objects as block function
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Object Block Function Class
+*/
+class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the execution of block plugin
+    * 
+    * @param array $args array with attributes from parser
+    * @param string $tag name of block function
+    * @param string $methode name of methode to call
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler, $tag, $methode)
+    {
+        $this->compiler = $compiler;
+        if (strlen($tag) < 5 || substr_compare($tag, 'close', -5, 5) != 0) {
+            // opening tag of block plugin
+            $this->required_attributes = array();
+            $this->optional_attributes = array('_any'); 
+            // check and get attributes
+            $_attr = $this->_get_attributes($args); 
+            // convert attributes into parameter array string
+            $_paramsArray = array();
+            foreach ($_attr as $_key => $_value) {
+                if (is_int($_key)) {
+                    $_paramsArray[] = "$_key=>$_value";
+                } else {
+                    $_paramsArray[] = "'$_key'=>$_value";
+                } 
+            } 
+            $_params = 'array(' . implode(",", $_paramsArray) . ')';
+
+            $this->_open_tag($tag . '->' . $methode, $_params); 
+            // compile code
+            $output = '<?php $_block_repeat=true; $_smarty_tpl->smarty->registered_objects[\'' . $tag . '\'][0]->' . $methode . '(' . $_params . ', null, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl);while ($_block_repeat) { ob_start();?>';
+        } else {
+            // closing tag of block plugin
+            $_params = $this->_close_tag(substr($tag, 0, -5) . '->' . $methode); 
+            // This tag does create output
+            $this->compiler->has_output = true; 
+            // compile code
+            $output = '<?php $_block_content = ob_get_contents(); ob_end_clean(); $_block_repeat=false; echo $_smarty_tpl->smarty->registered_objects[\'' . substr($tag, 0, -5) . '\'][0]->' . $methode . '(' . $_params . ', $_block_content, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl); }?>';
+        } 
+        return $output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_object_function.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_object_function.php
new file mode 100644 (file)
index 0000000..573f604
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Object Funtion
+* 
+* Compiles code for registered objects as function
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Object Function Class
+*/
+class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the execution of function plugin
+    * 
+    * @param array $args array with attributes from parser
+    * @param string $tag name of function
+    * @param string $methode name of methode to call
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler, $tag, $methode)
+    {
+        $this->compiler = $compiler; 
+        // This tag does create output
+        $this->compiler->has_output = true;
+
+        $this->required_attributes = array();
+        $this->optional_attributes = array('_any'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args); 
+        // convert attributes into parameter array string
+        if ($this->compiler->smarty->registered_objects[$tag][2]) {
+            $_paramsArray = array();
+            foreach ($_attr as $_key => $_value) {
+                if (is_int($_key)) {
+                    $_paramsArray[] = "$_key=>$_value";
+                } else {
+                    $_paramsArray[] = "'$_key'=>$_value";
+                } 
+            } 
+            $_params = 'array(' . implode(",", $_paramsArray) . ')';
+            $output = "<?php echo \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$methode}({$_params},\$_smarty_tpl->smarty,\$_smarty_tpl);?>";
+        } else {
+            $_params = implode(",", $_attr);
+            $output = "<?php echo \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$methode}({$_params});?>";
+        } 
+        return $output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_print_expression.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_print_expression.php
new file mode 100644 (file)
index 0000000..7cfe473
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Print Expression
+* 
+* Compiles any tag which will output an expression or variable
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Print Expression Class
+*/
+class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for gererting output from any expression
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('value');
+        $this->optional_attributes = array('assign', 'nocache', 'filter', 'nofilter'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        if (isset($_attr['nocache'])) {
+            if ($_attr['nocache'] == 'true') {
+                $this->compiler->tag_nocache = true;
+            } 
+        } 
+
+        if (!isset($_attr['filter'])) {
+            $_attr['filter'] = 'null';
+        } 
+        if (isset($_attr['nofilter'])) {
+            if ($_attr['nofilter'] == 'true') {
+                $_attr['filter'] = 'false';
+            } 
+        } 
+
+        if (isset($_attr['assign'])) {
+            // assign output to variable
+            $output = '<?php $_smarty_tpl->assign(' . $_attr['assign'] . ',' . $_attr['value'] . ');?>';
+        } else {
+            // display value
+            $this->compiler->has_output = true;
+            if (isset($this->compiler->smarty->registered_filters['variable'])) {
+                $output = '<?php echo Smarty_Internal_Filter_Handler::runFilter(\'variable\', ' . $_attr['value'] . ',$this->smarty, ' . $_attr['filter'] . ');?>';
+            } else {
+                $output = '<?php echo ' . $_attr['value'] . ';?>';
+            } 
+        } 
+        return $output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_registered_block.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_registered_block.php
new file mode 100644 (file)
index 0000000..218ec0e
--- /dev/null
@@ -0,0 +1,79 @@
+<?php\r
+/**\r
+* Smarty Internal Plugin Compile Registered Block\r
+* \r
+* Compiles code for the execution of a registered block function\r
+* \r
+* @package Smarty\r
+* @subpackage Compiler\r
+* @author Uwe Tews \r
+*/\r
+/**\r
+* Smarty Internal Plugin Compile Registered Block Class\r
+*/\r
+class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase {\r
+    /**\r
+    * Compiles code for the execution of a block function\r
+    * \r
+    * @param array $args array with attributes from parser\r
+    * @param string $tag name of block function\r
+    * @param object $compiler compiler object\r
+    * @return string compiled code\r
+    */\r
+    public function compile($args, $compiler, $tag)\r
+    {\r
+        $this->compiler = $compiler;\r
+        if (strlen($tag) < 6 || substr_compare($tag, 'close', -5, 5) != 0) {\r
+            // opening tag of block plugin\r
+            $this->required_attributes = array();\r
+            $this->optional_attributes = array('_any'); \r
+            // check and get attributes\r
+            $_attr = $this->_get_attributes($args); \r
+            // convert attributes into parameter array string\r
+            $_paramsArray = array();\r
+            foreach ($_attr as $_key => $_value) {\r
+                if (is_int($_key)) {\r
+                    $_paramsArray[] = "$_key=>$_value";\r
+                } else {\r
+                    $_paramsArray[] = "'$_key'=>$_value";\r
+                } \r
+            } \r
+            $_params = 'array(' . implode(",", $_paramsArray) . ')';\r
+\r
+            $this->_open_tag($tag, array($_params, $this->compiler->nocache)); \r
+            // maybe nocache because of nocache variables or nocache plugin\r
+            $this->compiler->nocache = !$compiler->smarty->registered_plugins['block'][$tag][1] | $this->compiler->nocache | $this->compiler->tag_nocache;\r
+            $function = $compiler->smarty->registered_plugins['block'][$tag][0]; \r
+            // compile code\r
+            if (!is_array($function)) {\r
+                $output = '<?php $_block_repeat=true; ' . $function . '(' . $_params . ', null, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl);while ($_block_repeat) { ob_start();?>';\r
+            } else if (is_object($function[0])) {\r
+                $output = '<?php $_block_repeat=true; call_user_func_array($_smarty_tpl->smarty->registered_plugins[\'block\'][\'' . $tag . '\'][0],array(' . $_params . ', null, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl));while ($_block_repeat) { ob_start();?>';\r
+            } else {\r
+                $output = '<?php $_block_repeat=true; call_user_func_array(array(\'' . $function[0] . '\',\'' . $function[1] . '\'),array(' . $_params . ', null, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl));while ($_block_repeat) { ob_start();?>';\r
+            } \r
+        } else {\r
+            // must endblock be nocache?\r
+            if ($this->compiler->nocache) {\r
+                $this->compiler->tag_nocache = true;\r
+            } \r
+            $base_tag = substr($tag, 0, -5); \r
+            // closing tag of block plugin, restore nocache\r
+            list($_params, $this->compiler->nocache) = $this->_close_tag($base_tag); \r
+            // This tag does create output\r
+            $this->compiler->has_output = true;\r
+            $function = $compiler->smarty->registered_plugins['block'][$base_tag][0]; \r
+            // compile code\r
+            if (!is_array($function)) {\r
+                $output = '<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo ' . $function . '(' . $_params . ', $_block_content, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl); }?>';\r
+            } else if (is_object($function[0])) {\r
+                $output = '<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo call_user_func_array($_smarty_tpl->smarty->registered_plugins[\'block\'][\'' . $base_tag . '\'][0],array(' . $_params . ', $_block_content, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl)); }?>';\r
+            } else {\r
+                $output = '<?php $_block_content = ob_get_clean(); $_block_repeat=false; echo call_user_func_array(array(\'' . $function[0] . '\',\'' . $function[1] . '\'),array(' . $_params . ', $_block_content, $_smarty_tpl->smarty, $_block_repeat, $_smarty_tpl)); }?>';\r
+            } \r
+        } \r
+        return $output;\r
+    } \r
+} \r
+\r
+?>\r
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_registered_function.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_registered_function.php
new file mode 100644 (file)
index 0000000..e38ee4b
--- /dev/null
@@ -0,0 +1,51 @@
+<?php\r
+/**\r
+* Smarty Internal Plugin Compile Registered Function\r
+* \r
+* Compiles code for the execution of a registered function\r
+* \r
+* @package Smarty\r
+* @subpackage Compiler\r
+* @author Uwe Tews \r
+*/\r
+/**\r
+* Smarty Internal Plugin Compile Registered Function Class\r
+*/\r
+class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase {\r
+    /**\r
+    * Compiles code for the execution of a registered function\r
+    * \r
+    * @param array $args array with attributes from parser\r
+    * @param string $tag name of function\r
+    * @param object $compiler compiler object\r
+    * @return string compiled code\r
+    */\r
+    public function compile($args, $compiler, $tag)\r
+    {\r
+        $this->compiler = $compiler; \r
+        // This tag does create output\r
+        $this->compiler->has_output = true;\r
+\r
+        $this->required_attributes = array();\r
+        $this->optional_attributes = array('_any'); \r
+        // check and get attributes\r
+        $_attr = $this->_get_attributes($args); \r
+        // not cachable?\r
+        $this->compiler->tag_nocache = !$compiler->smarty->registered_plugins['function'][$tag][1]; \r
+        // convert attributes into parameter array string\r
+        $_paramsArray = array();\r
+        foreach ($_attr as $_key => $_value) {\r
+            if (is_int($_key)) {\r
+                $_paramsArray[] = "$_key=>$_value";\r
+            } else {\r
+                $_paramsArray[] = "'$_key'=>$_value";\r
+            } \r
+        } \r
+        $_params = 'array(' . implode(",", $_paramsArray) . ')'; \r
+        // compile code\r
+        $output = '<?php echo call_user_func_array($_smarty_tpl->smarty->registered_plugins[\'function\'][\'' . $tag . '\'][0],array(' . $_params . ',$_smarty_tpl->smarty,$_smarty_tpl));?>';\r
+        return $output;\r
+    } \r
+} \r
+\r
+?>\r
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_special_variable.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_private_special_variable.php
new file mode 100644 (file)
index 0000000..1f473bc
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Special Smarty Variable
+* 
+* Compiles the special $smarty variables
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile special Smarty Variable Class
+*/
+class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the speical $smarty variables
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $_index = explode(',', str_replace(array(']['), array(','), substr($args, 1, strlen($args)-2)));
+        $compiled_ref = ' ';
+        $variable = trim($_index[0], "'");
+        switch ($variable) {
+            case 'foreach':
+                return "\$_smarty_tpl->getVariable('smarty')->value$args";
+            case 'section':
+                return "\$_smarty_tpl->getVariable('smarty')->value$args";
+            case 'capture':
+                return "\$_smarty_tpl->smarty->_smarty_vars$args";
+            case 'now':
+                return 'time()';
+            case 'cookies':
+                if ($compiler->smarty->security && !$compiler->smarty->security_policy->allow_super_globals) {
+                    $compiler->trigger_template_error("(secure mode) super globals not permitted");
+                    break;
+                } 
+                $compiled_ref = '$_COOKIE';
+                break;
+
+            case 'get':
+            case 'post':
+            case 'env':
+            case 'server':
+            case 'session':
+            case 'request':
+                if ($compiler->smarty->security && !$compiler->smarty->security_policy->allow_super_globals) {
+                    $compiler->trigger_template_error("(secure mode) super globals not permitted");
+                    break;
+                } 
+                $compiled_ref = '$_'.strtoupper($variable);
+                break;
+
+            case 'template':
+                $_template_name = basename($compiler->template->getTemplateFilepath());
+                return "'$_template_name'";
+
+            case 'current_dir':
+                $_template_dir_name = dirname($compiler->template->getTemplateFilepath());
+                return "'$_template_dir_name'";
+
+            case 'version':
+                $_version = Smarty::SMARTY_VERSION;
+                return "'$_version'";
+
+            case 'const':
+                if ($compiler->smarty->security && !$compiler->smarty->security_policy->allow_constants) {
+                    $compiler->trigger_template_error("(secure mode) constants not permitted");
+                    break;
+                } 
+                return '@' . trim($_index[1], "'");
+
+            case 'config':
+                return "\$_smarty_tpl->getConfigVariable($_index[1])";
+            case 'ldelim':
+                $_ldelim = $compiler->smarty->left_delimiter;
+                return "'$_ldelim'";
+
+            case 'rdelim':
+                $_rdelim = $compiler->smarty->right_delimiter;
+                return "'$_rdelim'";
+
+            default:
+                $compiler->trigger_template_error('$smarty.' . trim($_index[0], "'") . ' is invalid');
+                break;
+        } 
+        if (isset($_index[1])) {
+            array_shift($_index);
+            foreach ($_index as $_ind) {
+                $compiled_ref = $compiled_ref . "[$_ind]";
+            } 
+        } 
+        return $compiled_ref;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_rdelim.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_rdelim.php
new file mode 100644 (file)
index 0000000..88c4e1e
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+/**
+* Smarty Internal Plugin Compile Rdelim
+*
+* Compiles the {rdelim} tag 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+/**
+* Smarty Internal Plugin Compile Rdelim Class
+*/ 
+class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {rdelim} tag
+    *
+    * This tag does output the right delimiter 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        $_attr = $this->_get_attributes($args);
+        // this tag does not return compiled code
+        $this->compiler->has_code = true;
+        return $this->compiler->smarty->right_delimiter;
+    } 
+} 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_section.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_section.php
new file mode 100644 (file)
index 0000000..0de506a
--- /dev/null
@@ -0,0 +1,170 @@
+<?php
+/**
+* Smarty Internal Plugin Compile Section
+* 
+* Compiles the {section} {sectionelse} {/section} tags
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile Section Class
+*/
+class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {section} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('name', 'loop');
+        $this->optional_attributes = array('start', 'step', 'max', 'show'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        $this->_open_tag('section', array('section',$this->compiler->nocache));
+               // maybe nocache because of nocache variables
+               $this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
+
+        $output = "<?php ";
+
+        $section_name = $_attr['name'];
+        
+        $output .= "unset(\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]);\n";
+        $section_props = "\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]";
+
+        foreach ($_attr as $attr_name => $attr_value) {
+            switch ($attr_name) {
+                case 'loop':
+                    $output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int)\$_loop); unset(\$_loop);\n";
+                    break;
+
+                case 'show':
+                    if (is_bool($attr_value))
+                        $show_attr_value = $attr_value ? 'true' : 'false';
+                    else
+                        $show_attr_value = "(bool)$attr_value";
+                    $output .= "{$section_props}['show'] = $show_attr_value;\n";
+                    break;
+
+                case 'name':
+                    $output .= "{$section_props}['$attr_name'] = $attr_value;\n";
+                    break;
+
+                case 'max':
+                case 'start':
+                    $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n";
+                    break;
+
+                case 'step':
+                    $output .= "{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\n";
+                    break;
+            } 
+        } 
+
+        if (!isset($_attr['show']))
+            $output .= "{$section_props}['show'] = true;\n";
+
+        if (!isset($_attr['loop']))
+            $output .= "{$section_props}['loop'] = 1;\n";
+
+        if (!isset($_attr['max']))
+            $output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
+        else
+            $output .= "if ({$section_props}['max'] < 0)\n" . "    {$section_props}['max'] = {$section_props}['loop'];\n";
+
+        if (!isset($_attr['step']))
+            $output .= "{$section_props}['step'] = 1;\n";
+
+        if (!isset($_attr['start']))
+            $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
+        else {
+            $output .= "if ({$section_props}['start'] < 0)\n" . "    {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . "else\n" . "    {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n";
+        } 
+
+        $output .= "if ({$section_props}['show']) {\n";
+        if (!isset($_attr['start']) && !isset($_attr['step']) && !isset($_attr['max'])) {
+            $output .= "    {$section_props}['total'] = {$section_props}['loop'];\n";
+        } else {
+            $output .= "    {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n";
+        } 
+        $output .= "    if ({$section_props}['total'] == 0)\n" . "        {$section_props}['show'] = false;\n" . "} else\n" . "    {$section_props}['total'] = 0;\n";
+
+        $output .= "if ({$section_props}['show']):\n";
+        $output .= "
+            for ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1;
+                 {$section_props}['iteration'] <= {$section_props}['total'];
+                 {$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\n";
+        $output .= "{$section_props}['rownum'] = {$section_props}['iteration'];\n";
+        $output .= "{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\n";
+        $output .= "{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\n";
+        $output .= "{$section_props}['first']      = ({$section_props}['iteration'] == 1);\n";
+        $output .= "{$section_props}['last']       = ({$section_props}['iteration'] == {$section_props}['total']);\n";
+
+        $output .= "?>";
+        return $output;
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Sectionelse Class
+*/
+class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {sectionelse} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+        list($_open_tag, $nocache) = $this->_close_tag(array('section'));
+        $this->_open_tag('sectionelse',array('sectionelse', $nocache));
+
+        return "<?php endfor; else: ?>";
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Sectionclose Class
+*/
+class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/section} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+
+               // must endblock be nocache?
+               if ($this->compiler->nocache) {
+                 $this->compiler->tag_nocache = true;
+        }
+
+        list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('section', 'sectionelse'));
+
+        if ($_open_tag == 'sectionelse')
+            return "<?php endif; ?>";
+        else
+            return "<?php endfor; endif; ?>";
+    } 
+} 
+
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compile_while.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compile_while.php
new file mode 100644 (file)
index 0000000..6dc1804
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/**
+* Smarty Internal Plugin Compile While
+* 
+* Compiles the {while} tag
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Compile While Class
+*/
+class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {while} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler;
+        $this->required_attributes = array('if condition'); 
+        // check and get attributes
+        $_attr = $this->_get_attributes($args);
+        $this->_open_tag('while', $this->compiler->nocache);
+
+        // maybe nocache because of nocache variables
+               $this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
+
+               
+        if (is_array($args['if condition'])) {
+            $_output = " <?php if (!isset(\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."])) \$_smarty_tpl->tpl_vars[".$args['if condition']['var']."] = new Smarty_Variable;\n";
+            $_output .= " while (\$_smarty_tpl->tpl_vars[".$args['if condition']['var']."]->value = ".$args['if condition']['value'].") {\n ?>";
+            return $_output;
+        } else {
+            return '<?php while (' . $args['if condition'] . ') { ?>';
+        } 
+    } 
+} 
+
+/**
+* Smarty Internal Plugin Compile Whileclose Class
+*/
+class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase {
+    /**
+    * Compiles code for the {/while} tag
+    * 
+    * @param array $args array with attributes from parser
+    * @param object $compiler compiler object
+    * @return string compiled code
+    */
+    public function compile($args, $compiler)
+    {
+        $this->compiler = $compiler; 
+               // must endblock be nocache?
+               if ($this->compiler->nocache) {
+                 $this->compiler->tag_nocache = true;
+        }
+        $this->compiler->nocache = $this->_close_tag(array('while'));
+        return "<?php }?>";
+    } 
+} 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_compilebase.php b/gosa-core/include/smarty/sysplugins/smarty_internal_compilebase.php
new file mode 100644 (file)
index 0000000..7a398f5
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+
+/**
+* Smarty Internal Plugin CompileBase
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+
+/**
+* This class does extend all internal compile plugins
+*/
+//abstract class Smarty_Internal_CompileBase implements TagCompilerInterface 
+abstract class Smarty_Internal_CompileBase 
+{
+    function __construct()
+    {
+        // initialize valid attributes
+        $this->required_attributes = array();
+        $this->optional_attributes = array();
+    } 
+
+    /**
+    * This function checks if the attributes passed are valid
+    * 
+    * The attributes passed for the tag to compile are checked against the list of required and 
+    * optional attributes. Required attributes must be present. Optional attributes are check against
+    * against the corresponding list. The keyword '_any' specifies that any attribute will be accepted 
+    * as valid
+    * 
+    * @todo More generallized handling of the nocache attributes in compile plugins
+    * @param array $args attributes applied to the tag
+    * @return array attributes for further processing
+    */
+    function _get_attributes ($args)
+    { 
+        // check if all required attributes present
+        foreach ($this->required_attributes as $attr) {
+            if (!array_key_exists($attr, $args)) {
+                $this->compiler->trigger_template_error("missing \"" . $attr . "\" attribute");
+            } 
+        } 
+        // check for unallowed attributes
+        if ($this->optional_attributes != array('_any')) {
+            $tmp_array = array_merge($this->required_attributes, $this->optional_attributes);
+            foreach ($args as $key => $dummy) {
+                 if (!in_array($key, $tmp_array) && $key !== 0) {
+                   $this->compiler->trigger_template_error("unexpected \"" . $key . "\" attribute");
+                } 
+            } 
+        } 
+
+        return $args;
+    } 
+
+    /**
+    * Push opening tag name on stack
+    * 
+    * Optionally additional data can be saved on stack
+    * 
+    * @param string $open_tag the opening tag's name
+    * @param anytype $data optional data which shall be saved on stack
+    */
+    function _open_tag($open_tag, $data = null)
+    {
+        array_push($this->compiler->_tag_stack, array($open_tag, $data));
+    } 
+
+    /**
+    * Pop closing tag
+    * 
+    * Raise an error if this stack-top doesn't match with expected opening tags
+    * 
+    * @param array $ |string $expected_tag the expected opening tag names
+    * @return anytype the opening tag's name or saved data
+    */
+    function _close_tag($expected_tag)
+    {
+        if (count($this->compiler->_tag_stack) > 0) {
+            // get stacked info
+            list($_open_tag, $_data) = array_pop($this->compiler->_tag_stack); 
+            // open tag must match with the expected ones
+            if (in_array($_open_tag, (array)$expected_tag)) {
+                if (is_null($_data)) {
+                    // return opening tag
+                    return $_open_tag;
+                } else {
+                    // return restored data
+                    return $_data;
+                } 
+            } 
+            // wrong nesting of tags
+            $this->compiler->trigger_template_error("unclosed {" . $_open_tag . "} tag");
+            return;
+        } 
+        // wrong nesting of tags
+        $this->compiler->trigger_template_error("unexpected closing tag");
+        return;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_config.php b/gosa-core/include/smarty/sysplugins/smarty_internal_config.php
new file mode 100644 (file)
index 0000000..31b4108
--- /dev/null
@@ -0,0 +1,260 @@
+<?php
+/**
+* Smarty Internal Plugin Config
+* 
+* Main class for config variables
+* 
+* @ignore 
+* @package Smarty
+* @subpackage Config
+* @author Uwe Tews 
+*/
+class Smarty_Internal_Config {
+    static $config_objects = array();
+
+    public function __construct($config_resource, $smarty, $template = null)
+    {
+        $this->template = $template;
+        $this->smarty = $smarty;
+        $this->config_resource = $config_resource;
+        $this->config_resource_type = null;
+        $this->config_resource_name = null;
+        $this->config_filepath = null;
+        $this->config_timestamp = null;
+        $this->config_source = null;
+        $this->compiled_config = null;
+        $this->compiled_filepath = null;
+        $this->compiled_timestamp = null;
+        $this->mustCompile = null;
+        $this->compiler_object = null; 
+        // parse config resource name
+        if (!$this->parseConfigResourceName ($config_resource)) {
+            throw new Exception ("Unable to parse config resource '{$config_resource}'");
+        } 
+    } 
+
+    public function getConfigFilepath ()
+    {
+        return $this->config_filepath === null ?
+        $this->config_filepath = $this->buildConfigFilepath() :
+        $this->config_filepath;
+    } 
+
+    public function getTimestamp ()
+    {
+        return $this->config_timestamp === null ?
+        $this->config_timestamp = filemtime($this->getConfigFilepath()) :
+        $this->config_timestamp;
+    } 
+
+    private function parseConfigResourceName($config_resource)
+    {
+        if (empty($config_resource))
+            return false;
+        if (strpos($config_resource, ':') === false) {
+            // no resource given, use default
+            $this->config_resource_type = $this->smarty->default_config_type;
+            $this->config_resource_name = $config_resource;
+        } else {
+            // get type and name from path
+            list($this->config_resource_type, $this->config_resource_name) = explode(':', $config_resource, 2);
+            if (strlen($this->config_resource_type) == 1) {
+                // 1 char is not resource type, but part of filepath
+                $this->config_resource_type = $this->smarty->default_config_type;
+                $this->config_resource_name = $config_resource;
+            } else {
+                $this->config_resource_type = strtolower($this->config_resource_type);
+            } 
+        } 
+        return true;
+    } 
+
+    /*
+     * get system filepath to config
+     */
+    public function buildConfigFilepath ()
+    {
+        foreach((array)$this->smarty->config_dir as $_config_dir) {
+            if (strpos('/\\', substr($_config_dir, -1)) === false) {
+                $_config_dir .= DS;
+            } 
+
+            $_filepath = $_config_dir . $this->config_resource_name;
+            if (file_exists($_filepath))
+                return $_filepath;
+        } 
+        // check for absolute path
+        if (file_exists($this->config_resource_name))
+            return $this->config_resource_name;
+        // no tpl file found
+        throw new Exception("Unable to load config file \"{$this->config_resource_name}\"");
+        return false;
+    } 
+    /**
+    * Read config file source
+    * 
+    * @return string content of source file
+    */
+    /**
+    * Returns the template source code
+    * 
+    * The template source is being read by the actual resource handler
+    * 
+    * @return string the template source
+    */
+    public function getConfigSource ()
+    {
+        if ($this->config_source === null) {
+            if ($this->readConfigSource($this) === false) {
+                throw new Exception("Unable to load config file \"{$this->config_resource_name}\"");
+            } 
+        } 
+        return $this->config_source;
+    } 
+    public function readConfigSource()
+    { 
+        // read source file
+        if (file_exists($this->getConfigFilepath())) {
+            $this->config_source = file_get_contents($this->getConfigFilepath());
+            return true;
+        } else {
+            return false;
+        } 
+    } 
+
+    /**
+    * Returns the compiled  filepath
+    * 
+    * @return string the compiled filepath
+    */
+    public function getCompiledFilepath ()
+    {
+        return $this->compiled_filepath === null ?
+        ($this->compiled_filepath = $this->buildCompiledFilepath()) :
+        $this->compiled_filepath;
+    } 
+    public function buildCompiledFilepath()
+    {
+        $_flag = (int)$this->smarty->config_read_hidden + (int)$this->smarty->config_booleanize * 2 +
+        (int)$this->smarty->config_overwrite * 4;
+        $_filepath = sha1($this->config_resource_name . $_flag); 
+        // if use_sub_dirs, break file into directories
+        if ($this->smarty->use_sub_dirs) {
+            $_filepath = substr($_filepath, 0, 2) . DS
+             . substr($_filepath, 2, 2) . DS
+             . substr($_filepath, 4, 2) . DS
+             . $_filepath;
+        } 
+        $_compile_dir = $this->smarty->compile_dir;
+        if (substr($_compile_dir, -1) != DS) {
+            $_compile_dir .= DS;
+        } 
+        return $_compile_dir . $_filepath . '.' . basename($this->config_resource_name) . '.config' . '.php';
+    } 
+    /**
+    * Returns the timpestamp of the compiled file
+    * 
+    * @return integer the file timestamp
+    */
+    public function getCompiledTimestamp ()
+    {
+        return $this->compiled_timestamp === null ?
+        ($this->compiled_timestamp = (file_exists($this->getCompiledFilepath())) ? filemtime($this->getCompiledFilepath()) : false) :
+        $this->compiled_timestamp;
+    } 
+    /**
+    * Returns if the current config file must be compiled 
+    * 
+    * It does compare the timestamps of config source and the compiled config and checks the force compile configuration
+    * 
+    * @return boolean true if the file must be compiled
+    */
+    public function mustCompile ()
+    {
+        return $this->mustCompile === null ?
+        $this->mustCompile = ($this->smarty->force_compile || $this->getCompiledTimestamp () !== $this->getTimestamp ()):
+        $this->mustCompile;
+    } 
+    /**
+    * Returns the compiled config file 
+    * 
+    * It checks if the config file must be compiled or just read the compiled version
+    * 
+    * @return string the compiled config file
+    */
+    public function getCompiledConfig ()
+    {
+        if ($this->compiled_config === null) {
+            // see if template needs compiling.
+            if ($this->mustCompile()) {
+                $this->compileConfigSource();
+            } else {
+                $this->compiled_config = file_get_contents($this->getCompiledFilepath());
+            } 
+        } 
+        return $this->compiled_config;
+    } 
+
+    /**
+    * Compiles the config files
+    */
+    public function compileConfigSource ()
+    { 
+        // compile template
+        if (!is_object($this->compiler_object)) {
+            // load compiler
+            $this->compiler_object = new Smarty_Internal_Config_File_Compiler($this->smarty);
+        } 
+        // call compiler
+        if ($this->compiler_object->compileSource($this)) {
+            // compiling succeded
+            // write compiled template
+            Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty); 
+            // make template and compiled file timestamp match
+            touch($this->getCompiledFilepath(), $this->getTimestamp());
+        } else {
+            // error compiling template
+            throw new Exception("Error compiling template {$this->getConfigFilepath ()}");
+            return false;
+        } 
+    } 
+
+    /*
+     * load config variables
+    *
+    * @param mixed $sections array of section names, single section or null
+    * @param object $scope global,parent or local
+    */
+    public function loadConfigVars ($sections = null, $scope)
+    {
+        if (isset($this->template)) {
+            $this->template->properties['file_dependency'][sha1($this->getConfigFilepath())] = array($this->getConfigFilepath(), $this->getTimestamp());
+        } else {
+            $this->smarty->properties['file_dependency'][sha1($this->getConfigFilepath())] = array($this->getConfigFilepath(), $this->getTimestamp());
+        } 
+        $config_data = unserialize($this->getCompiledConfig()); 
+        // var_dump($config_data);
+        // copy global config vars
+        foreach ($config_data['vars'] as $variable => $value) {
+            if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {
+                $scope->config_vars[$variable] = $value;
+            } else {
+                $scope->config_vars[$variable] = array_merge((array)$scope->config_vars[$variable], (array)$value);
+            } 
+        } 
+        // scan sections
+        foreach ($config_data['sections'] as $this_section => $dummy) {
+            if ($sections == null || in_array($this_section, (array)$sections)) {
+                foreach ($config_data['sections'][$this_section]['vars'] as $variable => $value) {
+                    if ($this->smarty->config_overwrite || !isset($scope->config_vars[$variable])) {
+                        $scope->config_vars[$variable] = $value;
+                    } else {
+                        $scope->config_vars[$variable] = array_merge((array)$scope->config_vars[$variable], (array)$value);
+                    } 
+                } 
+            } 
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_config_file_compiler.php b/gosa-core/include/smarty/sysplugins/smarty_internal_config_file_compiler.php
new file mode 100644 (file)
index 0000000..1547911
--- /dev/null
@@ -0,0 +1,116 @@
+<?php
+
+/**
+* Smarty Internal Plugin Config File Compiler
+* 
+* This is the config file compiler class. It calls the lexer and parser to
+* perform the compiling.
+* 
+* @package Smarty
+* @subpackage Config
+* @author Uwe Tews 
+*/
+/**
+* Main config file compiler class
+*/
+class Smarty_Internal_Config_File_Compiler {
+   public $compile_error= false;
+   /**
+    * Initialize compiler
+    */
+    public function __construct($smarty)
+    {
+        $this->smarty = $smarty; 
+        // get required plugins
+        $this->smarty->loadPlugin('Smarty_Internal_Configfilelexer');
+        $this->smarty->loadPlugin('Smarty_Internal_Configfileparser');
+        $this->config_data['sections'] = array();
+        $this->config_data['vars'] = array();
+    } 
+
+    /**
+    * Methode to compile a Smarty template
+    * 
+    * @param  $template template object to compile
+    * @return bool true if compiling succeeded, false if it failed
+    */
+    public function compileSource($config)
+    {
+        /* here is where the compiling takes place. Smarty
+       tags in the templates are replaces with PHP code,
+       then written to compiled files. */ 
+       $this->config = $config; 
+       // get config file source
+        $_content = $config->getConfigSource()."\n";
+        // on empty template just return
+        if ($_content == '') {
+            return true;
+        } 
+        // init the lexer/parser to compile the config file
+        $lex = new Smarty_Internal_Configfilelexer($_content, $this->smarty);
+        $parser = new Smarty_Internal_Configfileparser($lex, $this); 
+        // $parser->PrintTrace();
+        // get tokens from lexer and parse them
+        while ($lex->yylex()) {
+            // echo "<br>Parsing  {$parser->yyTokenName[$lex->token]} Token {$lex->value} Line {$lex->line} \n";
+            $parser->doParse($lex->token, $lex->value);
+        } 
+        // finish parsing process
+        $parser->doParse(0, 0);
+
+        $config->compiled_config = serialize($this->config_data);
+        if (!$this->compile_error) {
+            return true;
+        } else {
+            // compilation error
+            return false;
+        } 
+    } 
+    /**
+    * display compiler error messages without dying
+    * 
+    * If parameter $args is empty it is a parser detected syntax error.
+    * In this case the parser is called to obtain information about exspected tokens.
+    * 
+    * If parameter $args contains a string this is used as error message
+    * 
+    * @todo output exact position of parse error in source line
+    * @param  $args string individual error message or null
+    */
+    public function trigger_config_file_error($args = null)
+    {
+        $this->lex = Smarty_Internal_Configfilelexer::instance();
+        $this->parser = Smarty_Internal_Configfileparser::instance(); 
+        // get template source line which has error
+        $line = $this->lex->line;
+        if (isset($args)) {
+//            $line--;
+        } 
+        $match = preg_split("/\n/", $this->lex->data);
+        $error_text = "Syntax error in config file '{$this->config->getConfigFilepath()}' on line {$line} '{$match[$line-1]}' ";
+        if (isset($args)) {
+            // individual error message
+            $error_text .= $args;
+        } else {
+            // exspected token from parser
+            foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
+                $exp_token = $this->parser->yyTokenName[$token];
+                if (isset($this->lex->smarty_token_names[$exp_token])) {
+                    // token type from lexer
+                    $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';
+                } else {
+                    // otherwise internal token name
+                    $expect[] = $this->parser->yyTokenName[$token];
+                } 
+            } 
+            // output parser error message
+            $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect);
+        } 
+        throw new Exception($error_text);
+        // set error flag
+        $this->compile_error = true;
+    } 
+
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_configfilelexer.php b/gosa-core/include/smarty/sysplugins/smarty_internal_configfilelexer.php
new file mode 100644 (file)
index 0000000..50d9fd6
--- /dev/null
@@ -0,0 +1,526 @@
+<?php
+/**
+* Smarty Internal Plugin Configfilelexer
+*
+* This is the lexer to break the config file source into tokens 
+* @package Smarty
+* @subpackage Config
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Configfilelexer
+*/
+class Smarty_Internal_Configfilelexer
+{
+
+    public $data;
+    public $counter;
+    public $token;
+    public $value;
+    public $node;
+    public $line;
+    private $state = 1;
+    public $smarty_token_names = array (               // Text for parser error messages
+                               );
+                               
+                               
+    function __construct($data, $smarty)
+    {
+        // set instance object
+        self::instance($this); 
+        $this->data = $data . "\n"; //now all lines are \n-terminated
+        $this->counter = 0;
+        $this->line = 1;
+        $this->smarty = $smarty; 
+     }
+    public static function &instance($new_instance = null)
+    {
+        static $instance = null;
+        if (isset($new_instance) && is_object($new_instance))
+            $instance = $new_instance;
+        return $instance;
+    } 
+
+
+
+    private $_yy_state = 1;
+    private $_yy_stack = array();
+
+    function yylex()
+    {
+        return $this->{'yylex' . $this->_yy_state}();
+    }
+
+    function yypushstate($state)
+    {
+        array_push($this->_yy_stack, $this->_yy_state);
+        $this->_yy_state = $state;
+    }
+
+    function yypopstate()
+    {
+        $this->_yy_state = array_pop($this->_yy_stack);
+    }
+
+    function yybegin($state)
+    {
+        $this->_yy_state = $state;
+    }
+
+
+
+
+    function yylex1()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+              4 => 0,
+              5 => 0,
+              6 => 0,
+              7 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(#)|^(\\[)|^(\\])|^(=)|^([ \t\r]+)|^(\n)|^([0-9]*[a-zA-Z_]\\w*)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state START');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const START = 1;
+    function yy_r1_1($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
+    $this->yypushstate(self::COMMENT);
+    }
+    function yy_r1_2($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
+    $this->yypushstate(self::SECTION);
+    }
+    function yy_r1_3($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
+    }
+    function yy_r1_4($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
+    $this->yypushstate(self::VALUE);
+    }
+    function yy_r1_5($yy_subpatterns)
+    {
+
+    return false;
+    }
+    function yy_r1_6($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
+    }
+    function yy_r1_7($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_ID;
+    }
+
+
+
+    function yylex2()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+              4 => 0,
+              5 => 0,
+              6 => 0,
+              7 => 0,
+              8 => 0,
+              9 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^([ \t\r]+)|^(\\d+\\.\\d+(?=[ \t\r]*[\n#]))|^(\\d+(?=[ \t\r]*[\n#]))|^('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#]))|^(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#]))|^(\"\"\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"\"\"(?=[ \t\r]*[\n#]))|^([a-zA-Z]+(?=[ \t\r]*[\n#]))|^([^\n]+?(?=[ \t\r]*\n))|^(\n)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state VALUE');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const VALUE = 2;
+    function yy_r2_1($yy_subpatterns)
+    {
+
+    return false;
+    }
+    function yy_r2_2($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
+    $this->yypopstate();
+    }
+    function yy_r2_3($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_INT;
+    $this->yypopstate();
+    }
+    function yy_r2_4($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
+    $this->yypopstate();
+    }
+    function yy_r2_5($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
+    $this->yypopstate();
+    }
+    function yy_r2_6($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_DOUBLE_QUOTED_STRING;
+    $this->yypopstate();
+    }
+    function yy_r2_7($yy_subpatterns)
+    {
+
+    if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) {
+        $this->yypopstate();
+        $this->yypushstate(self::NAKED_STRING_VALUE);
+        return true; //reprocess in new state
+    } else {
+        $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
+        $this->yypopstate();
+    }
+    }
+    function yy_r2_8($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+    $this->yypopstate();
+    }
+    function yy_r2_9($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+    $this->value = "";
+    $this->yypopstate();
+    }
+
+
+
+    function yylex3()
+    {
+        $tokenMap = array (
+              1 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^([^\n]+?(?=[ \t\r]*\n))/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state NAKED_STRING_VALUE');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const NAKED_STRING_VALUE = 3;
+    function yy_r3_1($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+    $this->yypopstate();
+    }
+
+
+
+    function yylex4()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^([ \t\r]+)|^([^\n]+?(?=[ \t\r]*\n))|^(\n)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state COMMENT');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const COMMENT = 4;
+    function yy_r4_1($yy_subpatterns)
+    {
+
+    return false;
+    }
+    function yy_r4_2($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+    }
+    function yy_r4_3($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
+    $this->yypopstate();
+    }
+
+
+
+    function yylex5()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(\\.)|^(.*?(?=[\.=[\]\r\n]))/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state SECTION');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const SECTION = 5;
+    function yy_r5_1($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
+    }
+    function yy_r5_2($yy_subpatterns)
+    {
+
+    $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
+    $this->yypopstate();
+    }
+
+
+}
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_configfileparser.php b/gosa-core/include/smarty/sysplugins/smarty_internal_configfileparser.php
new file mode 100644 (file)
index 0000000..3621a48
--- /dev/null
@@ -0,0 +1,864 @@
+<?php
+/**
+* Smarty Internal Plugin Configfileparser
+*
+* This is the config file parser.
+* It is generated from the internal.configfileparser.y file
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews
+*/
+
+class TPC_yyToken implements ArrayAccess
+{
+    public $string = '';
+    public $metadata = array();
+
+    function __construct($s, $m = array())
+    {
+        if ($s instanceof TPC_yyToken) {
+            $this->string = $s->string;
+            $this->metadata = $s->metadata;
+        } else {
+            $this->string = (string) $s;
+            if ($m instanceof TPC_yyToken) {
+                $this->metadata = $m->metadata;
+            } elseif (is_array($m)) {
+                $this->metadata = $m;
+            }
+        }
+    }
+
+    function __toString()
+    {
+        return $this->_string;
+    }
+
+    function offsetExists($offset)
+    {
+        return isset($this->metadata[$offset]);
+    }
+
+    function offsetGet($offset)
+    {
+        return $this->metadata[$offset];
+    }
+
+    function offsetSet($offset, $value)
+    {
+        if ($offset === null) {
+            if (isset($value[0])) {
+                $x = ($value instanceof TPC_yyToken) ?
+                    $value->metadata : $value;
+                $this->metadata = array_merge($this->metadata, $x);
+                return;
+            }
+            $offset = count($this->metadata);
+        }
+        if ($value === null) {
+            return;
+        }
+        if ($value instanceof TPC_yyToken) {
+            if ($value->metadata) {
+                $this->metadata[$offset] = $value->metadata;
+            }
+        } elseif ($value) {
+            $this->metadata[$offset] = $value;
+        }
+    }
+
+    function offsetUnset($offset)
+    {
+        unset($this->metadata[$offset]);
+    }
+}
+
+class TPC_yyStackEntry
+{
+    public $stateno;       /* The state-number */
+    public $major;         /* The major token value.  This is the code
+                     ** number for the token at this stack level */
+    public $minor; /* The user-supplied minor token value.  This
+                     ** is the value of the token  */
+};
+
+
+#line 12 "smarty_internal_configfileparser.y"
+class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser.php"
+{
+#line 14 "smarty_internal_configfileparser.y"
+
+    // states whether the parse was successful or not
+    public $successful = true;
+    public $retvalue = 0;
+    private $lex;
+    private $internalError = false;
+
+    function __construct($lex, $compiler) {
+        // set instance object
+        self::instance($this); 
+        $this->lex = $lex;
+        $this->smarty = $compiler->smarty; 
+        $this->compiler = $compiler;
+    }
+    public static function &instance($new_instance = null)
+    {
+        static $instance = null;
+        if (isset($new_instance) && is_object($new_instance))
+            $instance = $new_instance;
+        return $instance;
+    }
+
+    private function parse_bool($str) {
+        if (in_array(strtolower($str) ,array('on','yes','true'))) {
+            $res = true;
+        } else {
+            assert(in_array(strtolower($str), array('off','no','false')));
+            $res = false;
+        }
+        return $res;
+    }
+
+    private static $escapes_single = Array('\\' => '\\',
+                                          '\'' => '\'');
+    private static function parse_single_quoted_string($qstr) {
+        $escaped_string = substr($qstr, 1, strlen($qstr)-2); //remove outer quotes
+
+        $ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+        $str = "";
+        foreach ($ss as $s) {
+            if (strlen($s) === 2 && $s[0] === '\\') {
+                if (isset(self::$escapes_single[$s[1]])) {
+                    $s = self::$escapes_single[$s[1]];
+                }
+             }
+
+             $str .= $s;
+        }
+
+        return $str;
+    }
+
+    private static function parse_double_quoted_string($qstr) {
+        $inner_str = substr($qstr, 1, strlen($qstr)-2);
+        return stripcslashes($inner_str);
+    }
+
+    private static function parse_tripple_double_quoted_string($qstr) {
+        $inner_str = substr($qstr, 3, strlen($qstr)-6);
+        return stripcslashes($inner_str);
+    }
+
+    private function set_var(Array $var, Array &$target_array) {
+        $key = $var["key"];
+        $value = $var["value"];
+
+        if ($this->smarty->config_overwrite || !isset($target_array['vars'][$key])) {
+            $target_array['vars'][$key] = $value;
+        } else {
+            settype($target_array['vars'][$key], 'array');
+            $target_array['vars'][$key][] = $value;
+        }
+    }
+
+    private function add_global_vars(Array $vars) {
+        if (!isset($this->compiler->config_data['vars'])) {
+           $this->compiler->config_data['vars'] = Array();
+        }
+        foreach ($vars as $var) {
+            $this->set_var($var, $this->compiler->config_data);
+        }
+    }
+
+    private function add_section_vars($section_name, Array $vars) {
+        if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
+            $this->compiler->config_data['sections'][$section_name]['vars'] = Array();
+        }
+        foreach ($vars as $var) {
+            $this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
+        }
+    }
+#line 175 "smarty_internal_configfileparser.php"
+
+    const TPC_OPENB                          =  1;
+    const TPC_SECTION                        =  2;
+    const TPC_CLOSEB                         =  3;
+    const TPC_DOT                            =  4;
+    const TPC_ID                             =  5;
+    const TPC_EQUAL                          =  6;
+    const TPC_FLOAT                          =  7;
+    const TPC_INT                            =  8;
+    const TPC_BOOL                           =  9;
+    const TPC_SINGLE_QUOTED_STRING           = 10;
+    const TPC_DOUBLE_QUOTED_STRING           = 11;
+    const TPC_TRIPPLE_DOUBLE_QUOTED_STRING   = 12;
+    const TPC_NAKED_STRING                   = 13;
+    const TPC_NEWLINE                        = 14;
+    const TPC_COMMENTSTART                   = 15;
+    const YY_NO_ACTION = 54;
+    const YY_ACCEPT_ACTION = 53;
+    const YY_ERROR_ACTION = 52;
+
+    const YY_SZ_ACTTAB = 35;
+static public $yy_action = array(
+ /*     0 */    26,   27,   21,   30,   29,   28,   31,   16,   53,    8,
+ /*    10 */    19,    2,   20,   11,   24,   23,   20,   11,   17,   15,
+ /*    20 */     3,   14,   13,   18,    4,    6,    5,    1,   12,   22,
+ /*    30 */     9,   47,   10,   25,    7,
+    );
+    static public $yy_lookahead = array(
+ /*     0 */     7,    8,    9,   10,   11,   12,   13,    5,   17,   18,
+ /*    10 */    14,   20,   14,   15,   22,   23,   14,   15,    2,    2,
+ /*    20 */    20,    4,   13,   14,    6,    3,    3,   20,    1,   24,
+ /*    30 */    22,   25,   22,   21,   19,
+);
+    const YY_SHIFT_USE_DFLT = -8;
+    const YY_SHIFT_MAX = 17;
+    static public $yy_shift_ofst = array(
+ /*     0 */    -8,    2,    2,    2,   -7,   -2,   -2,   27,   -8,   -8,
+ /*    10 */    -8,    9,   17,   -4,   16,   23,   18,   22,
+);
+    const YY_REDUCE_USE_DFLT = -10;
+    const YY_REDUCE_MAX = 10;
+    static public $yy_reduce_ofst = array(
+ /*     0 */    -9,   -8,   -8,   -8,    5,   10,    8,   12,   15,    0,
+ /*    10 */     7,
+);
+    static public $yyExpectedTokens = array(
+        /* 0 */ array(),
+        /* 1 */ array(5, 14, 15, ),
+        /* 2 */ array(5, 14, 15, ),
+        /* 3 */ array(5, 14, 15, ),
+        /* 4 */ array(7, 8, 9, 10, 11, 12, 13, ),
+        /* 5 */ array(14, 15, ),
+        /* 6 */ array(14, 15, ),
+        /* 7 */ array(1, ),
+        /* 8 */ array(),
+        /* 9 */ array(),
+        /* 10 */ array(),
+        /* 11 */ array(13, 14, ),
+        /* 12 */ array(2, 4, ),
+        /* 13 */ array(14, ),
+        /* 14 */ array(2, ),
+        /* 15 */ array(3, ),
+        /* 16 */ array(6, ),
+        /* 17 */ array(3, ),
+        /* 18 */ array(),
+        /* 19 */ array(),
+        /* 20 */ array(),
+        /* 21 */ array(),
+        /* 22 */ array(),
+        /* 23 */ array(),
+        /* 24 */ array(),
+        /* 25 */ array(),
+        /* 26 */ array(),
+        /* 27 */ array(),
+        /* 28 */ array(),
+        /* 29 */ array(),
+        /* 30 */ array(),
+        /* 31 */ array(),
+);
+    static public $yy_default = array(
+ /*     0 */    40,   36,   33,   37,   52,   52,   52,   32,   35,   40,
+ /*    10 */    40,   52,   52,   52,   52,   52,   52,   52,   50,   51,
+ /*    20 */    49,   44,   41,   39,   38,   34,   42,   43,   47,   46,
+ /*    30 */    45,   48,
+);
+    const YYNOCODE = 26;
+    const YYSTACKDEPTH = 100;
+    const YYNSTATE = 32;
+    const YYNRULE = 20;
+    const YYERRORSYMBOL = 16;
+    const YYERRSYMDT = 'yy0';
+    const YYFALLBACK = 0;
+    static public $yyFallback = array(
+    );
+    static function Trace($TraceFILE, $zTracePrompt)
+    {
+        if (!$TraceFILE) {
+            $zTracePrompt = 0;
+        } elseif (!$zTracePrompt) {
+            $TraceFILE = 0;
+        }
+        self::$yyTraceFILE = $TraceFILE;
+        self::$yyTracePrompt = $zTracePrompt;
+    }
+
+    static function PrintTrace()
+    {
+        self::$yyTraceFILE = fopen('php://output', 'w');
+        self::$yyTracePrompt = '<br>';
+    }
+
+    static public $yyTraceFILE;
+    static public $yyTracePrompt;
+    public $yyidx;                    /* Index of top element in stack */
+    public $yyerrcnt;                 /* Shifts left before out of the error */
+    public $yystack = array();  /* The parser's stack */
+
+    public $yyTokenName = array( 
+  '$',             'OPENB',         'SECTION',       'CLOSEB',      
+  'DOT',           'ID',            'EQUAL',         'FLOAT',       
+  'INT',           'BOOL',          'SINGLE_QUOTED_STRING',  'DOUBLE_QUOTED_STRING',
+  'TRIPPLE_DOUBLE_QUOTED_STRING',  'NAKED_STRING',  'NEWLINE',       'COMMENTSTART',
+  'error',         'start',         'global_vars',   'sections',    
+  'var_list',      'section',       'newline',       'var',         
+  'value',       
+    );
+
+    static public $yyRuleName = array(
+ /*   0 */ "start ::= global_vars sections",
+ /*   1 */ "global_vars ::= var_list",
+ /*   2 */ "sections ::= sections section",
+ /*   3 */ "sections ::=",
+ /*   4 */ "section ::= OPENB SECTION CLOSEB newline var_list",
+ /*   5 */ "section ::= OPENB DOT SECTION CLOSEB newline var_list",
+ /*   6 */ "var_list ::= var_list newline",
+ /*   7 */ "var_list ::= var_list var",
+ /*   8 */ "var_list ::=",
+ /*   9 */ "var ::= ID EQUAL value",
+ /*  10 */ "value ::= FLOAT",
+ /*  11 */ "value ::= INT",
+ /*  12 */ "value ::= BOOL",
+ /*  13 */ "value ::= SINGLE_QUOTED_STRING",
+ /*  14 */ "value ::= DOUBLE_QUOTED_STRING",
+ /*  15 */ "value ::= TRIPPLE_DOUBLE_QUOTED_STRING",
+ /*  16 */ "value ::= NAKED_STRING",
+ /*  17 */ "newline ::= NEWLINE",
+ /*  18 */ "newline ::= COMMENTSTART NEWLINE",
+ /*  19 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
+    );
+
+    function tokenName($tokenType)
+    {
+        if ($tokenType === 0) {
+            return 'End of Input';
+        }
+        if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {
+            return $this->yyTokenName[$tokenType];
+        } else {
+            return "Unknown";
+        }
+    }
+
+    static function yy_destructor($yymajor, $yypminor)
+    {
+        switch ($yymajor) {
+            default:  break;   /* If no destructor action specified: do nothing */
+        }
+    }
+
+    function yy_pop_parser_stack()
+    {
+        if (!count($this->yystack)) {
+            return;
+        }
+        $yytos = array_pop($this->yystack);
+        if (self::$yyTraceFILE && $this->yyidx >= 0) {
+            fwrite(self::$yyTraceFILE,
+                self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
+                    "\n");
+        }
+        $yymajor = $yytos->major;
+        self::yy_destructor($yymajor, $yytos->minor);
+        $this->yyidx--;
+        return $yymajor;
+    }
+
+    function __destruct()
+    {
+        while ($this->yyidx >= 0) {
+            $this->yy_pop_parser_stack();
+        }
+        if (is_resource(self::$yyTraceFILE)) {
+            fclose(self::$yyTraceFILE);
+        }
+    }
+
+    function yy_get_expected_tokens($token)
+    {
+        $state = $this->yystack[$this->yyidx]->stateno;
+        $expected = self::$yyExpectedTokens[$state];
+        if (in_array($token, self::$yyExpectedTokens[$state], true)) {
+            return $expected;
+        }
+        $stack = $this->yystack;
+        $yyidx = $this->yyidx;
+        do {
+            $yyact = $this->yy_find_shift_action($token);
+            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
+                // reduce action
+                $done = 0;
+                do {
+                    if ($done++ == 100) {
+                        $this->yyidx = $yyidx;
+                        $this->yystack = $stack;
+                        // too much recursion prevents proper detection
+                        // so give up
+                        return array_unique($expected);
+                    }
+                    $yyruleno = $yyact - self::YYNSTATE;
+                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
+                    $nextstate = $this->yy_find_reduce_action(
+                        $this->yystack[$this->yyidx]->stateno,
+                        self::$yyRuleInfo[$yyruleno]['lhs']);
+                    if (isset(self::$yyExpectedTokens[$nextstate])) {
+                        $expected += self::$yyExpectedTokens[$nextstate];
+                            if (in_array($token,
+                                  self::$yyExpectedTokens[$nextstate], true)) {
+                            $this->yyidx = $yyidx;
+                            $this->yystack = $stack;
+                            return array_unique($expected);
+                        }
+                    }
+                    if ($nextstate < self::YYNSTATE) {
+                        // we need to shift a non-terminal
+                        $this->yyidx++;
+                        $x = new TPC_yyStackEntry;
+                        $x->stateno = $nextstate;
+                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
+                        $this->yystack[$this->yyidx] = $x;
+                        continue 2;
+                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
+                        $this->yyidx = $yyidx;
+                        $this->yystack = $stack;
+                        // the last token was just ignored, we can't accept
+                        // by ignoring input, this is in essence ignoring a
+                        // syntax error!
+                        return array_unique($expected);
+                    } elseif ($nextstate === self::YY_NO_ACTION) {
+                        $this->yyidx = $yyidx;
+                        $this->yystack = $stack;
+                        // input accepted, but not shifted (I guess)
+                        return $expected;
+                    } else {
+                        $yyact = $nextstate;
+                    }
+                } while (true);
+            }
+            break;
+        } while (true);
+        return array_unique($expected);
+    }
+
+    function yy_is_expected_token($token)
+    {
+        if ($token === 0) {
+            return true; // 0 is not part of this
+        }
+        $state = $this->yystack[$this->yyidx]->stateno;
+        if (in_array($token, self::$yyExpectedTokens[$state], true)) {
+            return true;
+        }
+        $stack = $this->yystack;
+        $yyidx = $this->yyidx;
+        do {
+            $yyact = $this->yy_find_shift_action($token);
+            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {
+                // reduce action
+                $done = 0;
+                do {
+                    if ($done++ == 100) {
+                        $this->yyidx = $yyidx;
+                        $this->yystack = $stack;
+                        // too much recursion prevents proper detection
+                        // so give up
+                        return true;
+                    }
+                    $yyruleno = $yyact - self::YYNSTATE;
+                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];
+                    $nextstate = $this->yy_find_reduce_action(
+                        $this->yystack[$this->yyidx]->stateno,
+                        self::$yyRuleInfo[$yyruleno]['lhs']);
+                    if (isset(self::$yyExpectedTokens[$nextstate]) &&
+                          in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
+                        $this->yyidx = $yyidx;
+                        $this->yystack = $stack;
+                        return true;
+                    }
+                    if ($nextstate < self::YYNSTATE) {
+                        // we need to shift a non-terminal
+                        $this->yyidx++;
+                        $x = new TPC_yyStackEntry;
+                        $x->stateno = $nextstate;
+                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
+                        $this->yystack[$this->yyidx] = $x;
+                        continue 2;
+                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {
+                        $this->yyidx = $yyidx;
+                        $this->yystack = $stack;
+                        if (!$token) {
+                            // end of input: this is valid
+                            return true;
+                        }
+                        // the last token was just ignored, we can't accept
+                        // by ignoring input, this is in essence ignoring a
+                        // syntax error!
+                        return false;
+                    } elseif ($nextstate === self::YY_NO_ACTION) {
+                        $this->yyidx = $yyidx;
+                        $this->yystack = $stack;
+                        // input accepted, but not shifted (I guess)
+                        return true;
+                    } else {
+                        $yyact = $nextstate;
+                    }
+                } while (true);
+            }
+            break;
+        } while (true);
+        $this->yyidx = $yyidx;
+        $this->yystack = $stack;
+        return true;
+    }
+
+   function yy_find_shift_action($iLookAhead)
+    {
+        $stateno = $this->yystack[$this->yyidx]->stateno;
+     
+        /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */
+        if (!isset(self::$yy_shift_ofst[$stateno])) {
+            // no shift actions
+            return self::$yy_default[$stateno];
+        }
+        $i = self::$yy_shift_ofst[$stateno];
+        if ($i === self::YY_SHIFT_USE_DFLT) {
+            return self::$yy_default[$stateno];
+        }
+        if ($iLookAhead == self::YYNOCODE) {
+            return self::YY_NO_ACTION;
+        }
+        $i += $iLookAhead;
+        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
+              self::$yy_lookahead[$i] != $iLookAhead) {
+            if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
+                   && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
+                if (self::$yyTraceFILE) {
+                    fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
+                        $this->yyTokenName[$iLookAhead] . " => " .
+                        $this->yyTokenName[$iFallback] . "\n");
+                }
+                return $this->yy_find_shift_action($iFallback);
+            }
+            return self::$yy_default[$stateno];
+        } else {
+            return self::$yy_action[$i];
+        }
+    }
+
+    function yy_find_reduce_action($stateno, $iLookAhead)
+    {
+        /* $stateno = $this->yystack[$this->yyidx]->stateno; */
+
+        if (!isset(self::$yy_reduce_ofst[$stateno])) {
+            return self::$yy_default[$stateno];
+        }
+        $i = self::$yy_reduce_ofst[$stateno];
+        if ($i == self::YY_REDUCE_USE_DFLT) {
+            return self::$yy_default[$stateno];
+        }
+        if ($iLookAhead == self::YYNOCODE) {
+            return self::YY_NO_ACTION;
+        }
+        $i += $iLookAhead;
+        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
+              self::$yy_lookahead[$i] != $iLookAhead) {
+            return self::$yy_default[$stateno];
+        } else {
+            return self::$yy_action[$i];
+        }
+    }
+
+    function yy_shift($yyNewState, $yyMajor, $yypMinor)
+    {
+        $this->yyidx++;
+        if ($this->yyidx >= self::YYSTACKDEPTH) {
+            $this->yyidx--;
+            if (self::$yyTraceFILE) {
+                fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
+            }
+            while ($this->yyidx >= 0) {
+                $this->yy_pop_parser_stack();
+            }
+            return;
+        }
+        $yytos = new TPC_yyStackEntry;
+        $yytos->stateno = $yyNewState;
+        $yytos->major = $yyMajor;
+        $yytos->minor = $yypMinor;
+        array_push($this->yystack, $yytos);
+        if (self::$yyTraceFILE && $this->yyidx > 0) {
+            fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
+                $yyNewState);
+            fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
+            for($i = 1; $i <= $this->yyidx; $i++) {
+                fprintf(self::$yyTraceFILE, " %s",
+                    $this->yyTokenName[$this->yystack[$i]->major]);
+            }
+            fwrite(self::$yyTraceFILE,"\n");
+        }
+    }
+
+    static public $yyRuleInfo = array(
+  array( 'lhs' => 17, 'rhs' => 2 ),
+  array( 'lhs' => 18, 'rhs' => 1 ),
+  array( 'lhs' => 19, 'rhs' => 2 ),
+  array( 'lhs' => 19, 'rhs' => 0 ),
+  array( 'lhs' => 21, 'rhs' => 5 ),
+  array( 'lhs' => 21, 'rhs' => 6 ),
+  array( 'lhs' => 20, 'rhs' => 2 ),
+  array( 'lhs' => 20, 'rhs' => 2 ),
+  array( 'lhs' => 20, 'rhs' => 0 ),
+  array( 'lhs' => 23, 'rhs' => 3 ),
+  array( 'lhs' => 24, 'rhs' => 1 ),
+  array( 'lhs' => 24, 'rhs' => 1 ),
+  array( 'lhs' => 24, 'rhs' => 1 ),
+  array( 'lhs' => 24, 'rhs' => 1 ),
+  array( 'lhs' => 24, 'rhs' => 1 ),
+  array( 'lhs' => 24, 'rhs' => 1 ),
+  array( 'lhs' => 24, 'rhs' => 1 ),
+  array( 'lhs' => 22, 'rhs' => 1 ),
+  array( 'lhs' => 22, 'rhs' => 2 ),
+  array( 'lhs' => 22, 'rhs' => 3 ),
+    );
+
+    static public $yyReduceMap = array(
+        0 => 0,
+        2 => 0,
+        3 => 0,
+        17 => 0,
+        18 => 0,
+        19 => 0,
+        1 => 1,
+        4 => 4,
+        5 => 5,
+        6 => 6,
+        7 => 7,
+        8 => 8,
+        9 => 9,
+        10 => 10,
+        11 => 11,
+        12 => 12,
+        13 => 13,
+        14 => 14,
+        15 => 15,
+        16 => 16,
+    );
+#line 127 "smarty_internal_configfileparser.y"
+    function yy_r0(){ $this->_retvalue = null;     }
+#line 645 "smarty_internal_configfileparser.php"
+#line 130 "smarty_internal_configfileparser.y"
+    function yy_r1(){ $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;     }
+#line 648 "smarty_internal_configfileparser.php"
+#line 136 "smarty_internal_configfileparser.y"
+    function yy_r4(){ $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;     }
+#line 651 "smarty_internal_configfileparser.php"
+#line 137 "smarty_internal_configfileparser.y"
+    function yy_r5(){ if ($this->smarty->config_read_hidden) { $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); } $this->_retvalue = null;     }
+#line 654 "smarty_internal_configfileparser.php"
+#line 140 "smarty_internal_configfileparser.y"
+    function yy_r6(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;     }
+#line 657 "smarty_internal_configfileparser.php"
+#line 141 "smarty_internal_configfileparser.y"
+    function yy_r7(){ $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));     }
+#line 660 "smarty_internal_configfileparser.php"
+#line 142 "smarty_internal_configfileparser.y"
+    function yy_r8(){ $this->_retvalue = Array();     }
+#line 663 "smarty_internal_configfileparser.php"
+#line 146 "smarty_internal_configfileparser.y"
+    function yy_r9(){ $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);     }
+#line 666 "smarty_internal_configfileparser.php"
+#line 148 "smarty_internal_configfileparser.y"
+    function yy_r10(){ $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;     }
+#line 669 "smarty_internal_configfileparser.php"
+#line 149 "smarty_internal_configfileparser.y"
+    function yy_r11(){ $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;     }
+#line 672 "smarty_internal_configfileparser.php"
+#line 150 "smarty_internal_configfileparser.y"
+    function yy_r12(){ $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);     }
+#line 675 "smarty_internal_configfileparser.php"
+#line 151 "smarty_internal_configfileparser.y"
+    function yy_r13(){ $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);     }
+#line 678 "smarty_internal_configfileparser.php"
+#line 152 "smarty_internal_configfileparser.y"
+    function yy_r14(){ $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);     }
+#line 681 "smarty_internal_configfileparser.php"
+#line 153 "smarty_internal_configfileparser.y"
+    function yy_r15(){ $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);     }
+#line 684 "smarty_internal_configfileparser.php"
+#line 154 "smarty_internal_configfileparser.y"
+    function yy_r16(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;     }
+#line 687 "smarty_internal_configfileparser.php"
+
+    private $_retvalue;
+
+    function yy_reduce($yyruleno)
+    {
+        $yymsp = $this->yystack[$this->yyidx];
+        if (self::$yyTraceFILE && $yyruleno >= 0 
+              && $yyruleno < count(self::$yyRuleName)) {
+            fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
+                self::$yyTracePrompt, $yyruleno,
+                self::$yyRuleName[$yyruleno]);
+        }
+
+        $this->_retvalue = $yy_lefthand_side = null;
+        if (array_key_exists($yyruleno, self::$yyReduceMap)) {
+            // call the action
+            $this->_retvalue = null;
+            $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();
+            $yy_lefthand_side = $this->_retvalue;
+        }
+        $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
+        $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
+        $this->yyidx -= $yysize;
+        for($i = $yysize; $i; $i--) {
+            // pop all of the right-hand side parameters
+            array_pop($this->yystack);
+        }
+        $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
+        if ($yyact < self::YYNSTATE) {
+            if (!self::$yyTraceFILE && $yysize) {
+                $this->yyidx++;
+                $x = new TPC_yyStackEntry;
+                $x->stateno = $yyact;
+                $x->major = $yygoto;
+                $x->minor = $yy_lefthand_side;
+                $this->yystack[$this->yyidx] = $x;
+            } else {
+                $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);
+            }
+        } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {
+            $this->yy_accept();
+        }
+    }
+
+    function yy_parse_failed()
+    {
+        if (self::$yyTraceFILE) {
+            fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
+        }
+        while ($this->yyidx >= 0) {
+            $this->yy_pop_parser_stack();
+        }
+    }
+
+    function yy_syntax_error($yymajor, $TOKEN)
+    {
+#line 120 "smarty_internal_configfileparser.y"
+
+    $this->internalError = true;
+    $this->yymajor = $yymajor;
+    $this->compiler->trigger_config_file_error();
+#line 750 "smarty_internal_configfileparser.php"
+    }
+
+    function yy_accept()
+    {
+        if (self::$yyTraceFILE) {
+            fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
+        }
+        while ($this->yyidx >= 0) {
+            $stack = $this->yy_pop_parser_stack();
+        }
+#line 112 "smarty_internal_configfileparser.y"
+
+    $this->successful = !$this->internalError;
+    $this->internalError = false;
+    $this->retvalue = $this->_retvalue;
+    //echo $this->retvalue."\n\n";
+#line 768 "smarty_internal_configfileparser.php"
+    }
+
+    function doParse($yymajor, $yytokenvalue)
+    {
+        $yyerrorhit = 0;   /* True if yymajor has invoked an error */
+        
+        if ($this->yyidx === null || $this->yyidx < 0) {
+            $this->yyidx = 0;
+            $this->yyerrcnt = -1;
+            $x = new TPC_yyStackEntry;
+            $x->stateno = 0;
+            $x->major = 0;
+            $this->yystack = array();
+            array_push($this->yystack, $x);
+        }
+        $yyendofinput = ($yymajor==0);
+        
+        if (self::$yyTraceFILE) {
+            fprintf(self::$yyTraceFILE, "%sInput %s\n",
+                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
+        }
+        
+        do {
+            $yyact = $this->yy_find_shift_action($yymajor);
+            if ($yymajor < self::YYERRORSYMBOL &&
+                  !$this->yy_is_expected_token($yymajor)) {
+                // force a syntax error
+                $yyact = self::YY_ERROR_ACTION;
+            }
+            if ($yyact < self::YYNSTATE) {
+                $this->yy_shift($yyact, $yymajor, $yytokenvalue);
+                $this->yyerrcnt--;
+                if ($yyendofinput && $this->yyidx >= 0) {
+                    $yymajor = 0;
+                } else {
+                    $yymajor = self::YYNOCODE;
+                }
+            } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
+                $this->yy_reduce($yyact - self::YYNSTATE);
+            } elseif ($yyact == self::YY_ERROR_ACTION) {
+                if (self::$yyTraceFILE) {
+                    fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
+                        self::$yyTracePrompt);
+                }
+                if (self::YYERRORSYMBOL) {
+                    if ($this->yyerrcnt < 0) {
+                        $this->yy_syntax_error($yymajor, $yytokenvalue);
+                    }
+                    $yymx = $this->yystack[$this->yyidx]->major;
+                    if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
+                        if (self::$yyTraceFILE) {
+                            fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
+                                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
+                        }
+                        $this->yy_destructor($yymajor, $yytokenvalue);
+                        $yymajor = self::YYNOCODE;
+                    } else {
+                        while ($this->yyidx >= 0 &&
+                                 $yymx != self::YYERRORSYMBOL &&
+        ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
+                              ){
+                            $this->yy_pop_parser_stack();
+                        }
+                        if ($this->yyidx < 0 || $yymajor==0) {
+                            $this->yy_destructor($yymajor, $yytokenvalue);
+                            $this->yy_parse_failed();
+                            $yymajor = self::YYNOCODE;
+                        } elseif ($yymx != self::YYERRORSYMBOL) {
+                            $u2 = 0;
+                            $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);
+                        }
+                    }
+                    $this->yyerrcnt = 3;
+                    $yyerrorhit = 1;
+                } else {
+                    if ($this->yyerrcnt <= 0) {
+                        $this->yy_syntax_error($yymajor, $yytokenvalue);
+                    }
+                    $this->yyerrcnt = 3;
+                    $this->yy_destructor($yymajor, $yytokenvalue);
+                    if ($yyendofinput) {
+                        $this->yy_parse_failed();
+                    }
+                    $yymajor = self::YYNOCODE;
+                }
+            } else {
+                $this->yy_accept();
+                $yymajor = self::YYNOCODE;
+            }            
+        } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
+    }
+}
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_data.php b/gosa-core/include/smarty/sysplugins/smarty_internal_data.php
new file mode 100644 (file)
index 0000000..61b9b52
--- /dev/null
@@ -0,0 +1,413 @@
+<?php
+
+/**
+* Smarty Internal Plugin Data
+* 
+* This file contains the basic classes and methodes for template and variable creation
+* 
+* @package Smarty
+* @subpackage Templates
+* @author Uwe Tews 
+*/
+
+/**
+* Base class with template and variable methodes
+*/
+class Smarty_Internal_Data {
+    // class used for templates
+    public $template_class = 'Smarty_Internal_Template';
+
+    /**
+    * assigns a Smarty variable
+    * 
+    * @param array $ |string $tpl_var the template variable name(s)
+    * @param mixed $value the value to assign
+    * @param boolean $nocache if true any output of this variable will be not cached
+    * @param boolean $scope the scope the variable will have  (local,parent or root)
+    */
+    public function assign($tpl_var, $value = null, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+    {
+        if (is_array($tpl_var)) {
+            foreach ($tpl_var as $_key => $_val) {
+                if ($_key != '') {
+                    $this->tpl_vars[$_key] = new Smarty_variable($_val, $nocache, $scope);
+                } 
+            } 
+        } else {
+            if ($tpl_var != '') {
+                $this->tpl_vars[$tpl_var] = new Smarty_variable($value, $nocache, $scope);
+            } 
+        } 
+    } 
+    /**
+    * assigns a global Smarty variable
+    * 
+    * @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
+    */
+    public function assign_global($varname, $value = null, $nocache = false)
+    {
+        if ($varname != '') {
+            $this->smarty->global_tpl_vars[$varname] = new Smarty_variable($value, $nocache);
+        } 
+    } 
+    /**
+    * assigns values to template variables by reference
+    * 
+    * @param string $tpl_var the template variable name
+    * @param mixed $ &$value the referenced value to assign
+    * @param boolean $nocache if true any output of this variable will be not cached
+    * @param boolean $scope the scope the variable will have  (local,parent or root)
+    */
+    public function assign_by_ref($tpl_var, &$value, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+    {
+        if ($tpl_var != '') {
+            $this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache, $scope);
+            $this->tpl_vars[$tpl_var]->value = &$value;
+        } 
+    } 
+    /**
+    * appends values to template variables
+    * 
+    * @param array $ |string $tpl_var the template variable name(s)
+    * @param mixed $value the value to append
+    * @param boolean $merge flag if array elements shall be merged
+    * @param boolean $nocache if true any output of this variable will be not cached
+    * @param boolean $scope the scope the variable will have  (local,parent or root)
+    */
+    public function append($tpl_var, $value = null, $merge = false, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+    {
+        if (is_array($tpl_var)) {
+            // $tpl_var is an array, ignore $value
+            foreach ($tpl_var as $_key => $_val) {
+                if ($_key != '') {
+                    if (!isset($this->tpl_vars[$_key])) {
+                        $tpl_var_inst = $this->getVariable($_key, null, true, false);
+                        if ($tpl_var_inst instanceof Undefined_Smarty_Variable) {
+                            $this->tpl_vars[$_key] = new Smarty_variable(null, $nocache, $scope);
+                        } else {
+                            $this->tpl_vars[$_key] = clone $tpl_var_inst;
+                            if ($scope != SMARTY_LOCAL_SCOPE) {
+                                $this->tpl_vars[$_key]->scope = $scope;
+                            } 
+                        } 
+                    } 
+                    if (!(is_array($this->tpl_vars[$_key]->value) || $this->tpl_vars[$_key]->value instanceof ArrayAccess)) {
+                        settype($this->tpl_vars[$_key]->value, 'array');
+                    } 
+                    if ($merge && is_array($_val)) {
+                        foreach($_val as $_mkey => $_mval) {
+                            $this->tpl_vars[$_key]->value[$_mkey] = $_mval;
+                        } 
+                    } else {
+                        $this->tpl_vars[$_key]->value[] = $_val;
+                    } 
+                } 
+            } 
+        } else {
+            if ($tpl_var != '' && isset($value)) {
+                if (!isset($this->tpl_vars[$tpl_var])) {
+                    $tpl_var_inst = $this->getVariable($tpl_var, null, true, false);
+                    if ($tpl_var_inst instanceof Undefined_Smarty_Variable) {
+                        $this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache, $scope);
+                    } else {
+                        $this->tpl_vars[$tpl_var] = clone $tpl_var_inst;
+                        if ($scope != SMARTY_LOCAL_SCOPE) {
+                            $this->tpl_vars[$tpl_var]->scope = $scope;
+                        } 
+                    } 
+                } 
+                if (!(is_array($this->tpl_vars[$tpl_var]->value) || $this->tpl_vars[$tpl_var]->value instanceof ArrayAccess)) {
+                    settype($this->tpl_vars[$tpl_var]->value, 'array');
+                } 
+                if ($merge && is_array($value)) {
+                    foreach($value as $_mkey => $_mval) {
+                        $this->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;
+                    } 
+                } else {
+                    $this->tpl_vars[$tpl_var]->value[] = $value;
+                } 
+            } 
+        } 
+    } 
+
+    /**
+    * appends values to template variables by reference
+    * 
+    * @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)
+    {
+        if ($tpl_var != '' && isset($value)) {
+            if (!isset($this->tpl_vars[$tpl_var])) {
+                $this->tpl_vars[$tpl_var] = new Smarty_variable();
+            } 
+            if (!@is_array($this->tpl_vars[$tpl_var]->value)) {
+                settype($this->tpl_vars[$tpl_var]->value, 'array');
+            } 
+            if ($merge && is_array($value)) {
+                foreach($value as $_key => $_val) {
+                    $this->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];
+                } 
+            } else {
+                $this->tpl_vars[$tpl_var]->value[] = &$value;
+            } 
+        } 
+    } 
+
+
+    /**
+    * clear the given assigned template variable.
+    * 
+    * @param string $ |array $tpl_var the template variable(s) to clear
+    */
+    public function clear_assign($tpl_var)
+    {
+        if (is_array($tpl_var)) {
+            foreach ($tpl_var as $curr_var) {
+                unset($this->tpl_vars[$curr_var]);
+            } 
+        } else {
+            unset($this->tpl_vars[$tpl_var]);
+        } 
+    } 
+
+    /**
+    * clear all the assigned template variables.
+    */
+    public function clear_all_assign()
+    {
+        $this->tpl_vars = array();
+    } 
+
+    /**
+    * load a config file, optionally load just selected sections
+    * 
+    * @param string $config_file filename
+    * @param mixed $sections array of section names, single section or null
+    */
+    public function config_load($config_file, $sections = null)
+    { 
+        // load Config class
+        $config = new Smarty_Internal_Config($config_file, $this->smarty);
+        $config->loadConfigVars($sections, $this);
+    } 
+
+    /**
+    * gets the object of a Smarty variable
+    * 
+    * @param string $variable the name of the Smarty variable
+    * @param object $_ptr optional pointer to data object
+    * @param boolean $search_parents search also in parent data
+    * @return object the object of the variable
+    */
+    public function getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
+    {
+        if ($_ptr === null) {
+            $_ptr = $this;
+        } while ($_ptr !== null) {
+            if (isset($_ptr->tpl_vars[$variable])) {
+                // found it, return it
+                return $_ptr->tpl_vars[$variable];
+            } 
+            // not found, try at parent
+            if ($search_parents) {
+                $_ptr = $_ptr->parent;
+            } else {
+                $_ptr = null;
+            } 
+        } 
+        if (isset($this->smarty->global_tpl_vars[$variable])) {
+            // found it, return it
+            return $this->smarty->global_tpl_vars[$variable];
+        } 
+        if ($this->smarty->error_unassigned && $error_enable) {
+            throw new Exception('Undefined Smarty variable "' . $variable . '"');
+        } else {
+            return new Undefined_Smarty_Variable;
+        } 
+    } 
+    /**
+    * gets  a config variable
+    * 
+    * @param string $variable the name of the config variable
+    * @return mixed the value of the config variable
+    */
+    public function getConfigVariable($variable)
+    {
+        $_ptr = $this;
+        while ($_ptr !== null) {
+            if (isset($_ptr->config_vars[$variable])) {
+                // found it, return it
+                return $_ptr->config_vars[$variable];
+            } 
+            // not found, try at parent
+            $_ptr = $_ptr->parent;
+        } 
+        if ($this->smarty->error_unassigned) {
+            throw new Exception('Undefined config variable "' . $variable . '"');
+        } else {
+            return '';
+        } 
+    } 
+    /**
+    * gets  a stream variable
+    * 
+    * @param string $variable the stream of the variable
+    * @return mixed the value of the stream variable
+    */
+    public function getStreamVariable($variable)
+    {
+        $_result = '';
+        if ($fp = fopen($variable, 'r+')) {
+            while (!feof($fp)) {
+                $_result .= fgets($fp);
+            } 
+            fclose($fp);
+            return $_result;
+        } 
+
+        if ($this->smarty->$error_unassigned) {
+            throw new Exception('Undefined stream variable "' . $variable . '"');
+        } else {
+            return '';
+        } 
+    } 
+
+    /**
+    * creates a template object
+    * 
+    * @param string $template the resource handle of the template file
+    * @param object $parent next higher level of Smarty variables
+    * @param mixed $cache_id cache id to be used with this template
+    * @param mixed $compile_id compile id to be used with this template
+    * @returns object template object
+    */
+    public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null)
+    {
+        if (is_object($cache_id) || is_array($cache_id)) {
+            $parent = $cache_id;
+            $cache_id = null;
+        } 
+        if (is_array($parent)) {
+            $data = $parent;
+            $parent = null;
+        } else {
+            $data = null;
+        } 
+        if (!is_object($template)) {
+            // we got a template resource
+            // already in template cache?
+            $_templateId = crc32($template . $cache_id . $compile_id);
+            if (isset($this->smarty->template_objects[$_templateId]) && $this->smarty->caching) {
+                // return cached template object
+                $tpl = $this->smarty->template_objects[$_templateId];
+            } else {
+                // create new template object
+                $tpl = new $this->template_class($template, $this->smarty, $parent, $cache_id, $compile_id);
+            } 
+        } else {
+            // just return a copy of template class
+            $tpl = $template;
+        } 
+        // fill data if present
+        if (is_array($data)) {
+            // set up variable values
+            foreach ($data as $_key => $_val) {
+                $tpl->tpl_vars[$_key] = new Smarty_variable($_val);
+            } 
+        } 
+        return $tpl;
+    } 
+
+    /**
+    * return current time
+    * 
+    * @returns double current time
+    */
+    function _get_time()
+    {
+        $_mtime = microtime();
+        $_mtime = explode(" ", $_mtime);
+        return (double)($_mtime[1]) + (double)($_mtime[0]);
+    } 
+} 
+
+/**
+* class for the Smarty data object
+* 
+* The Smarty data object will hold Smarty variables in the current scope
+* 
+* @param object $parent tpl_vars next higher level of Smarty variables
+*/
+class Smarty_Data extends Smarty_Internal_Data {
+    // array of variable objects
+    public $tpl_vars = array(); 
+    // back pointer to parent object
+    public $parent = null; 
+    // config vars
+    public $config_vars = array();
+    /**
+    * create Smarty data object
+    */
+    public function __construct ($_parent = null)
+    {
+        if (is_object($_parent)) {
+            // when object set up back pointer
+            $this->parent = $_parent;
+        } elseif (is_array($_parent)) {
+            // set up variable values
+            foreach ($_parent as $_key => $_val) {
+                $this->tpl_vars[$_key] = new Smarty_variable($_val);
+            } 
+        } else {
+            throw new Exception("Wrong type for template variables");
+        } 
+    } 
+} 
+/**
+* class for the Smarty variable object
+* 
+* This class defines the Smarty variable object
+*/
+class Smarty_Variable {
+    // template variable
+    public $value;
+    public $nocache;
+    public $scope;
+    /**
+    * create Smarty variable object
+    * 
+    * @param mixed $value the value to assign
+    * @param boolean $nocache if true any output of this variable will be not cached
+    * @param boolean $scope the scope the variable will have  (local,parent or root)
+    */
+    public function __construct ($value = null, $nocache = false, $scope = SMARTY_LOCAL_SCOPE)
+    {
+        $this->value = $value;
+        $this->nocache = $nocache;
+        $this->scope = $scope;
+    } 
+} 
+
+/**
+* class for undefined variable object
+* 
+* This class defines an object for undefined variable handling
+*/
+class Undefined_Smarty_Variable {
+    // return always false
+    public function __get ($name)
+    {
+        if ($name == 'nocache') {
+            return false;
+        } else {
+            return null;
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_debug.php b/gosa-core/include/smarty/sysplugins/smarty_internal_debug.php
new file mode 100644 (file)
index 0000000..9df0942
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+
+/**
+* Smarty Internal Plugin Debug
+* 
+* Class to collect data for the Smarty Debugging Consol
+* 
+* @package Smarty
+* @subpackage Debug
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Debug Class
+*/
+class Smarty_Internal_Debug extends Smarty_Internal_Data {
+    // template data
+    static $template_data = array();
+
+    /**
+    * Start logging of compile time
+    */
+    public static function start_compile($template)
+    {
+        $key = self::get_key($template);
+        self::$template_data[$key]['start_time'] = self::get_time();
+    } 
+
+    /**
+    * End logging of compile time
+    */
+    public static function end_compile($template)
+    {
+        $key = self::get_key($template);
+        self::$template_data[$key]['compile_time'] += self::get_time() - self::$template_data[$key]['start_time'];
+    } 
+
+    /**
+    * Start logging of render time
+    */
+    public static function start_render($template)
+    {
+        $key = self::get_key($template);
+        self::$template_data[$key]['start_time'] = self::get_time();
+    } 
+
+    /**
+    * End logging of compile time
+    */
+    public static function end_render($template)
+    {
+        $key = self::get_key($template);
+        self::$template_data[$key]['render_time'] += self::get_time() - self::$template_data[$key]['start_time'];
+    } 
+
+    /**
+    * Start logging of cache time
+    */
+    public static function start_cache($template)
+    {
+        $key = self::get_key($template);
+        self::$template_data[$key]['start_time'] = self::get_time();
+    } 
+
+    /**
+    * End logging of cache time
+    */
+    public static function end_cache($template)
+    {
+        $key = self::get_key($template);
+        self::$template_data[$key]['cache_time'] += self::get_time() - self::$template_data[$key]['start_time'];
+    } 
+    /**
+    * Opens a window for the Smarty Debugging Consol and display the data
+    */
+    public static function display_debug($smarty)
+    { 
+        // prepare information of assigned variables
+        $_assigned_vars = $smarty->tpl_vars;
+        ksort($_assigned_vars);
+        $_config_vars = $smarty->config_vars;
+        ksort($_config_vars);
+        $_template = new Smarty_Template ($smarty->debug_tpl, $smarty);
+        $_template->caching = false;
+        $_template->force_compile = false;
+        $_template->security = false;
+        $_template->cache_id = null;
+        $_template->compile_id = null;
+        $_template->assign('template_data', self::$template_data);
+        $_template->assign('assigned_vars', $_assigned_vars);
+        $_template->assign('config_vars', $_config_vars);
+        $_template->assign('execution_time', $smarty->_get_time() - $smarty->start_time);
+        echo $smarty->fetch($_template);
+    } 
+
+    /**
+    * get_key
+    */
+    static function get_key($template)
+    {
+        // calculate Uid if not already done
+        if ($template->templateUid == '') {
+            $template->getTemplateFilepath();
+        } 
+        $key = $template->templateUid;
+        if (isset(self::$template_data[$key])) {
+            return $key;
+        } else {
+            self::$template_data[$key]['name'] = $template->getTemplateFilepath();
+            self::$template_data[$key]['compile_time'] = 0;
+            self::$template_data[$key]['render_time'] = 0;
+            self::$template_data[$key]['cache_time'] = 0;
+            return $key;
+        } 
+    } 
+
+    /**
+    * return current time
+    * 
+    * @returns double current time
+    */
+    static function get_time()
+    {
+        $_mtime = microtime();
+        $_mtime = explode(" ", $_mtime);
+        return (double)($_mtime[1]) + (double)($_mtime[0]);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_filter_handler.php b/gosa-core/include/smarty/sysplugins/smarty_internal_filter_handler.php
new file mode 100644 (file)
index 0000000..1d81636
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+/**
+* Smarty Internal Plugin Filter Handler
+* 
+* Smarty filter handler class
+* 
+* @package Smarty
+* @subpackage PluginsInternal
+* @author Uwe Tews 
+*/
+
+/**
+* Class for filter processing
+*/
+class Smarty_Internal_Filter_Handler {
+    /**
+    * 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' or 'variable') which shall run
+    * @param string $content the content which shall be processed by the filters
+    * @return string the filtered content
+    */
+    static function runFilter($type, $content, $smarty, $flag = null)
+    {
+        $output = $content;
+        if ($type != 'variable' || ($smarty->variable_filter && $flag !== false) || $flag === true) {
+            // loop over autoload filters of specified type
+            if (!empty($smarty->autoload_filters[$type])) {
+                foreach ((array)$smarty->autoload_filters[$type] as $name) {
+                    $plugin_name = "Smarty_{$type}filter_{$name}";
+                    if ($smarty->loadPlugin($plugin_name)) {
+                        // use class plugin if found
+                        if (class_exists($plugin_name, false)) {
+                            // loaded class of filter plugin
+                            $output = call_user_func_array(array($plugin_name, 'execute'), array($output, $smarty));
+                        } elseif (function_exists($plugin_name)) {
+                            // use loaded Smarty2 style plugin
+                            $output = call_user_func_array($plugin_name, array($output, $smarty));
+                        } 
+                    } else {
+                        // nothing found, throw exception
+                        throw new Exception("Unable to load filter {$plugin_name}");
+                    } 
+                } 
+            } 
+            // loop over registerd filters of specified type
+            if (!empty($smarty->registered_filters[$type])) {
+                foreach ($smarty->registered_filters[$type] as $key => $name) {
+                    $output = call_user_func_array($smarty->registered_filters[$type][$key], array($output, $smarty));
+                } 
+            } 
+        } 
+        // return filtered output
+        return $output;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_function_call_handler.php b/gosa-core/include/smarty/sysplugins/smarty_internal_function_call_handler.php
new file mode 100644 (file)
index 0000000..cdbd3fa
--- /dev/null
@@ -0,0 +1,47 @@
+<?php\r
+/**\r
+* Smarty Internal Plugin Function Call Handler\r
+* \r
+* @package Smarty\r
+* @subpackage Security\r
+* @author Uwe Tews \r
+*/\r
+/**\r
+* This class does call function defined with the {function} tag\r
+*/\r
+class Smarty_Internal_Function_Call_Handler extends Smarty_Internal_Template {\r
+    function __construct($name, $smarty, $parent, $nocache)\r
+    {\r
+        parent::__construct('string:', $smarty, $parent);\r
+        if (!isset($this->smarty->template_functions[$name])) {\r
+            throw new Exception("Call to undefined template function \"{$name}\" in template \"{$parent->template_resource}\"");\r
+        } \r
+        $this->called_nocache = $nocache;\r
+        $this->mustCompile = false;\r
+        if ($nocache) {\r
+            $smarty->template_functions[$name]['called_nocache'] = true;\r
+            $this->properties['function'][$name]['called_nocache'] = true;\r
+        } \r
+        $this->properties['nocache_hash'] = $smarty->template_functions[$name]['nocache_hash']; \r
+        // load compiled function\r
+        if ($nocache) {\r
+            // if called in nocache mode convert nocache code to real code\r
+            $this->compiled_template = preg_replace(array("!(<\?php echo ')?/\*/?%%SmartyNocache:{$this->smarty->template_functions[$name]['nocache_hash']}%%\*/(';\?>)?!", "!\\\'!"), array('', "'"), $smarty->template_functions[$name]['compiled']);\r
+        } else {\r
+            $this->compiled_template = $smarty->template_functions[$name]['compiled'];\r
+        } \r
+        // assign default paramter\r
+        if (isset($smarty->template_functions[$name]['parameter'])) {\r
+            $_smarty_tpl = $this;\r
+            foreach ($smarty->template_functions[$name]['parameter'] as $_key => $_value) {\r
+                $this->assign($_key, eval("return {$_value};"));\r
+            } \r
+        } \r
+        // set flag if {function} contains nocache code\r
+        if ($smarty->template_functions[$name]['has_nocache_code']) {\r
+            $this->has_nocache_code = true;\r
+        } \r
+    } \r
+} \r
+\r
+?>\r
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_resource_extends.php b/gosa-core/include/smarty/sysplugins/smarty_internal_resource_extends.php
new file mode 100644 (file)
index 0000000..b796de7
--- /dev/null
@@ -0,0 +1,186 @@
+<?php
+
+/**
+* Smarty Internal Plugin Resource Extends
+* 
+* Implements the file system as resource for Smarty which does extend a chain of template files templates
+* 
+* @package Smarty
+* @subpackage TemplateResources
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Resource Extends
+*/
+class Smarty_Internal_Resource_Extends {
+    public function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+        $this->_rdl = preg_quote($smarty->right_delimiter);
+        $this->_ldl = preg_quote($smarty->left_delimiter);
+    } 
+    // classes used for compiling Smarty templates from file resource
+    public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
+    public $template_lexer_class = 'Smarty_Internal_Templatelexer';
+    public $template_parser_class = 'Smarty_Internal_Templateparser'; 
+    // properties
+    public $usesCompiler = true;
+    public $isEvaluated = false;
+    public $allFilepaths = array();
+
+    /**
+    * Return flag if template source is existing
+    * 
+    * @param object $_template template object
+    * @return boolean result
+    */
+    public function isExisting($_template)
+    {
+        if ($_template->getTemplateFilepath() === false) {
+            return false;
+        } else {
+            return true;
+        } 
+    } 
+    /**
+    * Get filepath to template source
+    * 
+    * @param object $_template template object
+    * @return string filepath to template source file
+    */
+    public function getTemplateFilepath($_template)
+    {
+        $sha1String = '';
+        $_files = explode('|', $_template->resource_name);
+        foreach ($_files as $_file) {
+            $_filepath = $_template->buildTemplateFilepath ($_file);
+            if ($_filepath !== false) {
+                if ($_template->security) {
+                    $_template->smarty->security_handler->isTrustedResourceDir($_filepath);
+                } 
+            } 
+            $sha1String .= $_filepath;
+            $this->allFilepaths[] = $_filepath;
+        } 
+        $_template->templateUid = sha1($sha1String);
+        return $_filepath;
+    } 
+
+    /**
+    * Get timestamp to template source
+    * 
+    * @param object $_template template object
+    * @return integer timestamp of template source file
+    */
+    public function getTemplateTimestamp($_template)
+    {
+        return filemtime($_template->getTemplateFilepath());
+    } 
+
+    /**
+    * Read template source from file
+    * 
+    * @param object $_template template object
+    * @return string content of template source file
+    */
+    public function getTemplateSource($_template)
+    {
+        $this->template = $_template;
+        $_files = array_reverse($this->allFilepaths);
+        foreach ($_files as $_filepath) {
+            // read template file
+            if ($_filepath === false) {
+                throw new Exception("Unable to load template 'file : {$_file}'");
+            } 
+            if ($_filepath != $_files[0]) {
+                $_template->properties['file_dependency'][sha1($_filepath)] = array($_filepath, filemtime($_filepath));
+            } 
+            $_template->template_filepath = $_filepath;
+            $_content = file_get_contents($_filepath);
+            if ($_filepath != $_files[count($_files)-1]) {
+                if (preg_match_all("!({$this->_ldl}block(.+?){$this->_rdl})!", $_content, $_open, PREG_OFFSET_CAPTURE) !=
+                        preg_match_all("!({$this->_ldl}/block(.*?){$this->_rdl})!", $_content, $_close, PREG_OFFSET_CAPTURE)) {
+                    $this->smarty->trigger_error('unmatched {block} {/block} pairs');
+                } 
+                $_block_count = count($_open[0]);
+                for ($_i = 0; $_i < $_block_count; $_i++) {
+                    $_block_content = str_replace($this->smarty->left_delimiter . '$smarty.parent' . $this->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',
+                        substr($_content, $_open[0][$_i][1] + strlen($_open[0][$_i][0]), $_close[0][$_i][1] - $_open[0][$_i][1] - strlen($_open[0][$_i][0])));
+                    $this->saveBlockData($_block_content, $_open[0][$_i][0], $_filepath);
+                } 
+            } else {
+                $_template->template_source = $_content;
+                return true;
+            } 
+        } 
+        // $_template->template_filepath = $saved_filepath;
+    } 
+    protected function saveBlockData($block_content, $block_tag, $_filepath)
+    {
+        if (0 == preg_match("!(.?)(name=)(.*?)(?=(\s|{$this->_rdl}))!", $block_tag, $_match)) {
+            $this->smarty->trigger_error("'{$block_tag}' missing name attribute");
+        } else {
+            $_name = trim($_match[3], '\'"');
+            if (isset($this->smarty->block_data[$_name])) {
+                if (strpos($this->smarty->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {
+                    $this->smarty->block_data[$_name]['source'] =
+                    str_replace('%%%%SMARTY_PARENT%%%%', $block_content, $this->smarty->block_data[$_name]['source']);
+                } elseif ($this->smarty->block_data[$_name]['mode'] == 'prepend') {
+                    $this->smarty->block_data[$_name]['source'] .= $block_content;
+                } elseif ($this->smarty->block_data[$_name]['mode'] == 'append') {
+                    $this->smarty->block_data[$_name]['source'] = $block_content . $this->smarty->block_data[$_name]['source'];
+                } 
+            } else {
+                $this->smarty->block_data[$_name]['source'] = $block_content;
+            } 
+            if (preg_match('/(.?)(append)(.*)/', $block_tag, $_match) != 0) {
+                $this->smarty->block_data[$_name]['mode'] = 'append';
+            } elseif (preg_match('/(.?)(prepend)(.*)/', $block_tag, $_match) != 0) {
+                $this->smarty->block_data[$_name]['mode'] = 'prepend';
+            } else {
+                $this->smarty->block_data[$_name]['mode'] = 'replace';
+            } 
+            $this->smarty->block_data[$_name]['file'] = $_filepath;
+        } 
+    } 
+
+    /**
+    * Get filepath to compiled template
+    * 
+    * @param object $_template template object
+    * @return string return path to compiled template
+    */
+    public function getCompiledFilepath($_template)
+    {
+        $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
+        $_files = explode('|', $_template->resource_name); 
+        // calculate Uid if not already done
+        if ($_template->templateUid == '') {
+            $_template->getTemplateFilepath();
+        } 
+        $_filepath = $_template->templateUid; 
+        // if use_sub_dirs, break file into directories
+        if ($_template->smarty->use_sub_dirs) {
+            $_filepath = substr($_filepath, 0, 2) . DS
+             . substr($_filepath, 2, 2) . DS
+             . substr($_filepath, 4, 2) . DS
+             . $_filepath;
+        } 
+        $_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
+        if (isset($_compile_id)) {
+            $_filepath = $_compile_id . $_compile_dir_sep . $_filepath;
+        } 
+        if ($_template->caching) {
+            $_cache = '.cache';
+        } else {
+            $_cache = '';
+        } 
+        $_compile_dir = $_template->smarty->compile_dir;
+        if (substr($_compile_dir, -1) != DS) {
+            $_compile_dir .= DS;
+        } 
+        return $_compile_dir . $_filepath . '.' . $_template->resource_type . '.' . basename($_files[count($_files)-1]) . $_cache . '.php';
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_resource_file.php b/gosa-core/include/smarty/sysplugins/smarty_internal_resource_file.php
new file mode 100644 (file)
index 0000000..b84f580
--- /dev/null
@@ -0,0 +1,127 @@
+<?php
+
+/**
+* Smarty Internal Plugin Resource File
+* 
+* Implements the file system as resource for Smarty templates
+* 
+* @package Smarty
+* @subpackage TemplateResources
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Resource File
+*/
+class Smarty_Internal_Resource_File {
+    public function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+    } 
+    // classes used for compiling Smarty templates from file resource
+    public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
+    public $template_lexer_class = 'Smarty_Internal_Templatelexer';
+    public $template_parser_class = 'Smarty_Internal_Templateparser'; 
+    // properties
+    public $usesCompiler = true;
+    public $isEvaluated = false;
+
+    /**
+    * Return flag if template source is existing
+    * 
+    * @return boolean true
+    */
+    public function isExisting($template)
+    {
+        if ($template->getTemplateFilepath() === false) {
+            return false;
+        } else {
+            return true;
+        } 
+    } 
+
+    /**
+    * Get filepath to template source
+    * 
+    * @param object $_template template object
+    * @return string filepath to template source file
+    */
+    public function getTemplateFilepath($_template)
+    {
+        $_filepath = $_template->buildTemplateFilepath ();
+
+        if ($_filepath !== false) {
+            if ($_template->security) {
+                $_template->smarty->security_handler->isTrustedResourceDir($_filepath);
+            } 
+        } 
+        $_template->templateUid = sha1($_filepath);
+        return $_filepath;
+    } 
+
+    /**
+    * Get timestamp to template source
+    * 
+    * @param object $_template template object
+    * @return integer timestamp of template source file
+    */
+    public function getTemplateTimestamp($_template)
+    {
+        return filemtime($_template->getTemplateFilepath());
+    } 
+
+    /**
+    * Read template source from file
+    * 
+    * @param object $_template template object
+    * @return string content of template source file
+    */
+    public function getTemplateSource($_template)
+    { 
+        // read template file
+        if (file_exists($_template->getTemplateFilepath())) {
+            $_template->template_source = file_get_contents($_template->getTemplateFilepath());
+            return true;
+        } else {
+            return false;
+        } 
+    } 
+
+    /**
+    * Get filepath to compiled template
+    * 
+    * @param object $_template template object
+    * @return string return path to compiled template
+    */
+    public function getCompiledFilepath($_template)
+    {
+        $_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
+        // calculate Uid if not already done
+        if ($_template->templateUid == '') {
+            $_template->getTemplateFilepath();
+        } 
+        $_filepath = $_template->templateUid; 
+        // if use_sub_dirs, break file into directories
+        if ($_template->smarty->use_sub_dirs) {
+            $_filepath = substr($_filepath, 0, 2) . DS
+             . substr($_filepath, 2, 2) . DS
+             . substr($_filepath, 4, 2) . DS
+             . $_filepath;
+        } 
+        $_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
+        if (isset($_compile_id)) {
+            $_filepath = $_compile_id . $_compile_dir_sep . $_filepath;
+        } 
+        if ($_template->caching) {
+            $_cache = '.cache';
+        } else {
+            $_cache = '';
+        } 
+        $_compile_dir = $_template->smarty->compile_dir;
+        if (strpos('/\\', substr($_compile_dir, -1)) === false) {
+            $_compile_dir .= DS;
+        } 
+        return $_compile_dir . $_filepath . '.' . $_template->resource_type . '.' . basename($_template->resource_name) . $_cache . '.php';
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_resource_php.php b/gosa-core/include/smarty/sysplugins/smarty_internal_resource_php.php
new file mode 100644 (file)
index 0000000..93176c3
--- /dev/null
@@ -0,0 +1,127 @@
+<?php
+
+/**
+* Smarty Internal Plugin Resource PHP
+* 
+* Implements the file system as resource for PHP templates
+* 
+* @package Smarty
+* @subpackage TemplateResources
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Resource PHP
+*/
+class Smarty_Internal_Resource_PHP {
+    /**
+    * Class constructor, enable short open tags
+    */
+    public function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+        ini_set('short_open_tag', '1');
+    } 
+    // properties
+    public $usesCompiler = false;
+    public $isEvaluated = false;
+
+    /**
+    * Return flag if template source is existing
+    * 
+    * @return boolean true
+    */
+    public function isExisting($template)
+    {
+        if ($template->getTemplateFilepath() === false) {
+            return false;
+        } else {
+            return true;
+        } 
+    } 
+
+    /**
+    * Get filepath to template source
+    * 
+    * @param object $_template template object
+    * @return string filepath to template source file
+    */
+    public function getTemplateFilepath($_template)
+    {
+        $_filepath = $_template->buildTemplateFilepath ();
+
+        if ($_template->security) {
+            $_template->smarty->security_handler->isTrustedResourceDir($_filepath);
+        } 
+        $_template->templateUid = sha1($_filepath);
+        return $_filepath;
+    } 
+
+    /**
+    * Get timestamp to template source
+    * 
+    * @param object $_template template object
+    * @return integer timestamp of template source file
+    */
+    public function getTemplateTimestamp($_template)
+    {
+        return filemtime($_template->getTemplateFilepath());
+    } 
+
+    /**
+    * Read template source from file
+    * 
+    * @param object $_template template object
+    * @return string content of template source file
+    */
+    public function getTemplateSource($_template)
+    {
+        if (file_exists($_template->getTemplateFilepath())) {
+            $_template->template_source = file_get_contents($_template->getTemplateFilepath());
+            return true;
+        } else {
+            return false;
+        } 
+    } 
+
+
+    /**
+    * Get filepath to compiled template
+    * 
+    * @param object $_template template object
+    * @return boolean return false as compiled template is not stored
+    */
+    public function getCompiledFilepath($_template)
+    { 
+        // no filepath for PHP templates
+        return false;
+    } 
+
+    /**
+    * renders the PHP template
+    */
+    public function renderUncompiled($_smarty_template)
+    {
+        if (!$this->smarty->allow_php_templates) {
+            throw new Exception("PHP templates are disabled");
+        } 
+        if ($this->getTemplateFilepath($_smarty_template) === false) {
+            throw new Exception("Unable to load template \"{$_smarty_template->resource_type} : {$_smarty_template->resource_name}\"");
+        } 
+        // prepare variables
+        $_smarty_ptr = $_smarty_template;
+        do {
+            foreach ($_smarty_ptr->tpl_vars as $_smarty_var => $_smarty_var_object) {
+                if (isset($_smarty_var_object->value)) {
+                    $$_smarty_var = $_smarty_var_object->value;
+                } 
+            } 
+            $_smarty_ptr = $_smarty_ptr->parent;
+        } while ($_smarty_ptr != null);
+        unset ($_smarty_var, $_smarty_var_object, $_smarty_ptr); 
+        // include PHP template
+        include($this->getTemplateFilepath($_smarty_template));
+        return;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_resource_registered.php b/gosa-core/include/smarty/sysplugins/smarty_internal_resource_registered.php
new file mode 100644 (file)
index 0000000..36a09cd
--- /dev/null
@@ -0,0 +1,137 @@
+<?php
+
+/**
+* Smarty Internal Plugin Resource Registered
+* 
+* Implements the registered resource for Smarty template
+* 
+* @package Smarty
+* @subpackage TemplateResources
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Resource Registered
+*/
+
+class Smarty_Internal_Resource_Registered {
+    public function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+    } 
+    // classes used for compiling Smarty templates from file resource
+    public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
+    public $template_lexer_class = 'Smarty_Internal_Templatelexer';
+    public $template_parser_class = 'Smarty_Internal_Templateparser';
+    // properties
+    public $usesCompiler = true;
+    public $isEvaluated = false;
+
+    /**
+    * Return flag if template source is existing
+    * 
+    * @return boolean true
+    */
+    public function isExisting($_template)
+    {
+        if (is_integer($this->getTemplateTimestamp($_template))) {
+            return true;
+        } else {
+            return false;
+        } 
+    } 
+    /**
+    * Get filepath to template source
+    * 
+    * @param object $_template template object
+    * @return string return 'string' as template source is not a file
+    */
+    public function getTemplateFilepath($_template)
+    { 
+        // no filepath for strings
+        // return "string" for compiler error messages
+           $_filepath = $_template->resource_type .':'.$_template->resource_name;
+        $_template->templateUid = sha1($_filepath);
+        return $_filepath;
+ } 
+
+    /**
+    * Get timestamp to template source
+    * 
+    * @param object $_template template object
+    * @return boolean false as string resources have no timestamp
+    */
+    public function getTemplateTimestamp($_template)
+    { 
+        // return timestamp
+        $time_stamp = false;
+        call_user_func_array($this->smarty->_plugins['resource'][$_template->resource_type][0][1],
+            array($_template->resource_name, &$time_stamp, $this->smarty));
+        return is_numeric($time_stamp) ? (int)$time_stamp : $time_stamp;
+    } 
+    /**
+    * Get timestamp to template source by type and name
+    * 
+    * @param object $_template template object
+    * @return boolean false as string resources have no timestamp
+    */
+    public function getTemplateTimestampTypeName($_resource_type, $_resource_name)
+    { 
+        // return timestamp
+        $time_stamp = false;
+        call_user_func_array($this->smarty->_plugins['resource'][$_resource_type][0][1],
+            array($_resource_name, &$time_stamp, $this->smarty));
+        return is_numeric($time_stamp) ? (int)$time_stamp : $time_stamp;
+    } 
+
+    /**
+    * Retuen template source from resource name
+    * 
+    * @param object $_template template object
+    * @return string content of template source
+    */
+    public function getTemplateSource($_template)
+    { 
+        // return template string
+        return call_user_func_array($this->smarty->_plugins['resource'][$_template->resource_type][0][0],
+            array($_template->resource_name, &$_template->template_source, $this->smarty));
+    } 
+
+    /**
+    * Get filepath to compiled template
+    * 
+    * @param object $_template template object
+    * @return boolean return false as compiled template is not stored
+    */
+    public function getCompiledFilepath($_template)
+    { 
+        $_compile_id =  isset($_template->compile_id) ? preg_replace('![^\w\|]+!','_',$_template->compile_id) : null;
+        // calculate Uid if not already done
+        if ($_template->templateUid == '') {
+            $_template->getTemplateFilepath();
+        } 
+        $_filepath = $_template->templateUid; 
+        // if use_sub_dirs, break file into directories
+        if ($_template->smarty->use_sub_dirs) {
+            $_filepath = substr($_filepath, 0, 2) . DS
+             . substr($_filepath, 2, 2) . DS
+             . substr($_filepath, 4, 2) . DS
+             . $_filepath;
+        } 
+        $_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
+        if (isset($_compile_id)) {
+            $_filepath = $_compile_id . $_compile_dir_sep . $_filepath;
+        } 
+        if ($_template->caching) {
+            $_cache = '.cache';
+        } else {
+            $_cache = '';
+        } 
+        $_compile_dir = $_template->smarty->compile_dir;
+        if (strpos('/\\', substr($_compile_dir, -1)) === false) {
+            $_compile_dir .= DS;
+        } 
+        return $_compile_dir . $_filepath . '.' . $_template->resource_type . '.' . basename($_template->resource_name) . $_cache . '.php';
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_resource_stream.php b/gosa-core/include/smarty/sysplugins/smarty_internal_resource_stream.php
new file mode 100644 (file)
index 0000000..2024a3a
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+
+/**
+* Smarty Internal Plugin Resource Stream
+* 
+* Implements the streams as resource for Smarty template
+* 
+* @package Smarty
+* @subpackage TemplateResources
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Resource Stream
+*/
+
+class Smarty_Internal_Resource_Stream {
+    public function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+    } 
+    // classes used for compiling Smarty templates from file resource
+    public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
+    public $template_lexer_class = 'Smarty_Internal_Templatelexer';
+    public $template_parser_class = 'Smarty_Internal_Templateparser';
+    // properties
+    public $usesCompiler = true;
+    public $isEvaluated = true;
+
+    /**
+    * Return flag if template source is existing
+    * 
+    * @return boolean true
+    */
+    public function isExisting($template)
+    {
+        if ($template->getTemplateSource() == '') {
+            return false;
+        } else {
+            return true;
+        } 
+    } 
+    /**
+    * Get filepath to template source
+    * 
+    * @param object $_template template object
+    * @return string return 'string' as template source is not a file
+    */
+    public function getTemplateFilepath($_template)
+    { 
+        // no filepath for strings
+        // return resource name for compiler error messages
+        return str_replace(':', '://', $_template->template_resource);
+    } 
+
+    /**
+    * Get timestamp to template source
+    * 
+    * @param object $_template template object
+    * @return boolean false as string resources have no timestamp
+    */
+    public function getTemplateTimestamp($_template)
+    { 
+        // strings must always be compiled and have no timestamp
+        return false;
+    } 
+
+    /**
+    * Retuen template source from resource name
+    * 
+    * @param object $_template template object
+    * @return string content of template source
+    */
+    public function getTemplateSource($_template)
+    { 
+        // return template string
+        $_template->template_source = '';
+        $fp = fopen(str_replace(':', '://', $_template->template_resource),'r+');
+        while (!feof($fp)) {
+            $_template->template_source .= fgets($fp);
+        } 
+        fclose($fp);
+
+        return true;
+    } 
+
+    /**
+    * Get filepath to compiled template
+    * 
+    * @param object $_template template object
+    * @return boolean return false as compiled template is not stored
+    */
+    public function getCompiledFilepath($_template)
+    { 
+        // no filepath for strings
+        return false;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_resource_string.php b/gosa-core/include/smarty/sysplugins/smarty_internal_resource_string.php
new file mode 100644 (file)
index 0000000..ad519b3
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+
+/**
+* Smarty Internal Plugin Resource String
+* 
+* Implements the strings as resource for Smarty template
+* 
+* @package Smarty
+* @subpackage TemplateResources
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Resource String
+*/
+
+class Smarty_Internal_Resource_String {
+    public function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+    } 
+    // classes used for compiling Smarty templates from file resource
+    public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
+    public $template_lexer_class = 'Smarty_Internal_Templatelexer';
+    public $template_parser_class = 'Smarty_Internal_Templateparser';
+    // properties
+    public $usesCompiler = true;
+    public $isEvaluated = true;
+
+    /**
+    * Return flag if template source is existing
+    * 
+    * @return boolean true
+    */
+    public function isExisting($template)
+    {
+        return true;
+    } 
+
+    /**
+    * Get filepath to template source
+    * 
+    * @param object $_template template object
+    * @return string return 'string' as template source is not a file
+    */
+    public function getTemplateFilepath($_template)
+    { 
+        // no filepath for strings
+        // return "string" for compiler error messages
+        return 'string';
+    } 
+
+    /**
+    * Get timestamp to template source
+    * 
+    * @param object $_template template object
+    * @return boolean false as string resources have no timestamp
+    */
+    public function getTemplateTimestamp($_template)
+    { 
+        // strings must always be compiled and have no timestamp
+        return false;
+    } 
+
+    /**
+    * Retuen template source from resource name
+    * 
+    * @param object $_template template object
+    * @return string content of template source
+    */
+    public function getTemplateSource($_template)
+    { 
+        // return template string
+        $_template->template_source = $_template->resource_name;
+        return true;
+    } 
+
+    /**
+    * Get filepath to compiled template
+    * 
+    * @param object $_template template object
+    * @return boolean return false as compiled template is not stored
+    */
+    public function getCompiledFilepath($_template)
+    { 
+        // no filepath for strings
+        return false;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_security_handler.php b/gosa-core/include/smarty/sysplugins/smarty_internal_security_handler.php
new file mode 100644 (file)
index 0000000..f433e9e
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+/**
+* Smarty Internal Plugin Security Handler
+* 
+* @package Smarty
+* @subpackage Security
+* @author Uwe Tews 
+*/
+/**
+* This class contains all methods for security checking
+*/
+class Smarty_Internal_Security_Handler {
+    function __construct($smarty)
+    {
+        $this->smarty = $smarty;
+    } 
+    /**
+    * Check if PHP function is trusted.
+    * 
+    * @param string $function_name 
+    * @param object $compiler compiler object
+    * @return boolean true if function is trusted
+    */
+    function isTrustedPhpFunction($function_name, $compiler)
+    {
+        if (empty($this->smarty->security_policy->php_functions) || in_array($function_name, $this->smarty->security_policy->php_functions)) {
+            return true;
+        } else {
+            $compiler->trigger_template_error ("PHP function \"" . $function_name . "\" not allowed by security setting");
+            return false;
+        } 
+    } 
+
+    /**
+    * Check if modifier is trusted.
+    * 
+    * @param string $modifier_name 
+    * @param object $compiler compiler object
+    * @return boolean true if modifier is trusted
+    */
+    function isTrustedModifier($modifier_name, $compiler)
+    {
+        if (empty($this->smarty->security_policy->modifiers) || in_array($modifier_name, $this->smarty->security_policy->modifiers)) {
+            return true;
+        } else {
+            $compiler->trigger_template_error ("modifier \"" . $modifier_name . "\" not allowed by security setting");
+            return false;
+        } 
+    } 
+    /**
+    * Check if stream is trusted.
+    * 
+    * @param string $stream_name 
+    * @param object $compiler compiler object
+    * @return boolean true if stream is trusted
+    */
+    function isTrustedStream($stream_name)
+    {
+        if (empty($this->smarty->security_policy->streams) || in_array($stream_name, $this->smarty->security_policy->streams)) {
+            return true;
+        } else {
+            throw new Exception ("stream \"" . $stream_name . "\" not allowed by security setting");
+            return false;
+        } 
+    } 
+
+    /**
+    * Check if directory of file resource is trusted.
+    * 
+    * @param string $filepath 
+    * @param object $compiler compiler object
+    * @return boolean true if directory is trusted
+    */
+    function isTrustedResourceDir($filepath)
+    {
+        $_rp = realpath($filepath);
+        if (isset($this->smarty->template_dir)) {
+            foreach ((array)$this->smarty->template_dir as $curr_dir) {
+                if (($_cd = realpath($curr_dir)) !== false &&
+                        strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+                        (strlen($_rp) == strlen($_cd) || substr($_rp, strlen($_cd), 1) == DS)) {
+                    return true;
+                } 
+            } 
+        } 
+        if (!empty($this->smarty->security_policy->secure_dir)) {
+            foreach ((array)$this->smarty->security_policy->secure_dir as $curr_dir) {
+                if (($_cd = realpath($curr_dir)) !== false) {
+                    if ($_cd == $_rp) {
+                        return true;
+                    } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+                            (strlen($_rp) == strlen($_cd) || substr($_rp, strlen($_cd), 1) == DS)) {
+                        return true;
+                    } 
+                } 
+            } 
+        } 
+
+        throw new Exception ("directory \"" . $_rp . "\" not allowed by security setting");
+        return false;
+    } 
+    /**
+    * Check if directory of file resource is trusted.
+    * 
+    * @param string $filepath 
+    * @param object $compiler compiler object
+    * @return boolean true if directory is trusted
+    */
+    function isTrustedPHPDir($filepath)
+    {
+        $_rp = realpath($filepath);
+        if (!empty($this->smarty->security_policy->trusted_dir)) {
+            foreach ((array)$this->smarty->security_policy->trusted_dir as $curr_dir) {
+                if (($_cd = realpath($curr_dir)) !== false) {
+                    if ($_cd == $_rp) {
+                        return true;
+                    } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+                            substr($_rp, strlen($_cd), 1) == DS) {
+                        return true;
+                    } 
+                } 
+            } 
+        } 
+
+        throw new Exception ("directory \"" . $_rp . "\" not allowed by security setting");
+        return false;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_smartytemplatecompiler.php b/gosa-core/include/smarty/sysplugins/smarty_internal_smartytemplatecompiler.php
new file mode 100644 (file)
index 0000000..2246f03
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+
+/**
+* Smarty Internal Plugin Smarty Template Compiler Base
+* 
+* This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser
+* 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Class SmartyTemplateCompiler
+*/
+class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase {
+    /**
+    * Initialize compiler
+    */
+    public function __construct($lexer_class, $parser_class, $smarty)
+    {
+        $this->smarty = $smarty;
+        parent::__construct(); 
+        // get required plugins
+        $this->lexer_class = $lexer_class;
+        $this->parser_class = $parser_class;
+    } 
+
+    /**
+    * Methode to compile a Smarty template
+    * 
+    * @param  $_content template source
+    * @return bool true if compiling succeeded, false if it failed
+    */
+    protected function doCompile($_content)
+    {
+        /* here is where the compiling takes place. Smarty
+       tags in the templates are replaces with PHP code,
+       then written to compiled files. */ 
+        // init the lexer/parser to compile the template
+        $this->lex = new $this->lexer_class($_content, $this);
+        $this->parser = new $this->parser_class($this->lex, $this); 
+        if (isset($this->smarty->_parserdebug)) $this->parser->PrintTrace();
+        // get tokens from lexer and parse them
+        while ($this->lex->yylex() && !$this->abort_and_recompile) {
+            if (isset($this->smarty->_parserdebug)) echo "<pre>Line {$this->lex->line} Parsing  {$this->parser->yyTokenName[$this->lex->token]} Token ".htmlentities($this->lex->value)."</pre>";
+            $this->parser->doParse($this->lex->token, $this->lex->value);
+        } 
+
+        if ($this->abort_and_recompile) {
+            // exit here on abort
+            return false;
+        } 
+        // finish parsing process
+        $this->parser->doParse(0, 0); 
+        // check for unclosed tags
+        if (count($this->_tag_stack) > 0) {
+            // get stacked info
+            list($_open_tag, $_data) = array_pop($this->_tag_stack);
+            $this->trigger_template_error("unclosed {" . $_open_tag . "} tag");
+        } 
+
+        if (!$this->compile_error) {
+            // return compiled code
+            // return str_replace(array("? >\n<?php","? ><?php"), array('',''), $this->parser->retvalue);
+            return $this->parser->retvalue;
+        } else {
+            // compilation error
+            return false;
+        } 
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_template.php b/gosa-core/include/smarty/sysplugins/smarty_internal_template.php
new file mode 100644 (file)
index 0000000..fab9d08
--- /dev/null
@@ -0,0 +1,810 @@
+<?php
+
+/**
+* Smarty Internal Plugin Template
+* 
+* This file contains the Smarty template engine
+* 
+* @package Smarty
+* @subpackage Templates
+* @author Uwe Tews 
+*/
+
+/**
+* Main class with template data structures and methods
+*/
+class Smarty_Internal_Template extends Smarty_Internal_Data {
+    // object cache
+    public $compiler_object = null;
+    public $cacher_object = null; 
+    // Smarty parameter
+    public $cache_id = null;
+    public $compile_id = null;
+    public $caching = null;
+    public $cache_lifetime = null;
+    public $cacher_class = null;
+    public $caching_type = null;
+    public $force_compile = null;
+    public $forceNocache = false; 
+    // Template resource
+    public $template_resource = null;
+    public $resource_type = null;
+    public $resource_name = null;
+    public $resource_object = null;
+    private $isExisting = null;
+    public $templateUid = '';
+    // Template source
+    public $template_filepath = null;
+    public $template_source = null;
+    private $template_timestamp = null; 
+    // Compiled template
+    private $compiled_filepath = null;
+    public $compiled_template = null;
+    private $compiled_timestamp = null;
+    public $mustCompile = null;
+    public $suppressHeader = false;
+    public $suppressFileDependency = false;
+    public $extract_code = false;
+    public $extracted_compiled_code = '';
+    public $has_nocache_code = false; 
+    // Rendered content
+    public $rendered_content = null; 
+    // Cache file
+    private $cached_filepath = null;
+    public $cached_timestamp = null;
+    private $isCached = null;
+    private $cache_resource_object = null;
+    private $cacheFileChecked = false; 
+    // template variables
+    public $tpl_vars = array();
+    public $parent = null;
+    public $config_vars = array(); 
+    // storage for plugin
+    public $plugin_data = array(); 
+    // special properties
+    public $properties = array ('file_dependency' => array(),
+        'nocache_hash' => '',
+        'function' => array()); 
+    // storage for block data
+    public $block_data = array(); 
+    // required plugins
+    public $required_plugins = array('compiled' => array(), 'cache' => array());
+
+    /**
+    * Create template data object
+    * 
+    * Some of the global Smarty settings copied to template scope
+    * It load the required template resources and cacher plugins
+    * 
+    * @param string $template_resource template resource string
+    * @param object $_parent back pointer to parent object with variables or null
+    * @param mixed $_cache_id cache id or null
+    * @param mixed $_compile_id compile id or null
+    */
+    public function __construct($template_resource, $smarty, $_parent = null, $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null)
+    {
+        $this->smarty = &$smarty; 
+        // Smarty parameter
+        $this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
+        $this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id;
+        $this->force_compile = $this->smarty->force_compile;
+        $this->caching = $_caching === null ? $this->smarty->caching : $_caching;
+        if ($this->caching === true) $this->caching = SMARTY_CACHING_LIFETIME_CURRENT;
+        $this->cache_lifetime = $_cache_lifetime === null ?$this->smarty->cache_lifetime : $_cache_lifetime;
+        $this->force_cache = $this->smarty->force_cache;
+        $this->security = $this->smarty->security;
+        $this->parent = $_parent; 
+        // dummy local smarty variable
+        $this->tpl_vars['smarty'] = new Smarty_Variable; 
+        // Template resource
+        $this->template_resource = $template_resource; 
+        // parse resource name
+        if (!$this->parseResourceName ($template_resource, $this->resource_type, $this->resource_name, $this->resource_object)) {
+            throw new Exception ("Unable to parse resource name \"{$template_resource}\"");
+        } 
+        // load cache resource
+        if (!$this->resource_object->isEvaluated && ($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) {
+            $this->cache_resource_object = $this->smarty->loadCacheResource();
+        } 
+    } 
+
+    /**
+    * Returns the template filepath
+    * 
+    * The template filepath is determined by the actual resource handler
+    * 
+    * @return string the template filepath
+    */
+    public function getTemplateFilepath ()
+    {
+        return $this->template_filepath === null ?
+        $this->template_filepath = $this->resource_object->getTemplateFilepath($this) :
+        $this->template_filepath;
+    } 
+
+    /**
+    * Returns the timpestamp of the template source
+    * 
+    * The template timestamp is determined by the actual resource handler
+    * 
+    * @return integer the template timestamp
+    */
+    public function getTemplateTimestamp ()
+    {
+        return $this->template_timestamp === null ?
+        $this->template_timestamp = $this->resource_object->getTemplateTimestamp($this) :
+        $this->template_timestamp;
+    } 
+
+    /**
+    * Returns the template source code
+    * 
+    * The template source is being read by the actual resource handler
+    * 
+    * @return string the template source
+    */
+    public function getTemplateSource ()
+    {
+        if ($this->template_source === null) {
+            if (!$this->resource_object->getTemplateSource($this)) {
+                throw new Exception("Unable to read template {$this->resource_type} '{$this->resource_name}'");
+            } 
+        } 
+        return $this->template_source;
+    } 
+
+    /**
+    * Returns if the  template is existing
+    * 
+    * The status is determined by the actual resource handler
+    * 
+    * @return boolean true if the template exists
+    */
+    public function isExisting ($error = false)
+    {
+        if ($this->isExisting === null) {
+            $this->isExisting = $this->resource_object->isExisting($this);
+        } 
+        if (!$this->isExisting && $error) {
+            throw new Exception("Unable to load template {$this->resource_type} '{$this->resource_name}'");
+        } 
+        return $this->isExisting;
+    } 
+
+    /**
+    * 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
+    * 
+    * @return boolean true if the template must be compiled
+    */
+    public function mustCompile ()
+    {
+        $this->isExisting(true);
+        if ($this->mustCompile === null) {
+            $this->mustCompile = ($this->resource_object->usesCompiler && ($this->force_compile || $this->resource_object->isEvaluated || $this->getCompiledTimestamp () === false || 
+                    // ($this->smarty->compile_check && $this->getCompiledTimestamp () !== $this->getTemplateTimestamp ())));
+                    ($this->smarty->compile_check && $this->getCompiledTimestamp () < $this->getTemplateTimestamp ())));
+        } 
+        return $this->mustCompile;
+    } 
+
+    /**
+    * Returns the compiled template filepath
+    * 
+    * @return string the template filepath
+    */
+    public function getCompiledFilepath ()
+    {
+        return $this->compiled_filepath === null ?
+        ($this->compiled_filepath = !$this->resource_object->isEvaluated ? $this->resource_object->getCompiledFilepath($this) : false) :
+        $this->compiled_filepath;
+    } 
+
+    /**
+    * Returns the timpestamp of the compiled template
+    * 
+    * @return integer the template timestamp
+    */
+    public function getCompiledTimestamp ()
+    {
+        return $this->compiled_timestamp === null ?
+        ($this->compiled_timestamp = (!$this->resource_object->isEvaluated && file_exists($this->getCompiledFilepath())) ? filemtime($this->getCompiledFilepath()) : false) :
+        $this->compiled_timestamp;
+    } 
+
+    /**
+    * Returns the compiled template 
+    * 
+    * It checks if the template must be compiled or just read from the template resource
+    * 
+    * @return string the compiled template
+    */
+    public function getCompiledTemplate ()
+    {
+        if ($this->compiled_template === null) {
+            // see if template needs compiling.
+            if ($this->mustCompile()) {
+                $this->compileTemplateSource();
+            } else {
+                if ($this->compiled_template === null) {
+                    $this->compiled_template = !$this->resource_object->isEvaluated && $this->resource_object->usesCompiler ? file_get_contents($this->getCompiledFilepath()) : false;
+                } 
+            } 
+        } 
+        return $this->compiled_template;
+    } 
+
+    /**
+    * Compiles the template
+    * 
+    * If the template is not evaluated the compiled template is saved on disk
+    */
+    public function compileTemplateSource ()
+    {
+        if (!$this->resource_object->isEvaluated) {
+            $this->properties['file_dependency'] = array();
+            $this->properties['file_dependency'][$this->templateUid] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp());
+        } 
+        if ($this->smarty->debugging) {
+            Smarty_Internal_Debug::start_compile($this);
+        } 
+        // compile template
+        if (!is_object($this->compiler_object)) {
+            // load compiler
+            $this->smarty->loadPlugin($this->resource_object->compiler_class);
+            $this->compiler_object = new $this->resource_object->compiler_class($this->resource_object->template_lexer_class, $this->resource_object->template_parser_class, $this->smarty);
+        } 
+        // call compiler
+        if ($this->compiler_object->compileTemplate($this)) {
+            // compiling succeded
+            if (!$this->resource_object->isEvaluated) {
+                // write compiled template
+                Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->compiled_template, $this->smarty); 
+            } 
+        } else {
+            // error compiling template
+            throw new Exception("Error compiling template {$this->getTemplateFilepath ()}");
+            return false;
+        } 
+        if ($this->smarty->debugging) {
+            Smarty_Internal_Debug::end_compile($this);
+        } 
+    } 
+
+    /**
+    * Returns the filepath of the cached template output
+    * 
+    * The filepath is determined by the actual cache resource
+    * 
+    * @return string the cache filepath
+    */
+    public function getCachedFilepath ()
+    {
+        return $this->cached_filepath === null ?
+        $this->cached_filepath = ($this->resource_object->isEvaluated || !($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) ? false : $this->cache_resource_object->getCachedFilepath($this) :
+        $this->cached_filepath;
+    } 
+
+    /**
+    * Returns the timpestamp of the cached template output
+    * 
+    * The timestamp is determined by the actual cache resource
+    * 
+    * @return integer the template timestamp
+    */
+    public function getCachedTimestamp ()
+    {
+        return $this->cached_timestamp === null ?
+        $this->cached_timestamp = ($this->resource_object->isEvaluated || !($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) ? false : $this->cache_resource_object->getCachedTimestamp($this) :
+        $this->cached_timestamp;
+    } 
+
+    /**
+    * Returns the cached template output
+    * 
+    * @return string |booelan the template content or false if the file does not exist
+    */
+    public function getCachedContent ()
+    {
+        return $this->rendered_content === null ?
+        $this->rendered_content = ($this->resource_object->isEvaluated || !($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) ? false : $this->cache_resource_object->getCachedContents($this) :
+        $this->rendered_content;
+    } 
+
+    /**
+    * Writes the cached template output
+    */
+    public function writeCachedContent ($content)
+    {
+        if ($this->resource_object->isEvaluated || !($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED)) {
+            // don't write cache file
+            return false;
+        } 
+        $this->properties['cache_lifetime'] = $this->cache_lifetime;
+        return $this->cache_resource_object->writeCachedContent($this, $this->createPropertyHeader(true) . $content);
+    } 
+
+    /**
+    * Checks of a valid version redered HTML output is in the cache
+    * 
+    * If the cache is valid the contents is stored in the template object
+    * 
+    * @return boolean true if cache is valid
+    */
+    public function isCached ()
+    {
+        if ($this->isCached === null) {
+            $this->isCached = false;
+            if (($this->caching == SMARTY_CACHING_LIFETIME_CURRENT || $this->caching == SMARTY_CACHING_LIFETIME_SAVED) && !$this->resource_object->isEvaluated && !$this->force_compile && !$this->force_cache) {
+                $cachedTimestamp = $this->getCachedTimestamp();
+                if ($cachedTimestamp === false) {
+                    return $this->isCached;
+                } 
+                if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED || ($this->caching == SMARTY_CACHING_LIFETIME_CURRENT && (time() <= ($cachedTimestamp + $this->cache_lifetime) || $this->cache_lifetime < 0))) {
+                    if ($this->smarty->debugging) {
+                        Smarty_Internal_Debug::start_cache($this);
+                    } 
+                    $this->rendered_content = $this->cache_resource_object->getCachedContents($this);
+                    if ($this->smarty->debugging) {
+                        Smarty_Internal_Debug::end_cache($this);
+                    } 
+                    if ($this->cacheFileChecked) {
+                        $this->isCached = true;
+                        return $this->isCached;
+                    } 
+                    $this->cacheFileChecked = true;
+                    if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED && $this->properties['cache_lifetime'] > 0 && (time() > ($this->getCachedTimestamp() + $this->properties['cache_lifetime']))) {
+                        $this->rendered_content = null;
+                        return $this->isCached;
+                    } 
+                    if (!empty($this->properties['file_dependency']) && $this->smarty->compile_check) {
+                        foreach ($this->properties['file_dependency'] as $_file_to_check) {
+                            $this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name);
+                            If ($resource_type == 'file') {
+                                $mtime = filemtime($_file_to_check[0]);
+                            } else {
+                                $resource_handler = $this->loadTemplateResourceHandler($resource_type);
+                                $mtime = $resource_handler->getTemplateTimestampTypeName($resource_type, $resource_name);
+                            } 
+                            // If ($mtime > $this->getCachedTimestamp()) {
+                            If ($mtime > $_file_to_check[1]) {
+                                $this->rendered_content = null;
+                                return $this->isCached;
+                            } 
+                        } 
+                    } 
+                    $this->isCached = true;
+                } 
+            } 
+        } 
+        return $this->isCached;
+    } 
+
+    /**
+    * Render the output using the compiled template or the PHP template source
+    * 
+    * The rendering process is accomplished by just including the PHP files.
+    * The only exceptions are evaluated templates (string template). Their code has 
+    * to be evaluated
+    */
+    public function renderTemplate ()
+    {
+        if ($this->resource_object->usesCompiler) {
+            if ($this->mustCompile() && $this->compiled_template === null) {
+                $this->compileTemplateSource();
+            } 
+            if ($this->smarty->debugging) {
+                Smarty_Internal_Debug::start_render($this);
+            } 
+            $_smarty_tpl = $this;
+            ob_start();
+            if ($this->resource_object->isEvaluated) {
+                eval("?>" . $this->compiled_template);
+            } else {
+                include($this->getCompiledFilepath ()); 
+                // check file dependencies at compiled code
+                if ($this->smarty->compile_check) {
+                    if (!empty($this->properties['file_dependency'])) {
+                        $this->mustCompile = false;
+                        foreach ($this->properties['file_dependency'] as $_file_to_check) {
+                            $this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name);
+                            If ($resource_type == 'file') {
+                                $mtime = filemtime($_file_to_check[0]);
+                            } else {
+                                $resource_handler = $this->loadTemplateResourceHandler($resource_type);
+                                $mtime = $resource_handler->getTemplateTimestampTypeName($resource_type, $resource_name);
+                            } 
+                            // If ($mtime != $_file_to_check[1]) {
+                            If ($mtime > $_file_to_check[1]) {
+                                $this->mustCompile = true;
+                                break;
+                            } 
+                        } 
+                        if ($this->mustCompile) {
+                            // recompile and render again
+                            ob_get_clean();
+                            $this->compileTemplateSource();
+                            ob_start();
+                            include($this->getCompiledFilepath ());
+                        } 
+                    } 
+                } 
+            } 
+        } else {
+            if (is_callable(array($this->resource_object, 'renderUncompiled'))) {
+                if ($this->smarty->debugging) {
+                    Smarty_Internal_Debug::start_render($this);
+                } 
+                ob_start();
+                $this->resource_object->renderUncompiled($this);
+            } else {
+                throw new Exception("Resource '$this->resource_type' must have 'renderUncompiled' methode");
+            } 
+        } 
+        $this->rendered_content = ob_get_clean();
+        if (!$this->resource_object->isEvaluated && empty($this->properties['file_dependency'][$this->templateUid])) {
+            $this->properties['file_dependency'][$this->templateUid] = array($this->getTemplateFilepath(), $this->getTemplateTimestamp());
+        } 
+        if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) {
+            $this->parent->properties['file_dependency'] = array_merge($this->parent->properties['file_dependency'], $this->properties['file_dependency']);
+            $this->parent->required_plugins['compiled'] = array_merge($this->parent->required_plugins['compiled'], $this->required_plugins['compiled']);
+            $this->parent->required_plugins['cache'] = array_merge($this->parent->required_plugins['cache'], $this->required_plugins['cache']);
+        } 
+        if ($this->smarty->debugging) {
+            Smarty_Internal_Debug::end_render($this);
+        } 
+        // write to cache when nessecary
+        if (!$this->resource_object->isEvaluated && ($this->caching == SMARTY_CACHING_LIFETIME_SAVED || $this->caching == SMARTY_CACHING_LIFETIME_CURRENT)) {
+            if ($this->smarty->debugging) {
+                Smarty_Internal_Debug::start_cache($this);
+            } 
+            $this->properties['has_nocache_code'] = false; 
+            // get text between non-cached items
+            $cache_split = preg_split("!/\*%%SmartyNocache:{$this->properties['nocache_hash']}%%\*\/(.+?)/\*/%%SmartyNocache:{$this->properties['nocache_hash']}%%\*/!s", $this->rendered_content); 
+            // get non-cached items
+            preg_match_all("!/\*%%SmartyNocache:{$this->properties['nocache_hash']}%%\*\/(.+?)/\*/%%SmartyNocache:{$this->properties['nocache_hash']}%%\*/!s", $this->rendered_content, $cache_parts);
+            $output = ''; 
+            // loop over items, stitch back together
+            foreach($cache_split as $curr_idx => $curr_split) {
+                // escape PHP tags in template content
+                $output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php echo \'$1\'; ?>', $curr_split);
+                if (isset($cache_parts[0][$curr_idx])) {
+                    $this->properties['has_nocache_code'] = true; 
+                    // remove nocache tags from cache output
+                    $output .= preg_replace("!/\*/?%%SmartyNocache:{$this->properties['nocache_hash']}%%\*/!", '', $cache_parts[0][$curr_idx]);
+                } 
+            } 
+            // rendering (must be done before writing cache file because of {function} nocache handling)
+            $_smarty_tpl = $this;
+            ob_start();
+            eval("?>" . $output);
+            $this->rendered_content = ob_get_clean(); 
+            // write cache file content
+            $this->writeCachedContent($output); 
+            if ($this->smarty->debugging) {
+                Smarty_Internal_Debug::end_cache($this);
+            } 
+        } else {
+            // var_dump('renderTemplate', $this->has_nocache_code, $this->template_resource, $this->properties['nocache_hash'], $this->parent->properties['nocache_hash'], $this->rendered_content);
+            if ($this->has_nocache_code && !empty($this->properties['nocache_hash']) && !empty($this->parent->properties['nocache_hash'])) {
+                // replace nocache_hash
+                $this->rendered_content = preg_replace("/{$this->properties['nocache_hash']}/", $this->parent->properties['nocache_hash'], $this->rendered_content);
+                $this->parent->has_nocache_code = $this->has_nocache_code;
+            } 
+        } 
+    } 
+
+    /**
+    * Returns the rendered HTML output 
+    * 
+    * If the cache is valid the cached content is used, otherwise
+    * the output is rendered from the compiled template or PHP template source
+    * 
+    * @return string rendered HTML output
+    */
+    public function getRenderedTemplate ()
+    { 
+        // disable caching for evaluated code
+        if ($this->resource_object->isEvaluated) {
+            $this->caching = false;
+        } 
+        // checks if template exists
+        $this->isExisting(true); 
+        // read from cache or render
+        if ($this->rendered_content === null && !$this->isCached()) {
+            // render template (not loaded and not in cache)
+            $this->renderTemplate();
+        } 
+        $this->updateParentVariables();
+        $this->isCached = null;
+        return $this->rendered_content;
+    } 
+
+    /**
+    * Parse a template resource in its name and type
+    * Load required resource handler
+    * 
+    * @param string $template_resource template resource specification
+    * @param string $resource_type return resource type
+    * @param string $resource_name return resource name
+    * @param object $resource_handler return resource handler object
+    */
+    public function parseResourceName($template_resource, &$resource_type, &$resource_name, &$resource_handler)
+    {
+        if (empty($template_resource))
+            return false;
+        $this->getResourceTypeName($template_resource, $resource_type, $resource_name);
+        $resource_handler = $this->loadTemplateResourceHandler($resource_type); 
+        // cache template object under a unique ID
+        // do not cache string resources
+        // *****        if ($resource_type != 'string' && $this->smarty->caching) {
+        if ($resource_type != 'string') {
+            $this->smarty->template_objects[crc32($this->template_resource . $this->cache_id . $this->compile_id)] = $this;
+        } 
+        return true;
+    } 
+
+    /**
+    * get system filepath to template
+    */
+    public function buildTemplateFilepath ($file = null)
+    {
+        if ($file == null) {
+            $file = $this->resource_name;
+        } 
+        foreach((array)$this->smarty->template_dir as $_template_dir) {
+            if (strpos('/\\', substr($_template_dir, -1)) === false) {
+                $_template_dir .= DS;
+            } 
+
+            $_filepath = $_template_dir . $file;
+            if (file_exists($_filepath))
+                return $_filepath;
+        } 
+        if (file_exists($file)) return $file; 
+        // no tpl file found
+        if (!empty($this->smarty->default_template_handler_func)) {
+            if (!is_callable($this->smarty->default_template_handler_func)) {
+                throw new Exception("Default template handler not callable");
+            } else {
+                $_return = call_user_func_array($this->smarty->default_template_handler_func,
+                    array($this->resource_type, $this->resource_name, &$this->template_source, &$this->template_timestamp, $this));
+                if (is_string($_return)) {
+                    return $_return;
+                } elseif ($_return === true) {
+                    return $file;
+                } 
+            } 
+        } 
+        // throw new Exception("Unable to load template \"{$file}\"");
+        return false;
+    } 
+
+    /**
+    * Update Smarty variables in other scopes
+    */
+    public function updateParentVariables ($scope = SMARTY_LOCAL_SCOPE)
+    {
+        $has_root = false;
+        foreach ($this->tpl_vars as $_key => $_variable) {
+            $_variable_scope = $this->tpl_vars[$_key]->scope;
+            if ($scope == SMARTY_LOCAL_SCOPE && $_variable_scope == SMARTY_LOCAL_SCOPE) {
+                continue;
+            } 
+            if (isset($this->parent) && ($scope == SMARTY_PARENT_SCOPE || $_variable_scope == SMARTY_PARENT_SCOPE)) {
+                if (isset($this->parent->tpl_vars[$_key])) {
+                    // variable is already defined in parent, copy value
+                    $this->parent->tpl_vars[$_key]->value = $this->tpl_vars[$_key]->value;
+                } else {
+                    // create variable in parent
+                    $this->parent->tpl_vars[$_key] = clone $_variable;
+                    $this->parent->tpl_vars[$_key]->scope = SMARTY_LOCAL_SCOPE;
+                } 
+            } 
+            if ($scope == SMARTY_ROOT_SCOPE || $_variable_scope == SMARTY_ROOT_SCOPE) {
+                if ($this->parent == null) {
+                    continue;
+                } 
+                if (!$has_root) {
+                    // find  root
+                    $root_ptr = $this;
+                    while ($root_ptr->parent != null) {
+                        $root_ptr = $root_ptr->parent;
+                        $has_root = true;
+                    } 
+                } 
+                if (isset($root_ptr->tpl_vars[$_key])) {
+                    // variable is already defined in root, copy value
+                    $root_ptr->tpl_vars[$_key]->value = $this->tpl_vars[$_key]->value;
+                } else {
+                    // create variable in root
+                    $root_ptr->tpl_vars[$_key] = clone $_variable;
+                    $root_ptr->tpl_vars[$_key]->scope = SMARTY_LOCAL_SCOPE;
+                } 
+            } 
+            if ($scope == SMARTY_GLOBAL_SCOPE || $_variable_scope == SMARTY_GLOBAL_SCOPE) {
+                if (isset($this->smarty->global_tpl_vars[$_key])) {
+                    // variable is already defined in root, copy value
+                    $this->smarty->global_tpl_vars[$_key]->value = $this->tpl_vars[$_key]->value;
+                } else {
+                    // create variable in root
+                    $this->smarty->global_tpl_vars[$_key] = clone $_variable;
+                } 
+                $this->smarty->global_tpl_vars[$_key]->scope = SMARTY_LOCAL_SCOPE;
+            } 
+        } 
+    } 
+
+    /**
+    * Split a template resource in its name and type
+    * 
+    * @param string $template_resource template resource specification
+    * @param string $resource_type return resource type
+    * @param string $resource_name return resource name
+    */
+    private function getResourceTypeName ($template_resource, &$resource_type, &$resource_name)
+    {
+        if (strpos($template_resource, ':') === false) {
+            // no resource given, use default
+            $resource_type = $this->smarty->default_resource_type;
+            $resource_name = $template_resource;
+        } else {
+            // get type and name from path
+            list($resource_type, $resource_name) = explode(':', $template_resource, 2);
+            if (strlen($resource_type) == 1) {
+                // 1 char is not resource type, but part of filepath
+                $resource_type = 'file';
+                $resource_name = $template_resource;
+            } else {
+                $resource_type = strtolower($resource_type);
+            } 
+        } 
+    } 
+
+    /**
+    * Load template resource handler by type
+    * 
+    * @param string $resource_type template resource type
+    * @return object resource handler object
+    */
+    private function loadTemplateResourceHandler ($resource_type)
+    { 
+        // try registered resource
+        if (isset($this->smarty->_plugins['resource'][$resource_type])) {
+            return new Smarty_Internal_Resource_Registered($this->smarty);
+        } else {
+            // try sysplugins dir
+            if (in_array($resource_type, array('file', 'string', 'extends', 'php', 'registered', 'stream'))) {
+                $_resource_class = 'Smarty_Internal_Resource_' . $resource_type;
+                return new $_resource_class($this->smarty);
+            } else {
+                // try plugins dir
+                $_resource_class = 'Smarty_Resource_' . $resource_type;
+                if ($this->smarty->loadPlugin($_resource_class)) {
+                    if (class_exists($_resource_class, false)) {
+                        return new $_resource_class($this->smarty);
+                    } else {
+                        $this->smarty->register_resource($resource_type,
+                            array("smarty_resource_{$resource_type}_source",
+                                "smarty_resource_{$resource_type}_timestamp",
+                                "smarty_resource_{$resource_type}_secure",
+                                "smarty_resource_{$resource_type}_trusted"));
+                        return new Smarty_Internal_Resource_Registered($this->smarty);
+                    } 
+                } else {
+                    // try streams
+                    $_known_stream = stream_get_wrappers();
+                    if (in_array($resource_type, $_known_stream)) {
+                        // is known stream
+                        if ($this->smarty->security) {
+                            $this->smarty->security_handler->isTrustedStream($resource_type);
+                        } 
+                        return new Smarty_Internal_Resource_Stream($this->smarty);
+                    } else {
+                        throw new Exception('Unkown resource type \'' . $resource_type . '\'');
+                    } 
+                } 
+            } 
+        } 
+    } 
+
+    /**
+    * Create property header
+    */
+    public function createPropertyHeader ($cache = false)
+    {
+        $plugins_string = ''; 
+        // include code for plugins
+        if (!$cache) {
+            if (!empty($this->required_plugins['compiled'])) {
+                $plugins_string = '<?php ';
+                foreach($this->required_plugins['compiled'] as $plugin_name => $data) {
+                    $plugin = 'smarty_' . $data['type'] . '_' . $plugin_name;
+                    $plugins_string .= "if (!is_callable('{$plugin}')) include '{$data['file']}';\n";
+                } 
+                $plugins_string .= '?>';
+            } 
+            if (!empty($this->required_plugins['cache'])) {
+                $this->has_nocache_code = true;
+                $plugins_string .= "<?php echo '/*%%SmartyNocache:{$this->properties['nocache_hash']}%%*/<?php ";
+                foreach($this->required_plugins['cache'] as $plugin_name => $data) {
+                    $plugin = 'smarty_' . $data['type'] . '_' . $plugin_name;
+                    $plugins_string .= "if (!is_callable(\'{$plugin}\')) include \'{$data['file']}\';\n";
+                } 
+                $plugins_string .= "?>/*/%%SmartyNocache:{$this->properties['nocache_hash']}%%*/';?>\n";
+            } 
+        } 
+        // build property code
+        $this->properties['has_nocache_code'] = $this->has_nocache_code;
+        $properties_string = "<?php /*%%SmartyHeaderCode:{$this->properties['nocache_hash']}%%*/" ;
+        if ($this->smarty->direct_access_security) {
+            $properties_string .= "if(!defined('SMARTY_DIR')) exit('no direct access allowed');\n";
+        } 
+        if ($cache) {
+            // remove compiled code of{function} definition
+            unset($this->properties['function']);
+            if (!empty($this->smarty->template_functions)) {
+                // copy code of {function} tags called in nocache mode
+                foreach ($this->smarty->template_functions as $name => $function_data) {
+                    if (isset($function_data['called_nocache'])) {
+                        unset($function_data['called_nocache'], $this->smarty->template_functions[$name]['called_nocache']);
+                        $this->properties['function'][$name] = $function_data;
+                    } 
+                } 
+            } 
+        } 
+        $properties_string .= "\$_smarty_tpl->decodeProperties(" . var_export($this->properties, true) . "); /*/%%SmartyHeaderCode%%*/?>\n";
+        return $properties_string . $plugins_string;
+    } 
+
+    /**
+    * Decode saved properties from compiled template and cache files
+    */
+    public function decodeProperties ($properties)
+    {
+        $this->has_nocache_code = $properties['has_nocache_code'];
+        $this->properties['nocache_hash'] = $properties['nocache_hash'];
+        if (isset($properties['cache_lifetime'])) {
+            $this->properties['cache_lifetime'] = $properties['cache_lifetime'];
+        } 
+        if (isset($properties['file_dependency'])) {
+            $this->properties['file_dependency'] = array_merge($this->properties['file_dependency'], $properties['file_dependency']);
+        } 
+        if (!empty($properties['function'])) {
+            $this->properties['function'] = array_merge($this->properties['function'], $properties['function']);
+            $this->smarty->template_functions = array_merge($this->smarty->template_functions, $properties['function']);
+        } 
+    } 
+
+    /**
+    * wrapper for display
+    */
+    public function display ()
+    {
+        return $this->smarty->display($this);
+    } 
+
+    /**
+    * wrapper for fetch
+    */
+    public function fetch ()
+    {
+        return $this->smarty->fetch($this);
+    } 
+    /**
+    * wrapper for is_cached
+    */
+    public function is_cached ()
+    {
+        return $this->iscached($this);
+    } 
+} 
+
+/**
+* wrapper for template class
+*/
+class Smarty_Template extends Smarty_Internal_Template {
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_templatecompilerbase.php b/gosa-core/include/smarty/sysplugins/smarty_internal_templatecompilerbase.php
new file mode 100644 (file)
index 0000000..68e3efd
--- /dev/null
@@ -0,0 +1,404 @@
+<?php\r
+/**\r
+* Smarty Internal Plugin Smarty Template Compiler Base\r
+* \r
+* This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser\r
+* \r
+* @package Smarty\r
+* @subpackage Compiler\r
+* @author Uwe Tews \r
+*/\r
+/**\r
+* Main compiler class\r
+*/\r
+class Smarty_Internal_TemplateCompilerBase {\r
+    // hash for nocache sections\r
+    private $nocache_hash = null; \r
+    // suppress generation of nocache code\r
+    public $suppressNocacheProcessing = false;\r
+    // compile tag objects\r
+    static $_tag_objects = array(); \r
+    // tag stack\r
+    public $_tag_stack = array(); \r
+    // current template\r
+    public $template = null; \r
+    // required plugins\r
+    public $required_plugins_call = array(); \r
+\r
+    /**\r
+    * Initialize compiler\r
+    */\r
+    public function __construct()\r
+    {\r
+        $this->nocache_hash = str_replace('.', '-', uniqid(rand(), true));\r
+    } \r
+    // abstract function doCompile($_content);\r
+    /**\r
+    * Methode to compile a Smarty template\r
+    * \r
+    * @param  $template template object to compile\r
+    * @return bool true if compiling succeeded, false if it failed\r
+    */\r
+    public function compileTemplate($template)\r
+    {\r
+        if (empty($template->properties['nocache_hash'])) {\r
+            $template->properties['nocache_hash'] = $this->nocache_hash;\r
+        } else {\r
+            $this->nocache_hash = $template->properties['nocache_hash'];\r
+        } \r
+        /* here is where the compiling takes place. Smarty\r
+       tags in the templates are replaces with PHP code,\r
+       then written to compiled files. */\r
+        // flag for nochache sections\r
+        $this->nocache = false;\r
+        $this->tag_nocache = false; \r
+        // assume successfull compiling\r
+        $this->compile_error = false; \r
+        // save template object in compiler class\r
+        $this->template = $template;\r
+        $this->smarty->_current_file = $this->template->getTemplateFilepath(); \r
+        // template header code\r
+        $template_header = '';\r
+        if (!$template->suppressHeader) {\r
+            $template_header .= "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";\r
+            $template_header .= "         compiled from \"" . $this->template->getTemplateFilepath() . "\" */ ?>\n";\r
+        } \r
+\r
+        do {\r
+            // flag for aborting current and start recompile\r
+            $this->abort_and_recompile = false; \r
+            // get template source\r
+            $_content = $template->getTemplateSource(); \r
+            // run prefilter if required\r
+            if (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) {\r
+                $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $this->smarty);\r
+            } \r
+            // on empty template just return header\r
+            if ($_content == '') {\r
+                if ($template->suppressFileDependency) {\r
+                    $template->compiled_template = '';\r
+                } else {\r
+                    $template->compiled_template = $template_header . $template->createPropertyHeader();\r
+                } \r
+                return true;\r
+            } \r
+            // call compiler\r
+            $_compiled_code = $this->doCompile($_content);\r
+        } while ($this->abort_and_recompile);\r
+        if (!$this->compile_error) {\r
+            // return compiled code to template object\r
+            if ($template->suppressFileDependency) {\r
+                $template->compiled_template = $_compiled_code;\r
+            } else {\r
+                $template->compiled_template = $template_header . $template->createPropertyHeader() . $_compiled_code;\r
+            } \r
+            // run postfilter if required\r
+            if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {\r
+                $template->compiled_template = Smarty_Internal_Filter_Handler::runFilter('post', $template->compiled_template, $this->smarty);\r
+            } \r
+            return true;\r
+        } else {\r
+            // compilation error\r
+            return false;\r
+        } \r
+    } \r
+\r
+    /**\r
+    * Compile Tag\r
+    * \r
+    * This is a call back from the lexer/parser\r
+    * It executes the required compile plugin for the Smarty tag\r
+    * \r
+    * @param string $tag tag name\r
+    * @param array $args array with tag attributes\r
+    * @return string compiled code\r
+    */\r
+    public function compileTag($tag, $args)\r
+    { \r
+        // $args contains the attributes parsed and compiled by the lexer/parser\r
+        // assume that tag does compile into code, but creates no HTML output\r
+        $this->has_code = true;\r
+        $this->has_output = false; \r
+        // compile the smarty tag (required compile classes to compile the tag are autoloaded)\r
+        if (($_output = $this->callTagCompiler($tag, $args)) === false) {\r
+            if (isset($this->smarty->template_functions[$tag])) {\r
+                // template defined by {template} tag\r
+                $args['name'] = "'" . $tag . "'";\r
+                $_output = $this->callTagCompiler('call', $args);\r
+            } \r
+        } \r
+        if ($_output !== false) {\r
+            if ($_output !== true) {\r
+                // did we get compiled code\r
+                if ($this->has_code) {\r
+                    // Does it create output?\r
+                    if ($this->has_output) {\r
+                        $_output .= "\n";\r
+                    } \r
+                    // return compiled code\r
+                    return $_output;\r
+                } \r
+            } \r
+            // tag did not produce compiled code\r
+            return '';\r
+        } else {\r
+            // not an internal compiler tag\r
+            if (strlen($tag) < 6 || substr_compare($tag, 'close', -5, 5) != 0) {\r
+                // check if tag is a registered object\r
+                if (isset($this->smarty->registered_objects[$tag]) && isset($args['object_methode'])) {\r
+                    $methode = $args['object_methode'];\r
+                    unset ($args['object_methode']);\r
+                    if (!in_array($methode, $this->smarty->registered_objects[$tag][3]) &&\r
+                            (empty($this->smarty->registered_objects[$tag][1]) || in_array($methode, $this->smarty->registered_objects[$tag][1]))) {\r
+                        return $this->callTagCompiler('private_object_function', $args, $tag, $methode);\r
+                    } elseif (in_array($methode, $this->smarty->registered_objects[$tag][3])) {\r
+                        return $this->callTagCompiler('private_object_block_function', $args, $tag, $methode);\r
+                    } else {\r
+                        return $this->trigger_template_error ('unallowed methode "' . $methode . '" in registered object "' . $tag . '"', $this->lex->taglineno);\r
+                    } \r
+                } \r
+                // check if tag is registered\r
+                foreach (array('compiler', 'function', 'block') as $type) {\r
+                    if (isset($this->smarty->registered_plugins[$type][$tag])) {\r
+                        // if compiler function plugin call it now\r
+                        if ($type == 'compiler') {\r
+                            if (!$this->smarty->registered_plugins[$type][$tag][1]) {\r
+                                $this->tag_nocache = true;\r
+                            } \r
+                            return call_user_func_array($this->smarty->registered_plugins[$type][$tag][0], array($args, $this));\r
+                        } \r
+                        // compile registered function or block function\r
+                        if ($type == 'function' || $type == 'block') {\r
+                            return $this->callTagCompiler('private_registered_' . $type, $args, $tag);\r
+                        } \r
+                    } \r
+                } \r
+                // check plugins from plugins folder\r
+                foreach ($this->smarty->plugin_search_order as $plugin_type) {\r
+                    if ($plugin_type == 'compiler' && $this->smarty->loadPlugin('smarty_compiler_' . $tag)) {\r
+                        $plugin = 'smarty_compiler_' . $tag;\r
+                        if (class_exists($plugin, false)) {\r
+                            $plugin = array(new $plugin, 'compile');\r
+                        } \r
+                        if (is_callable($plugin)) {\r
+                            return call_user_func_array($plugin, array($args, $this));\r
+                        } else {\r
+                            throw new Exception("Plugin \"{$tag}\" not callable");\r
+                        } \r
+                    } else {\r
+                        if ($function = $this->getPlugin($tag, $plugin_type)) {\r
+                            return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $tag, $function);\r
+                        } \r
+                    } \r
+                } \r
+            } else {\r
+                // compile closing tag of block function\r
+                $base_tag = substr($tag, 0, -5); \r
+                // check if closing tag is a registered object\r
+                if (isset($this->smarty->registered_objects[$base_tag]) && isset($args['object_methode'])) {\r
+                    $methode = $args['object_methode'];\r
+                    unset ($args['object_methode']);\r
+                    if (in_array($methode, $this->smarty->registered_objects[$base_tag][3])) {\r
+                        return $this->callTagCompiler('private_object_block_function', $args, $tag, $methode);\r
+                    } else {\r
+                        return $this->trigger_template_error ('unallowed closing tag methode "' . $methode . '" in registered object "' . $base_tag . '"', $this->lex->taglineno);\r
+                    } \r
+                } \r
+                // registered block tag ?\r
+                if (isset($this->smarty->registered_plugins['block'][$base_tag])) {\r
+                    return $this->callTagCompiler('private_registered_block', $args, $tag);\r
+                } \r
+                // block plugin?\r
+                if ($function = $this->getPlugin($base_tag, 'block')) {\r
+                    return $this->callTagCompiler('private_block_plugin', $args, $tag, $function);\r
+                } \r
+                if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {\r
+                    $plugin = 'smarty_compiler_' . $tag;\r
+                    if (class_exists($plugin, false)) {\r
+                        $plugin = array(new $plugin, 'compile');\r
+                    } \r
+                    if (is_callable($plugin)) {\r
+                        return call_user_func_array($plugin, array($args, $this));\r
+                    } else {\r
+                        throw new Exception("Plugin \"{$tag}\" not callable");\r
+                    } \r
+                } \r
+            } \r
+            $this->trigger_template_error ("unknown tag \"" . $tag . "\"", $this->lex->taglineno);\r
+        } \r
+    } \r
+\r
+    /**\r
+    * lazy loads internal compile plugin for tag and calls the compile methode\r
+    * \r
+    * compile objects cached for reuse.\r
+    * class name format:  Smarty_Internal_Compile_TagName\r
+    * plugin filename format: Smarty_Internal_Tagname.php\r
+    * \r
+    * @param  $tag string tag name\r
+    * @param  $args array with tag attributes\r
+    * @param  $param1 optional parameter\r
+    * @param  $param2 optional parameter\r
+    * @param  $param3 optional parameter\r
+    * @return string compiled code\r
+    */\r
+    public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null)\r
+    { \r
+        // re-use object if already exists\r
+        if (isset(self::$_tag_objects[$tag])) {\r
+            // compile this tag\r
+            return call_user_func(array(self::$_tag_objects[$tag], 'compile'), $args, $this, $param1, $param2, $param3);\r
+        } \r
+        // lazy load internal compiler plugin\r
+        $class_name = 'Smarty_Internal_Compile_' . $tag;\r
+        if ($this->smarty->loadPlugin($class_name)) {\r
+            // use plugin if found\r
+            self::$_tag_objects[$tag] = new $class_name; \r
+            // compile this tag\r
+            return call_user_func(array(self::$_tag_objects[$tag], 'compile'), $args, $this, $param1, $param2, $param3);\r
+        } \r
+        // no internal compile plugin for this tag\r
+        return false;\r
+    } \r
+\r
+    /**\r
+    * Check for plugins and return function name\r
+    * \r
+    * @param  $pugin_name string name of plugin or function\r
+    * @param  $type string type of plugin\r
+    * @return string call name of function\r
+    */\r
+    public function getPlugin($plugin_name, $type)\r
+    {\r
+        if (isset($this->template->required_plugins_call[$plugin_name][$type])) {\r
+            if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\r
+                if (isset($this->template->required_plugins['compiled'][$plugin_name])) {\r
+                    $this->template->required_plugins['cache'][$plugin_name] = $this->template->required_plugins['compiled'][$plugin_name];\r
+                } \r
+            } else {\r
+                if (isset($this->template->required_plugins['cache'][$plugin_name])) {\r
+                    $this->template->required_plugins['compiled'][$plugin_name] = $this->template->required_plugins['compiled'][$plugin_name];\r
+                } \r
+            } \r
+            if ($type == 'modifier') {\r
+                $this->template->saved_modifer[$plugin_name] = true;\r
+            } \r
+            return $this->template->required_plugins_call[$plugin_name][$type];\r
+        } \r
+        // loop through plugin dirs and find the plugin\r
+        $plugin = 'smarty_' . $type . '_' . $plugin_name;\r
+        $found = false;\r
+        foreach((array)$this->smarty->plugins_dir as $_plugin_dir) {\r
+            $file = rtrim($_plugin_dir, '/\\') . DS . $type . '.' . $plugin_name . '.php';\r
+            if (file_exists($file)) {\r
+                // require_once($file);\r
+                $found = true;\r
+                break;\r
+            } \r
+        } \r
+        if ($found) {\r
+            // if (is_callable($plugin)) {\r
+            $this->template->required_plugins_call[$plugin_name][$type] = $plugin;\r
+            if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\r
+                $this->template->required_plugins['cache'][$plugin_name]['file'] = $file;\r
+                $this->template->required_plugins['cache'][$plugin_name]['type'] = $type;\r
+            } else {\r
+                $this->template->required_plugins['compiled'][$plugin_name]['file'] = $file;\r
+                $this->template->required_plugins['compiled'][$plugin_name]['type'] = $type;\r
+            } \r
+            if ($type == 'modifier') {\r
+                $this->template->saved_modifer[$plugin_name] = true;\r
+            } \r
+\r
+            return $plugin;\r
+        } \r
+        if (is_callable($plugin)) {\r
+            // plugin function is defined in the script\r
+            return $plugin;\r
+        } \r
+        return false;\r
+    } \r
+    /**\r
+    * Inject inline code for nocache template sections\r
+    * \r
+    * This method gets the content of each template element from the parser.\r
+    * If the content is compiled code and it should be not cached the code is injected\r
+    * into the rendered output.\r
+    * \r
+    * @param string $content content of template element\r
+    * @param boolean $tag_nocache true if the parser detected a nocache situation\r
+    * @param boolean $is_code true if content is compiled code\r
+    * @return string content\r
+    */\r
+    public function processNocacheCode ($content, $is_code)\r
+    { \r
+        // If the template is not evaluated and we have a nocache section and or a nocache tag\r
+        if ($is_code && !empty($content)) {\r
+            // generate replacement code\r
+            if ((!$this->template->resource_object->isEvaluated || $this->template->forceNocache) && $this->template->caching && !$this->suppressNocacheProcessing &&\r
+                    ($this->nocache || $this->tag_nocache || $this->template->forceNocache == 2)) {\r
+                $this->tag_nocache = false;\r
+                $this->template->has_nocache_code = true;\r
+                $_output = str_replace("'", "\'", $content);\r
+                $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>"; \r
+                // make sure we include modifer plugins for nocache code\r
+                if (isset($this->template->saved_modifer)) {\r
+                    foreach ($this->template->saved_modifer as $plugin_name => $dummy) {\r
+                        if (isset($this->template->required_plugins['compiled'][$plugin_name])) {\r
+                            $this->template->required_plugins['cache'][$plugin_name] = $this->template->required_plugins['compiled'][$plugin_name];\r
+                        } \r
+                    } \r
+                    unset($this->template->saved_modifer);\r
+                } \r
+            } else {\r
+                $_output = $content;\r
+            } \r
+        } else {\r
+            $_output = $content;\r
+        } \r
+        $this->suppressNocacheProcessing = false;\r
+        return $_output;\r
+    } \r
+    /**\r
+    * display compiler error messages without dying\r
+    * \r
+    * If parameter $args is empty it is a parser detected syntax error.\r
+    * In this case the parser is called to obtain information about expected tokens.\r
+    * \r
+    * If parameter $args contains a string this is used as error message\r
+    * \r
+    * @param  $args string individual error message or null\r
+    */\r
+    public function trigger_template_error($args = null, $line = null)\r
+    { \r
+        // get template source line which has error\r
+        if (!isset($line)) {\r
+            $line = $this->lex->line;\r
+        } \r
+        $match = preg_split("/\n/", $this->lex->data);\r
+        $error_text = 'Syntax Error in template "' . $this->template->getTemplateFilepath() . '"  on line ' . $line . ' "' . $match[$line-1] . '" ';\r
+        if (isset($args)) {\r
+            // individual error message\r
+            $error_text .= $args;\r
+        } else {\r
+            // expected token from parser\r
+            foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {\r
+                $exp_token = $this->parser->yyTokenName[$token];\r
+                if (isset($this->lex->smarty_token_names[$exp_token])) {\r
+                    // token type from lexer\r
+                    $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';\r
+                } else {\r
+                    // otherwise internal token name\r
+                    $expect[] = $this->parser->yyTokenName[$token];\r
+                } \r
+            } \r
+            // output parser error message\r
+            $error_text .= ' - Unexpected "' . $this->lex->value . '", expected one of: ' . implode(' , ', $expect);\r
+        } \r
+        throw new Exception($error_text); \r
+        // set error flag\r
+        $this->compile_error = true;\r
+    } \r
+} \r
+\r
+?>\r
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_templatelexer.php b/gosa-core/include/smarty/sysplugins/smarty_internal_templatelexer.php
new file mode 100644 (file)
index 0000000..fb25984
--- /dev/null
@@ -0,0 +1,1831 @@
+<?php
+/**
+* Smarty Internal Plugin Templatelexer
+*
+* This is the lexer to break the template source into tokens 
+* @package Smarty
+* @subpackage Compiler
+* @author Uwe Tews 
+*/
+/**
+* Smarty Internal Plugin Templatelexer
+*/
+class Smarty_Internal_Templatelexer
+{
+    public $data;
+    public $counter;
+    public $token;
+    public $value;
+    public $node;
+    public $line;
+    public $taglineno;
+    public $state = 1;
+    public $strip = false;
+    private $heredoc_id_stack = Array();
+    public $smarty_token_names = array (               // Text for parser error messages
+                               'IDENTITY'      => '===',
+                               'NONEIDENTITY'  => '!==',
+                               'EQUALS'        => '==',
+                               'NOTEQUALS'     => '!=',
+                               'GREATEREQUAL' => '(>=,ge)',
+                               'LESSEQUAL' => '(<=,le)',
+                               'GREATERTHAN' => '(>,gt)',
+                               'LESSTHAN' => '(<,lt)',
+                               'MOD' => '(%,mod)',
+                               'NOT'                   => '(!,not)',
+                               'LAND'          => '(&&,and)',
+                               'LOR'                   => '(||,or)',
+                               'LXOR'                  => 'xor',
+                               'OPENP'         => '(',
+                               'CLOSEP'        => ')',
+                               'OPENB'         => '[',
+                               'CLOSEB'        => ']',
+                               'PTR'                   => '->',
+                               'APTR'          => '=>',
+                               'EQUAL'         => '=',
+                               'NUMBER'        => 'number',
+                               'UNIMATH'       => '+" , "-',
+                               'MATH'          => '*" , "/" , "%',
+                               'INCDEC'        => '++" , "--',
+                               'SPACE'         => ' ',
+                               'DOLLAR'        => '$',
+                               'SEMICOLON' => ';',
+                               'COLON'         => ':',
+                               'DOUBLECOLON'           => '::',
+                               'AT'            => '@',
+                               'HATCH'         => '#',
+                               'QUOTE'         => '"',
+                               'BACKTICK'              => '`',
+                               'VERT'          => '|',
+                               'DOT'                   => '.',
+                               'COMMA'         => '","',
+                               'ANDSYM'                => '"&"',
+                               'QMARK'         => '"?"',
+                               'ID'                    => 'identifier',
+                               'OTHER'         => 'text',
+                               'FAKEPHPSTARTTAG'       => 'Fake PHP start tag',
+                               'PHPSTARTTAG'   => 'PHP start tag',
+                               'PHPENDTAG'     => 'PHP end tag',
+                                               'LITERALSTART'  => 'Literal start',
+                                               'LITERALEND'    => 'Literal end',
+                               'LDELSLASH' => 'closing tag',
+                               'COMMENT' => 'comment',
+                               'LITERALEND' => 'literal close',
+                               'AS' => 'as',
+                               'TO' => 'to',
+                               'NULL' => 'null',
+                               'BOOLEAN' => 'boolean'
+                               );
+                               
+                               
+    function __construct($data,$compiler)
+    {
+        // set instance object
+        self::instance($this); 
+        $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
+        $this->counter = 0;
+        $this->line = 1;
+        $this->smarty = $compiler->smarty;
+        $this->compiler = $compiler;
+        $this->ldel = preg_quote($this->smarty->left_delimiter,'/'); 
+        $this->rdel = preg_quote($this->smarty->right_delimiter,'/');
+        $this->smarty_token_names['LDEL'] =    $this->smarty->left_delimiter;
+        $this->smarty_token_names['RDEL'] =    $this->smarty->right_delimiter;
+     }
+    public static function &instance($new_instance = null)
+    {
+        static $instance = null;
+        if (isset($new_instance) && is_object($new_instance))
+            $instance = $new_instance;
+        return $instance;
+    } 
+
+
+
+    private $_yy_state = 1;
+    private $_yy_stack = array();
+
+    function yylex()
+    {
+        return $this->{'yylex' . $this->_yy_state}();
+    }
+
+    function yypushstate($state)
+    {
+        array_push($this->_yy_stack, $this->_yy_state);
+        $this->_yy_state = $state;
+    }
+
+    function yypopstate()
+    {
+        $this->_yy_state = array_pop($this->_yy_stack);
+    }
+
+    function yybegin($state)
+    {
+        $this->_yy_state = $state;
+    }
+
+
+
+    function yylex1()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 1,
+              4 => 0,
+              5 => 0,
+              6 => 0,
+              7 => 0,
+              8 => 0,
+              9 => 0,
+              10 => 0,
+              11 => 0,
+              12 => 0,
+              13 => 2,
+              16 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(\\{\\})|^(".$this->ldel."\\*([\S\s]*?)\\*".$this->rdel.")|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^([\t ]*[\r\n]+[\t ]*)|^(".$this->ldel."strip".$this->rdel.")|^(".$this->ldel."\/strip".$this->rdel.")|^(".$this->ldel."literal".$this->rdel.")|^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s{1,})|^(".$this->ldel."\/)|^(".$this->ldel.")|^(([\S\s]*?)([\t ]*[\r\n]+[\t ]*|".$this->ldel."|<\\?))|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state TEXT');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r1_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const TEXT = 1;
+    function yy_r1_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+    }
+    function yy_r1_2($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_COMMENT;
+    }
+    function yy_r1_4($yy_subpatterns)
+    {
+
+  if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
+    $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
+        $this->yypushstate(self::PHP);
+  } else {
+    $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
+    $this->value = substr($this->value, 0, 2);
+  }
+     }
+    function yy_r1_5($yy_subpatterns)
+    {
+
+  if ($this->strip) {
+     return false;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  }
+    }
+    function yy_r1_6($yy_subpatterns)
+    {
+
+  $this->strip = true;
+  return false;
+    }
+    function yy_r1_7($yy_subpatterns)
+    {
+
+  $this->strip = false;
+  return false;
+    }
+    function yy_r1_8($yy_subpatterns)
+    {
+
+   $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
+   $this->yypushstate(self::LITERAL);
+    }
+    function yy_r1_9($yy_subpatterns)
+    {
+
+  if ($this->smarty->auto_literal) {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+  }
+    }
+    function yy_r1_10($yy_subpatterns)
+    {
+
+  if ($this->smarty->auto_literal) {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+  }
+    }
+    function yy_r1_11($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+    }
+    function yy_r1_12($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+    }
+    function yy_r1_13($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  if (substr($this->value,-2) == '<?') {
+     $this->value = substr($this->value,0,-2);
+  } elseif (substr($this->value,-strlen($this->smarty->left_delimiter)) == $this->smarty->left_delimiter){
+     $this->value = substr($this->value,0,-strlen($this->smarty->left_delimiter));
+  } else {
+     $this->value = rtrim($this->value);
+  }
+  if (strlen($this->value) == 0) {
+     return true;              // rescan
+  }
+    }
+    function yy_r1_16($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+    }
+
+
+    function yylex2()
+    {
+        $tokenMap = array (
+              1 => 1,
+              3 => 0,
+              4 => 0,
+              5 => 0,
+              6 => 0,
+              7 => 0,
+              8 => 0,
+              9 => 0,
+              10 => 0,
+              11 => 1,
+              13 => 1,
+              15 => 0,
+              16 => 0,
+              17 => 0,
+              18 => 0,
+              19 => 0,
+              20 => 1,
+              22 => 1,
+              24 => 1,
+              26 => 1,
+              28 => 1,
+              30 => 1,
+              32 => 1,
+              34 => 1,
+              36 => 1,
+              38 => 1,
+              40 => 1,
+              42 => 0,
+              43 => 0,
+              44 => 0,
+              45 => 0,
+              46 => 0,
+              47 => 0,
+              48 => 0,
+              49 => 0,
+              50 => 0,
+              51 => 0,
+              52 => 3,
+              56 => 0,
+              57 => 0,
+              58 => 0,
+              59 => 0,
+              60 => 0,
+              61 => 0,
+              62 => 0,
+              63 => 1,
+              65 => 1,
+              67 => 1,
+              69 => 0,
+              70 => 0,
+              71 => 0,
+              72 => 0,
+              73 => 0,
+              74 => 0,
+              75 => 0,
+              76 => 0,
+              77 => 0,
+              78 => 0,
+              79 => 0,
+              80 => 0,
+              81 => 0,
+              82 => 1,
+              84 => 0,
+              85 => 0,
+              86 => 0,
+              87 => 0,
+              88 => 0,
+              89 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^((\\\\\"|\\\\'))|^('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s{1,})|^(\\s{1,}".$this->rdel.")|^(".$this->ldel."\/)|^(".$this->ldel.")|^(".$this->rdel.")|^(\\s+is\\s+in\\s+)|^(\\s+(AS|as)\\s+)|^(\\s+(to)\\s+)|^(\\s+instanceof\\s+)|^(true|TRUE|True|false|FALSE|False)|^(null|NULL|Null)|^(\\s*===\\s*)|^(\\s*!==\\s*)|^(\\s*==\\s*|\\s+(EQ|eq)\\s+)|^(\\s*!=\\s*|\\s*<>\\s*|\\s+(NE|NEQ|ne|neq)\\s+)|^(\\s*>=\\s*|\\s+(GE|GTE|ge|gte)\\s+)|^(\\s*<=\\s*|\\s+(LE|LTE|le|lte)\\s+)|^(\\s*>\\s*|\\s+(GT|gt)\\s+)|^(\\s*<\\s*|\\s+(LT|lt)\\s+)|^(\\s+(MOD|mod)\\s+)|^(!\\s*|(NOT|not)\\s+)|^(\\s*&&\\s*|\\s*(AND|and)\\s+)|^(\\s*\\|\\|\\s*|\\s*(OR|or)\\s+)|^(\\s*(XOR|xor)\\s+)|^(\\s+is\\s+odd\\s+by\\s+)|^(\\s+is\\s+not\\s+odd\\s+by\\s+)|^(\\s+is\\s+odd)|^(\\s+is\\s+not\\s+odd)|^(\\s+is\\s+even\\s+by\\s+)|^(\\s+is\\s+not\\s+even\\s+by\\s+)|^(\\s+is\\s+even)|^(\\s+is\\s+not\\s+even)|^(\\s+is\\s+div\\s+by\\s+)|^(\\s+is\\s+not\\s+div\\s+by\\s+)|^(\\((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)\\))|^(\\(\\s*)|^(\\s*\\))|^(\\[\\s*)|^(\\s*\\])|^(\\s*->\\s*)|^(\\s*=>\\s*)|^(\\s*=\\s*)|^((\\+\\+|--)\\s*)|^(\\s*(\\+|-)\\s*)|^(\\s*(\\*|\/|%)\\s*)|^(\\$)|^(\\s*;)|^(::)|^(\\s*:\\s*)|^(@)|^(#)|^(\")|^(`)|^(\\|)|^(\\.)|^(\\s*,\\s*)|^(\\s*&\\s*)|^(\\s*\\?\\s*)|^((if|elseif|else if|while)(?![^\s]))|^(foreach(?![^\s]))|^(for(?![^\s]))|^([0-9]*[a-zA-Z_]\\w*)|^(\\d+)|^(\\s+)|^(.)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state SMARTY');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r2_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const SMARTY = 2;
+    function yy_r2_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+    }
+    function yy_r2_3($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
+    }
+    function yy_r2_4($yy_subpatterns)
+    {
+
+  if ($this->smarty->auto_literal) {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+  }
+    }
+    function yy_r2_5($yy_subpatterns)
+    {
+
+  if ($this->smarty->auto_literal) {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+  }
+    }
+    function yy_r2_6($yy_subpatterns)
+    {
+
+  if ($this->smarty->auto_literal) {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_RDEL;
+     $this->yypopstate();
+  }
+    }
+    function yy_r2_7($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+    }
+    function yy_r2_8($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+    }
+    function yy_r2_9($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_RDEL;
+     $this->yypopstate();
+    }
+    function yy_r2_10($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISIN;
+    }
+    function yy_r2_11($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_AS;
+    }
+    function yy_r2_13($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_TO;
+    }
+    function yy_r2_15($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
+    }
+    function yy_r2_16($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_BOOLEAN;
+    }
+    function yy_r2_17($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_NULL;
+    }
+    function yy_r2_18($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_IDENTITY;
+    }
+    function yy_r2_19($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY;
+    }
+    function yy_r2_20($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_EQUALS;
+    }
+    function yy_r2_22($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS;
+    }
+    function yy_r2_24($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL;
+    }
+    function yy_r2_26($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL;
+    }
+    function yy_r2_28($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN;
+    }
+    function yy_r2_30($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN;
+    }
+    function yy_r2_32($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_MOD;
+    }
+    function yy_r2_34($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_NOT;
+    }
+    function yy_r2_36($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LAND;
+    }
+    function yy_r2_38($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LOR;
+    }
+    function yy_r2_40($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LXOR;
+    }
+    function yy_r2_42($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISODDBY;
+    }
+    function yy_r2_43($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY;
+    }
+    function yy_r2_44($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISODD;
+    }
+    function yy_r2_45($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD;
+    }
+    function yy_r2_46($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY;
+    }
+    function yy_r2_47($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY;
+    }
+    function yy_r2_48($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISEVEN;
+    }
+    function yy_r2_49($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN;
+    }
+    function yy_r2_50($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY;
+    }
+    function yy_r2_51($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY;
+    }
+    function yy_r2_52($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
+    }
+    function yy_r2_56($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OPENP;
+    }
+    function yy_r2_57($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
+    }
+    function yy_r2_58($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OPENB;
+    }
+    function yy_r2_59($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
+    }
+    function yy_r2_60($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PTR; 
+    }
+    function yy_r2_61($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_APTR;
+    }
+    function yy_r2_62($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
+    }
+    function yy_r2_63($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
+    }
+    function yy_r2_65($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
+    }
+    function yy_r2_67($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_MATH;
+    }
+    function yy_r2_69($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
+    }
+    function yy_r2_70($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
+    }
+    function yy_r2_71($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
+    }
+    function yy_r2_72($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_COLON;
+    }
+    function yy_r2_73($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_AT;
+    }
+    function yy_r2_74($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_HATCH;
+    }
+    function yy_r2_75($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+  $this->yypushstate(self::DOUBLEQUOTEDSTRING);
+    }
+    function yy_r2_76($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+  $this->yypopstate();
+    }
+    function yy_r2_77($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_VERT;
+    }
+    function yy_r2_78($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_DOT;
+    }
+    function yy_r2_79($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_COMMA;
+    }
+    function yy_r2_80($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ANDSYM;
+    }
+    function yy_r2_81($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_QMARK;
+    }
+    function yy_r2_82($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_IF;
+    }
+    function yy_r2_84($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_FOREACH;
+    }
+    function yy_r2_85($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_FOR;
+    }
+    function yy_r2_86($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_ID;
+    }
+    function yy_r2_87($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
+    }
+    function yy_r2_88($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_SPACE;
+    }
+    function yy_r2_89($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+    }
+
+
+    function yylex3()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 1,
+              4 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(\\?>)|^([\s\S]+?(\\?>|\/\\*|'|\"|<<<\\s*'?\\w+'?\r?\n|\/\/|#))|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r3_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP = 3;
+    function yy_r3_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
+  $this->yypopstate();
+    }
+    function yy_r3_2($yy_subpatterns)
+    {
+
+   switch ($yy_subpatterns[0]) {
+   case '?>':
+      $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;
+      $this->value = substr($this->value, 0, -2);
+      break;
+   case "'":
+      $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;
+      $this->yypushstate(self::PHP_SINGLE_QUOTED_STRING);
+      break;
+   case '"':
+      $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE_START_DOUBLEQUOTE;
+      $this->yypushstate(self::PHP_DOUBLE_QUOTED_STRING);
+      break;
+   case '/*':
+      $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;
+      $this->yypushstate(self::PHP_ML_COMMENT);
+      break;
+   case '//':
+   case '#':
+      $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;
+      $this->yypushstate(self::PHP_SL_COMMENT);
+      break;
+   default:
+      $res = preg_match('/\A<<<\s*\'?(\w+)(\'?)\r?\n\z/', $yy_subpatterns[0], $matches);
+      assert($res === 1);
+      $is_nowdoc = $matches[2] === "'";
+      $this->token = $is_nowdoc
+        ? Smarty_Internal_Templateparser::TP_PHP_NOWDOC_START
+        : Smarty_Internal_Templateparser::TP_PHP_HEREDOC_START;
+      $this->heredoc_id_stack[] = $matches[1];
+      $this->yypushstate($is_nowdoc ? self::PHP_NOWDOC : self::PHP_HEREDOC);
+      break;
+   }
+    }
+    function yy_r3_4($yy_subpatterns)
+    {
+
+  $this->compiler->trigger_template_error ("missing PHP end tag");
+    }
+
+
+    function yylex4()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^([\s\S]*\\*\/)|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_ML_COMMENT');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r4_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_ML_COMMENT = 4;
+    function yy_r4_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;  
+  $this->yypopstate();
+    }
+    function yy_r4_2($yy_subpatterns)
+    {
+
+  $this->compiler->trigger_template_error("missing PHP comment end */");
+    }
+
+
+    function yylex5()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(.+?(?=\\?>|\n))|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_SL_COMMENT');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_SL_COMMENT = 5;
+    function yy_r5_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;  
+  $this->yypopstate();
+    }
+    function yy_r5_2($yy_subpatterns)
+    {
+
+  /* this can happen for "//?>" */
+  $this->yypopstate();
+  return true;
+    }
+
+
+    function yylex6()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^([^\n]*\n)|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_NOWDOC');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r6_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_NOWDOC = 6;
+    function yy_r6_1($yy_subpatterns)
+    {
+
+  $heredoc_id = $this->heredoc_id_stack[sizeof($this->heredoc_id_stack)-1];
+  if (   $this->value === $heredoc_id."\n"
+      || $this->value === $heredoc_id."\r\n"
+      || $this->value === $heredoc_id.";\n"
+      || $this->value === $heredoc_id.";\r\n"
+     ) {
+    $this->token = Smarty_Internal_Templateparser::TP_PHP_NOWDOC_END;
+    array_pop($this->heredoc_id_stack);
+    $this->yypopstate();
+  } else {
+    $this->token = Smarty_Internal_Templateparser::TP_PHP_DQ_CONTENT;
+  }
+    }
+    function yy_r6_2($yy_subpatterns)
+    {
+
+  $this->compiler->trigger_template_error("missing PHP NOWDOC end");
+    }
+
+
+    function yylex7()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(\\{\\$|\\{\\$)|^([^\n]*\n)|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_HEREDOC');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r7_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_HEREDOC = 7;
+    function yy_r7_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_DQ_EMBED_START;
+  $this->yypushstate(self::PHP_RETURNING_TO_HEREDOC_FROM_EMBEDDED);    
+  $this->yypushstate(self::PHP_DOUBLE_QUOTED_STRING_EMBEDDED);    
+    }
+    function yy_r7_2($yy_subpatterns)
+    {
+
+  $heredoc_id = $this->heredoc_id_stack[sizeof($this->heredoc_id_stack)-1];
+  if (   $this->value === $heredoc_id."\n"
+      || $this->value === $heredoc_id."\r\n"
+      || $this->value === $heredoc_id.";\n"
+      || $this->value === $heredoc_id.";\r\n"
+     ) {
+    $this->token = Smarty_Internal_Templateparser::TP_PHP_HEREDOC_END;
+    array_pop($this->heredoc_id_stack);
+    $this->yypopstate();
+  } else {
+    $this->token = Smarty_Internal_Templateparser::TP_PHP_DQ_CONTENT;
+    if (preg_match('/(.*?)(\{\$\|\$\{)/', $this->value, $matches)) {
+      $this->value = $matches[1];
+    }
+  }
+    }
+    function yy_r7_3($yy_subpatterns)
+    {
+
+  $this->compiler->trigger_template_error("missing PHP HEREDOC end");
+    }
+
+
+    function yylex8()
+    {
+        $tokenMap = array (
+              1 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^([^\n]*\n)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_RETURNING_TO_HEREDOC_FROM_EMBEDDED');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r8_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_RETURNING_TO_HEREDOC_FROM_EMBEDDED = 8;
+    function yy_r8_1($yy_subpatterns)
+    {
+
+  $this->yypopstate();
+  $heredoc_id = $this->heredoc_id_stack[sizeof($this->heredoc_id_stack)-1];
+  if (   $this->value === $heredoc_id."\n"
+      || $this->value === $heredoc_id."\r\n"
+      || $this->value === $heredoc_id.";\n"
+      || $this->value === $heredoc_id.";\r\n"
+     ) {
+    //Make sure it isn't interpreted as HEREDOC end.
+    $this->token = Smarty_Internal_Templateparser::TP_PHP_DQ_CONTENT;
+  } else {
+    return true; //retry in PHP_HEREDOC state
+  }
+    }
+
+
+    function yylex9()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^((?:[^\\\\']|\\\\.)*')|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_SINGLE_QUOTED_STRING');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r9_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_SINGLE_QUOTED_STRING = 9;
+    function yy_r9_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;  
+  $this->yypopstate();
+    }
+    function yy_r9_2($yy_subpatterns)
+    {
+
+  $this->compiler->trigger_template_error("missing PHP single quoted string end");
+    }
+
+
+    function yylex10()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+              4 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(\\{\\$|\\{\\$)|^(\")|^((?:\\\\.|[^\"\\\\])+?(?=\"|\\{\\$|\\$\\{))|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_DOUBLE_QUOTED_STRING');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r10_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_DOUBLE_QUOTED_STRING = 10;
+    function yy_r10_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_DQ_EMBED_START;
+  $this->yypushstate(self::PHP_DOUBLE_QUOTED_STRING_EMBEDDED);
+    }
+    function yy_r10_2($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE_DOUBLEQUOTE;
+  $this->yypopstate();
+    }
+    function yy_r10_3($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_DQ_CONTENT;
+    }
+    function yy_r10_4($yy_subpatterns)
+    {
+
+  $this->compiler->trigger_template_error("missing PHP double quoted string end");
+    }
+
+
+    function yylex11()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+              4 => 0,
+              5 => 0,
+              6 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(\")|^(')|^(<<<\\s*\\w+\r?\n)|^(<<<\\s*'\\w+'\r?\n)|^(\\})|^([^'\"}]+?(?='|\"|\\}|<<<\\s*'?\\w+'?\r?\n))/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state PHP_DOUBLE_QUOTED_STRING_EMBEDDED');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r11_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const PHP_DOUBLE_QUOTED_STRING_EMBEDDED = 11;
+    function yy_r11_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE_START_DOUBLEQUOTE;
+  $this->yypushstate(self::PHP_DOUBLE_QUOTED_STRING);
+    }
+    function yy_r11_2($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;
+  $this->yypushstate(self::PHP_SINGLE_QUOTED_STRING);
+    }
+    function yy_r11_3($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_HEREDOC_START;
+  $res = preg_match('/\A\<\<\<\s*(\w+)\r?\n\z/', $this->value, $matches);
+  assert($res === 1);
+  $this->heredoc_id_stack[] = $matches[1];
+  $this->yypushstate(self::PHP_HEREDOC);
+    }
+    function yy_r11_4($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_NOWDOC_START;
+  $res = preg_match('/\A\<\<\<\s*\'(\w+)\'\r?\n\z/', $this->value, $matches);
+  assert($res === 1);
+  $this->heredoc_id_stack[] = $matches[1];
+  $this->yypushstate(self::PHP_NOWDOC);
+    }
+    function yy_r11_5($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_DQ_EMBED_END;
+  $this->yypopstate();
+    }
+    function yy_r11_6($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_PHP_CODE;
+    }
+
+
+
+    function yylex12()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+              4 => 0,
+              5 => 1,
+              7 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(".$this->ldel."literal".$this->rdel.")|^(".$this->ldel."\/literal".$this->rdel.")|^(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|^(\\?>)|^([\S\s]+?(".$this->ldel."\/?literal".$this->rdel."|<\\?))|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state LITERAL');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r12_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const LITERAL = 12;
+    function yy_r12_1($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
+  $this->yypushstate(self::LITERAL);
+    }
+    function yy_r12_2($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
+  $this->yypopstate();
+    }
+    function yy_r12_3($yy_subpatterns)
+    {
+
+  if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
+    $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
+   } else {
+    $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
+    $this->value = substr($this->value, 0, 2);
+   }
+    }
+    function yy_r12_4($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+    }
+    function yy_r12_5($yy_subpatterns)
+    {
+
+  $lenght_literal = strlen($this->smarty->left_delimiter.$this->smarty->right_delimiter)+7;
+  if (substr($this->value,-2,2) === '<?') {
+    $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+    $this->value = substr($this->value,0,-2);
+  } else if (substr($this->value,-$lenght_literal,$lenght_literal) === $this->smarty->left_delimiter.'literal'.$this->smarty->right_delimiter) {
+    $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+    $this->value = substr($this->value,0,-$lenght_literal);
+  } else {
+    assert(substr($this->value,-$lenght_literal-1,$lenght_literal+1) === $this->smarty->left_delimiter.'/literal'.$this->smarty->right_delimiter);
+    $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+    $this->value = substr($this->value,0,-$lenght_literal-1);
+  }
+    }
+    function yy_r12_7($yy_subpatterns)
+    {
+
+  $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
+    }
+
+
+    function yylex13()
+    {
+        $tokenMap = array (
+              1 => 0,
+              2 => 0,
+              3 => 0,
+              4 => 0,
+              5 => 0,
+              6 => 0,
+              7 => 0,
+              8 => 0,
+              9 => 2,
+              12 => 0,
+            );
+        if ($this->counter >= strlen($this->data)) {
+            return false; // end of input
+        }
+        $yy_global_pattern = "/^(".$this->ldel."\\s{1,}\/)|^(".$this->ldel."\\s{1,})|^(".$this->ldel."\/)|^(".$this->ldel.")|^(\")|^(`\\$)|^(\\$\\w+)|^(\\$)|^(([\S\s]*?)(".$this->ldel."|\\$|`\\$|\\\\\\\\|[^\\\\]\"))|^([\S\s]+)/";
+
+        do {
+            if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
+                $yysubmatches = $yymatches;
+                $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+                if (!count($yymatches)) {
+                    throw new Exception('Error: lexing failed because a rule matched' .
+                        'an empty string.  Input "' . substr($this->data,
+                        $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
+                }
+                next($yymatches); // skip global match
+                $this->token = key($yymatches); // token number
+                if ($tokenMap[$this->token]) {
+                    // extract sub-patterns for passing to lex function
+                    $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+                        $tokenMap[$this->token]);
+                } else {
+                    $yysubmatches = array();
+                }
+                $this->value = current($yymatches); // token value
+                $r = $this->{'yy_r13_' . $this->token}($yysubmatches);
+                if ($r === null) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    // accept this token
+                    return true;
+                } elseif ($r === true) {
+                    // we have changed state
+                    // process this token in the new state
+                    return $this->yylex();
+                } elseif ($r === false) {
+                    $this->counter += strlen($this->value);
+                    $this->line += substr_count($this->value, "\n");
+                    if ($this->counter >= strlen($this->data)) {
+                        return false; // end of input
+                    }
+                    // skip this token
+                    continue;
+                }            } else {
+                throw new Exception('Unexpected input at line' . $this->line .
+                    ': ' . $this->data[$this->counter]);
+            }
+            break;
+        } while (true);
+
+    } // end function
+
+
+    const DOUBLEQUOTEDSTRING = 13;
+    function yy_r13_1($yy_subpatterns)
+    {
+
+  if ($this->smarty->auto_literal) {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+  }
+    }
+    function yy_r13_2($yy_subpatterns)
+    {
+
+  if ($this->smarty->auto_literal) {
+     $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  } else {
+     $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+  }
+    }
+    function yy_r13_3($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+    }
+    function yy_r13_4($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+     $this->yypushstate(self::SMARTY);
+     $this->taglineno = $this->line;
+    }
+    function yy_r13_5($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+  $this->yypopstate();
+    }
+    function yy_r13_6($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+  $this->value = substr($this->value,0,-1);
+  $this->yypushstate(self::SMARTY);
+  $this->taglineno = $this->line;
+    }
+    function yy_r13_7($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
+    }
+    function yy_r13_8($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+    }
+    function yy_r13_9($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+  if (substr($this->value,-strlen($this->smarty->left_delimiter)) == $this->smarty->left_delimiter) {
+     $this->value = substr($this->value,0,-strlen($this->smarty->left_delimiter));
+  } elseif (substr($this->value,-2) == '`$') {
+    $this->value = substr($this->value,0,-2);  
+  } elseif (strpbrk(substr($this->value,-1),'"$') !== false) {
+    $this->value = substr($this->value,0,-1);
+  } 
+  if (strlen($this->value) == 0) {
+     return true;              // rescan
+  }
+    }
+    function yy_r13_12($yy_subpatterns)
+    {
+
+  $this->token = Smarty_Internal_Templateparser::TP_OTHER;
+    }
+
+}
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_templateparser.php b/gosa-core/include/smarty/sysplugins/smarty_internal_templateparser.php
new file mode 100644 (file)
index 0000000..3ad0602
--- /dev/null
@@ -0,0 +1,2684 @@
+<?php\r
+/**\r
+* Smarty Internal Plugin Templateparser\r
+*\r
+* This is the template parser.\r
+* It is generated from the internal.templateparser.y file\r
+* @package Smarty\r
+* @subpackage Compiler\r
+* @author Uwe Tews\r
+*/\r
+\r
+class TP_yyToken implements ArrayAccess\r
+{\r
+    public $string = '';\r
+    public $metadata = array();\r
+\r
+    function __construct($s, $m = array())\r
+    {\r
+        if ($s instanceof TP_yyToken) {\r
+            $this->string = $s->string;\r
+            $this->metadata = $s->metadata;\r
+        } else {\r
+            $this->string = (string) $s;\r
+            if ($m instanceof TP_yyToken) {\r
+                $this->metadata = $m->metadata;\r
+            } elseif (is_array($m)) {\r
+                $this->metadata = $m;\r
+            }\r
+        }\r
+    }\r
+\r
+    function __toString()\r
+    {\r
+        return $this->_string;\r
+    }\r
+\r
+    function offsetExists($offset)\r
+    {\r
+        return isset($this->metadata[$offset]);\r
+    }\r
+\r
+    function offsetGet($offset)\r
+    {\r
+        return $this->metadata[$offset];\r
+    }\r
+\r
+    function offsetSet($offset, $value)\r
+    {\r
+        if ($offset === null) {\r
+            if (isset($value[0])) {\r
+                $x = ($value instanceof TP_yyToken) ?\r
+                    $value->metadata : $value;\r
+                $this->metadata = array_merge($this->metadata, $x);\r
+                return;\r
+            }\r
+            $offset = count($this->metadata);\r
+        }\r
+        if ($value === null) {\r
+            return;\r
+        }\r
+        if ($value instanceof TP_yyToken) {\r
+            if ($value->metadata) {\r
+                $this->metadata[$offset] = $value->metadata;\r
+            }\r
+        } elseif ($value) {\r
+            $this->metadata[$offset] = $value;\r
+        }\r
+    }\r
+\r
+    function offsetUnset($offset)\r
+    {\r
+        unset($this->metadata[$offset]);\r
+    }\r
+}\r
+\r
+class TP_yyStackEntry\r
+{\r
+    public $stateno;       /* The state-number */\r
+    public $major;         /* The major token value.  This is the code\r
+                     ** number for the token at this stack level */\r
+    public $minor; /* The user-supplied minor token value.  This\r
+                     ** is the value of the token  */\r
+};\r
+\r
+\r
+#line 12 "smarty_internal_templateparser.y"\r
+class Smarty_Internal_Templateparser#line 79 "smarty_internal_templateparser.php"\r
+{\r
+#line 14 "smarty_internal_templateparser.y"\r
+\r
+    // states whether the parse was successful or not\r
+    public $successful = true;\r
+    public $retvalue = 0;\r
+    private $lex;\r
+    private $internalError = false;\r
+\r
+    function __construct($lex, $compiler) {\r
+        // set instance object\r
+        self::instance($this); \r
+        $this->lex = $lex;\r
+        $this->compiler = $compiler;\r
+        $this->smarty = $this->compiler->smarty;\r
+        $this->template = $this->compiler->template;\r
+        if ($this->template->security && isset($this->smarty->security_handler)) {\r
+              $this->sec_obj = $this->smarty->security_policy;\r
+        } else {\r
+              $this->sec_obj = $this->smarty;\r
+        }\r
+        $this->compiler->has_variable_string = false;\r
+                               $this->compiler->prefix_code = array();\r
+                               $this->prefix_number = 0;\r
+    }\r
+    public static function &instance($new_instance = null)\r
+    {\r
+        static $instance = null;\r
+        if (isset($new_instance) && is_object($new_instance))\r
+            $instance = $new_instance;\r
+        return $instance;\r
+    }\r
+\r
+    public static function escape_start_tag($tag_text) {\r
+       $tag = preg_replace('/\A<\?(.*)\z/', '<<?php ?>?\1', $tag_text, -1 , $count); //Escape tag\r
+       assert($tag !== false && $count === 1);\r
+       return $tag;\r
+    }\r
+\r
+    public static function escape_end_tag($tag_text) {\r
+       assert($tag_text === '?>');\r
+       return '?<?php ?>>';\r
+    }\r
+\r
+    \r
+#line 126 "smarty_internal_templateparser.php"\r
+\r
+    const TP_COMMENT                        =  1;\r
+    const TP_PHPSTARTTAG                    =  2;\r
+    const TP_PHPENDTAG                      =  3;\r
+    const TP_OTHER                          =  4;\r
+    const TP_FAKEPHPSTARTTAG                =  5;\r
+    const TP_PHP_CODE                       =  6;\r
+    const TP_PHP_CODE_START_DOUBLEQUOTE     =  7;\r
+    const TP_PHP_CODE_DOUBLEQUOTE           =  8;\r
+    const TP_PHP_HEREDOC_START              =  9;\r
+    const TP_PHP_HEREDOC_END                = 10;\r
+    const TP_PHP_NOWDOC_START               = 11;\r
+    const TP_PHP_NOWDOC_END                 = 12;\r
+    const TP_PHP_DQ_CONTENT                 = 13;\r
+    const TP_PHP_DQ_EMBED_START             = 14;\r
+    const TP_PHP_DQ_EMBED_END               = 15;\r
+    const TP_LITERALSTART                   = 16;\r
+    const TP_LITERALEND                     = 17;\r
+    const TP_LITERAL                        = 18;\r
+    const TP_LDEL                           = 19;\r
+    const TP_RDEL                           = 20;\r
+    const TP_DOLLAR                         = 21;\r
+    const TP_ID                             = 22;\r
+    const TP_EQUAL                          = 23;\r
+    const TP_FOREACH                        = 24;\r
+    const TP_PTR                            = 25;\r
+    const TP_IF                             = 26;\r
+    const TP_SPACE                          = 27;\r
+    const TP_UNIMATH                        = 28;\r
+    const TP_FOR                            = 29;\r
+    const TP_SEMICOLON                      = 30;\r
+    const TP_INCDEC                         = 31;\r
+    const TP_TO                             = 32;\r
+    const TP_AS                             = 33;\r
+    const TP_APTR                           = 34;\r
+    const TP_LDELSLASH                      = 35;\r
+    const TP_INTEGER                        = 36;\r
+    const TP_COMMA                          = 37;\r
+    const TP_COLON                          = 38;\r
+    const TP_MATH                           = 39;\r
+    const TP_ANDSYM                         = 40;\r
+    const TP_OPENP                          = 41;\r
+    const TP_CLOSEP                         = 42;\r
+    const TP_QMARK                          = 43;\r
+    const TP_NOT                            = 44;\r
+    const TP_TYPECAST                       = 45;\r
+    const TP_DOT                            = 46;\r
+    const TP_BOOLEAN                        = 47;\r
+    const TP_NULL                           = 48;\r
+    const TP_SINGLEQUOTESTRING              = 49;\r
+    const TP_QUOTE                          = 50;\r
+    const TP_DOUBLECOLON                    = 51;\r
+    const TP_AT                             = 52;\r
+    const TP_HATCH                          = 53;\r
+    const TP_OPENB                          = 54;\r
+    const TP_CLOSEB                         = 55;\r
+    const TP_VERT                           = 56;\r
+    const TP_ISIN                           = 57;\r
+    const TP_ISDIVBY                        = 58;\r
+    const TP_ISNOTDIVBY                     = 59;\r
+    const TP_ISEVEN                         = 60;\r
+    const TP_ISNOTEVEN                      = 61;\r
+    const TP_ISEVENBY                       = 62;\r
+    const TP_ISNOTEVENBY                    = 63;\r
+    const TP_ISODD                          = 64;\r
+    const TP_ISNOTODD                       = 65;\r
+    const TP_ISODDBY                        = 66;\r
+    const TP_ISNOTODDBY                     = 67;\r
+    const TP_INSTANCEOF                     = 68;\r
+    const TP_EQUALS                         = 69;\r
+    const TP_NOTEQUALS                      = 70;\r
+    const TP_GREATERTHAN                    = 71;\r
+    const TP_LESSTHAN                       = 72;\r
+    const TP_GREATEREQUAL                   = 73;\r
+    const TP_LESSEQUAL                      = 74;\r
+    const TP_IDENTITY                       = 75;\r
+    const TP_NONEIDENTITY                   = 76;\r
+    const TP_MOD                            = 77;\r
+    const TP_LAND                           = 78;\r
+    const TP_LOR                            = 79;\r
+    const TP_LXOR                           = 80;\r
+    const TP_BACKTICK                       = 81;\r
+    const TP_DOLLARID                       = 82;\r
+    const YY_NO_ACTION = 613;\r
+    const YY_ACCEPT_ACTION = 612;\r
+    const YY_ERROR_ACTION = 611;\r
+\r
+    const YY_SZ_ACTTAB = 1771;\r
+static public $yy_action = array(\r
+ /*     0 */    19,   25,   98,   62,  192,  106,  376,  210,  202,   48,\r
+ /*    10 */   224,  228,   42,  214,   22,  188,  129,  225,  330,   95,\r
+ /*    20 */   202,   92,   11,   96,  143,   52,   50,   22,  300,  301,\r
+ /*    30 */   312,   61,   97,  282,   65,   14,   19,  143,  100,  194,\r
+ /*    40 */   344,  339,  202,  340,  141,   48,  612,   59,  273,  332,\r
+ /*    50 */   335,  202,  129,  225,   60,  346,  345,   51,   26,  304,\r
+ /*    60 */    28,   52,   50,  226,  300,  301,  312,   61,   47,   49,\r
+ /*    70 */    65,   14,  264,   19,    9,   89,  209,  253,  344,  339,\r
+ /*    80 */   328,  340,   48,  229,  267,   27,  362,  100,  157,  129,\r
+ /*    90 */   225,    2,   60,   30,  345,   26,  317,   33,   52,   50,\r
+ /*   100 */   202,  300,  301,  312,   61,  285,  240,   65,   14,   19,\r
+ /*   110 */    22,   89,  209,   30,  310,  254,  317,   32,   48,   65,\r
+ /*   120 */   143,   51,  269,  326,  266,  129,  225,  217,  258,  476,\r
+ /*   130 */    51,    5,   47,   49,    8,   50,  476,  300,  301,  312,\r
+ /*   140 */    61,   47,   49,   65,   14,   19,  216,   89,  199,   64,\r
+ /*   150 */    22,  274,  324,  277,   48,  236,  275,  239,  475,  214,\r
+ /*   160 */   143,  129,  225,   30,  368,  214,  317,   26,  187,  303,\r
+ /*   170 */    52,   50,  351,  300,  301,  312,   61,    1,  218,   65,\r
+ /*   180 */    14,   19,  303,  100,  203,  150,   30,  369,  202,  317,\r
+ /*   190 */    48,  186,  100,  241,  127,   22,   30,  129,  225,  317,\r
+ /*   200 */   304,  248,  256,   26,  202,  143,   52,   50,  391,  300,\r
+ /*   210 */   301,  312,   61,  289,   39,   65,   14,   19,  191,  100,\r
+ /*   220 */   213,   40,  109,    4,   65,   56,   48,   30,   22,  216,\r
+ /*   230 */   317,   32,  287,  129,  225,  138,  270,  479,  143,   26,\r
+ /*   240 */   386,  186,   52,   50,  479,  300,  301,  312,   61,  202,\r
+ /*   250 */   304,   65,   14,   19,   29,  100,  200,   56,   30,  367,\r
+ /*   260 */    30,  317,   48,  317,   39,  406,  313,    3,   10,  129,\r
+ /*   270 */   207,   30,  370,  214,  317,   26,   23,  303,   52,   50,\r
+ /*   280 */   156,  300,  301,  312,   61,   53,  186,   65,   14,   19,\r
+ /*   290 */   293,   89,  193,  221,  352,  304,  388,  177,   48,  246,\r
+ /*   300 */   320,  214,  319,  109,  350,  129,  225,  144,   56,  242,\r
+ /*   310 */    63,   16,  303,  186,    8,   50,  147,  300,  301,  312,\r
+ /*   320 */    61,  386,  304,   65,   14,   19,  186,  103,  209,  192,\r
+ /*   330 */   202,  304,  281,  153,   48,  327,   83,   42,  293,  190,\r
+ /*   340 */    41,  129,  225,  306,   53,  238,   90,    5,  304,   39,\r
+ /*   350 */     8,   50,  164,  300,  301,  312,   61,  214,  202,   65,\r
+ /*   360 */    14,   19,  186,   89,  209,   78,  271,  304,   43,  152,\r
+ /*   370 */    48,  333,  332,  335,  220,  185,  350,  129,  225,  306,\r
+ /*   380 */   262,  349,   63,   16,  304,   39,    8,   50,  146,  300,\r
+ /*   390 */   301,  312,   61,   35,  348,   65,   14,   19,    9,  100,\r
+ /*   400 */   213,  140,  404,  304,  261,  374,   48,  189,  360,  214,\r
+ /*   410 */   373,  202,  214,  129,  225,  214,  304,  214,    9,   26,\r
+ /*   420 */   202,   45,   52,   50,  245,  300,  301,  312,   61,  260,\r
+ /*   430 */    90,   65,   31,  400,  396,  395,  397,  398,  399,  380,\r
+ /*   440 */   379,  361,    6,    7,  296,  359,   13,   12,  358,  354,\r
+ /*   450 */    18,   17,  342,  169,   68,   44,  202,  101,  290,  214,\r
+ /*   460 */   168,  135,  353,  355,  356,   19,   30,  100,  208,  317,\r
+ /*   470 */   375,  372,  268,  378,   48,   85,  304,  214,  214,  366,\r
+ /*   480 */   214,  129,  225,  279,  278,  223,  214,   26,  306,  391,\r
+ /*   490 */    52,   50,   66,  300,  301,  312,   61,   21,  173,   65,\r
+ /*   500 */   133,    6,    7,  296,  359,   13,   12,  358,  354,   18,\r
+ /*   510 */    17,  365,  389,  214,  391,  384,  186,  305,  214,  214,\r
+ /*   520 */   181,  353,  355,  356,  214,  319,    6,    7,  296,  359,\r
+ /*   530 */    13,   12,  358,  354,   18,   17,  364,  155,  323,   24,\r
+ /*   540 */   322,  178,  202,  377,  357,  214,  353,  355,  356,  130,\r
+ /*   550 */   214,  214,    6,    7,  296,  359,   13,   12,  358,  354,\r
+ /*   560 */    18,   17,   30,  391,  252,  211,  159,  371,  314,  311,\r
+ /*   570 */   142,  283,  353,  355,  356,  214,  214,  154,  214,  136,\r
+ /*   580 */     6,    7,  296,  359,   13,   12,  358,  354,   18,   17,\r
+ /*   590 */   215,   82,  304,   30,  304,  390,  247,  341,  331,   82,\r
+ /*   600 */   353,  355,  356,  255,  214,    6,    7,  296,  359,   13,\r
+ /*   610 */    12,  358,  354,   18,   17,  214,   70,  202,   45,  235,\r
+ /*   620 */    90,  325,   90,  250,   82,  353,  355,  356,  128,  362,\r
+ /*   630 */   400,  396,  395,  397,  398,  399,  380,  379,  361,  251,\r
+ /*   640 */   205,  107,  391,  202,   45,  145,    6,    7,  296,  359,\r
+ /*   650 */    13,   12,  358,  354,   18,   17,  400,  396,  395,  397,\r
+ /*   660 */   398,  399,  380,  379,  361,  131,  353,  355,  356,    6,\r
+ /*   670 */     7,  296,  359,   13,   12,  358,  354,   18,   17,  391,\r
+ /*   680 */   334,   80,  299,  338,  347,   73,  132,  477,  257,  353,\r
+ /*   690 */   355,  356,  175,  165,  477,   60,  475,  319,   19,  387,\r
+ /*   700 */   391,  322,  387,  214,  151,  163,  180,  234,  304,  233,\r
+ /*   710 */   302,  319,  233,  109,  129,  158,  109,   38,   88,  304,\r
+ /*   720 */   304,  237,  315,  202,   45,  309,  321,  336,  309,  394,\r
+ /*   730 */   304,  386,  202,   45,  386,  276,  400,  396,  395,  397,\r
+ /*   740 */   398,  399,  380,  379,  361,  400,  396,  395,  397,  398,\r
+ /*   750 */   399,  380,  379,  361,  403,  387,   34,   81,  337,   79,\r
+ /*   760 */   318,  214,  387,  197,  183,  233,   74,  272,  124,  109,\r
+ /*   770 */   401,  391,  233,  391,  227,   36,  109,  392,   93,  295,\r
+ /*   780 */   201,  309,  294,  240,  405,   53,  294,  386,  309,   28,\r
+ /*   790 */   202,   45,  363,  102,  386,  329,   71,   20,  111,  381,\r
+ /*   800 */   229,   20,  263,  400,  396,  395,  397,  398,  399,  380,\r
+ /*   810 */   379,  361,  387,  129,    1,   99,   23,  129,  265,  343,\r
+ /*   820 */   204,  320,  233,   55,  105,   57,  109,   43,  280,  214,\r
+ /*   830 */   160,  108,  292,   46,  392,  322,  219,  201,  309,  286,\r
+ /*   840 */   387,  230,  306,  382,  386,   91,   15,  336,  249,  363,\r
+ /*   850 */   233,   77,  284,  117,  109,  336,  336,  243,  336,   37,\r
+ /*   860 */   288,  336,  392,   37,  288,  201,  309,  336,  387,  336,\r
+ /*   870 */   336,  336,  386,  336,  336,  336,  249,  363,  233,   54,\r
+ /*   880 */   110,   58,  109,  336,  336,  336,  336,  336,  336,  336,\r
+ /*   890 */   392,  336,  336,  201,  309,  336,  387,  336,  336,  336,\r
+ /*   900 */   386,  336,  336,  336,  249,  363,  233,   77,  336,  125,\r
+ /*   910 */   109,  336,  336,  336,  336,  336,  336,  336,  392,  336,\r
+ /*   920 */   336,  201,  309,  336,  336,  336,  387,  336,  386,  336,\r
+ /*   930 */   336,  336,  336,  363,  249,  336,  233,   77,  336,  113,\r
+ /*   940 */   109,  336,  336,  336,  336,  387,  336,  336,  392,  336,\r
+ /*   950 */   336,  201,  309,  291,  387,  233,  336,  336,  386,  109,\r
+ /*   960 */   336,  336,  259,  363,  233,   77,  336,  126,  109,  336,\r
+ /*   970 */   336,  309,  336,  336,  336,  336,  392,  386,  336,  201,\r
+ /*   980 */   309,  336,  387,  336,  336,  336,  386,  336,  336,  336,\r
+ /*   990 */   249,  363,  233,   77,  336,  122,  109,  336,  336,  336,\r
+ /*  1000 */   336,  336,  336,  336,  392,  336,  336,  201,  309,  336,\r
+ /*  1010 */   387,  336,  336,  336,  386,  336,  336,  336,  249,  363,\r
+ /*  1020 */   233,   77,  336,  115,  109,  336,  336,  336,  336,  336,\r
+ /*  1030 */   336,  336,  392,  336,  336,  201,  309,  336,  336,  336,\r
+ /*  1040 */   387,  336,  386,  336,  336,  336,  336,  363,  249,  336,\r
+ /*  1050 */   233,   76,  336,  116,  109,  336,  336,  336,  336,  387,\r
+ /*  1060 */   336,  336,  392,  336,  336,  201,  309,  297,  387,  233,\r
+ /*  1070 */   336,  336,  386,  109,  336,  336,  249,  363,  233,   77,\r
+ /*  1080 */   336,  120,  109,  336,  336,  309,  336,  336,  336,  336,\r
+ /*  1090 */   392,  386,  336,  201,  309,  336,  387,  336,  336,  336,\r
+ /*  1100 */   386,  336,  336,  336,  249,  363,  233,   77,  336,  123,\r
+ /*  1110 */   109,  336,  336,  336,  336,  336,  336,  336,  392,  336,\r
+ /*  1120 */   336,  201,  309,  336,  387,  336,  336,  336,  386,  336,\r
+ /*  1130 */   336,  336,  244,  363,  233,  179,  336,  336,  109,  336,\r
+ /*  1140 */   336,  336,  336,  336,  336,  336,  392,  336,  336,  201,\r
+ /*  1150 */   309,  336,  336,  336,  336,  336,  386,  336,  336,  336,\r
+ /*  1160 */   387,  336,  336,  336,  206,  393,  336,  336,  249,  336,\r
+ /*  1170 */   233,   77,  336,  118,  109,  336,  336,  336,  336,  387,\r
+ /*  1180 */   336,  336,  392,  336,  336,  201,  309,  316,  387,  233,\r
+ /*  1190 */   336,  336,  386,  109,  336,  336,  249,  363,  233,   77,\r
+ /*  1200 */   336,  121,  109,  336,  336,  309,  336,  336,  336,  336,\r
+ /*  1210 */   392,  386,  336,  201,  309,  336,  387,  336,  336,  336,\r
+ /*  1220 */   386,  336,  336,  336,  249,  363,  233,   76,  336,  114,\r
+ /*  1230 */   109,  336,  336,  336,  336,  336,  336,  336,  392,  336,\r
+ /*  1240 */   336,  201,  309,  336,  387,  336,  336,  336,  386,  336,\r
+ /*  1250 */   336,  336,  249,  363,  233,   77,  336,  119,  109,  336,\r
+ /*  1260 */   336,  336,  336,  336,  336,  336,  392,  336,  336,  201,\r
+ /*  1270 */   309,  336,  336,  336,  387,  336,  386,  336,  336,  336,\r
+ /*  1280 */   336,  363,  249,  336,  233,   75,  336,  112,  109,  336,\r
+ /*  1290 */   336,  336,  336,  336,  336,  336,  392,  336,  336,  201,\r
+ /*  1300 */   309,  336,  387,  336,  336,  336,  386,  336,  336,  336,\r
+ /*  1310 */   244,  363,  233,  179,  336,  387,  109,  336,  336,  336,\r
+ /*  1320 */   336,  336,  336,  307,  392,  233,  161,  201,  309,  109,\r
+ /*  1330 */   336,  336,  336,  336,  386,  336,  336,  392,  336,  336,\r
+ /*  1340 */   201,  309,  387,  385,  222,  336,  336,  386,  336,  336,\r
+ /*  1350 */   307,  336,  233,  161,  336,  336,  109,  336,  336,  336,\r
+ /*  1360 */   336,  336,  387,  336,  392,  336,  336,  201,  309,  336,\r
+ /*  1370 */   307,  231,  233,  161,  386,  387,  109,  336,  336,  336,\r
+ /*  1380 */   336,  336,  336,  307,  392,  233,  161,  201,  309,  109,\r
+ /*  1390 */   336,  383,  336,  336,  386,  336,  336,  392,  387,  336,\r
+ /*  1400 */   201,  309,  336,  387,  232,  336,   87,  386,   86,   67,\r
+ /*  1410 */   104,   87,   94,   84,   72,  104,  336,   94,  336,  336,\r
+ /*  1420 */   392,  336,  336,  201,  309,  392,  336,  336,  201,  309,\r
+ /*  1430 */   386,  387,  336,  336,  336,  386,  336,  336,  336,  307,\r
+ /*  1440 */   387,  212,  137,  336,  336,  109,  336,  336,  307,  336,\r
+ /*  1450 */   233,  184,  336,  392,  109,  336,  201,  309,  336,  387,\r
+ /*  1460 */   336,  336,  392,  386,  336,  201,  309,  307,  336,  233,\r
+ /*  1470 */   176,  336,  386,  109,  336,  336,  336,  336,  336,  387,\r
+ /*  1480 */   336,  392,  336,  336,  201,  309,  336,  307,  387,  233,\r
+ /*  1490 */   134,  386,  336,  109,  336,  336,  307,  336,  233,  172,\r
+ /*  1500 */   336,  392,  109,  336,  201,  309,  336,  336,  387,  336,\r
+ /*  1510 */   392,  386,  336,  201,  309,  336,  307,  387,  233,  170,\r
+ /*  1520 */   386,  336,  109,  336,  336,  307,  336,  233,  149,  336,\r
+ /*  1530 */   392,  109,  336,  201,  309,  336,  387,  336,  336,  392,\r
+ /*  1540 */   386,  336,  201,  309,  307,  387,  233,  174,  336,  386,\r
+ /*  1550 */   109,  336,  336,  307,  336,  233,  166,  336,  392,  109,\r
+ /*  1560 */   336,  201,  309,  336,  336,  336,  336,  392,  386,  336,\r
+ /*  1570 */   201,  309,  387,  336,  336,  336,  336,  386,  336,  336,\r
+ /*  1580 */   307,  387,  233,  167,  336,  336,  109,  336,  336,  307,\r
+ /*  1590 */   336,  233,  171,  336,  392,  109,  336,  201,  309,  336,\r
+ /*  1600 */   336,  387,  336,  392,  386,  336,  201,  309,  336,  307,\r
+ /*  1610 */   387,  233,  162,  386,  336,  109,  336,  336,  307,  336,\r
+ /*  1620 */   233,  148,  336,  392,  109,  336,  201,  309,  336,  336,\r
+ /*  1630 */   387,  336,  392,  386,  336,  201,  309,  336,  307,  336,\r
+ /*  1640 */   233,   69,  386,  387,  109,  336,  336,  336,  336,  336,\r
+ /*  1650 */   387,  307,  392,  233,  182,  201,  309,  109,  298,  336,\r
+ /*  1660 */   233,  336,  386,  336,  109,  392,  336,  336,  201,  309,\r
+ /*  1670 */   387,  336,  336,  336,  336,  386,  309,  336,  307,  387,\r
+ /*  1680 */   233,  139,  386,  336,  109,  336,  336,  307,  336,  233,\r
+ /*  1690 */   336,  336,  392,  109,  336,  201,  309,  336,  387,  387,\r
+ /*  1700 */   336,  392,  386,  336,  198,  309,  307,  308,  233,  233,\r
+ /*  1710 */   336,  386,  109,  109,  336,  336,  336,  336,  387,  336,\r
+ /*  1720 */   392,  336,  336,  196,  309,  309,  307,  336,  233,  336,\r
+ /*  1730 */   386,  386,  109,  336,  336,  336,  336,  336,  387,  336,\r
+ /*  1740 */   392,  336,  336,  195,  309,  336,  402,  336,  233,  336,\r
+ /*  1750 */   386,  336,  109,  336,  336,  336,  336,  336,  336,  336,\r
+ /*  1760 */   336,  336,  336,  336,  309,  336,  336,  336,  336,  336,\r
+ /*  1770 */   386,\r
+    );\r
+    static public $yy_lookahead = array(\r
+ /*     0 */    19,   37,   21,   22,   46,   24,   20,   26,   56,   28,\r
+ /*    10 */    29,   25,   54,   27,   41,   20,   35,   36,    6,    7,\r
+ /*    20 */    56,    9,   41,   11,   51,   44,   45,   41,   47,   48,\r
+ /*    30 */    49,   50,   21,   81,   53,   54,   19,   51,   21,   22,\r
+ /*    40 */     2,    3,   56,    5,   96,   28,   84,   85,   86,   87,\r
+ /*    50 */    88,   56,   35,   36,   16,   17,   18,   28,   41,  111,\r
+ /*    60 */    23,   44,   45,   22,   47,   48,   49,   50,   39,   40,\r
+ /*    70 */    53,   54,   55,   19,  126,   21,   22,   36,    2,    3,\r
+ /*    80 */    10,    5,   28,   46,   55,   19,   42,   21,   22,   35,\r
+ /*    90 */    36,   23,   16,   19,   18,   41,   22,   23,   44,   45,\r
+ /*   100 */    56,   47,   48,   49,   50,   31,   38,   53,   54,   19,\r
+ /*   110 */    41,   21,   22,   19,  122,   46,   22,   23,   28,   53,\r
+ /*   120 */    51,   28,   20,    8,   55,   35,   36,   21,   22,   20,\r
+ /*   130 */    28,   41,   39,   40,   44,   45,   27,   47,   48,   49,\r
+ /*   140 */    50,   39,   40,   53,   54,   19,   52,   21,   22,   22,\r
+ /*   150 */    41,   24,   20,   26,   28,   33,   29,   25,   20,   27,\r
+ /*   160 */    51,   35,   36,   19,   20,   27,   22,   41,   20,   31,\r
+ /*   170 */    44,   45,   22,   47,   48,   49,   50,   23,   34,   53,\r
+ /*   180 */    54,   19,   31,   21,   22,   96,   19,   20,   56,   22,\r
+ /*   190 */    28,  102,   21,   22,  107,   41,   19,   35,   36,   22,\r
+ /*   200 */   111,   34,   52,   41,   56,   51,   44,   45,  121,   47,\r
+ /*   210 */    48,   49,   50,   20,  125,   53,   54,   19,   97,   21,\r
+ /*   220 */    22,   34,  101,   23,   53,   25,   28,   19,   41,   52,\r
+ /*   230 */    22,   23,   81,   35,   36,   96,  115,   20,   51,   41,\r
+ /*   240 */   119,  102,   44,   45,   27,   47,   48,   49,   50,   56,\r
+ /*   250 */   111,   53,   54,   19,   19,   21,   22,   25,   19,   20,\r
+ /*   260 */    19,   22,   28,   22,  125,   20,   20,   27,   28,   35,\r
+ /*   270 */    36,   19,   20,   27,   22,   41,   41,   31,   44,   45,\r
+ /*   280 */    96,   47,   48,   49,   50,   68,  102,   53,   54,   19,\r
+ /*   290 */    87,   21,   22,   52,   20,  111,   20,  117,   28,   97,\r
+ /*   300 */   120,   27,  122,  101,   88,   35,   36,   96,   25,   93,\r
+ /*   310 */    94,   41,   31,  102,   44,   45,   96,   47,   48,   49,\r
+ /*   320 */    50,  119,  111,   53,   54,   19,  102,   21,   22,   46,\r
+ /*   330 */    56,  111,  129,   96,   28,   13,   14,   54,   87,  102,\r
+ /*   340 */    38,   35,   36,  123,   68,   91,   92,   41,  111,  125,\r
+ /*   350 */    44,   45,   96,   47,   48,   49,   50,   27,   56,   53,\r
+ /*   360 */    54,   19,  102,   21,   22,  114,   20,  111,   38,   96,\r
+ /*   370 */    28,   86,   87,   88,   33,  102,   88,   35,   36,  123,\r
+ /*   380 */   129,   93,   94,   41,  111,  125,   44,   45,   96,   47,\r
+ /*   390 */    48,   49,   50,   38,   17,   53,   54,   19,  126,   21,\r
+ /*   400 */    22,   96,   20,  111,   20,   20,   28,  102,   20,   27,\r
+ /*   410 */    20,   56,   27,   35,   36,   27,  111,   27,  126,   41,\r
+ /*   420 */    56,   57,   44,   45,   22,   47,   48,   49,   50,   91,\r
+ /*   430 */    92,   53,   34,   69,   70,   71,   72,   73,   74,   75,\r
+ /*   440 */    76,   77,   58,   59,   60,   61,   62,   63,   64,   65,\r
+ /*   450 */    66,   67,   20,   30,  103,   19,   56,   21,   22,   27,\r
+ /*   460 */    37,   96,   78,   79,   80,   19,   19,   21,   22,   22,\r
+ /*   470 */    20,   20,   36,   20,   28,  107,  111,   27,   27,   20,\r
+ /*   480 */    27,   35,   36,   47,   48,   42,   27,   41,  123,  121,\r
+ /*   490 */    44,   45,  118,   47,   48,   49,   50,   37,   30,   53,\r
+ /*   500 */   107,   58,   59,   60,   61,   62,   63,   64,   65,   66,\r
+ /*   510 */    67,   20,   20,   27,  121,   55,  102,   20,   27,   27,\r
+ /*   520 */   117,   78,   79,   80,   27,  122,   58,   59,   60,   61,\r
+ /*   530 */    62,   63,   64,   65,   66,   67,   42,  118,   20,   41,\r
+ /*   540 */   121,  103,   56,   20,   20,   27,   78,   79,   80,  107,\r
+ /*   550 */    27,   27,   58,   59,   60,   61,   62,   63,   64,   65,\r
+ /*   560 */    66,   67,   19,  121,   42,   22,  118,   20,   20,   20,\r
+ /*   570 */   118,   20,   78,   79,   80,   27,   27,   96,   27,   96,\r
+ /*   580 */    58,   59,   60,   61,   62,   63,   64,   65,   66,   67,\r
+ /*   590 */    89,   90,  111,   19,  111,   22,   22,   20,   89,   90,\r
+ /*   600 */    78,   79,   80,   42,   27,   58,   59,   60,   61,   62,\r
+ /*   610 */    63,   64,   65,   66,   67,   27,  103,   56,   57,   91,\r
+ /*   620 */    92,   91,   92,   89,   90,   78,   79,   80,  107,   42,\r
+ /*   630 */    69,   70,   71,   72,   73,   74,   75,   76,   77,  104,\r
+ /*   640 */   105,   42,  121,   56,   57,  118,   58,   59,   60,   61,\r
+ /*   650 */    62,   63,   64,   65,   66,   67,   69,   70,   71,   72,\r
+ /*   660 */    73,   74,   75,   76,   77,  107,   78,   79,   80,   58,\r
+ /*   670 */    59,   60,   61,   62,   63,   64,   65,   66,   67,  121,\r
+ /*   680 */     1,    2,   36,    4,    5,  103,  107,   20,  108,   78,\r
+ /*   690 */    79,   80,  117,   96,   27,   16,   20,  122,   19,   87,\r
+ /*   700 */   121,  121,   87,   27,   96,   96,  117,   95,  111,   97,\r
+ /*   710 */    95,  122,   97,  101,   35,   96,  101,   32,   21,  111,\r
+ /*   720 */   111,  109,   22,   56,   57,  113,   22,    3,  113,   42,\r
+ /*   730 */   111,  119,   56,   57,  119,   20,   69,   70,   71,   72,\r
+ /*   740 */    73,   74,   75,   76,   77,   69,   70,   71,   72,   73,\r
+ /*   750 */    74,   75,   76,   77,   20,   87,   43,  107,   15,  107,\r
+ /*   760 */    22,   27,   87,   95,   22,   97,   98,   99,  100,  101,\r
+ /*   770 */    95,  121,   97,  121,   22,   43,  101,  109,   21,   20,\r
+ /*   780 */   112,  113,    4,   38,  109,   68,    4,  119,  113,   23,\r
+ /*   790 */    56,   57,  124,   21,  119,   12,   22,   19,   27,   53,\r
+ /*   800 */    46,   19,   55,   69,   70,   71,   72,   73,   74,   75,\r
+ /*   810 */    76,   77,   87,   35,   23,   21,   41,   35,   42,  111,\r
+ /*   820 */    95,  120,   97,   98,   99,  100,  101,   38,   50,   27,\r
+ /*   830 */   118,  115,   50,   27,  109,  121,  110,  112,  113,   27,\r
+ /*   840 */    87,  106,  123,   53,  119,   21,  106,  130,   95,  124,\r
+ /*   850 */    97,   98,  104,  100,  101,  130,  130,  104,  130,   81,\r
+ /*   860 */    82,  130,  109,   81,   82,  112,  113,  130,   87,  130,\r
+ /*   870 */   130,  130,  119,  130,  130,  130,   95,  124,   97,   98,\r
+ /*   880 */    99,  100,  101,  130,  130,  130,  130,  130,  130,  130,\r
+ /*   890 */   109,  130,  130,  112,  113,  130,   87,  130,  130,  130,\r
+ /*   900 */   119,  130,  130,  130,   95,  124,   97,   98,  130,  100,\r
+ /*   910 */   101,  130,  130,  130,  130,  130,  130,  130,  109,  130,\r
+ /*   920 */   130,  112,  113,  130,  130,  130,   87,  130,  119,  130,\r
+ /*   930 */   130,  130,  130,  124,   95,  130,   97,   98,  130,  100,\r
+ /*   940 */   101,  130,  130,  130,  130,   87,  130,  130,  109,  130,\r
+ /*   950 */   130,  112,  113,   95,   87,   97,  130,  130,  119,  101,\r
+ /*   960 */   130,  130,   95,  124,   97,   98,  130,  100,  101,  130,\r
+ /*   970 */   130,  113,  130,  130,  130,  130,  109,  119,  130,  112,\r
+ /*   980 */   113,  130,   87,  130,  130,  130,  119,  130,  130,  130,\r
+ /*   990 */    95,  124,   97,   98,  130,  100,  101,  130,  130,  130,\r
+ /*  1000 */   130,  130,  130,  130,  109,  130,  130,  112,  113,  130,\r
+ /*  1010 */    87,  130,  130,  130,  119,  130,  130,  130,   95,  124,\r
+ /*  1020 */    97,   98,  130,  100,  101,  130,  130,  130,  130,  130,\r
+ /*  1030 */   130,  130,  109,  130,  130,  112,  113,  130,  130,  130,\r
+ /*  1040 */    87,  130,  119,  130,  130,  130,  130,  124,   95,  130,\r
+ /*  1050 */    97,   98,  130,  100,  101,  130,  130,  130,  130,   87,\r
+ /*  1060 */   130,  130,  109,  130,  130,  112,  113,   95,   87,   97,\r
+ /*  1070 */   130,  130,  119,  101,  130,  130,   95,  124,   97,   98,\r
+ /*  1080 */   130,  100,  101,  130,  130,  113,  130,  130,  130,  130,\r
+ /*  1090 */   109,  119,  130,  112,  113,  130,   87,  130,  130,  130,\r
+ /*  1100 */   119,  130,  130,  130,   95,  124,   97,   98,  130,  100,\r
+ /*  1110 */   101,  130,  130,  130,  130,  130,  130,  130,  109,  130,\r
+ /*  1120 */   130,  112,  113,  130,   87,  130,  130,  130,  119,  130,\r
+ /*  1130 */   130,  130,   95,  124,   97,   98,  130,  130,  101,  130,\r
+ /*  1140 */   130,  130,  130,  130,  130,  130,  109,  130,  130,  112,\r
+ /*  1150 */   113,  130,  130,  130,  130,  130,  119,  130,  130,  130,\r
+ /*  1160 */    87,  130,  130,  130,  127,  128,  130,  130,   95,  130,\r
+ /*  1170 */    97,   98,  130,  100,  101,  130,  130,  130,  130,   87,\r
+ /*  1180 */   130,  130,  109,  130,  130,  112,  113,   95,   87,   97,\r
+ /*  1190 */   130,  130,  119,  101,  130,  130,   95,  124,   97,   98,\r
+ /*  1200 */   130,  100,  101,  130,  130,  113,  130,  130,  130,  130,\r
+ /*  1210 */   109,  119,  130,  112,  113,  130,   87,  130,  130,  130,\r
+ /*  1220 */   119,  130,  130,  130,   95,  124,   97,   98,  130,  100,\r
+ /*  1230 */   101,  130,  130,  130,  130,  130,  130,  130,  109,  130,\r
+ /*  1240 */   130,  112,  113,  130,   87,  130,  130,  130,  119,  130,\r
+ /*  1250 */   130,  130,   95,  124,   97,   98,  130,  100,  101,  130,\r
+ /*  1260 */   130,  130,  130,  130,  130,  130,  109,  130,  130,  112,\r
+ /*  1270 */   113,  130,  130,  130,   87,  130,  119,  130,  130,  130,\r
+ /*  1280 */   130,  124,   95,  130,   97,   98,  130,  100,  101,  130,\r
+ /*  1290 */   130,  130,  130,  130,  130,  130,  109,  130,  130,  112,\r
+ /*  1300 */   113,  130,   87,  130,  130,  130,  119,  130,  130,  130,\r
+ /*  1310 */    95,  124,   97,   98,  130,   87,  101,  130,  130,  130,\r
+ /*  1320 */   130,  130,  130,   95,  109,   97,   98,  112,  113,  101,\r
+ /*  1330 */   130,  130,  130,  130,  119,  130,  130,  109,  130,  130,\r
+ /*  1340 */   112,  113,   87,  128,  116,  130,  130,  119,  130,  130,\r
+ /*  1350 */    95,  130,   97,   98,  130,  130,  101,  130,  130,  130,\r
+ /*  1360 */   130,  130,   87,  130,  109,  130,  130,  112,  113,  130,\r
+ /*  1370 */    95,  116,   97,   98,  119,   87,  101,  130,  130,  130,\r
+ /*  1380 */   130,  130,  130,   95,  109,   97,   98,  112,  113,  101,\r
+ /*  1390 */   130,  116,  130,  130,  119,  130,  130,  109,   87,  130,\r
+ /*  1400 */   112,  113,  130,   87,  116,  130,   95,  119,   97,   98,\r
+ /*  1410 */    99,   95,  101,   97,   98,   99,  130,  101,  130,  130,\r
+ /*  1420 */   109,  130,  130,  112,  113,  109,  130,  130,  112,  113,\r
+ /*  1430 */   119,   87,  130,  130,  130,  119,  130,  130,  130,   95,\r
+ /*  1440 */    87,   97,   98,  130,  130,  101,  130,  130,   95,  130,\r
+ /*  1450 */    97,   98,  130,  109,  101,  130,  112,  113,  130,   87,\r
+ /*  1460 */   130,  130,  109,  119,  130,  112,  113,   95,  130,   97,\r
+ /*  1470 */    98,  130,  119,  101,  130,  130,  130,  130,  130,   87,\r
+ /*  1480 */   130,  109,  130,  130,  112,  113,  130,   95,   87,   97,\r
+ /*  1490 */    98,  119,  130,  101,  130,  130,   95,  130,   97,   98,\r
+ /*  1500 */   130,  109,  101,  130,  112,  113,  130,  130,   87,  130,\r
+ /*  1510 */   109,  119,  130,  112,  113,  130,   95,   87,   97,   98,\r
+ /*  1520 */   119,  130,  101,  130,  130,   95,  130,   97,   98,  130,\r
+ /*  1530 */   109,  101,  130,  112,  113,  130,   87,  130,  130,  109,\r
+ /*  1540 */   119,  130,  112,  113,   95,   87,   97,   98,  130,  119,\r
+ /*  1550 */   101,  130,  130,   95,  130,   97,   98,  130,  109,  101,\r
+ /*  1560 */   130,  112,  113,  130,  130,  130,  130,  109,  119,  130,\r
+ /*  1570 */   112,  113,   87,  130,  130,  130,  130,  119,  130,  130,\r
+ /*  1580 */    95,   87,   97,   98,  130,  130,  101,  130,  130,   95,\r
+ /*  1590 */   130,   97,   98,  130,  109,  101,  130,  112,  113,  130,\r
+ /*  1600 */   130,   87,  130,  109,  119,  130,  112,  113,  130,   95,\r
+ /*  1610 */    87,   97,   98,  119,  130,  101,  130,  130,   95,  130,\r
+ /*  1620 */    97,   98,  130,  109,  101,  130,  112,  113,  130,  130,\r
+ /*  1630 */    87,  130,  109,  119,  130,  112,  113,  130,   95,  130,\r
+ /*  1640 */    97,   98,  119,   87,  101,  130,  130,  130,  130,  130,\r
+ /*  1650 */    87,   95,  109,   97,   98,  112,  113,  101,   95,  130,\r
+ /*  1660 */    97,  130,  119,  130,  101,  109,  130,  130,  112,  113,\r
+ /*  1670 */    87,  130,  130,  130,  130,  119,  113,  130,   95,   87,\r
+ /*  1680 */    97,   98,  119,  130,  101,  130,  130,   95,  130,   97,\r
+ /*  1690 */   130,  130,  109,  101,  130,  112,  113,  130,   87,   87,\r
+ /*  1700 */   130,  109,  119,  130,  112,  113,   95,   95,   97,   97,\r
+ /*  1710 */   130,  119,  101,  101,  130,  130,  130,  130,   87,  130,\r
+ /*  1720 */   109,  130,  130,  112,  113,  113,   95,  130,   97,  130,\r
+ /*  1730 */   119,  119,  101,  130,  130,  130,  130,  130,   87,  130,\r
+ /*  1740 */   109,  130,  130,  112,  113,  130,   95,  130,   97,  130,\r
+ /*  1750 */   119,  130,  101,  130,  130,  130,  130,  130,  130,  130,\r
+ /*  1760 */   130,  130,  130,  130,  113,  130,  130,  130,  130,  130,\r
+ /*  1770 */   119,\r
+);\r
+    const YY_SHIFT_USE_DFLT = -49;\r
+    const YY_SHIFT_MAX = 260;\r
+    static public $yy_shift_ofst = array(\r
+ /*     0 */   679,  270,  342,  306,  342,   90,   90,   90,   90,   90,\r
+ /*    10 */    90,   90,   90,   90,  126,   90,   90,   90,   90,  -19,\r
+ /*    20 */   -19,  126,   54,   54,   54,   54,   54,   54,   54,   54,\r
+ /*    30 */    54,   54,   54,   54,   54,   54,   54,   54,   54,   54,\r
+ /*    40 */    54,   54,   17,  162,  198,  198,  234,  378,  378,  378,\r
+ /*    50 */   378,  378,  378,  446,  676,  734,   66,  588,  588,  679,\r
+ /*    60 */    38,  782,  -14,   76,  132,  171,  283,  274,  330,  486,\r
+ /*    70 */   330,  486,  486,  330,  667,  587,  561,  364,  778,   74,\r
+ /*    80 */    12,   94,   12,   12,  138,  177,  246,  577,  447,  574,\r
+ /*    90 */   322,  447,  322,  447,  200,  322,  322,  447,  543,  447,\r
+ /*   100 */   447,  447,  447,  574,  802,  802,  806,  232,  232,  232,\r
+ /*   110 */   802,  824,  494,  384,  522,  468,  443,  547,  611,  611,\r
+ /*   120 */   611,  611,  611,  611,  611,  611,  611,  167,  144,  127,\r
+ /*   130 */   239,  208,  241,  252,  302,  390,  432,  -48,  382,   -5,\r
+ /*   140 */   385,  388,  -42,  106,  551,  -42,  450,  497,  193,   44,\r
+ /*   150 */   491,  492,  518,  523,  549,  -42,  548,  235,  524,  -42,\r
+ /*   160 */   -42,  -36,  355,  459,  453,  451,  148,  400,  824,  812,\r
+ /*   170 */   400,  400,  400,  812,  400,  232,  400,  232,  789,  400,\r
+ /*   180 */   232,  232,  400,  498,  400,  -49,  -49,  -49,  -49,  -49,\r
+ /*   190 */   -49,  -49,  436,  109,   69,   29,  102,  217,   93,  187,\r
+ /*   200 */   154,   93,  150,  -27,  276,  423,  460,   37,  -27,  -27,\r
+ /*   210 */   240,   68,  151,  -27,   41,  743,  738,  742,  757,  715,\r
+ /*   220 */   697,  704,  687,  732,  771,  754,  791,  747,  774,  646,\r
+ /*   230 */   772,  776,  599,  281,  341,   70,   11,  122,  115,  402,\r
+ /*   240 */   573,  790,  377,  245,  398,  346,  746,  745,  794,  717,\r
+ /*   250 */   724,  685,  732,  766,  752,  713,  700,  759,  775,  717,\r
+ /*   260 */   783,\r
+);\r
+    const YY_REDUCE_USE_DFLT = -53;\r
+    const YY_REDUCE_MAX = 191;\r
+    static public $yy_reduce_ofst = array(\r
+ /*     0 */   -38,  668,  725,  753,  781, 1187,  895, 1157,  867,  809,\r
+ /*    10 */   839,  953,  981, 1101, 1037,  923, 1129, 1009, 1073, 1316,\r
+ /*    20 */  1311, 1215, 1228, 1255, 1288, 1275, 1430, 1458, 1556, 1583,\r
+ /*    30 */  1523, 1449, 1485, 1494, 1514, 1421, 1392, 1344, 1543, 1353,\r
+ /*    40 */  1372, 1401, 1631, 1592, 1611,  675,  612, 1612,  615,  858,\r
+ /*    50 */   972, 1092, 1563, 1651,   89,  139,  121,  -52,  292,  285,\r
+ /*    60 */   216,  251,  305,  288,  273,  202,  180,  184,  220,  211,\r
+ /*    70 */   256,  237,  184,  365,  260,  224,  260,  224,  203,  580,\r
+ /*    80 */   534,  419,  509,  501,  481,  419,  481,  483,  521,  368,\r
+ /*    90 */   530,  558,  528,  442,  403,  254,  338,   87,  368,  393,\r
+ /*   100 */   368,  579,  652,  650,  608,  619,  597,  575,  589,  403,\r
+ /*   110 */   609,  535,  272,  272,  272,  272,  272,  272,  272,  272,\r
+ /*   120 */   272,  272,  272,  272,  272,  272,  272,  714,  714,  726,\r
+ /*   130 */   714,  714,  714,  714,  414,  708,  708,  414,  708,  414,\r
+ /*   140 */   708,  708,  701,  716,  708,  701,  708,  708,  414,  414,\r
+ /*   150 */   708,  708,  708,  708,  708,  701,  708,  712,  708,  701,\r
+ /*   160 */   701,  414,  414,  708,  708,  708,  414,  414,  748,  740,\r
+ /*   170 */   414,  414,  414,  735,  414,   -8,  414,   -8,  719,  414,\r
+ /*   180 */    -8,   -8,  414,  374,  414,  351,  438,  448,  527,  582,\r
+ /*   190 */   513,  452,\r
+);\r
+    static public $yyExpectedTokens = array(\r
+        /* 0 */ array(1, 2, 4, 5, 16, 19, 35, ),\r
+        /* 1 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 2 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 3 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 4 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 5 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 6 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 7 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 8 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 9 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 10 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 11 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 12 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 13 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 14 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 15 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 16 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 17 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 18 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 19 */ array(19, 21, 22, 24, 26, 28, 29, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 20 */ array(19, 21, 22, 24, 26, 28, 29, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 21 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 22 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 23 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 24 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 25 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 26 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 27 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 28 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 29 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 30 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 31 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 32 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 33 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 34 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 35 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 36 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 37 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 38 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 39 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 40 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 41 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 42 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, 55, ),\r
+        /* 43 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 44 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 45 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 46 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, 54, ),\r
+        /* 47 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, ),\r
+        /* 48 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, ),\r
+        /* 49 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, ),\r
+        /* 50 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, ),\r
+        /* 51 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, ),\r
+        /* 52 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, ),\r
+        /* 53 */ array(19, 21, 22, 28, 35, 36, 41, 44, 45, 47, 48, 49, 50, 53, ),\r
+        /* 54 */ array(20, 27, 56, 57, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),\r
+        /* 55 */ array(20, 27, 56, 57, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),\r
+        /* 56 */ array(19, 21, 22, 53, ),\r
+        /* 57 */ array(27, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 58 */ array(27, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 59 */ array(1, 2, 4, 5, 16, 19, 35, ),\r
+        /* 60 */ array(2, 3, 5, 16, 17, 18, ),\r
+        /* 61 */ array(4, 19, 35, 50, 81, 82, ),\r
+        /* 62 */ array(20, 25, 27, 41, 51, 56, ),\r
+        /* 63 */ array(2, 3, 5, 16, 18, ),\r
+        /* 64 */ array(20, 25, 27, 56, ),\r
+        /* 65 */ array(21, 22, 53, ),\r
+        /* 66 */ array(25, 46, 54, ),\r
+        /* 67 */ array(20, 27, 56, ),\r
+        /* 68 */ array(27, 38, ),\r
+        /* 69 */ array(27, 56, ),\r
+        /* 70 */ array(27, 38, ),\r
+        /* 71 */ array(27, 56, ),\r
+        /* 72 */ array(27, 56, ),\r
+        /* 73 */ array(27, 38, ),\r
+        /* 74 */ array(20, 27, 56, 57, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),\r
+        /* 75 */ array(42, 56, 57, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),\r
+        /* 76 */ array(42, 56, 57, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),\r
+        /* 77 */ array(56, 57, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),\r
+        /* 78 */ array(4, 19, 35, 50, 81, 82, ),\r
+        /* 79 */ array(19, 22, 23, 31, ),\r
+        /* 80 */ array(6, 7, 9, 11, ),\r
+        /* 81 */ array(19, 22, 23, 52, ),\r
+        /* 82 */ array(6, 7, 9, 11, ),\r
+        /* 83 */ array(6, 7, 9, 11, ),\r
+        /* 84 */ array(20, 27, 31, ),\r
+        /* 85 */ array(19, 22, 52, ),\r
+        /* 86 */ array(20, 27, 31, ),\r
+        /* 87 */ array(20, 27, ),\r
+        /* 88 */ array(19, 22, ),\r
+        /* 89 */ array(19, 22, ),\r
+        /* 90 */ array(13, 14, ),\r
+        /* 91 */ array(19, 22, ),\r
+        /* 92 */ array(13, 14, ),\r
+        /* 93 */ array(19, 22, ),\r
+        /* 94 */ array(23, 25, ),\r
+        /* 95 */ array(13, 14, ),\r
+        /* 96 */ array(13, 14, ),\r
+        /* 97 */ array(19, 22, ),\r
+        /* 98 */ array(19, 22, ),\r
+        /* 99 */ array(19, 22, ),\r
+        /* 100 */ array(19, 22, ),\r
+        /* 101 */ array(19, 22, ),\r
+        /* 102 */ array(19, 22, ),\r
+        /* 103 */ array(19, 22, ),\r
+        /* 104 */ array(27, ),\r
+        /* 105 */ array(27, ),\r
+        /* 106 */ array(27, ),\r
+        /* 107 */ array(25, ),\r
+        /* 108 */ array(25, ),\r
+        /* 109 */ array(25, ),\r
+        /* 110 */ array(27, ),\r
+        /* 111 */ array(21, ),\r
+        /* 112 */ array(42, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 113 */ array(20, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 114 */ array(42, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 115 */ array(30, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 116 */ array(42, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 117 */ array(20, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 118 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 119 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 120 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 121 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 122 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 123 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 124 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 125 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 126 */ array(58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 78, 79, 80, ),\r
+        /* 127 */ array(19, 20, 22, 34, ),\r
+        /* 128 */ array(19, 20, 22, 34, ),\r
+        /* 129 */ array(22, 24, 26, 29, ),\r
+        /* 130 */ array(19, 20, 22, ),\r
+        /* 131 */ array(19, 22, 23, ),\r
+        /* 132 */ array(19, 22, 52, ),\r
+        /* 133 */ array(19, 20, 22, ),\r
+        /* 134 */ array(38, 56, ),\r
+        /* 135 */ array(20, 27, ),\r
+        /* 136 */ array(20, 27, ),\r
+        /* 137 */ array(56, 81, ),\r
+        /* 138 */ array(20, 27, ),\r
+        /* 139 */ array(20, 56, ),\r
+        /* 140 */ array(20, 27, ),\r
+        /* 141 */ array(20, 27, ),\r
+        /* 142 */ array(46, 54, ),\r
+        /* 143 */ array(21, 22, ),\r
+        /* 144 */ array(20, 27, ),\r
+        /* 145 */ array(46, 54, ),\r
+        /* 146 */ array(20, 27, ),\r
+        /* 147 */ array(20, 27, ),\r
+        /* 148 */ array(20, 56, ),\r
+        /* 149 */ array(42, 56, ),\r
+        /* 150 */ array(20, 27, ),\r
+        /* 151 */ array(20, 27, ),\r
+        /* 152 */ array(20, 27, ),\r
+        /* 153 */ array(20, 27, ),\r
+        /* 154 */ array(20, 27, ),\r
+        /* 155 */ array(46, 54, ),\r
+        /* 156 */ array(20, 27, ),\r
+        /* 157 */ array(19, 41, ),\r
+        /* 158 */ array(20, 27, ),\r
+        /* 159 */ array(46, 54, ),\r
+        /* 160 */ array(46, 54, ),\r
+        /* 161 */ array(37, 56, ),\r
+        /* 162 */ array(38, 56, ),\r
+        /* 163 */ array(20, 27, ),\r
+        /* 164 */ array(20, 27, ),\r
+        /* 165 */ array(20, 27, ),\r
+        /* 166 */ array(20, 56, ),\r
+        /* 167 */ array(56, ),\r
+        /* 168 */ array(21, ),\r
+        /* 169 */ array(27, ),\r
+        /* 170 */ array(56, ),\r
+        /* 171 */ array(56, ),\r
+        /* 172 */ array(56, ),\r
+        /* 173 */ array(27, ),\r
+        /* 174 */ array(56, ),\r
+        /* 175 */ array(25, ),\r
+        /* 176 */ array(56, ),\r
+        /* 177 */ array(25, ),\r
+        /* 178 */ array(38, ),\r
+        /* 179 */ array(56, ),\r
+        /* 180 */ array(25, ),\r
+        /* 181 */ array(25, ),\r
+        /* 182 */ array(56, ),\r
+        /* 183 */ array(41, ),\r
+        /* 184 */ array(56, ),\r
+        /* 185 */ array(),\r
+        /* 186 */ array(),\r
+        /* 187 */ array(),\r
+        /* 188 */ array(),\r
+        /* 189 */ array(),\r
+        /* 190 */ array(),\r
+        /* 191 */ array(),\r
+        /* 192 */ array(19, 21, 22, 36, 47, 48, ),\r
+        /* 193 */ array(20, 27, 41, 51, ),\r
+        /* 194 */ array(41, 46, 51, 55, ),\r
+        /* 195 */ array(28, 39, 40, 55, ),\r
+        /* 196 */ array(20, 28, 39, 40, ),\r
+        /* 197 */ array(20, 27, 68, ),\r
+        /* 198 */ array(28, 39, 40, ),\r
+        /* 199 */ array(34, 41, 51, ),\r
+        /* 200 */ array(23, 41, 51, ),\r
+        /* 201 */ array(28, 39, 40, ),\r
+        /* 202 */ array(22, 52, ),\r
+        /* 203 */ array(41, 51, ),\r
+        /* 204 */ array(20, 68, ),\r
+        /* 205 */ array(30, 37, ),\r
+        /* 206 */ array(37, 55, ),\r
+        /* 207 */ array(23, 46, ),\r
+        /* 208 */ array(41, 51, ),\r
+        /* 209 */ array(41, 51, ),\r
+        /* 210 */ array(27, 28, ),\r
+        /* 211 */ array(23, 38, ),\r
+        /* 212 */ array(31, 81, ),\r
+        /* 213 */ array(41, 51, ),\r
+        /* 214 */ array(22, 36, ),\r
+        /* 215 */ array(15, ),\r
+        /* 216 */ array(22, ),\r
+        /* 217 */ array(22, ),\r
+        /* 218 */ array(21, ),\r
+        /* 219 */ array(20, ),\r
+        /* 220 */ array(21, ),\r
+        /* 221 */ array(22, ),\r
+        /* 222 */ array(42, ),\r
+        /* 223 */ array(43, ),\r
+        /* 224 */ array(27, ),\r
+        /* 225 */ array(46, ),\r
+        /* 226 */ array(23, ),\r
+        /* 227 */ array(55, ),\r
+        /* 228 */ array(22, ),\r
+        /* 229 */ array(36, ),\r
+        /* 230 */ array(21, ),\r
+        /* 231 */ array(42, ),\r
+        /* 232 */ array(42, ),\r
+        /* 233 */ array(31, ),\r
+        /* 234 */ array(33, ),\r
+        /* 235 */ array(10, ),\r
+        /* 236 */ array(21, ),\r
+        /* 237 */ array(33, ),\r
+        /* 238 */ array(8, ),\r
+        /* 239 */ array(22, ),\r
+        /* 240 */ array(22, ),\r
+        /* 241 */ array(53, ),\r
+        /* 242 */ array(17, ),\r
+        /* 243 */ array(20, ),\r
+        /* 244 */ array(34, ),\r
+        /* 245 */ array(20, ),\r
+        /* 246 */ array(53, ),\r
+        /* 247 */ array(38, ),\r
+        /* 248 */ array(21, ),\r
+        /* 249 */ array(68, ),\r
+        /* 250 */ array(3, ),\r
+        /* 251 */ array(32, ),\r
+        /* 252 */ array(43, ),\r
+        /* 253 */ array(23, ),\r
+        /* 254 */ array(22, ),\r
+        /* 255 */ array(43, ),\r
+        /* 256 */ array(22, ),\r
+        /* 257 */ array(20, ),\r
+        /* 258 */ array(41, ),\r
+        /* 259 */ array(68, ),\r
+        /* 260 */ array(12, ),\r
+        /* 261 */ array(),\r
+        /* 262 */ array(),\r
+        /* 263 */ array(),\r
+        /* 264 */ array(),\r
+        /* 265 */ array(),\r
+        /* 266 */ array(),\r
+        /* 267 */ array(),\r
+        /* 268 */ array(),\r
+        /* 269 */ array(),\r
+        /* 270 */ array(),\r
+        /* 271 */ array(),\r
+        /* 272 */ array(),\r
+        /* 273 */ array(),\r
+        /* 274 */ array(),\r
+        /* 275 */ array(),\r
+        /* 276 */ array(),\r
+        /* 277 */ array(),\r
+        /* 278 */ array(),\r
+        /* 279 */ array(),\r
+        /* 280 */ array(),\r
+        /* 281 */ array(),\r
+        /* 282 */ array(),\r
+        /* 283 */ array(),\r
+        /* 284 */ array(),\r
+        /* 285 */ array(),\r
+        /* 286 */ array(),\r
+        /* 287 */ array(),\r
+        /* 288 */ array(),\r
+        /* 289 */ array(),\r
+        /* 290 */ array(),\r
+        /* 291 */ array(),\r
+        /* 292 */ array(),\r
+        /* 293 */ array(),\r
+        /* 294 */ array(),\r
+        /* 295 */ array(),\r
+        /* 296 */ array(),\r
+        /* 297 */ array(),\r
+        /* 298 */ array(),\r
+        /* 299 */ array(),\r
+        /* 300 */ array(),\r
+        /* 301 */ array(),\r
+        /* 302 */ array(),\r
+        /* 303 */ array(),\r
+        /* 304 */ array(),\r
+        /* 305 */ array(),\r
+        /* 306 */ array(),\r
+        /* 307 */ array(),\r
+        /* 308 */ array(),\r
+        /* 309 */ array(),\r
+        /* 310 */ array(),\r
+        /* 311 */ array(),\r
+        /* 312 */ array(),\r
+        /* 313 */ array(),\r
+        /* 314 */ array(),\r
+        /* 315 */ array(),\r
+        /* 316 */ array(),\r
+        /* 317 */ array(),\r
+        /* 318 */ array(),\r
+        /* 319 */ array(),\r
+        /* 320 */ array(),\r
+        /* 321 */ array(),\r
+        /* 322 */ array(),\r
+        /* 323 */ array(),\r
+        /* 324 */ array(),\r
+        /* 325 */ array(),\r
+        /* 326 */ array(),\r
+        /* 327 */ array(),\r
+        /* 328 */ array(),\r
+        /* 329 */ array(),\r
+        /* 330 */ array(),\r
+        /* 331 */ array(),\r
+        /* 332 */ array(),\r
+        /* 333 */ array(),\r
+        /* 334 */ array(),\r
+        /* 335 */ array(),\r
+        /* 336 */ array(),\r
+        /* 337 */ array(),\r
+        /* 338 */ array(),\r
+        /* 339 */ array(),\r
+        /* 340 */ array(),\r
+        /* 341 */ array(),\r
+        /* 342 */ array(),\r
+        /* 343 */ array(),\r
+        /* 344 */ array(),\r
+        /* 345 */ array(),\r
+        /* 346 */ array(),\r
+        /* 347 */ array(),\r
+        /* 348 */ array(),\r
+        /* 349 */ array(),\r
+        /* 350 */ array(),\r
+        /* 351 */ array(),\r
+        /* 352 */ array(),\r
+        /* 353 */ array(),\r
+        /* 354 */ array(),\r
+        /* 355 */ array(),\r
+        /* 356 */ array(),\r
+        /* 357 */ array(),\r
+        /* 358 */ array(),\r
+        /* 359 */ array(),\r
+        /* 360 */ array(),\r
+        /* 361 */ array(),\r
+        /* 362 */ array(),\r
+        /* 363 */ array(),\r
+        /* 364 */ array(),\r
+        /* 365 */ array(),\r
+        /* 366 */ array(),\r
+        /* 367 */ array(),\r
+        /* 368 */ array(),\r
+        /* 369 */ array(),\r
+        /* 370 */ array(),\r
+        /* 371 */ array(),\r
+        /* 372 */ array(),\r
+        /* 373 */ array(),\r
+        /* 374 */ array(),\r
+        /* 375 */ array(),\r
+        /* 376 */ array(),\r
+        /* 377 */ array(),\r
+        /* 378 */ array(),\r
+        /* 379 */ array(),\r
+        /* 380 */ array(),\r
+        /* 381 */ array(),\r
+        /* 382 */ array(),\r
+        /* 383 */ array(),\r
+        /* 384 */ array(),\r
+        /* 385 */ array(),\r
+        /* 386 */ array(),\r
+        /* 387 */ array(),\r
+        /* 388 */ array(),\r
+        /* 389 */ array(),\r
+        /* 390 */ array(),\r
+        /* 391 */ array(),\r
+        /* 392 */ array(),\r
+        /* 393 */ array(),\r
+        /* 394 */ array(),\r
+        /* 395 */ array(),\r
+        /* 396 */ array(),\r
+        /* 397 */ array(),\r
+        /* 398 */ array(),\r
+        /* 399 */ array(),\r
+        /* 400 */ array(),\r
+        /* 401 */ array(),\r
+        /* 402 */ array(),\r
+        /* 403 */ array(),\r
+        /* 404 */ array(),\r
+        /* 405 */ array(),\r
+        /* 406 */ array(),\r
+);\r
+    static public $yy_default = array(\r
+ /*     0 */   611,  611,  611,  611,  611,  611,  611,  611,  611,  611,\r
+ /*    10 */   611,  611,  611,  611,  596,  611,  611,  611,  611,  611,\r
+ /*    20 */   611,  611,  554,  554,  554,  554,  611,  611,  611,  611,\r
+ /*    30 */   611,  611,  611,  611,  611,  611,  611,  611,  611,  611,\r
+ /*    40 */   611,  611,  611,  611,  611,  611,  611,  611,  611,  611,\r
+ /*    50 */   611,  611,  611,  611,  564,  564,  611,  475,  475,  407,\r
+ /*    60 */   611,  611,  611,  429,  611,  611,  516,  611,  475,  475,\r
+ /*    70 */   475,  475,  475,  475,  564,  564,  564,  564,  611,  611,\r
+ /*    80 */   417,  526,  417,  417,  497,  526,  497,  490,  611,  611,\r
+ /*    90 */   423,  611,  423,  611,  519,  423,  423,  611,  611,  611,\r
+ /*   100 */   611,  611,  611,  611,  475,  475,  475,  512,  511,  519,\r
+ /*   110 */   475,  611,  611,  611,  611,  611,  611,  611,  577,  570,\r
+ /*   120 */   574,  573,  569,  578,  478,  568,  562,  611,  611,  611,\r
+ /*   130 */   611,  611,  527,  611,  611,  611,  611,  611,  611,  611,\r
+ /*   140 */   611,  611,  546,  611,  611,  548,  611,  611,  611,  611,\r
+ /*   150 */   611,  611,  611,  611,  611,  524,  611,  526,  611,  547,\r
+ /*   160 */   545,  553,  611,  611,  611,  611,  611,  485,  611,  610,\r
+ /*   170 */   496,  458,  495,  610,  597,  514,  598,  517,  489,  599,\r
+ /*   180 */   513,  542,  482,  526,  565,  558,  558,  526,  526,  558,\r
+ /*   190 */   558,  526,  611,  486,  611,  611,  611,  490,  559,  486,\r
+ /*   200 */   481,  487,  611,  560,  490,  611,  611,  502,  579,  486,\r
+ /*   210 */   611,  540,  497,  611,  611,  611,  611,  611,  611,  611,\r
+ /*   220 */   611,  611,  611,  611,  611,  502,  481,  611,  611,  611,\r
+ /*   230 */   611,  611,  611,  497,  611,  611,  611,  611,  611,  611,\r
+ /*   240 */   611,  611,  611,  611,  490,  611,  611,  540,  611,  490,\r
+ /*   250 */   611,  483,  563,  611,  611,  507,  611,  611,  515,  490,\r
+ /*   260 */   611,  455,  601,  535,  537,  551,  534,  536,  532,  533,\r
+ /*   270 */   549,  472,  480,  408,  469,  468,  466,  467,  531,  530,\r
+ /*   280 */   509,  600,  603,  460,  484,  459,  609,  602,  604,  541,\r
+ /*   290 */   529,  493,  510,  607,  608,  457,  571,  500,  499,  503,\r
+ /*   300 */   504,  505,  498,  501,  474,  471,  557,  490,  491,  506,\r
+ /*   310 */   544,  437,  508,  605,  438,  555,  492,  540,  520,  543,\r
+ /*   320 */   525,  528,  539,  470,  465,  422,  419,  424,  420,  421,\r
+ /*   330 */   418,  416,  410,  409,  411,  412,  413,  425,  414,  434,\r
+ /*   340 */   433,  435,  436,  473,  432,  431,  426,  415,  427,  428,\r
+ /*   350 */   430,  556,  606,  590,  576,  591,  592,  444,  575,  572,\r
+ /*   360 */   443,  589,  507,  561,  563,  445,  446,  462,  461,  463,\r
+ /*   370 */   464,  454,  449,  452,  448,  447,  450,  451,  453,  588,\r
+ /*   380 */   587,  523,  522,  552,  593,  595,  521,  518,  440,  439,\r
+ /*   390 */   488,  538,  494,  594,  550,  583,  582,  584,  585,  586,\r
+ /*   400 */   581,  567,  580,  441,  442,  566,  456,\r
+);\r
+    const YYNOCODE = 131;\r
+    const YYSTACKDEPTH = 100;\r
+    const YYNSTATE = 407;\r
+    const YYNRULE = 204;\r
+    const YYERRORSYMBOL = 83;\r
+    const YYERRSYMDT = 'yy0';\r
+    const YYFALLBACK = 0;\r
+    static public $yyFallback = array(\r
+    );\r
+    static function Trace($TraceFILE, $zTracePrompt)\r
+    {\r
+        if (!$TraceFILE) {\r
+            $zTracePrompt = 0;\r
+        } elseif (!$zTracePrompt) {\r
+            $TraceFILE = 0;\r
+        }\r
+        self::$yyTraceFILE = $TraceFILE;\r
+        self::$yyTracePrompt = $zTracePrompt;\r
+    }\r
+\r
+    static function PrintTrace()\r
+    {\r
+        self::$yyTraceFILE = fopen('php://output', 'w');\r
+        self::$yyTracePrompt = '<br>';\r
+    }\r
+\r
+    static public $yyTraceFILE;\r
+    static public $yyTracePrompt;\r
+    public $yyidx;                    /* Index of top element in stack */\r
+    public $yyerrcnt;                 /* Shifts left before out of the error */\r
+    public $yystack = array();  /* The parser's stack */\r
+\r
+    public $yyTokenName = array( \r
+  '$',             'COMMENT',       'PHPSTARTTAG',   'PHPENDTAG',   \r
+  'OTHER',         'FAKEPHPSTARTTAG',  'PHP_CODE',      'PHP_CODE_START_DOUBLEQUOTE',\r
+  'PHP_CODE_DOUBLEQUOTE',  'PHP_HEREDOC_START',  'PHP_HEREDOC_END',  'PHP_NOWDOC_START',\r
+  'PHP_NOWDOC_END',  'PHP_DQ_CONTENT',  'PHP_DQ_EMBED_START',  'PHP_DQ_EMBED_END',\r
+  'LITERALSTART',  'LITERALEND',    'LITERAL',       'LDEL',        \r
+  'RDEL',          'DOLLAR',        'ID',            'EQUAL',       \r
+  'FOREACH',       'PTR',           'IF',            'SPACE',       \r
+  'UNIMATH',       'FOR',           'SEMICOLON',     'INCDEC',      \r
+  'TO',            'AS',            'APTR',          'LDELSLASH',   \r
+  'INTEGER',       'COMMA',         'COLON',         'MATH',        \r
+  'ANDSYM',        'OPENP',         'CLOSEP',        'QMARK',       \r
+  'NOT',           'TYPECAST',      'DOT',           'BOOLEAN',     \r
+  'NULL',          'SINGLEQUOTESTRING',  'QUOTE',         'DOUBLECOLON', \r
+  'AT',            'HATCH',         'OPENB',         'CLOSEB',      \r
+  'VERT',          'ISIN',          'ISDIVBY',       'ISNOTDIVBY',  \r
+  'ISEVEN',        'ISNOTEVEN',     'ISEVENBY',      'ISNOTEVENBY', \r
+  'ISODD',         'ISNOTODD',      'ISODDBY',       'ISNOTODDBY',  \r
+  'INSTANCEOF',    'EQUALS',        'NOTEQUALS',     'GREATERTHAN', \r
+  'LESSTHAN',      'GREATEREQUAL',  'LESSEQUAL',     'IDENTITY',    \r
+  'NONEIDENTITY',  'MOD',           'LAND',          'LOR',         \r
+  'LXOR',          'BACKTICK',      'DOLLARID',      'error',       \r
+  'start',         'template',      'template_element',  'smartytag',   \r
+  'literal',       'php_code',      'php_code_element',  'php_dq_contents',\r
+  'php_dq_content',  'literal_elements',  'literal_element',  'value',       \r
+  'attributes',    'variable',      'expr',          'ternary',     \r
+  'ifexprs',       'varindexed',    'modifier',      'modparameters',\r
+  'statement',     'statements',    'optspace',      'varvar',      \r
+  'foraction',     'array',         'specialclose',  'attribute',   \r
+  'exprs',         'function',      'doublequoted',  'method',      \r
+  'params',        'objectchain',   'arrayindex',    'object',      \r
+  'indexdef',      'varvarele',     'objectelement',  'modparameter',\r
+  'ifexpr',        'ifcond',        'lop',           'arrayelements',\r
+  'arrayelement',  'doublequotedcontent',\r
+    );\r
+\r
+    static public $yyRuleName = array(\r
+ /*   0 */ "start ::= template",\r
+ /*   1 */ "template ::= template_element",\r
+ /*   2 */ "template ::= template template_element",\r
+ /*   3 */ "template_element ::= smartytag",\r
+ /*   4 */ "template_element ::= COMMENT",\r
+ /*   5 */ "template_element ::= literal",\r
+ /*   6 */ "template_element ::= PHPSTARTTAG php_code PHPENDTAG",\r
+ /*   7 */ "template_element ::= OTHER",\r
+ /*   8 */ "template_element ::= FAKEPHPSTARTTAG",\r
+ /*   9 */ "php_code ::= php_code_element php_code",\r
+ /*  10 */ "php_code ::=",\r
+ /*  11 */ "php_code_element ::= PHP_CODE",\r
+ /*  12 */ "php_code_element ::= PHP_CODE_START_DOUBLEQUOTE php_dq_contents PHP_CODE_DOUBLEQUOTE",\r
+ /*  13 */ "php_code_element ::= PHP_HEREDOC_START php_dq_contents PHP_HEREDOC_END",\r
+ /*  14 */ "php_code_element ::= PHP_NOWDOC_START php_dq_contents PHP_NOWDOC_END",\r
+ /*  15 */ "php_dq_contents ::= php_dq_content php_dq_contents",\r
+ /*  16 */ "php_dq_contents ::=",\r
+ /*  17 */ "php_dq_content ::= PHP_DQ_CONTENT",\r
+ /*  18 */ "php_dq_content ::= PHP_DQ_EMBED_START php_code PHP_DQ_EMBED_END",\r
+ /*  19 */ "literal ::= LITERALSTART LITERALEND",\r
+ /*  20 */ "literal ::= LITERALSTART literal_elements LITERALEND",\r
+ /*  21 */ "literal_elements ::= literal_element literal_elements",\r
+ /*  22 */ "literal_elements ::=",\r
+ /*  23 */ "literal_element ::= literal",\r
+ /*  24 */ "literal_element ::= LITERAL",\r
+ /*  25 */ "literal_element ::= PHPSTARTTAG",\r
+ /*  26 */ "literal_element ::= FAKEPHPSTARTTAG",\r
+ /*  27 */ "literal_element ::= PHPENDTAG",\r
+ /*  28 */ "smartytag ::= LDEL value RDEL",\r
+ /*  29 */ "smartytag ::= LDEL value attributes RDEL",\r
+ /*  30 */ "smartytag ::= LDEL variable attributes RDEL",\r
+ /*  31 */ "smartytag ::= LDEL expr attributes RDEL",\r
+ /*  32 */ "smartytag ::= LDEL ternary attributes RDEL",\r
+ /*  33 */ "smartytag ::= LDEL DOLLAR ID EQUAL value RDEL",\r
+ /*  34 */ "smartytag ::= LDEL DOLLAR ID EQUAL expr RDEL",\r
+ /*  35 */ "smartytag ::= LDEL DOLLAR ID EQUAL expr attributes RDEL",\r
+ /*  36 */ "smartytag ::= LDEL DOLLAR ID EQUAL ifexprs attributes RDEL",\r
+ /*  37 */ "smartytag ::= LDEL DOLLAR ID EQUAL ternary attributes RDEL",\r
+ /*  38 */ "smartytag ::= LDEL varindexed EQUAL expr attributes RDEL",\r
+ /*  39 */ "smartytag ::= LDEL varindexed EQUAL ternary attributes RDEL",\r
+ /*  40 */ "smartytag ::= LDEL varindexed EQUAL ifexprs attributes RDEL",\r
+ /*  41 */ "smartytag ::= LDEL ID attributes RDEL",\r
+ /*  42 */ "smartytag ::= LDEL FOREACH attributes RDEL",\r
+ /*  43 */ "smartytag ::= LDEL ID RDEL",\r
+ /*  44 */ "smartytag ::= LDEL ID PTR ID attributes RDEL",\r
+ /*  45 */ "smartytag ::= LDEL ID modifier modparameters attributes RDEL",\r
+ /*  46 */ "smartytag ::= LDEL ID PTR ID modifier modparameters attributes RDEL",\r
+ /*  47 */ "smartytag ::= LDEL IF SPACE ifexprs RDEL",\r
+ /*  48 */ "smartytag ::= LDEL IF UNIMATH ifexprs RDEL",\r
+ /*  49 */ "smartytag ::= LDEL IF SPACE statement RDEL",\r
+ /*  50 */ "smartytag ::= LDEL FOR SPACE statements SEMICOLON optspace ifexprs SEMICOLON optspace DOLLAR varvar foraction RDEL",\r
+ /*  51 */ "foraction ::= EQUAL expr",\r
+ /*  52 */ "foraction ::= INCDEC",\r
+ /*  53 */ "smartytag ::= LDEL FOR SPACE statement TO expr attributes RDEL",\r
+ /*  54 */ "smartytag ::= LDEL FOREACH SPACE value AS DOLLAR varvar RDEL",\r
+ /*  55 */ "smartytag ::= LDEL FOREACH SPACE value AS DOLLAR varvar APTR DOLLAR varvar RDEL",\r
+ /*  56 */ "smartytag ::= LDEL FOREACH SPACE array AS DOLLAR varvar RDEL",\r
+ /*  57 */ "smartytag ::= LDEL FOREACH SPACE array AS DOLLAR varvar APTR DOLLAR varvar RDEL",\r
+ /*  58 */ "smartytag ::= LDELSLASH ID RDEL",\r
+ /*  59 */ "smartytag ::= LDELSLASH specialclose RDEL",\r
+ /*  60 */ "specialclose ::= IF",\r
+ /*  61 */ "specialclose ::= FOR",\r
+ /*  62 */ "specialclose ::= FOREACH",\r
+ /*  63 */ "smartytag ::= LDELSLASH ID attributes RDEL",\r
+ /*  64 */ "smartytag ::= LDELSLASH ID modifier modparameters attributes RDEL",\r
+ /*  65 */ "smartytag ::= LDELSLASH ID PTR ID RDEL",\r
+ /*  66 */ "attributes ::= attributes attribute",\r
+ /*  67 */ "attributes ::= attribute",\r
+ /*  68 */ "attributes ::=",\r
+ /*  69 */ "attribute ::= SPACE ID EQUAL ID",\r
+ /*  70 */ "attribute ::= SPACE ID EQUAL expr",\r
+ /*  71 */ "attribute ::= SPACE ID EQUAL ifexprs",\r
+ /*  72 */ "attribute ::= SPACE ID EQUAL value",\r
+ /*  73 */ "attribute ::= SPACE ID EQUAL ternary",\r
+ /*  74 */ "attribute ::= SPACE ID",\r
+ /*  75 */ "attribute ::= SPACE INTEGER EQUAL expr",\r
+ /*  76 */ "statements ::= statement",\r
+ /*  77 */ "statements ::= statements COMMA statement",\r
+ /*  78 */ "statement ::= DOLLAR varvar EQUAL expr",\r
+ /*  79 */ "expr ::= ID",\r
+ /*  80 */ "expr ::= exprs",\r
+ /*  81 */ "expr ::= DOLLAR ID COLON ID",\r
+ /*  82 */ "expr ::= expr modifier modparameters",\r
+ /*  83 */ "exprs ::= value",\r
+ /*  84 */ "exprs ::= exprs MATH value",\r
+ /*  85 */ "exprs ::= exprs UNIMATH value",\r
+ /*  86 */ "exprs ::= exprs ANDSYM value",\r
+ /*  87 */ "exprs ::= array",\r
+ /*  88 */ "ternary ::= OPENP ifexprs CLOSEP QMARK expr COLON expr",\r
+ /*  89 */ "ternary ::= OPENP expr CLOSEP QMARK expr COLON expr",\r
+ /*  90 */ "value ::= variable",\r
+ /*  91 */ "value ::= UNIMATH value",\r
+ /*  92 */ "value ::= NOT value",\r
+ /*  93 */ "value ::= TYPECAST value",\r
+ /*  94 */ "value ::= variable INCDEC",\r
+ /*  95 */ "value ::= INTEGER",\r
+ /*  96 */ "value ::= INTEGER DOT INTEGER",\r
+ /*  97 */ "value ::= BOOLEAN",\r
+ /*  98 */ "value ::= NULL",\r
+ /*  99 */ "value ::= function",\r
+ /* 100 */ "value ::= OPENP expr CLOSEP",\r
+ /* 101 */ "value ::= SINGLEQUOTESTRING",\r
+ /* 102 */ "value ::= QUOTE doublequoted QUOTE",\r
+ /* 103 */ "value ::= QUOTE QUOTE",\r
+ /* 104 */ "value ::= ID DOUBLECOLON method",\r
+ /* 105 */ "value ::= ID DOUBLECOLON DOLLAR ID OPENP params CLOSEP",\r
+ /* 106 */ "value ::= ID DOUBLECOLON method objectchain",\r
+ /* 107 */ "value ::= ID DOUBLECOLON DOLLAR ID OPENP params CLOSEP objectchain",\r
+ /* 108 */ "value ::= ID DOUBLECOLON ID",\r
+ /* 109 */ "value ::= ID DOUBLECOLON DOLLAR ID arrayindex",\r
+ /* 110 */ "value ::= ID DOUBLECOLON DOLLAR ID arrayindex objectchain",\r
+ /* 111 */ "value ::= smartytag",\r
+ /* 112 */ "variable ::= varindexed",\r
+ /* 113 */ "variable ::= DOLLAR varvar AT ID",\r
+ /* 114 */ "variable ::= object",\r
+ /* 115 */ "variable ::= HATCH ID HATCH",\r
+ /* 116 */ "variable ::= HATCH variable HATCH",\r
+ /* 117 */ "varindexed ::= DOLLAR varvar arrayindex",\r
+ /* 118 */ "arrayindex ::= arrayindex indexdef",\r
+ /* 119 */ "arrayindex ::=",\r
+ /* 120 */ "indexdef ::= DOT DOLLAR varvar",\r
+ /* 121 */ "indexdef ::= DOT DOLLAR varvar AT ID",\r
+ /* 122 */ "indexdef ::= DOT ID",\r
+ /* 123 */ "indexdef ::= DOT BOOLEAN",\r
+ /* 124 */ "indexdef ::= DOT NULL",\r
+ /* 125 */ "indexdef ::= DOT INTEGER",\r
+ /* 126 */ "indexdef ::= DOT LDEL exprs RDEL",\r
+ /* 127 */ "indexdef ::= OPENB ID CLOSEB",\r
+ /* 128 */ "indexdef ::= OPENB ID DOT ID CLOSEB",\r
+ /* 129 */ "indexdef ::= OPENB exprs CLOSEB",\r
+ /* 130 */ "indexdef ::= OPENB CLOSEB",\r
+ /* 131 */ "varvar ::= varvarele",\r
+ /* 132 */ "varvar ::= varvar varvarele",\r
+ /* 133 */ "varvarele ::= ID",\r
+ /* 134 */ "varvarele ::= LDEL expr RDEL",\r
+ /* 135 */ "object ::= varindexed objectchain",\r
+ /* 136 */ "objectchain ::= objectelement",\r
+ /* 137 */ "objectchain ::= objectchain objectelement",\r
+ /* 138 */ "objectelement ::= PTR ID arrayindex",\r
+ /* 139 */ "objectelement ::= PTR variable arrayindex",\r
+ /* 140 */ "objectelement ::= PTR LDEL expr RDEL arrayindex",\r
+ /* 141 */ "objectelement ::= PTR ID LDEL expr RDEL arrayindex",\r
+ /* 142 */ "objectelement ::= PTR method",\r
+ /* 143 */ "function ::= ID OPENP params CLOSEP",\r
+ /* 144 */ "method ::= ID OPENP params CLOSEP",\r
+ /* 145 */ "params ::= expr COMMA params",\r
+ /* 146 */ "params ::= expr",\r
+ /* 147 */ "params ::=",\r
+ /* 148 */ "modifier ::= VERT AT ID",\r
+ /* 149 */ "modifier ::= VERT ID",\r
+ /* 150 */ "modparameters ::= modparameters modparameter",\r
+ /* 151 */ "modparameters ::=",\r
+ /* 152 */ "modparameter ::= COLON exprs",\r
+ /* 153 */ "modparameter ::= COLON ID",\r
+ /* 154 */ "ifexprs ::= ifexpr",\r
+ /* 155 */ "ifexprs ::= NOT ifexprs",\r
+ /* 156 */ "ifexprs ::= OPENP ifexprs CLOSEP",\r
+ /* 157 */ "ifexpr ::= expr",\r
+ /* 158 */ "ifexpr ::= expr ifcond expr",\r
+ /* 159 */ "ifexpr ::= expr ISIN array",\r
+ /* 160 */ "ifexpr ::= expr ISIN value",\r
+ /* 161 */ "ifexpr ::= ifexprs lop ifexprs",\r
+ /* 162 */ "ifexpr ::= ifexprs ISDIVBY ifexprs",\r
+ /* 163 */ "ifexpr ::= ifexprs ISNOTDIVBY ifexprs",\r
+ /* 164 */ "ifexpr ::= ifexprs ISEVEN",\r
+ /* 165 */ "ifexpr ::= ifexprs ISNOTEVEN",\r
+ /* 166 */ "ifexpr ::= ifexprs ISEVENBY ifexprs",\r
+ /* 167 */ "ifexpr ::= ifexprs ISNOTEVENBY ifexprs",\r
+ /* 168 */ "ifexpr ::= ifexprs ISODD",\r
+ /* 169 */ "ifexpr ::= ifexprs ISNOTODD",\r
+ /* 170 */ "ifexpr ::= ifexprs ISODDBY ifexprs",\r
+ /* 171 */ "ifexpr ::= ifexprs ISNOTODDBY ifexprs",\r
+ /* 172 */ "ifexpr ::= value INSTANCEOF ID",\r
+ /* 173 */ "ifexpr ::= value INSTANCEOF value",\r
+ /* 174 */ "ifcond ::= EQUALS",\r
+ /* 175 */ "ifcond ::= NOTEQUALS",\r
+ /* 176 */ "ifcond ::= GREATERTHAN",\r
+ /* 177 */ "ifcond ::= LESSTHAN",\r
+ /* 178 */ "ifcond ::= GREATEREQUAL",\r
+ /* 179 */ "ifcond ::= LESSEQUAL",\r
+ /* 180 */ "ifcond ::= IDENTITY",\r
+ /* 181 */ "ifcond ::= NONEIDENTITY",\r
+ /* 182 */ "ifcond ::= MOD",\r
+ /* 183 */ "lop ::= LAND",\r
+ /* 184 */ "lop ::= LOR",\r
+ /* 185 */ "lop ::= LXOR",\r
+ /* 186 */ "array ::= OPENB arrayelements CLOSEB",\r
+ /* 187 */ "arrayelements ::= arrayelement",\r
+ /* 188 */ "arrayelements ::= arrayelements COMMA arrayelement",\r
+ /* 189 */ "arrayelements ::=",\r
+ /* 190 */ "arrayelement ::= value APTR expr",\r
+ /* 191 */ "arrayelement ::= ID APTR expr",\r
+ /* 192 */ "arrayelement ::= expr",\r
+ /* 193 */ "doublequoted ::= doublequoted doublequotedcontent",\r
+ /* 194 */ "doublequoted ::= doublequotedcontent",\r
+ /* 195 */ "doublequotedcontent ::= BACKTICK variable BACKTICK",\r
+ /* 196 */ "doublequotedcontent ::= BACKTICK expr BACKTICK",\r
+ /* 197 */ "doublequotedcontent ::= DOLLARID",\r
+ /* 198 */ "doublequotedcontent ::= LDEL variable RDEL",\r
+ /* 199 */ "doublequotedcontent ::= LDEL expr RDEL",\r
+ /* 200 */ "doublequotedcontent ::= smartytag",\r
+ /* 201 */ "doublequotedcontent ::= OTHER",\r
+ /* 202 */ "optspace ::= SPACE",\r
+ /* 203 */ "optspace ::=",\r
+    );\r
+\r
+    function tokenName($tokenType)\r
+    {\r
+        if ($tokenType === 0) {\r
+            return 'End of Input';\r
+        }\r
+        if ($tokenType > 0 && $tokenType < count($this->yyTokenName)) {\r
+            return $this->yyTokenName[$tokenType];\r
+        } else {\r
+            return "Unknown";\r
+        }\r
+    }\r
+\r
+    static function yy_destructor($yymajor, $yypminor)\r
+    {\r
+        switch ($yymajor) {\r
+            default:  break;   /* If no destructor action specified: do nothing */\r
+        }\r
+    }\r
+\r
+    function yy_pop_parser_stack()\r
+    {\r
+        if (!count($this->yystack)) {\r
+            return;\r
+        }\r
+        $yytos = array_pop($this->yystack);\r
+        if (self::$yyTraceFILE && $this->yyidx >= 0) {\r
+            fwrite(self::$yyTraceFILE,\r
+                self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .\r
+                    "\n");\r
+        }\r
+        $yymajor = $yytos->major;\r
+        self::yy_destructor($yymajor, $yytos->minor);\r
+        $this->yyidx--;\r
+        return $yymajor;\r
+    }\r
+\r
+    function __destruct()\r
+    {\r
+        while ($this->yyidx >= 0) {\r
+            $this->yy_pop_parser_stack();\r
+        }\r
+        if (is_resource(self::$yyTraceFILE)) {\r
+            fclose(self::$yyTraceFILE);\r
+        }\r
+    }\r
+\r
+    function yy_get_expected_tokens($token)\r
+    {\r
+        $state = $this->yystack[$this->yyidx]->stateno;\r
+        $expected = self::$yyExpectedTokens[$state];\r
+        if (in_array($token, self::$yyExpectedTokens[$state], true)) {\r
+            return $expected;\r
+        }\r
+        $stack = $this->yystack;\r
+        $yyidx = $this->yyidx;\r
+        do {\r
+            $yyact = $this->yy_find_shift_action($token);\r
+            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {\r
+                // reduce action\r
+                $done = 0;\r
+                do {\r
+                    if ($done++ == 100) {\r
+                        $this->yyidx = $yyidx;\r
+                        $this->yystack = $stack;\r
+                        // too much recursion prevents proper detection\r
+                        // so give up\r
+                        return array_unique($expected);\r
+                    }\r
+                    $yyruleno = $yyact - self::YYNSTATE;\r
+                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];\r
+                    $nextstate = $this->yy_find_reduce_action(\r
+                        $this->yystack[$this->yyidx]->stateno,\r
+                        self::$yyRuleInfo[$yyruleno]['lhs']);\r
+                    if (isset(self::$yyExpectedTokens[$nextstate])) {\r
+                        $expected += self::$yyExpectedTokens[$nextstate];\r
+                            if (in_array($token,\r
+                                  self::$yyExpectedTokens[$nextstate], true)) {\r
+                            $this->yyidx = $yyidx;\r
+                            $this->yystack = $stack;\r
+                            return array_unique($expected);\r
+                        }\r
+                    }\r
+                    if ($nextstate < self::YYNSTATE) {\r
+                        // we need to shift a non-terminal\r
+                        $this->yyidx++;\r
+                        $x = new TP_yyStackEntry;\r
+                        $x->stateno = $nextstate;\r
+                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];\r
+                        $this->yystack[$this->yyidx] = $x;\r
+                        continue 2;\r
+                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {\r
+                        $this->yyidx = $yyidx;\r
+                        $this->yystack = $stack;\r
+                        // the last token was just ignored, we can't accept\r
+                        // by ignoring input, this is in essence ignoring a\r
+                        // syntax error!\r
+                        return array_unique($expected);\r
+                    } elseif ($nextstate === self::YY_NO_ACTION) {\r
+                        $this->yyidx = $yyidx;\r
+                        $this->yystack = $stack;\r
+                        // input accepted, but not shifted (I guess)\r
+                        return $expected;\r
+                    } else {\r
+                        $yyact = $nextstate;\r
+                    }\r
+                } while (true);\r
+            }\r
+            break;\r
+        } while (true);\r
+        return array_unique($expected);\r
+    }\r
+\r
+    function yy_is_expected_token($token)\r
+    {\r
+        if ($token === 0) {\r
+            return true; // 0 is not part of this\r
+        }\r
+        $state = $this->yystack[$this->yyidx]->stateno;\r
+        if (in_array($token, self::$yyExpectedTokens[$state], true)) {\r
+            return true;\r
+        }\r
+        $stack = $this->yystack;\r
+        $yyidx = $this->yyidx;\r
+        do {\r
+            $yyact = $this->yy_find_shift_action($token);\r
+            if ($yyact >= self::YYNSTATE && $yyact < self::YYNSTATE + self::YYNRULE) {\r
+                // reduce action\r
+                $done = 0;\r
+                do {\r
+                    if ($done++ == 100) {\r
+                        $this->yyidx = $yyidx;\r
+                        $this->yystack = $stack;\r
+                        // too much recursion prevents proper detection\r
+                        // so give up\r
+                        return true;\r
+                    }\r
+                    $yyruleno = $yyact - self::YYNSTATE;\r
+                    $this->yyidx -= self::$yyRuleInfo[$yyruleno]['rhs'];\r
+                    $nextstate = $this->yy_find_reduce_action(\r
+                        $this->yystack[$this->yyidx]->stateno,\r
+                        self::$yyRuleInfo[$yyruleno]['lhs']);\r
+                    if (isset(self::$yyExpectedTokens[$nextstate]) &&\r
+                          in_array($token, self::$yyExpectedTokens[$nextstate], true)) {\r
+                        $this->yyidx = $yyidx;\r
+                        $this->yystack = $stack;\r
+                        return true;\r
+                    }\r
+                    if ($nextstate < self::YYNSTATE) {\r
+                        // we need to shift a non-terminal\r
+                        $this->yyidx++;\r
+                        $x = new TP_yyStackEntry;\r
+                        $x->stateno = $nextstate;\r
+                        $x->major = self::$yyRuleInfo[$yyruleno]['lhs'];\r
+                        $this->yystack[$this->yyidx] = $x;\r
+                        continue 2;\r
+                    } elseif ($nextstate == self::YYNSTATE + self::YYNRULE + 1) {\r
+                        $this->yyidx = $yyidx;\r
+                        $this->yystack = $stack;\r
+                        if (!$token) {\r
+                            // end of input: this is valid\r
+                            return true;\r
+                        }\r
+                        // the last token was just ignored, we can't accept\r
+                        // by ignoring input, this is in essence ignoring a\r
+                        // syntax error!\r
+                        return false;\r
+                    } elseif ($nextstate === self::YY_NO_ACTION) {\r
+                        $this->yyidx = $yyidx;\r
+                        $this->yystack = $stack;\r
+                        // input accepted, but not shifted (I guess)\r
+                        return true;\r
+                    } else {\r
+                        $yyact = $nextstate;\r
+                    }\r
+                } while (true);\r
+            }\r
+            break;\r
+        } while (true);\r
+        $this->yyidx = $yyidx;\r
+        $this->yystack = $stack;\r
+        return true;\r
+    }\r
+\r
+   function yy_find_shift_action($iLookAhead)\r
+    {\r
+        $stateno = $this->yystack[$this->yyidx]->stateno;\r
+     \r
+        /* if ($this->yyidx < 0) return self::YY_NO_ACTION;  */\r
+        if (!isset(self::$yy_shift_ofst[$stateno])) {\r
+            // no shift actions\r
+            return self::$yy_default[$stateno];\r
+        }\r
+        $i = self::$yy_shift_ofst[$stateno];\r
+        if ($i === self::YY_SHIFT_USE_DFLT) {\r
+            return self::$yy_default[$stateno];\r
+        }\r
+        if ($iLookAhead == self::YYNOCODE) {\r
+            return self::YY_NO_ACTION;\r
+        }\r
+        $i += $iLookAhead;\r
+        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||\r
+              self::$yy_lookahead[$i] != $iLookAhead) {\r
+            if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)\r
+                   && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {\r
+                if (self::$yyTraceFILE) {\r
+                    fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .\r
+                        $this->yyTokenName[$iLookAhead] . " => " .\r
+                        $this->yyTokenName[$iFallback] . "\n");\r
+                }\r
+                return $this->yy_find_shift_action($iFallback);\r
+            }\r
+            return self::$yy_default[$stateno];\r
+        } else {\r
+            return self::$yy_action[$i];\r
+        }\r
+    }\r
+\r
+    function yy_find_reduce_action($stateno, $iLookAhead)\r
+    {\r
+        /* $stateno = $this->yystack[$this->yyidx]->stateno; */\r
+\r
+        if (!isset(self::$yy_reduce_ofst[$stateno])) {\r
+            return self::$yy_default[$stateno];\r
+        }\r
+        $i = self::$yy_reduce_ofst[$stateno];\r
+        if ($i == self::YY_REDUCE_USE_DFLT) {\r
+            return self::$yy_default[$stateno];\r
+        }\r
+        if ($iLookAhead == self::YYNOCODE) {\r
+            return self::YY_NO_ACTION;\r
+        }\r
+        $i += $iLookAhead;\r
+        if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||\r
+              self::$yy_lookahead[$i] != $iLookAhead) {\r
+            return self::$yy_default[$stateno];\r
+        } else {\r
+            return self::$yy_action[$i];\r
+        }\r
+    }\r
+\r
+    function yy_shift($yyNewState, $yyMajor, $yypMinor)\r
+    {\r
+        $this->yyidx++;\r
+        if ($this->yyidx >= self::YYSTACKDEPTH) {\r
+            $this->yyidx--;\r
+            if (self::$yyTraceFILE) {\r
+                fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);\r
+            }\r
+            while ($this->yyidx >= 0) {\r
+                $this->yy_pop_parser_stack();\r
+            }\r
+            return;\r
+        }\r
+        $yytos = new TP_yyStackEntry;\r
+        $yytos->stateno = $yyNewState;\r
+        $yytos->major = $yyMajor;\r
+        $yytos->minor = $yypMinor;\r
+        array_push($this->yystack, $yytos);\r
+        if (self::$yyTraceFILE && $this->yyidx > 0) {\r
+            fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,\r
+                $yyNewState);\r
+            fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);\r
+            for($i = 1; $i <= $this->yyidx; $i++) {\r
+                fprintf(self::$yyTraceFILE, " %s",\r
+                    $this->yyTokenName[$this->yystack[$i]->major]);\r
+            }\r
+            fwrite(self::$yyTraceFILE,"\n");\r
+        }\r
+    }\r
+\r
+    static public $yyRuleInfo = array(\r
+  array( 'lhs' => 84, 'rhs' => 1 ),\r
+  array( 'lhs' => 85, 'rhs' => 1 ),\r
+  array( 'lhs' => 85, 'rhs' => 2 ),\r
+  array( 'lhs' => 86, 'rhs' => 1 ),\r
+  array( 'lhs' => 86, 'rhs' => 1 ),\r
+  array( 'lhs' => 86, 'rhs' => 1 ),\r
+  array( 'lhs' => 86, 'rhs' => 3 ),\r
+  array( 'lhs' => 86, 'rhs' => 1 ),\r
+  array( 'lhs' => 86, 'rhs' => 1 ),\r
+  array( 'lhs' => 89, 'rhs' => 2 ),\r
+  array( 'lhs' => 89, 'rhs' => 0 ),\r
+  array( 'lhs' => 90, 'rhs' => 1 ),\r
+  array( 'lhs' => 90, 'rhs' => 3 ),\r
+  array( 'lhs' => 90, 'rhs' => 3 ),\r
+  array( 'lhs' => 90, 'rhs' => 3 ),\r
+  array( 'lhs' => 91, 'rhs' => 2 ),\r
+  array( 'lhs' => 91, 'rhs' => 0 ),\r
+  array( 'lhs' => 92, 'rhs' => 1 ),\r
+  array( 'lhs' => 92, 'rhs' => 3 ),\r
+  array( 'lhs' => 88, 'rhs' => 2 ),\r
+  array( 'lhs' => 88, 'rhs' => 3 ),\r
+  array( 'lhs' => 93, 'rhs' => 2 ),\r
+  array( 'lhs' => 93, 'rhs' => 0 ),\r
+  array( 'lhs' => 94, 'rhs' => 1 ),\r
+  array( 'lhs' => 94, 'rhs' => 1 ),\r
+  array( 'lhs' => 94, 'rhs' => 1 ),\r
+  array( 'lhs' => 94, 'rhs' => 1 ),\r
+  array( 'lhs' => 94, 'rhs' => 1 ),\r
+  array( 'lhs' => 87, 'rhs' => 3 ),\r
+  array( 'lhs' => 87, 'rhs' => 4 ),\r
+  array( 'lhs' => 87, 'rhs' => 4 ),\r
+  array( 'lhs' => 87, 'rhs' => 4 ),\r
+  array( 'lhs' => 87, 'rhs' => 4 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 7 ),\r
+  array( 'lhs' => 87, 'rhs' => 7 ),\r
+  array( 'lhs' => 87, 'rhs' => 7 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 4 ),\r
+  array( 'lhs' => 87, 'rhs' => 4 ),\r
+  array( 'lhs' => 87, 'rhs' => 3 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 8 ),\r
+  array( 'lhs' => 87, 'rhs' => 5 ),\r
+  array( 'lhs' => 87, 'rhs' => 5 ),\r
+  array( 'lhs' => 87, 'rhs' => 5 ),\r
+  array( 'lhs' => 87, 'rhs' => 13 ),\r
+  array( 'lhs' => 108, 'rhs' => 2 ),\r
+  array( 'lhs' => 108, 'rhs' => 1 ),\r
+  array( 'lhs' => 87, 'rhs' => 8 ),\r
+  array( 'lhs' => 87, 'rhs' => 8 ),\r
+  array( 'lhs' => 87, 'rhs' => 11 ),\r
+  array( 'lhs' => 87, 'rhs' => 8 ),\r
+  array( 'lhs' => 87, 'rhs' => 11 ),\r
+  array( 'lhs' => 87, 'rhs' => 3 ),\r
+  array( 'lhs' => 87, 'rhs' => 3 ),\r
+  array( 'lhs' => 110, 'rhs' => 1 ),\r
+  array( 'lhs' => 110, 'rhs' => 1 ),\r
+  array( 'lhs' => 110, 'rhs' => 1 ),\r
+  array( 'lhs' => 87, 'rhs' => 4 ),\r
+  array( 'lhs' => 87, 'rhs' => 6 ),\r
+  array( 'lhs' => 87, 'rhs' => 5 ),\r
+  array( 'lhs' => 96, 'rhs' => 2 ),\r
+  array( 'lhs' => 96, 'rhs' => 1 ),\r
+  array( 'lhs' => 96, 'rhs' => 0 ),\r
+  array( 'lhs' => 111, 'rhs' => 4 ),\r
+  array( 'lhs' => 111, 'rhs' => 4 ),\r
+  array( 'lhs' => 111, 'rhs' => 4 ),\r
+  array( 'lhs' => 111, 'rhs' => 4 ),\r
+  array( 'lhs' => 111, 'rhs' => 4 ),\r
+  array( 'lhs' => 111, 'rhs' => 2 ),\r
+  array( 'lhs' => 111, 'rhs' => 4 ),\r
+  array( 'lhs' => 105, 'rhs' => 1 ),\r
+  array( 'lhs' => 105, 'rhs' => 3 ),\r
+  array( 'lhs' => 104, 'rhs' => 4 ),\r
+  array( 'lhs' => 98, 'rhs' => 1 ),\r
+  array( 'lhs' => 98, 'rhs' => 1 ),\r
+  array( 'lhs' => 98, 'rhs' => 4 ),\r
+  array( 'lhs' => 98, 'rhs' => 3 ),\r
+  array( 'lhs' => 112, 'rhs' => 1 ),\r
+  array( 'lhs' => 112, 'rhs' => 3 ),\r
+  array( 'lhs' => 112, 'rhs' => 3 ),\r
+  array( 'lhs' => 112, 'rhs' => 3 ),\r
+  array( 'lhs' => 112, 'rhs' => 1 ),\r
+  array( 'lhs' => 99, 'rhs' => 7 ),\r
+  array( 'lhs' => 99, 'rhs' => 7 ),\r
+  array( 'lhs' => 95, 'rhs' => 1 ),\r
+  array( 'lhs' => 95, 'rhs' => 2 ),\r
+  array( 'lhs' => 95, 'rhs' => 2 ),\r
+  array( 'lhs' => 95, 'rhs' => 2 ),\r
+  array( 'lhs' => 95, 'rhs' => 2 ),\r
+  array( 'lhs' => 95, 'rhs' => 1 ),\r
+  array( 'lhs' => 95, 'rhs' => 3 ),\r
+  array( 'lhs' => 95, 'rhs' => 1 ),\r
+  array( 'lhs' => 95, 'rhs' => 1 ),\r
+  array( 'lhs' => 95, 'rhs' => 1 ),\r
+  array( 'lhs' => 95, 'rhs' => 3 ),\r
+  array( 'lhs' => 95, 'rhs' => 1 ),\r
+  array( 'lhs' => 95, 'rhs' => 3 ),\r
+  array( 'lhs' => 95, 'rhs' => 2 ),\r
+  array( 'lhs' => 95, 'rhs' => 3 ),\r
+  array( 'lhs' => 95, 'rhs' => 7 ),\r
+  array( 'lhs' => 95, 'rhs' => 4 ),\r
+  array( 'lhs' => 95, 'rhs' => 8 ),\r
+  array( 'lhs' => 95, 'rhs' => 3 ),\r
+  array( 'lhs' => 95, 'rhs' => 5 ),\r
+  array( 'lhs' => 95, 'rhs' => 6 ),\r
+  array( 'lhs' => 95, 'rhs' => 1 ),\r
+  array( 'lhs' => 97, 'rhs' => 1 ),\r
+  array( 'lhs' => 97, 'rhs' => 4 ),\r
+  array( 'lhs' => 97, 'rhs' => 1 ),\r
+  array( 'lhs' => 97, 'rhs' => 3 ),\r
+  array( 'lhs' => 97, 'rhs' => 3 ),\r
+  array( 'lhs' => 101, 'rhs' => 3 ),\r
+  array( 'lhs' => 118, 'rhs' => 2 ),\r
+  array( 'lhs' => 118, 'rhs' => 0 ),\r
+  array( 'lhs' => 120, 'rhs' => 3 ),\r
+  array( 'lhs' => 120, 'rhs' => 5 ),\r
+  array( 'lhs' => 120, 'rhs' => 2 ),\r
+  array( 'lhs' => 120, 'rhs' => 2 ),\r
+  array( 'lhs' => 120, 'rhs' => 2 ),\r
+  array( 'lhs' => 120, 'rhs' => 2 ),\r
+  array( 'lhs' => 120, 'rhs' => 4 ),\r
+  array( 'lhs' => 120, 'rhs' => 3 ),\r
+  array( 'lhs' => 120, 'rhs' => 5 ),\r
+  array( 'lhs' => 120, 'rhs' => 3 ),\r
+  array( 'lhs' => 120, 'rhs' => 2 ),\r
+  array( 'lhs' => 107, 'rhs' => 1 ),\r
+  array( 'lhs' => 107, 'rhs' => 2 ),\r
+  array( 'lhs' => 121, 'rhs' => 1 ),\r
+  array( 'lhs' => 121, 'rhs' => 3 ),\r
+  array( 'lhs' => 119, 'rhs' => 2 ),\r
+  array( 'lhs' => 117, 'rhs' => 1 ),\r
+  array( 'lhs' => 117, 'rhs' => 2 ),\r
+  array( 'lhs' => 122, 'rhs' => 3 ),\r
+  array( 'lhs' => 122, 'rhs' => 3 ),\r
+  array( 'lhs' => 122, 'rhs' => 5 ),\r
+  array( 'lhs' => 122, 'rhs' => 6 ),\r
+  array( 'lhs' => 122, 'rhs' => 2 ),\r
+  array( 'lhs' => 113, 'rhs' => 4 ),\r
+  array( 'lhs' => 115, 'rhs' => 4 ),\r
+  array( 'lhs' => 116, 'rhs' => 3 ),\r
+  array( 'lhs' => 116, 'rhs' => 1 ),\r
+  array( 'lhs' => 116, 'rhs' => 0 ),\r
+  array( 'lhs' => 102, 'rhs' => 3 ),\r
+  array( 'lhs' => 102, 'rhs' => 2 ),\r
+  array( 'lhs' => 103, 'rhs' => 2 ),\r
+  array( 'lhs' => 103, 'rhs' => 0 ),\r
+  array( 'lhs' => 123, 'rhs' => 2 ),\r
+  array( 'lhs' => 123, 'rhs' => 2 ),\r
+  array( 'lhs' => 100, 'rhs' => 1 ),\r
+  array( 'lhs' => 100, 'rhs' => 2 ),\r
+  array( 'lhs' => 100, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 1 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 2 ),\r
+  array( 'lhs' => 124, 'rhs' => 2 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 2 ),\r
+  array( 'lhs' => 124, 'rhs' => 2 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 124, 'rhs' => 3 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 125, 'rhs' => 1 ),\r
+  array( 'lhs' => 126, 'rhs' => 1 ),\r
+  array( 'lhs' => 126, 'rhs' => 1 ),\r
+  array( 'lhs' => 126, 'rhs' => 1 ),\r
+  array( 'lhs' => 109, 'rhs' => 3 ),\r
+  array( 'lhs' => 127, 'rhs' => 1 ),\r
+  array( 'lhs' => 127, 'rhs' => 3 ),\r
+  array( 'lhs' => 127, 'rhs' => 0 ),\r
+  array( 'lhs' => 128, 'rhs' => 3 ),\r
+  array( 'lhs' => 128, 'rhs' => 3 ),\r
+  array( 'lhs' => 128, 'rhs' => 1 ),\r
+  array( 'lhs' => 114, 'rhs' => 2 ),\r
+  array( 'lhs' => 114, 'rhs' => 1 ),\r
+  array( 'lhs' => 129, 'rhs' => 3 ),\r
+  array( 'lhs' => 129, 'rhs' => 3 ),\r
+  array( 'lhs' => 129, 'rhs' => 1 ),\r
+  array( 'lhs' => 129, 'rhs' => 3 ),\r
+  array( 'lhs' => 129, 'rhs' => 3 ),\r
+  array( 'lhs' => 129, 'rhs' => 1 ),\r
+  array( 'lhs' => 129, 'rhs' => 1 ),\r
+  array( 'lhs' => 106, 'rhs' => 1 ),\r
+  array( 'lhs' => 106, 'rhs' => 0 ),\r
+    );\r
+\r
+    static public $yyReduceMap = array(\r
+        0 => 0,\r
+        5 => 0,\r
+        11 => 0,\r
+        17 => 0,\r
+        23 => 0,\r
+        24 => 0,\r
+        60 => 0,\r
+        61 => 0,\r
+        62 => 0,\r
+        83 => 0,\r
+        90 => 0,\r
+        95 => 0,\r
+        97 => 0,\r
+        98 => 0,\r
+        99 => 0,\r
+        101 => 0,\r
+        114 => 0,\r
+        187 => 0,\r
+        1 => 1,\r
+        2 => 2,\r
+        3 => 3,\r
+        4 => 4,\r
+        6 => 6,\r
+        7 => 7,\r
+        8 => 8,\r
+        9 => 9,\r
+        15 => 9,\r
+        21 => 9,\r
+        91 => 9,\r
+        93 => 9,\r
+        94 => 9,\r
+        10 => 10,\r
+        16 => 10,\r
+        19 => 10,\r
+        22 => 10,\r
+        12 => 12,\r
+        13 => 12,\r
+        14 => 12,\r
+        18 => 12,\r
+        20 => 20,\r
+        25 => 25,\r
+        26 => 25,\r
+        27 => 27,\r
+        28 => 28,\r
+        29 => 29,\r
+        30 => 29,\r
+        31 => 29,\r
+        32 => 29,\r
+        33 => 33,\r
+        34 => 33,\r
+        35 => 35,\r
+        36 => 35,\r
+        37 => 35,\r
+        38 => 38,\r
+        39 => 38,\r
+        40 => 38,\r
+        41 => 41,\r
+        42 => 41,\r
+        43 => 43,\r
+        44 => 44,\r
+        45 => 45,\r
+        46 => 46,\r
+        47 => 47,\r
+        49 => 47,\r
+        48 => 48,\r
+        50 => 50,\r
+        51 => 51,\r
+        52 => 52,\r
+        67 => 52,\r
+        146 => 52,\r
+        192 => 52,\r
+        53 => 53,\r
+        54 => 54,\r
+        55 => 55,\r
+        56 => 56,\r
+        57 => 57,\r
+        58 => 58,\r
+        59 => 58,\r
+        63 => 63,\r
+        64 => 64,\r
+        65 => 65,\r
+        66 => 66,\r
+        68 => 68,\r
+        69 => 69,\r
+        70 => 70,\r
+        71 => 70,\r
+        72 => 70,\r
+        73 => 70,\r
+        75 => 70,\r
+        74 => 74,\r
+        76 => 76,\r
+        77 => 77,\r
+        78 => 78,\r
+        79 => 79,\r
+        80 => 80,\r
+        87 => 80,\r
+        131 => 80,\r
+        154 => 80,\r
+        194 => 80,\r
+        201 => 80,\r
+        202 => 80,\r
+        81 => 81,\r
+        82 => 82,\r
+        84 => 84,\r
+        85 => 84,\r
+        86 => 84,\r
+        88 => 88,\r
+        89 => 88,\r
+        92 => 92,\r
+        96 => 96,\r
+        100 => 100,\r
+        102 => 102,\r
+        103 => 103,\r
+        104 => 104,\r
+        105 => 105,\r
+        106 => 106,\r
+        107 => 107,\r
+        108 => 108,\r
+        109 => 109,\r
+        110 => 110,\r
+        111 => 111,\r
+        112 => 112,\r
+        113 => 113,\r
+        115 => 115,\r
+        116 => 116,\r
+        117 => 117,\r
+        118 => 118,\r
+        193 => 118,\r
+        119 => 119,\r
+        151 => 119,\r
+        120 => 120,\r
+        121 => 121,\r
+        122 => 122,\r
+        123 => 122,\r
+        124 => 122,\r
+        125 => 125,\r
+        126 => 126,\r
+        129 => 126,\r
+        127 => 127,\r
+        128 => 128,\r
+        130 => 130,\r
+        203 => 130,\r
+        132 => 132,\r
+        133 => 133,\r
+        134 => 134,\r
+        156 => 134,\r
+        135 => 135,\r
+        136 => 136,\r
+        137 => 137,\r
+        138 => 138,\r
+        139 => 139,\r
+        140 => 140,\r
+        141 => 141,\r
+        142 => 142,\r
+        143 => 143,\r
+        144 => 144,\r
+        145 => 145,\r
+        147 => 147,\r
+        148 => 148,\r
+        149 => 148,\r
+        150 => 150,\r
+        152 => 152,\r
+        153 => 153,\r
+        155 => 155,\r
+        157 => 157,\r
+        158 => 158,\r
+        161 => 158,\r
+        172 => 158,\r
+        159 => 159,\r
+        160 => 160,\r
+        162 => 162,\r
+        163 => 163,\r
+        164 => 164,\r
+        169 => 164,\r
+        165 => 165,\r
+        168 => 165,\r
+        166 => 166,\r
+        171 => 166,\r
+        167 => 167,\r
+        170 => 167,\r
+        173 => 173,\r
+        174 => 174,\r
+        175 => 175,\r
+        176 => 176,\r
+        177 => 177,\r
+        178 => 178,\r
+        179 => 179,\r
+        180 => 180,\r
+        181 => 181,\r
+        182 => 182,\r
+        183 => 183,\r
+        184 => 184,\r
+        185 => 185,\r
+        186 => 186,\r
+        188 => 188,\r
+        189 => 189,\r
+        190 => 190,\r
+        191 => 191,\r
+        195 => 195,\r
+        198 => 195,\r
+        196 => 196,\r
+        197 => 197,\r
+        199 => 199,\r
+        200 => 200,\r
+    );\r
+#line 81 "smarty_internal_templateparser.y"\r
+    function yy_r0(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2044 "smarty_internal_templateparser.php"\r
+#line 87 "smarty_internal_templateparser.y"\r
+    function yy_r1(){if ($this->template->extract_code == false) {\r
+                                                  $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;\r
+                                               } else {\r
+                                                 // store code in extract buffer\r
+                                                  $this->template->extracted_compiled_code .= $this->yystack[$this->yyidx + 0]->minor;\r
+                                               } \r
+                                                 }\r
+#line 2053 "smarty_internal_templateparser.php"\r
+#line 95 "smarty_internal_templateparser.y"\r
+    function yy_r2(){if ($this->template->extract_code == false) {\r
+                                                             $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;\r
+                                                           } else {\r
+                                                             // store code in extract buffer\r
+                                                             $this->template->extracted_compiled_code .= $this->yystack[$this->yyidx + 0]->minor;\r
+                                                             $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;\r
+                                                           } \r
+                                                              }\r
+#line 2063 "smarty_internal_templateparser.php"\r
+#line 108 "smarty_internal_templateparser.y"\r
+    function yy_r3(){\r
+                                          if ($this->compiler->has_code) {\r
+                                            $tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array();\r
+                                            $this->_retvalue = $this->compiler->processNocacheCode($tmp.$this->yystack[$this->yyidx + 0]->minor,true);\r
+                                         } else { $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;}  $this->compiler->has_variable_string = false;    }\r
+#line 2070 "smarty_internal_templateparser.php"\r
+#line 115 "smarty_internal_templateparser.y"\r
+    function yy_r4(){ $this->_retvalue = '';    }\r
+#line 2073 "smarty_internal_templateparser.php"\r
+#line 121 "smarty_internal_templateparser.y"\r
+    function yy_r6(){\r
+                                      if ($this->sec_obj->php_handling == SMARTY_PHP_PASSTHRU) {\r
+                                                                    $this->_retvalue = self::escape_start_tag($this->yystack[$this->yyidx + -2]->minor) . str_replace('<?','&lt;?',$this->yystack[$this->yyidx + -1]->minor) . '?<??>>';\r
+                                      } elseif ($this->sec_obj->php_handling == SMARTY_PHP_QUOTE) {\r
+                                       $this->_retvalue = $this->compiler->processNocacheCode(htmlspecialchars($this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.'?>', ENT_QUOTES), false);\r
+                                      }elseif ($this->sec_obj->php_handling == SMARTY_PHP_ALLOW) {\r
+                                       $this->_retvalue = $this->compiler->processNocacheCode('<?php'.$this->yystack[$this->yyidx + -1]->minor.'?>', true);\r
+                                      }elseif ($this->sec_obj->php_handling == SMARTY_PHP_REMOVE) {\r
+                                       $this->_retvalue = '';\r
+                                      }\r
+                                         }\r
+#line 2086 "smarty_internal_templateparser.php"\r
+#line 135 "smarty_internal_templateparser.y"\r
+    function yy_r7(){if ($this->lex->strip) {\r
+                                       $this->_retvalue = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $this->yystack[$this->yyidx + 0]->minor);  \r
+                                     } else {\r
+                                       $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;     \r
+                                     }\r
+                                        }\r
+#line 2094 "smarty_internal_templateparser.php"\r
+#line 141 "smarty_internal_templateparser.y"\r
+    function yy_r8(){if ($this->lex->strip) {\r
+                                       $this->_retvalue = preg_replace('![\$this->yystack[$this->yyidx + 0]->minor ]*[\r\n]+[\$this->yystack[$this->yyidx + 0]->minor ]*!', '', self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));      \r
+                                     } else {\r
+                                       $this->_retvalue = self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor);     \r
+                                     }\r
+                                        }\r
+#line 2102 "smarty_internal_templateparser.php"\r
+#line 150 "smarty_internal_templateparser.y"\r
+    function yy_r9(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2105 "smarty_internal_templateparser.php"\r
+#line 151 "smarty_internal_templateparser.y"\r
+    function yy_r10(){ $this->_retvalue = '';     }\r
+#line 2108 "smarty_internal_templateparser.php"\r
+#line 154 "smarty_internal_templateparser.y"\r
+    function yy_r12(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2111 "smarty_internal_templateparser.php"\r
+#line 167 "smarty_internal_templateparser.y"\r
+    function yy_r20(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;     }\r
+#line 2114 "smarty_internal_templateparser.php"\r
+#line 174 "smarty_internal_templateparser.y"\r
+    function yy_r25(){ $this->_retvalue = self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor);     }\r
+#line 2117 "smarty_internal_templateparser.php"\r
+#line 176 "smarty_internal_templateparser.y"\r
+    function yy_r27(){ $this->_retvalue = self::escape_end_tag($this->yystack[$this->yyidx + 0]->minor);     }\r
+#line 2120 "smarty_internal_templateparser.php"\r
+#line 184 "smarty_internal_templateparser.y"\r
+    function yy_r28(){ $this->_retvalue = $this->compiler->compileTag('private_print_expression',array('value'=>$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2123 "smarty_internal_templateparser.php"\r
+#line 185 "smarty_internal_templateparser.y"\r
+    function yy_r29(){ $this->_retvalue = $this->compiler->compileTag('private_print_expression',array_merge(array('value'=>$this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2126 "smarty_internal_templateparser.php"\r
+#line 196 "smarty_internal_templateparser.y"\r
+    function yy_r33(){ $this->_retvalue = $this->compiler->compileTag('assign',array('value'=>$this->yystack[$this->yyidx + -1]->minor,'var'=>"'".$this->yystack[$this->yyidx + -3]->minor."'"));    }\r
+#line 2129 "smarty_internal_templateparser.php"\r
+#line 198 "smarty_internal_templateparser.y"\r
+    function yy_r35(){ $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array('value'=>$this->yystack[$this->yyidx + -2]->minor,'var'=>"'".$this->yystack[$this->yyidx + -4]->minor."'"),$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2132 "smarty_internal_templateparser.php"\r
+#line 201 "smarty_internal_templateparser.y"\r
+    function yy_r38(){ $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array('value'=>$this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -4]->minor,$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2135 "smarty_internal_templateparser.php"\r
+#line 205 "smarty_internal_templateparser.y"\r
+    function yy_r41(){ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor,$this->yystack[$this->yyidx + -1]->minor);    }\r
+#line 2138 "smarty_internal_templateparser.php"\r
+#line 207 "smarty_internal_templateparser.y"\r
+    function yy_r43(){ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor,array());    }\r
+#line 2141 "smarty_internal_templateparser.php"\r
+#line 209 "smarty_internal_templateparser.y"\r
+    function yy_r44(){ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor,array_merge(array('object_methode'=>$this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2144 "smarty_internal_templateparser.php"\r
+#line 211 "smarty_internal_templateparser.y"\r
+    function yy_r45(){  $this->_retvalue = '<?php ob_start();?>'.$this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor,$this->yystack[$this->yyidx + -1]->minor).'<?php echo ';\r
+                                                                                    $this->_retvalue .= $this->compiler->compileTag('private_modifier',array('modifier'=>$this->yystack[$this->yyidx + -3]->minor,'params'=>'ob_get_clean()'.$this->yystack[$this->yyidx + -2]->minor)).'?>';\r
+                                                                                     }\r
+#line 2149 "smarty_internal_templateparser.php"\r
+#line 215 "smarty_internal_templateparser.y"\r
+    function yy_r46(){  $this->_retvalue = '<?php ob_start();?>'.$this->compiler->compileTag($this->yystack[$this->yyidx + -6]->minor,array_merge(array('object_methode'=>$this->yystack[$this->yyidx + -4]->minor),$this->yystack[$this->yyidx + -1]->minor)).'<?php echo ';\r
+                                                                                               $this->_retvalue .= $this->compiler->compileTag('private_modifier',array('modifier'=>$this->yystack[$this->yyidx + -3]->minor,'params'=>'ob_get_clean()'.$this->yystack[$this->yyidx + -2]->minor)).'?>';\r
+                                                                                                }\r
+#line 2154 "smarty_internal_templateparser.php"\r
+#line 219 "smarty_internal_templateparser.y"\r
+    function yy_r47(){ $this->_retvalue = $this->compiler->compileTag(($this->yystack[$this->yyidx + -3]->minor == 'else if')? 'elseif' : $this->yystack[$this->yyidx + -3]->minor,array('if condition'=>$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2157 "smarty_internal_templateparser.php"\r
+#line 220 "smarty_internal_templateparser.y"\r
+    function yy_r48(){ $this->_retvalue = $this->compiler->compileTag(($this->yystack[$this->yyidx + -3]->minor == 'else if')? 'elseif' : $this->yystack[$this->yyidx + -3]->minor,array('if condition'=>trim($this->yystack[$this->yyidx + -2]->minor).$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2160 "smarty_internal_templateparser.php"\r
+#line 223 "smarty_internal_templateparser.y"\r
+    function yy_r50(){\r
+                                                             $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -11]->minor,array('start'=>$this->yystack[$this->yyidx + -9]->minor,'ifexp'=>$this->yystack[$this->yyidx + -6]->minor,'varloop'=>$this->yystack[$this->yyidx + -2]->minor,'loop'=>$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2164 "smarty_internal_templateparser.php"\r
+#line 225 "smarty_internal_templateparser.y"\r
+    function yy_r51(){ $this->_retvalue = '='.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2167 "smarty_internal_templateparser.php"\r
+#line 226 "smarty_internal_templateparser.y"\r
+    function yy_r52(){ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2170 "smarty_internal_templateparser.php"\r
+#line 227 "smarty_internal_templateparser.y"\r
+    function yy_r53(){ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -6]->minor,array_merge(array('start'=>$this->yystack[$this->yyidx + -4]->minor,'to'=>$this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2173 "smarty_internal_templateparser.php"\r
+#line 230 "smarty_internal_templateparser.y"\r
+    function yy_r54(){\r
+                                                            $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -6]->minor,array('from'=>$this->yystack[$this->yyidx + -4]->minor,'item'=>$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2177 "smarty_internal_templateparser.php"\r
+#line 232 "smarty_internal_templateparser.y"\r
+    function yy_r55(){\r
+                                                            $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -9]->minor,array('from'=>$this->yystack[$this->yyidx + -7]->minor,'item'=>$this->yystack[$this->yyidx + -1]->minor,'key'=>$this->yystack[$this->yyidx + -4]->minor));    }\r
+#line 2181 "smarty_internal_templateparser.php"\r
+#line 234 "smarty_internal_templateparser.y"\r
+    function yy_r56(){ \r
+                                                            $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -6]->minor,array('from'=>$this->yystack[$this->yyidx + -4]->minor,'item'=>$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2185 "smarty_internal_templateparser.php"\r
+#line 236 "smarty_internal_templateparser.y"\r
+    function yy_r57(){ \r
+                                                            $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -9]->minor,array('from'=>$this->yystack[$this->yyidx + -7]->minor,'item'=>$this->yystack[$this->yyidx + -1]->minor,'key'=>$this->yystack[$this->yyidx + -4]->minor));    }\r
+#line 2189 "smarty_internal_templateparser.php"\r
+#line 240 "smarty_internal_templateparser.y"\r
+    function yy_r58(){ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor.'close',array());    }\r
+#line 2192 "smarty_internal_templateparser.php"\r
+#line 245 "smarty_internal_templateparser.y"\r
+    function yy_r63(){ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor.'close',$this->yystack[$this->yyidx + -1]->minor);    }\r
+#line 2195 "smarty_internal_templateparser.php"\r
+#line 246 "smarty_internal_templateparser.y"\r
+    function yy_r64(){  $this->_retvalue = '<?php ob_start();?>'.$this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor.'close',$this->yystack[$this->yyidx + -1]->minor).'<?php echo ';\r
+                                                                                         $this->_retvalue .= $this->compiler->compileTag('private_modifier',array('modifier'=>$this->yystack[$this->yyidx + -3]->minor,'params'=>'ob_get_clean()'.$this->yystack[$this->yyidx + -2]->minor)).'?>';\r
+                                                                                          }\r
+#line 2200 "smarty_internal_templateparser.php"\r
+#line 250 "smarty_internal_templateparser.y"\r
+    function yy_r65(){  $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor.'close',array('object_methode'=>$this->yystack[$this->yyidx + -1]->minor));    }\r
+#line 2203 "smarty_internal_templateparser.php"\r
+#line 257 "smarty_internal_templateparser.y"\r
+    function yy_r66(){ $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor);    }\r
+#line 2206 "smarty_internal_templateparser.php"\r
+#line 261 "smarty_internal_templateparser.y"\r
+    function yy_r68(){ $this->_retvalue = array();    }\r
+#line 2209 "smarty_internal_templateparser.php"\r
+#line 264 "smarty_internal_templateparser.y"\r
+    function yy_r69(){ $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>"'".$this->yystack[$this->yyidx + 0]->minor."'");    }\r
+#line 2212 "smarty_internal_templateparser.php"\r
+#line 265 "smarty_internal_templateparser.y"\r
+    function yy_r70(){ $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>$this->yystack[$this->yyidx + 0]->minor);    }\r
+#line 2215 "smarty_internal_templateparser.php"\r
+#line 269 "smarty_internal_templateparser.y"\r
+    function yy_r74(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor=>'true');    }\r
+#line 2218 "smarty_internal_templateparser.php"\r
+#line 276 "smarty_internal_templateparser.y"\r
+    function yy_r76(){ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);    }\r
+#line 2221 "smarty_internal_templateparser.php"\r
+#line 277 "smarty_internal_templateparser.y"\r
+    function yy_r77(){ $this->yystack[$this->yyidx + -2]->minor[]=$this->yystack[$this->yyidx + 0]->minor; $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor;    }\r
+#line 2224 "smarty_internal_templateparser.php"\r
+#line 279 "smarty_internal_templateparser.y"\r
+    function yy_r78(){ $this->_retvalue = array('var' => $this->yystack[$this->yyidx + -2]->minor, 'value'=>$this->yystack[$this->yyidx + 0]->minor);    }\r
+#line 2227 "smarty_internal_templateparser.php"\r
+#line 285 "smarty_internal_templateparser.y"\r
+    function yy_r79(){ $this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\'';     }\r
+#line 2230 "smarty_internal_templateparser.php"\r
+#line 286 "smarty_internal_templateparser.y"\r
+    function yy_r80(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2233 "smarty_internal_templateparser.php"\r
+#line 288 "smarty_internal_templateparser.y"\r
+    function yy_r81(){$this->_retvalue = '$_smarty_tpl->getStreamVariable(\''. $this->yystack[$this->yyidx + -2]->minor .'://'. $this->yystack[$this->yyidx + 0]->minor . '\')';    }\r
+#line 2236 "smarty_internal_templateparser.php"\r
+#line 289 "smarty_internal_templateparser.y"\r
+    function yy_r82(){  $this->_retvalue = $this->compiler->compileTag('private_modifier',array('modifier'=>$this->yystack[$this->yyidx + -1]->minor,'params'=>$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor));     }\r
+#line 2239 "smarty_internal_templateparser.php"\r
+#line 294 "smarty_internal_templateparser.y"\r
+    function yy_r84(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor . trim($this->yystack[$this->yyidx + -1]->minor) . $this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2242 "smarty_internal_templateparser.php"\r
+#line 307 "smarty_internal_templateparser.y"\r
+    function yy_r88(){ $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.' ? '.$this->yystack[$this->yyidx + -2]->minor.' : '.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2245 "smarty_internal_templateparser.php"\r
+#line 316 "smarty_internal_templateparser.y"\r
+    function yy_r92(){ $this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2248 "smarty_internal_templateparser.php"\r
+#line 321 "smarty_internal_templateparser.y"\r
+    function yy_r96(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2251 "smarty_internal_templateparser.php"\r
+#line 331 "smarty_internal_templateparser.y"\r
+    function yy_r100(){ $this->_retvalue = "(". $this->yystack[$this->yyidx + -1]->minor .")";     }\r
+#line 2254 "smarty_internal_templateparser.php"\r
+#line 335 "smarty_internal_templateparser.y"\r
+    function yy_r102(){ $_s = str_replace(array('."".','.""'),array('.',''),'"'.$this->yystack[$this->yyidx + -1]->minor.'"'); \r
+                                                    if (substr($_s,0,3) == '"".') {\r
+                                                      $this->_retvalue = substr($_s,3);\r
+                                                    } else {\r
+                                                      $this->_retvalue = $_s;\r
+                                                    }\r
+                                                      }\r
+#line 2263 "smarty_internal_templateparser.php"\r
+#line 342 "smarty_internal_templateparser.y"\r
+    function yy_r103(){ $this->_retvalue = "''";     }\r
+#line 2266 "smarty_internal_templateparser.php"\r
+#line 344 "smarty_internal_templateparser.y"\r
+    function yy_r104(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2269 "smarty_internal_templateparser.php"\r
+#line 345 "smarty_internal_templateparser.y"\r
+    function yy_r105(){ $this->prefix_number++; $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'=$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + -3]->minor .'\')->value;?>'; $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.'::$_tmp'.$this->prefix_number.'('. $this->yystack[$this->yyidx + -1]->minor .')';     }\r
+#line 2272 "smarty_internal_templateparser.php"\r
+#line 347 "smarty_internal_templateparser.y"\r
+    function yy_r106(){ $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor.'::'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2275 "smarty_internal_templateparser.php"\r
+#line 348 "smarty_internal_templateparser.y"\r
+    function yy_r107(){ $this->prefix_number++; $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'=$_smarty_tpl->getVariable(\''. $this->yystack[$this->yyidx + -4]->minor .'\')->value;?>'; $this->_retvalue = $this->yystack[$this->yyidx + -7]->minor.'::$_tmp'.$this->prefix_number.'('. $this->yystack[$this->yyidx + -2]->minor .')'.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2278 "smarty_internal_templateparser.php"\r
+#line 350 "smarty_internal_templateparser.y"\r
+    function yy_r108(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2281 "smarty_internal_templateparser.php"\r
+#line 352 "smarty_internal_templateparser.y"\r
+    function yy_r109(){ $this->_retvalue = $this->yystack[$this->yyidx + -4]->minor.'::$'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2284 "smarty_internal_templateparser.php"\r
+#line 354 "smarty_internal_templateparser.y"\r
+    function yy_r110(){ $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.'::$'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2287 "smarty_internal_templateparser.php"\r
+#line 356 "smarty_internal_templateparser.y"\r
+    function yy_r111(){ $this->prefix_number++; $this->compiler->prefix_code[] = '<?php ob_start();?>'.$this->yystack[$this->yyidx + 0]->minor.'<?php $_tmp'.$this->prefix_number.'=ob_get_clean();?>'; $this->_retvalue = '$_tmp'.$this->prefix_number;     }\r
+#line 2290 "smarty_internal_templateparser.php"\r
+#line 365 "smarty_internal_templateparser.y"\r
+    function yy_r112(){if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') { $this->_retvalue =  $this->compiler->compileTag('private_special_variable',$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);} else {\r
+                                                         $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor['var'] .')->value'.$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor['var'],"'"), null, true, false)->nocache;}    }\r
+#line 2294 "smarty_internal_templateparser.php"\r
+#line 368 "smarty_internal_templateparser.y"\r
+    function yy_r113(){ $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'"), null, true, false)->nocache;    }\r
+#line 2297 "smarty_internal_templateparser.php"\r
+#line 372 "smarty_internal_templateparser.y"\r
+    function yy_r115(){$this->_retvalue = '$_smarty_tpl->getConfigVariable(\''. $this->yystack[$this->yyidx + -1]->minor .'\')';    }\r
+#line 2300 "smarty_internal_templateparser.php"\r
+#line 373 "smarty_internal_templateparser.y"\r
+    function yy_r116(){$this->_retvalue = '$_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -1]->minor .')';    }\r
+#line 2303 "smarty_internal_templateparser.php"\r
+#line 376 "smarty_internal_templateparser.y"\r
+    function yy_r117(){$this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor);    }\r
+#line 2306 "smarty_internal_templateparser.php"\r
+#line 382 "smarty_internal_templateparser.y"\r
+    function yy_r118(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2309 "smarty_internal_templateparser.php"\r
+#line 384 "smarty_internal_templateparser.y"\r
+    function yy_r119(){return;    }\r
+#line 2312 "smarty_internal_templateparser.php"\r
+#line 388 "smarty_internal_templateparser.y"\r
+    function yy_r120(){ $this->_retvalue = '[$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + 0]->minor .')->value]'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable('$this->yystack[$this->yyidx + 0]->minor', null, true, false)->nocache;    }\r
+#line 2315 "smarty_internal_templateparser.php"\r
+#line 389 "smarty_internal_templateparser.y"\r
+    function yy_r121(){ $this->_retvalue = '[$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor.']'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'"), null, true, false)->nocache;    }\r
+#line 2318 "smarty_internal_templateparser.php"\r
+#line 392 "smarty_internal_templateparser.y"\r
+    function yy_r122(){ $this->_retvalue = "['". $this->yystack[$this->yyidx + 0]->minor ."']";    }\r
+#line 2321 "smarty_internal_templateparser.php"\r
+#line 396 "smarty_internal_templateparser.y"\r
+    function yy_r125(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + 0]->minor ."]";    }\r
+#line 2324 "smarty_internal_templateparser.php"\r
+#line 397 "smarty_internal_templateparser.y"\r
+    function yy_r126(){ $this->_retvalue = "[". $this->yystack[$this->yyidx + -1]->minor ."]";    }\r
+#line 2327 "smarty_internal_templateparser.php"\r
+#line 399 "smarty_internal_templateparser.y"\r
+    function yy_r127(){ $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable','[\'section\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\'][\'index\']').']';    }\r
+#line 2330 "smarty_internal_templateparser.php"\r
+#line 400 "smarty_internal_templateparser.y"\r
+    function yy_r128(){ $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable','[\'section\'][\''.$this->yystack[$this->yyidx + -3]->minor.'\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\']').']';    }\r
+#line 2333 "smarty_internal_templateparser.php"\r
+#line 404 "smarty_internal_templateparser.y"\r
+    function yy_r130(){$this->_retvalue = '';    }\r
+#line 2336 "smarty_internal_templateparser.php"\r
+#line 412 "smarty_internal_templateparser.y"\r
+    function yy_r132(){$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2339 "smarty_internal_templateparser.php"\r
+#line 414 "smarty_internal_templateparser.y"\r
+    function yy_r133(){$this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\'';    }\r
+#line 2342 "smarty_internal_templateparser.php"\r
+#line 417 "smarty_internal_templateparser.y"\r
+    function yy_r134(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')';    }\r
+#line 2345 "smarty_internal_templateparser.php"\r
+#line 422 "smarty_internal_templateparser.y"\r
+    function yy_r135(){ if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\'smarty\'') { $this->_retvalue =  $this->compiler->compileTag('private_special_variable',$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index']).$this->yystack[$this->yyidx + 0]->minor;} else {\r
+                                                         $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor['var'] .')->value'.$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index'].$this->yystack[$this->yyidx + 0]->minor; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor['var'],"'"), null, true, false)->nocache;}    }\r
+#line 2349 "smarty_internal_templateparser.php"\r
+#line 425 "smarty_internal_templateparser.y"\r
+    function yy_r136(){$this->_retvalue  = $this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2352 "smarty_internal_templateparser.php"\r
+#line 427 "smarty_internal_templateparser.y"\r
+    function yy_r137(){$this->_retvalue  = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2355 "smarty_internal_templateparser.php"\r
+#line 429 "smarty_internal_templateparser.y"\r
+    function yy_r138(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2358 "smarty_internal_templateparser.php"\r
+#line 430 "smarty_internal_templateparser.y"\r
+    function yy_r139(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';    }\r
+#line 2361 "smarty_internal_templateparser.php"\r
+#line 431 "smarty_internal_templateparser.y"\r
+    function yy_r140(){ $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';    }\r
+#line 2364 "smarty_internal_templateparser.php"\r
+#line 432 "smarty_internal_templateparser.y"\r
+    function yy_r141(){ $this->_retvalue = '->{\''.$this->yystack[$this->yyidx + -4]->minor.'\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';    }\r
+#line 2367 "smarty_internal_templateparser.php"\r
+#line 434 "smarty_internal_templateparser.y"\r
+    function yy_r142(){ $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2370 "smarty_internal_templateparser.php"\r
+#line 440 "smarty_internal_templateparser.y"\r
+    function yy_r143(){if (!$this->template->security || $this->smarty->security_handler->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {\r
+                                                                                                                                                                                   if ($this->yystack[$this->yyidx + -3]->minor == 'isset' || $this->yystack[$this->yyidx + -3]->minor == 'empty' || $this->yystack[$this->yyidx + -3]->minor == 'array' || is_callable($this->yystack[$this->yyidx + -3]->minor)) {\r
+                                                                                                                                                                                       $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $this->yystack[$this->yyidx + -1]->minor .")";\r
+                                                                                                                                                                                   } else {\r
+                                                       $this->compiler->trigger_template_error ("unknown function \"" . $this->yystack[$this->yyidx + -3]->minor . "\"");\r
+                                                      }\r
+                                                    }    }\r
+#line 2379 "smarty_internal_templateparser.php"\r
+#line 451 "smarty_internal_templateparser.y"\r
+    function yy_r144(){ $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $this->yystack[$this->yyidx + -1]->minor .")";    }\r
+#line 2382 "smarty_internal_templateparser.php"\r
+#line 455 "smarty_internal_templateparser.y"\r
+    function yy_r145(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.",".$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2385 "smarty_internal_templateparser.php"\r
+#line 459 "smarty_internal_templateparser.y"\r
+    function yy_r147(){ return;    }\r
+#line 2388 "smarty_internal_templateparser.php"\r
+#line 464 "smarty_internal_templateparser.y"\r
+    function yy_r148(){ $this->_retvalue =  $this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2391 "smarty_internal_templateparser.php"\r
+#line 477 "smarty_internal_templateparser.y"\r
+    function yy_r150(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2394 "smarty_internal_templateparser.php"\r
+#line 481 "smarty_internal_templateparser.y"\r
+    function yy_r152(){$this->_retvalue = ','.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2397 "smarty_internal_templateparser.php"\r
+#line 482 "smarty_internal_templateparser.y"\r
+    function yy_r153(){$this->_retvalue = ',\''.$this->yystack[$this->yyidx + 0]->minor.'\'';    }\r
+#line 2400 "smarty_internal_templateparser.php"\r
+#line 489 "smarty_internal_templateparser.y"\r
+    function yy_r155(){$this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2403 "smarty_internal_templateparser.php"\r
+#line 494 "smarty_internal_templateparser.y"\r
+    function yy_r157(){$this->_retvalue =$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2406 "smarty_internal_templateparser.php"\r
+#line 495 "smarty_internal_templateparser.y"\r
+    function yy_r158(){$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2409 "smarty_internal_templateparser.php"\r
+#line 496 "smarty_internal_templateparser.y"\r
+    function yy_r159(){$this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor.')';    }\r
+#line 2412 "smarty_internal_templateparser.php"\r
+#line 497 "smarty_internal_templateparser.y"\r
+    function yy_r160(){$this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array)'.$this->yystack[$this->yyidx + 0]->minor.')';    }\r
+#line 2415 "smarty_internal_templateparser.php"\r
+#line 499 "smarty_internal_templateparser.y"\r
+    function yy_r162(){$this->_retvalue = '!('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')';    }\r
+#line 2418 "smarty_internal_templateparser.php"\r
+#line 500 "smarty_internal_templateparser.y"\r
+    function yy_r163(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')';    }\r
+#line 2421 "smarty_internal_templateparser.php"\r
+#line 501 "smarty_internal_templateparser.y"\r
+    function yy_r164(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -1]->minor.')';    }\r
+#line 2424 "smarty_internal_templateparser.php"\r
+#line 502 "smarty_internal_templateparser.y"\r
+    function yy_r165(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -1]->minor.')';    }\r
+#line 2427 "smarty_internal_templateparser.php"\r
+#line 503 "smarty_internal_templateparser.y"\r
+    function yy_r166(){$this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')';    }\r
+#line 2430 "smarty_internal_templateparser.php"\r
+#line 504 "smarty_internal_templateparser.y"\r
+    function yy_r167(){$this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')';    }\r
+#line 2433 "smarty_internal_templateparser.php"\r
+#line 510 "smarty_internal_templateparser.y"\r
+    function yy_r173(){$this->prefix_number++; $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'='.$this->yystack[$this->yyidx + 0]->minor.';?>'; $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.'$_tmp'.$this->prefix_number;    }\r
+#line 2436 "smarty_internal_templateparser.php"\r
+#line 512 "smarty_internal_templateparser.y"\r
+    function yy_r174(){$this->_retvalue = '==';    }\r
+#line 2439 "smarty_internal_templateparser.php"\r
+#line 513 "smarty_internal_templateparser.y"\r
+    function yy_r175(){$this->_retvalue = '!=';    }\r
+#line 2442 "smarty_internal_templateparser.php"\r
+#line 514 "smarty_internal_templateparser.y"\r
+    function yy_r176(){$this->_retvalue = '>';    }\r
+#line 2445 "smarty_internal_templateparser.php"\r
+#line 515 "smarty_internal_templateparser.y"\r
+    function yy_r177(){$this->_retvalue = '<';    }\r
+#line 2448 "smarty_internal_templateparser.php"\r
+#line 516 "smarty_internal_templateparser.y"\r
+    function yy_r178(){$this->_retvalue = '>=';    }\r
+#line 2451 "smarty_internal_templateparser.php"\r
+#line 517 "smarty_internal_templateparser.y"\r
+    function yy_r179(){$this->_retvalue = '<=';    }\r
+#line 2454 "smarty_internal_templateparser.php"\r
+#line 518 "smarty_internal_templateparser.y"\r
+    function yy_r180(){$this->_retvalue = '===';    }\r
+#line 2457 "smarty_internal_templateparser.php"\r
+#line 519 "smarty_internal_templateparser.y"\r
+    function yy_r181(){$this->_retvalue = '!==';    }\r
+#line 2460 "smarty_internal_templateparser.php"\r
+#line 520 "smarty_internal_templateparser.y"\r
+    function yy_r182(){$this->_retvalue = '%';    }\r
+#line 2463 "smarty_internal_templateparser.php"\r
+#line 522 "smarty_internal_templateparser.y"\r
+    function yy_r183(){$this->_retvalue = '&&';    }\r
+#line 2466 "smarty_internal_templateparser.php"\r
+#line 523 "smarty_internal_templateparser.y"\r
+    function yy_r184(){$this->_retvalue = '||';    }\r
+#line 2469 "smarty_internal_templateparser.php"\r
+#line 524 "smarty_internal_templateparser.y"\r
+    function yy_r185(){$this->_retvalue = ' XOR ';    }\r
+#line 2472 "smarty_internal_templateparser.php"\r
+#line 529 "smarty_internal_templateparser.y"\r
+    function yy_r186(){ $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')';    }\r
+#line 2475 "smarty_internal_templateparser.php"\r
+#line 531 "smarty_internal_templateparser.y"\r
+    function yy_r188(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor;     }\r
+#line 2478 "smarty_internal_templateparser.php"\r
+#line 532 "smarty_internal_templateparser.y"\r
+    function yy_r189(){ return;     }\r
+#line 2481 "smarty_internal_templateparser.php"\r
+#line 533 "smarty_internal_templateparser.y"\r
+    function yy_r190(){ $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2484 "smarty_internal_templateparser.php"\r
+#line 534 "smarty_internal_templateparser.y"\r
+    function yy_r191(){ $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor;    }\r
+#line 2487 "smarty_internal_templateparser.php"\r
+#line 543 "smarty_internal_templateparser.y"\r
+    function yy_r195(){if (substr($this->yystack[$this->yyidx + -1]->minor,0,1) == '\'' || substr($this->yystack[$this->yyidx + -1]->minor,0,1) == '@') {\r
+                                                                 $this->_retvalue = '".'.$this->yystack[$this->yyidx + -1]->minor.'."'; $this->compiler->has_variable_string = true;\r
+                                                                } else {\r
+                                                                 $this->_retvalue = '{'.$this->yystack[$this->yyidx + -1]->minor.'}'; $this->compiler->has_variable_string = true;\r
+                                                                }\r
+                                                                   }\r
+#line 2495 "smarty_internal_templateparser.php"\r
+#line 549 "smarty_internal_templateparser.y"\r
+    function yy_r196(){$this->_retvalue = '{'.$this->yystack[$this->yyidx + -1]->minor.'}'; $this->compiler->has_variable_string = true;    }\r
+#line 2498 "smarty_internal_templateparser.php"\r
+#line 550 "smarty_internal_templateparser.y"\r
+    function yy_r197(){$this->_retvalue = '{$_smarty_tpl->getVariable(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')->value}'; $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable(trim($this->yystack[$this->yyidx + 0]->minor,"'"), null, true, false)->nocache; $this->compiler->has_variable_string = true;    }\r
+#line 2501 "smarty_internal_templateparser.php"\r
+#line 557 "smarty_internal_templateparser.y"\r
+    function yy_r199(){ $this->_retvalue = '".('.$this->yystack[$this->yyidx + -1]->minor.')."'; $this->compiler->has_variable_string = true;    }\r
+#line 2504 "smarty_internal_templateparser.php"\r
+#line 558 "smarty_internal_templateparser.y"\r
+    function yy_r200(){ $this->prefix_number++; $this->compiler->prefix_code[] = '<?php ob_start();?>'.$this->yystack[$this->yyidx + 0]->minor.'<?php $_tmp'.$this->prefix_number.'=ob_get_clean();?>'; $this->_retvalue = '{$_tmp'.$this->prefix_number.'}'; $this->compiler->has_variable_string = true;    }\r
+#line 2507 "smarty_internal_templateparser.php"\r
+\r
+    private $_retvalue;\r
+\r
+    function yy_reduce($yyruleno)\r
+    {\r
+        $yymsp = $this->yystack[$this->yyidx];\r
+        if (self::$yyTraceFILE && $yyruleno >= 0 \r
+              && $yyruleno < count(self::$yyRuleName)) {\r
+            fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",\r
+                self::$yyTracePrompt, $yyruleno,\r
+                self::$yyRuleName[$yyruleno]);\r
+        }\r
+\r
+        $this->_retvalue = $yy_lefthand_side = null;\r
+        if (array_key_exists($yyruleno, self::$yyReduceMap)) {\r
+            // call the action\r
+            $this->_retvalue = null;\r
+            $this->{'yy_r' . self::$yyReduceMap[$yyruleno]}();\r
+            $yy_lefthand_side = $this->_retvalue;\r
+        }\r
+        $yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];\r
+        $yysize = self::$yyRuleInfo[$yyruleno]['rhs'];\r
+        $this->yyidx -= $yysize;\r
+        for($i = $yysize; $i; $i--) {\r
+            // pop all of the right-hand side parameters\r
+            array_pop($this->yystack);\r
+        }\r
+        $yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);\r
+        if ($yyact < self::YYNSTATE) {\r
+            if (!self::$yyTraceFILE && $yysize) {\r
+                $this->yyidx++;\r
+                $x = new TP_yyStackEntry;\r
+                $x->stateno = $yyact;\r
+                $x->major = $yygoto;\r
+                $x->minor = $yy_lefthand_side;\r
+                $this->yystack[$this->yyidx] = $x;\r
+            } else {\r
+                $this->yy_shift($yyact, $yygoto, $yy_lefthand_side);\r
+            }\r
+        } elseif ($yyact == self::YYNSTATE + self::YYNRULE + 1) {\r
+            $this->yy_accept();\r
+        }\r
+    }\r
+\r
+    function yy_parse_failed()\r
+    {\r
+        if (self::$yyTraceFILE) {\r
+            fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);\r
+        }\r
+        while ($this->yyidx >= 0) {\r
+            $this->yy_pop_parser_stack();\r
+        }\r
+    }\r
+\r
+    function yy_syntax_error($yymajor, $TOKEN)\r
+    {\r
+#line 71 "smarty_internal_templateparser.y"\r
+\r
+    $this->internalError = true;\r
+    $this->yymajor = $yymajor;\r
+    $this->compiler->trigger_template_error();\r
+#line 2570 "smarty_internal_templateparser.php"\r
+    }\r
+\r
+    function yy_accept()\r
+    {\r
+        if (self::$yyTraceFILE) {\r
+            fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);\r
+        }\r
+        while ($this->yyidx >= 0) {\r
+            $stack = $this->yy_pop_parser_stack();\r
+        }\r
+#line 63 "smarty_internal_templateparser.y"\r
+\r
+    $this->successful = !$this->internalError;\r
+    $this->internalError = false;\r
+    $this->retvalue = $this->_retvalue;\r
+    //echo $this->retvalue."\n\n";\r
+#line 2588 "smarty_internal_templateparser.php"\r
+    }\r
+\r
+    function doParse($yymajor, $yytokenvalue)\r
+    {\r
+        $yyerrorhit = 0;   /* True if yymajor has invoked an error */\r
+        \r
+        if ($this->yyidx === null || $this->yyidx < 0) {\r
+            $this->yyidx = 0;\r
+            $this->yyerrcnt = -1;\r
+            $x = new TP_yyStackEntry;\r
+            $x->stateno = 0;\r
+            $x->major = 0;\r
+            $this->yystack = array();\r
+            array_push($this->yystack, $x);\r
+        }\r
+        $yyendofinput = ($yymajor==0);\r
+        \r
+        if (self::$yyTraceFILE) {\r
+            fprintf(self::$yyTraceFILE, "%sInput %s\n",\r
+                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);\r
+        }\r
+        \r
+        do {\r
+            $yyact = $this->yy_find_shift_action($yymajor);\r
+            if ($yymajor < self::YYERRORSYMBOL &&\r
+                  !$this->yy_is_expected_token($yymajor)) {\r
+                // force a syntax error\r
+                $yyact = self::YY_ERROR_ACTION;\r
+            }\r
+            if ($yyact < self::YYNSTATE) {\r
+                $this->yy_shift($yyact, $yymajor, $yytokenvalue);\r
+                $this->yyerrcnt--;\r
+                if ($yyendofinput && $this->yyidx >= 0) {\r
+                    $yymajor = 0;\r
+                } else {\r
+                    $yymajor = self::YYNOCODE;\r
+                }\r
+            } elseif ($yyact < self::YYNSTATE + self::YYNRULE) {\r
+                $this->yy_reduce($yyact - self::YYNSTATE);\r
+            } elseif ($yyact == self::YY_ERROR_ACTION) {\r
+                if (self::$yyTraceFILE) {\r
+                    fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",\r
+                        self::$yyTracePrompt);\r
+                }\r
+                if (self::YYERRORSYMBOL) {\r
+                    if ($this->yyerrcnt < 0) {\r
+                        $this->yy_syntax_error($yymajor, $yytokenvalue);\r
+                    }\r
+                    $yymx = $this->yystack[$this->yyidx]->major;\r
+                    if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){\r
+                        if (self::$yyTraceFILE) {\r
+                            fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",\r
+                                self::$yyTracePrompt, $this->yyTokenName[$yymajor]);\r
+                        }\r
+                        $this->yy_destructor($yymajor, $yytokenvalue);\r
+                        $yymajor = self::YYNOCODE;\r
+                    } else {\r
+                        while ($this->yyidx >= 0 &&\r
+                                 $yymx != self::YYERRORSYMBOL &&\r
+        ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE\r
+                              ){\r
+                            $this->yy_pop_parser_stack();\r
+                        }\r
+                        if ($this->yyidx < 0 || $yymajor==0) {\r
+                            $this->yy_destructor($yymajor, $yytokenvalue);\r
+                            $this->yy_parse_failed();\r
+                            $yymajor = self::YYNOCODE;\r
+                        } elseif ($yymx != self::YYERRORSYMBOL) {\r
+                            $u2 = 0;\r
+                            $this->yy_shift($yyact, self::YYERRORSYMBOL, $u2);\r
+                        }\r
+                    }\r
+                    $this->yyerrcnt = 3;\r
+                    $yyerrorhit = 1;\r
+                } else {\r
+                    if ($this->yyerrcnt <= 0) {\r
+                        $this->yy_syntax_error($yymajor, $yytokenvalue);\r
+                    }\r
+                    $this->yyerrcnt = 3;\r
+                    $this->yy_destructor($yymajor, $yytokenvalue);\r
+                    if ($yyendofinput) {\r
+                        $this->yy_parse_failed();\r
+                    }\r
+                    $yymajor = self::YYNOCODE;\r
+                }\r
+            } else {\r
+                $this->yy_accept();\r
+                $yymajor = self::YYNOCODE;\r
+            }            \r
+        } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);\r
+    }\r
+}\r
+?>\r
diff --git a/gosa-core/include/smarty/sysplugins/smarty_internal_write_file.php b/gosa-core/include/smarty/sysplugins/smarty_internal_write_file.php
new file mode 100644 (file)
index 0000000..5c756f1
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+/**
+* Smarty write file plugin
+* 
+* @package Smarty
+* @subpackage PluginsInternal
+* @author Monte Ohrt 
+*/
+/**
+* Smarty Internal Write File Class
+*/
+class Smarty_Internal_Write_File {
+    /**
+    * Writes file in a save way to disk
+    * 
+    * @param string $_filepath complete filepath
+    * @param string $_contents file content
+    * @return boolean true
+    */
+    public static function writeFile($_filepath, $_contents, $smarty)
+    {
+        $old_umask = umask(0);
+        $_dirpath = dirname($_filepath); 
+        // if subdirs, create dir structure
+        if ($_dirpath !== '.' && !file_exists($_dirpath)) {
+            mkdir($_dirpath, $smarty->_dir_perms, true);
+        } 
+        // write to tmp file, then move to overt file lock race condition
+        $_tmp_file = tempnam($_dirpath, 'wrt');
+
+        if (!file_put_contents($_tmp_file, $_contents)) {
+            umask($old_umask);
+            throw new Exception("unable to write file {$_tmp_file}");
+            return false;
+        } 
+        // remove original file
+        if (file_exists($_filepath))
+            @unlink($_filepath); 
+        // rename tmp file
+        rename($_tmp_file, $_filepath); 
+        // set file permissions
+        chmod($_filepath, $smarty->_file_perms);
+        umask($old_umask);
+        return true;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method__get_filter_name.php b/gosa-core/include/smarty/sysplugins/smarty_method__get_filter_name.php
new file mode 100644 (file)
index 0000000..9bc18fb
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+/**
+* Smarty method _get_filter_name
+* 
+* Return internal filter name
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Return internal filter name
+* 
+* @param object $smarty 
+* @param callback $function 
+*/
+function Smarty_Method__get_filter_name($smarty, $function)
+{
+               if (is_array($function)) {
+                       $_class_name = (is_object($function[0]) ?
+                               get_class($function[0]) : $function[0]);
+                       return $_class_name . '_' . $function[1];
+               }
+               else {
+                       return $function;
+               }
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_addpluginsdir.php b/gosa-core/include/smarty/sysplugins/smarty_method_addpluginsdir.php
new file mode 100644 (file)
index 0000000..24eb113
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method addPluginsDir
+* 
+* Adds directory of plugin files
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Adds directory of plugin files
+* 
+* @param object $smarty 
+* @param string $ |array $ plugins folder
+* @return 
+*/
+function  Smarty_Method_AddPluginsDir($smarty, $plugins_dir)
+{
+    $smarty->plugins_dir = array_merge((array)$smarty->plugins_dir, (array)$plugins_dir);
+    $smarty->plugins_dir = array_unique($smarty->plugins_dir);
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_clear_all_assign.php b/gosa-core/include/smarty/sysplugins/smarty_method_clear_all_assign.php
new file mode 100644 (file)
index 0000000..9809f03
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+* Smarty method Clear_All_Assign
+* 
+* Deletes all assigned Smarty variables at current level
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Delete Smarty variables
+* 
+* @param object $smarty 
+* @param object $data_object object which holds tpl_vars
+*/
+function  Smarty_Method_Clear_All_Assign($smarty, $data_object = null)
+{
+    if (isset($data_object)) {
+        $ptr = $data_object;
+    } else {
+        $ptr = $smarty;
+    } 
+    $ptr->tpl_vars = array();
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_clear_all_cache.php b/gosa-core/include/smarty/sysplugins/smarty_method_clear_all_cache.php
new file mode 100644 (file)
index 0000000..2d26315
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+* Smarty method Clear_All_Cache
+* 
+* Empties the cache folder
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Empty cache folder
+* 
+* @param object $smarty 
+* @param integer $exp_time expiration time
+* @param string $type resource type
+* @return integer number of cache files deleted
+*/
+function  Smarty_Method_Clear_All_Cache($smarty, $exp_time = null, $type = null)
+{ 
+    // load cache resource
+    $cacheResource = $smarty->loadCacheResource($type);
+
+    return $cacheResource->clearAll($exp_time);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_clear_assign.php b/gosa-core/include/smarty/sysplugins/smarty_method_clear_assign.php
new file mode 100644 (file)
index 0000000..1f1fe0b
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+/**
+* Smarty method Clear_Assign
+* 
+* Deletes a assigned Smarty variable or array of variables at current level
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Delete a Smarty variable or array of variables
+* 
+* @param object $smarty 
+* @param string $ |array $varname variable name or array of variable names
+* @param object $data_object object which holds tpl_vars
+*/
+function  Smarty_Method_Clear_Assign($smarty, $varname, $data_object = null)
+{
+    foreach ((array)$varname as $variable) {
+        if (isset($data_object)) {
+            $ptr = $data_object;
+        } else {
+            $ptr = $smarty;
+        } while ($ptr != null) {
+            if (isset($ptr->tpl_vars[$variable])) {
+                unset($ptr->tpl_vars[$variable]);
+            } 
+            $ptr = $ptr->parent;
+        } 
+    } 
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_clear_cache.php b/gosa-core/include/smarty/sysplugins/smarty_method_clear_cache.php
new file mode 100644 (file)
index 0000000..59b79d7
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+/**
+* Smarty method Clear_Cache
+* 
+* Empties the cache for a specific template
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Empty cache for a specific template
+* 
+* @param object $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
+*/
+function  Smarty_Method_Clear_Cache($smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
+{ 
+   // load cache resource
+    $cacheResource = $smarty->loadCacheResource($type);
+
+    return $cacheResource->clear($template_name, $cache_id, $compile_id, $exp_time);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_clear_compiled_tpl.php b/gosa-core/include/smarty/sysplugins/smarty_method_clear_compiled_tpl.php
new file mode 100644 (file)
index 0000000..f57f985
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+/**
+* Smarty method Clear_Compiled_Tpl
+* 
+* Deletes compiled template files
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Delete compiled template file
+* 
+* @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
+*/
+function  Smarty_Method_Clear_Compiled_Tpl($smarty, $resource_name = null, $compile_id = null, $exp_time = null)
+{
+    $_compile_id =  isset($compile_id) ? preg_replace('![^\w\|]+!','_',$compile_id) : null;
+    $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
+    if (isset($resource_name)) {
+        $_resource_part_1 = $resource_name . '.php';
+        $_resource_part_2 = $resource_name . '.cache' . '.php';
+    } else {
+        $_resource_part = '';
+    } 
+    $_dir = $smarty->compile_dir;
+    if ($smarty->use_sub_dirs && isset($_compile_id)) {
+        $_dir .= $_compile_id . $_dir_sep;
+    } 
+    if (isset($_compile_id)) {
+        $_compile_id_part = $smarty->compile_dir . $_compile_id . $_dir_sep;
+    } 
+    $_count = 0;
+    $_compileDirs = new RecursiveDirectoryIterator($_dir);
+    $_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
+    foreach ($_compile as $_file) {
+        if (strpos($_file, '.svn') !== false) continue;
+        if ($_file->isDir()) {
+            if (!$_compile->isDot()) {
+                // delete folder if empty
+                @rmdir($_file->getPathname());
+            } 
+        } else {
+            if ((!isset($_compile_id) || (strlen((string)$_file) > strlen($_compile_id_part) && substr_compare((string)$_file, $_compile_id_part, 0, strlen($_compile_id_part)) == 0)) &&
+                    (!isset($resource_name) || (strlen((string)$_file) > strlen($_resource_part_1) && substr_compare((string)$_file, $_resource_part_1, - strlen($_resource_part_1), strlen($_resource_part_1)) == 0) ||
+                        (strlen((string)$_file) > strlen($_resource_part_2) && substr_compare((string)$_file, $_resource_part_2, - strlen($_resource_part_2), strlen($_resource_part_2)) == 0))) {
+                if (isset($exp_time)) {
+                    if (time() - @filemtime($_file) >= $exp_time) {
+                        $_count += @unlink((string) $_file) ? 1 : 0;
+                    } 
+                } else {
+                    $_count += @unlink((string) $_file) ? 1 : 0;
+                } 
+            } 
+        } 
+    } 
+    return $_count;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_clear_config.php b/gosa-core/include/smarty/sysplugins/smarty_method_clear_config.php
new file mode 100644 (file)
index 0000000..3c752e0
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+/**
+* Smarty method Get_Config_Vars
+* 
+* Returns a single or all global config variables
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Deassigns a single or all global config variables
+* 
+* @param object $smarty 
+* @param string $varname variable name or null
+*/
+function  Smarty_Method_Clear_Config($smarty, $varname = null)
+{
+    if (isset($varname)) {
+        unset($smarty->config_vars[$varname]);
+        return;
+    } else {
+        $smarty->config_vars = array();
+        return;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_compile_directory.php b/gosa-core/include/smarty/sysplugins/smarty_method_compile_directory.php
new file mode 100644 (file)
index 0000000..48ffff7
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+
+/**
+* Smarty method compile_dir
+* 
+* Compiles all template files in an given directory
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Compile all template files
+* 
+* @param string $dir_name name of directories
+* @return integer number of template files deleted
+*/
+function  Smarty_Method_Compile_Directory($smarty, $extention = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
+{
+    function _get_time()
+    {
+        $_mtime = microtime();
+        $_mtime = explode(" ", $_mtime);
+        return (double)($_mtime[1]) + (double)($_mtime[0]);
+    } 
+    // set default directory
+    if ($dir_name === null) {
+        $dir_name = $smarty->template_dir;
+    } 
+    // switch off time limit
+    if (function_exists('set_time_limit')) {
+        @set_time_limit($time_limit);
+    } 
+    $smarty->force_compile = $force_compile;
+    $_count = 0;
+    $_error_count = 0; 
+    // loop over array of template directories
+    foreach((array)$smarty->template_dir as $_dir) {
+        $_compileDirs = new RecursiveDirectoryIterator($_dir);
+        $_compile = new RecursiveIteratorIterator($_compileDirs);
+        foreach ($_compile as $_fileinfo) {
+            if (strpos($_fileinfo, '.svn') !== false) continue;
+            $_file = $_fileinfo->getFilename();
+            if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;
+            if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {
+                $_template_file = $_file;
+            } else {
+                $_template_file = substr($_fileinfo->getPath(), strlen($_dir)) . '\\' . $_file;
+            } 
+            echo '<br>', $_dir, '---', $_template_file;
+            flush();
+            $_start_time = _get_time();
+            try {
+                $_tpl = $smarty->createTemplate($_template_file);
+                $_tpl->getCompiledTemplate();
+            } 
+            catch (Exception $e) {
+                echo 'Error: ', $e->getMessage(), "<br><br>";
+                $_error_count++;
+            } 
+            echo ' done in  ', _get_time() - $_start_time, ' seconds';
+            if ($max_errors !== null && $_error_count == $max_errors) {
+                echo '<br><br>too many errors';
+                exit();
+            } 
+        } 
+    } 
+    return $_count;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disablecachemodifycheck.php b/gosa-core/include/smarty/sysplugins/smarty_method_disablecachemodifycheck.php
new file mode 100644 (file)
index 0000000..aac8fab
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+/**
+* Smarty method DisableCacheModifyCheck
+* 
+* Disable cache modify check
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* 
+* Disable cache modify check
+*/
+function  Smarty_Method_DisableCacheModifyCheck($smarty)
+    {
+        $smarty->cache_modified_check = false;
+        return ;
+    } 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disablecaching.php b/gosa-core/include/smarty/sysplugins/smarty_method_disablecaching.php
new file mode 100644 (file)
index 0000000..ba5097a
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method DisableCaching
+* 
+* Disable caching
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable caching
+*/
+function  Smarty_Method_DisableCaching()
+{
+    $this->smarty->caching = false;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disablecompilecheck.php b/gosa-core/include/smarty/sysplugins/smarty_method_disablecompilecheck.php
new file mode 100644 (file)
index 0000000..f18514f
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+/**
+* Smarty method DisableCompileCheck
+* 
+* Disable compile checking
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable compile checking
+* 
+* @param object $smarty 
+*/
+function  Smarty_Method_DisableCompileCheck($smarty)
+{
+    $smarty->compile_check = false;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disableconfigbooleanize.php b/gosa-core/include/smarty/sysplugins/smarty_method_disableconfigbooleanize.php
new file mode 100644 (file)
index 0000000..fa7a434
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method DisableConfigBooleanize
+* 
+* Disable config booleanize mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable config booleanize mode
+*/
+function  Smarty_Method_DisableConfigBooleanize($smarty)
+{
+    $this->smarty->config_booleanize = false;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disableconfigoverwrite.php b/gosa-core/include/smarty/sysplugins/smarty_method_disableconfigoverwrite.php
new file mode 100644 (file)
index 0000000..d37cea4
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method DisableConfigOverwrite
+* 
+* Disable config overwrite mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable config overwrite mode
+*/
+function  Smarty_Method_DisableConfigOverwrite($smarty)
+{
+    $smarty->config_overwrite = false;
+    return ;
+} 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disableconfigreadhidden.php b/gosa-core/include/smarty/sysplugins/smarty_method_disableconfigreadhidden.php
new file mode 100644 (file)
index 0000000..e5001d6
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method DisableConfigReadHidden
+* 
+* Disable config read hidden mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable config read hidden mode
+*/
+function  Smarty_Method_DisableConfigReadHidden ($smarty)
+{
+    $this->smarty->config_read_hidden = false;
+    return;
+} 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disabledebugging.php b/gosa-core/include/smarty/sysplugins/smarty_method_disabledebugging.php
new file mode 100644 (file)
index 0000000..3cfccd7
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method DisableDebugging
+* 
+* Disable debugging
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable debugging
+*/
+function  Smarty_Method_DisableDebugging($smarty)
+{
+    $smarty->debugging = false;
+    return;
+} 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disabledebuggingurlctrl.php b/gosa-core/include/smarty/sysplugins/smarty_method_disabledebuggingurlctrl.php
new file mode 100644 (file)
index 0000000..fa149db
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method DisableDebuggingUrlCtrl
+* 
+* Disable possibility to Disable debugging by SMARTY_DEBUG attribute
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable possibility to Disable debugging by SMARTY_DEBUG attribute
+*/
+function  Smarty_Method_DisableDebuggingUrlCtrl($smarty)
+    {
+        $smarty->debugging_ctrl = 'none';
+        return;
+    } 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disabledefaulttimezone.php b/gosa-core/include/smarty/sysplugins/smarty_method_disabledefaulttimezone.php
new file mode 100644 (file)
index 0000000..3aef9cb
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method DisableDefaultTimezone
+* 
+* Disable setting of default timezone
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable setting of default timezone
+*/
+function  Smarty_Method_DisableDefaultTimezone($smarty)
+{
+    $smarty->set_timezone = false;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disableforcecompile.php b/gosa-core/include/smarty/sysplugins/smarty_method_disableforcecompile.php
new file mode 100644 (file)
index 0000000..7dab167
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method DisableForceCompile
+* 
+* Disable forced compiling
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable forced compiling
+*/
+function  Smarty_Method_DisableForceCompile($smarty)
+{
+    $smarty->force_compile = false;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_disablevariablefilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_disablevariablefilter.php
new file mode 100644 (file)
index 0000000..173bdfe
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method DisableVariableFilter
+* 
+* Disable  filter on variable output
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Disable filter on variable output
+*/
+function  Smarty_Method_DisableVariableFilter($smarty)
+{
+    $smarty->variable_filter = false;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enablecachemodifycheck.php b/gosa-core/include/smarty/sysplugins/smarty_method_enablecachemodifycheck.php
new file mode 100644 (file)
index 0000000..31dbbeb
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableCacheModifyCheck
+* 
+* Enable cache modify check
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable cache modify check
+*/
+function  Smarty_Method_EnableCacheModifyCheck($smarty)
+{
+    $smarty->cache_modified_check = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enablecompilecheck.php b/gosa-core/include/smarty/sysplugins/smarty_method_enablecompilecheck.php
new file mode 100644 (file)
index 0000000..23cd283
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableCompileCheck
+* 
+* Enable compile checking
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable compile checking
+*/
+function  Smarty_Method_EnableCompileCheck($smarty)
+{
+    $smarty->compile_check = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enableconfigbooleanize.php b/gosa-core/include/smarty/sysplugins/smarty_method_enableconfigbooleanize.php
new file mode 100644 (file)
index 0000000..ab7bd14
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableConfigBooleanize
+* 
+* Enable config booleanize mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable config booleanize mode
+*/
+function  Smarty_Method_EnableConfigBooleanize($smarty)
+{
+    $smarty->config_booleanize = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enableconfigoverwrite.php b/gosa-core/include/smarty/sysplugins/smarty_method_enableconfigoverwrite.php
new file mode 100644 (file)
index 0000000..7f0cc71
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableConfigOverwrite
+* 
+* Enable config overwrite mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable config overwrite mode
+*/
+function  Smarty_Method_EnableConfigOverwrite($smarty)
+{
+    $smarty->config_overwrite = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enableconfigreadhidden.php b/gosa-core/include/smarty/sysplugins/smarty_method_enableconfigreadhidden.php
new file mode 100644 (file)
index 0000000..982d0fd
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableConfigReadHidden
+* 
+* Enable config read hidden mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable config read hidden mode
+*/
+function  Smarty_Method_EnableConfigReadHidden($smarty)
+{
+    $this->smarty->config_read_hidden = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enabledebugging.php b/gosa-core/include/smarty/sysplugins/smarty_method_enabledebugging.php
new file mode 100644 (file)
index 0000000..3f3cc90
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableDebugging
+* 
+* Enable debugging
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable debugging
+*/
+function  Smarty_Method_EnableDebugging($smarty)
+{
+    $this->smarty->debugging = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enabledebuggingurlctrl.php b/gosa-core/include/smarty/sysplugins/smarty_method_enabledebuggingurlctrl.php
new file mode 100644 (file)
index 0000000..0743270
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableDebuggingUrlCtrl
+* 
+* Enable possibility to enable debugging by SMARTY_DEBUG attribute
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable possibility to enable debugging by SMARTY_DEBUG attribute
+*/
+function  Smarty_Method_EnableDebuggingUrlCtrl($smarty)
+{
+    $smarty->debugging_ctrl = 'URL';
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enabledefaulttimezone.php b/gosa-core/include/smarty/sysplugins/smarty_method_enabledefaulttimezone.php
new file mode 100644 (file)
index 0000000..e5a7f27
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableDefaultTimezone
+* 
+* Enable setting of default timezone
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable setting of default timezone
+*/
+function  Smarty_Method_EnableDefaultTimezone($smarty)
+{
+    $this->smarty->set_timezone = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enableforcecompile.php b/gosa-core/include/smarty/sysplugins/smarty_method_enableforcecompile.php
new file mode 100644 (file)
index 0000000..f78fc91
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableForceCompile
+* 
+* Enable forced compiling
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable forced compiling
+*/
+function  Smarty_Method_EnableForceCompile($smarty)
+{
+    $smarty->force_compile = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_enablevariablefilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_enablevariablefilter.php
new file mode 100644 (file)
index 0000000..6abe923
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+/**
+* Smarty method EnableVariableFilter
+* 
+* Enable  filter on variable output
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Enable filter on variable output
+*/
+function  Smarty_Method_EnableVariableFilter($smarty)
+{
+    $smarty->variable_filter = true;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_get_config_vars.php b/gosa-core/include/smarty/sysplugins/smarty_method_get_config_vars.php
new file mode 100644 (file)
index 0000000..9bbf4b5
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+/**
+* Smarty method Get_Config_Vars
+* 
+* Returns a single or all global config variables
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns a single or all global config variables
+*/
+
+/**
+* Returns a single or all global config variables
+* 
+* @param string $varname variable name or null
+* @return string variable value or or array of variables
+*/
+function  Smarty_Method_Get_Config_Vars($smarty, $varname = null)
+{
+    if (isset($varname)) {
+        if (isset($smarty->config_vars[$varname])) {
+            return $smarty->config_vars[$varname];
+        } else {
+            return '';
+        } 
+    } else {
+        return $smarty->config_vars;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_get_global.php b/gosa-core/include/smarty/sysplugins/smarty_method_get_global.php
new file mode 100644 (file)
index 0000000..539e082
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+/**
+* Smarty method Get_Global
+* 
+* Returns a single or all global variables
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns a single or all global  variables
+* 
+* @param object $smarty 
+* @param string $varname variable name or null
+* @return string variable value or or array of variables
+*/
+function  Smarty_Method_Get_Global($smarty, $varname = null)
+{
+    if (isset($varname)) {
+        if (isset($smarty->global_tpl_vars[$varname])) {
+            return $smarty->global_tpl_vars[$varname]->value;
+        } else {
+            return '';
+        } 
+    } else {
+        $_result = array();
+        foreach ($smarty->global_tpl_vars AS $key => $var) {
+            $_result[$key] = $var->value;
+        } 
+        return $_result;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_get_registered_object.php b/gosa-core/include/smarty/sysplugins/smarty_method_get_registered_object.php
new file mode 100644 (file)
index 0000000..147a1f3
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+/**
+* Smarty method Get_Registered_Object
+* 
+* Registers a PHP object
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns a reference to a registered object
+*/
+
+/**
+* return a reference to a registered object
+* 
+* @param string $name 
+* @return object 
+*/
+function  Smarty_Method_Get_Registered_Object($smarty, $name)
+{
+    if (!isset($smarty->registered_objects[$name]))
+        throw new Exception("'$name' is not a registered object");
+
+    if (!is_object($smarty->registered_objects[$name][0]))
+        throw new Exception("registered '$name' is not an object");
+
+    return $smarty->registered_objects[$name][0];
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_get_template_vars.php b/gosa-core/include/smarty/sysplugins/smarty_method_get_template_vars.php
new file mode 100644 (file)
index 0000000..9bfdbd8
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+
+/**
+* Smarty method Get_Template_Vars
+* 
+* Returns a single or all template variables
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns a single or all template variables
+*/
+
+/**
+* Returns a single or all template variables
+* 
+* @param string $varname variable name or null
+* @return string variable value or or array of variables
+*/
+function  Smarty_Method_Get_Template_Vars($smarty, $varname = null, $_ptr = null, $search_parents = true)
+{
+    if (isset($varname)) {
+        $_var = $smarty->getVariable($varname, $_ptr, $search_parents);
+        if (is_object($_var)) {
+            return $_var->value;
+        } else {
+            return null;
+        } 
+    } else {
+        $_result = array();
+        if ($_ptr === null) {
+            $_ptr = $smarty;
+        } while ($_ptr !== null) {
+            foreach ($_ptr->tpl_vars AS $key => $var) {
+                $_result[$key] = $var->value;
+            } 
+            // not found, try at parent
+            if ($search_parents) {
+                $_ptr = $_ptr->parent;
+            } else {
+                $_ptr = null;
+            } 
+        } 
+        if ($search_parents) {
+            foreach ($smarty->global_tpl_vars AS $key => $var) {
+                $_result[$key] = $var->value;
+            } 
+        } 
+        return $_result;
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_getcachedir.php b/gosa-core/include/smarty/sysplugins/smarty_method_getcachedir.php
new file mode 100644 (file)
index 0000000..47ed877
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method GetCacheDir
+* 
+* Returns directory of cache files
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns directory of cache files
+*/
+
+/**
+* Returns directory of cache files
+* 
+* @return array cache folder
+*/
+function  Smarty_Method_GetCacheDir($smarty)
+{
+    return $this->smarty->cache_dir;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_getcachelifetime.php b/gosa-core/include/smarty/sysplugins/smarty_method_getcachelifetime.php
new file mode 100644 (file)
index 0000000..0db4fc7
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+* Smarty method GetCacheLifetime
+* 
+* Returns lifetime of cache files
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Smarty class getCacheLifetime
+* 
+* Returns lifetime of cache files
+*/
+/**
+* Returns lifetime of cache files
+* 
+* @return integer cache file lifetime
+*/
+function  Smarty_Method_GetCacheLifetime($smarty)
+{
+    return $smarty->cache_lifetime;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_getcompiledir.php b/gosa-core/include/smarty/sysplugins/smarty_method_getcompiledir.php
new file mode 100644 (file)
index 0000000..929da27
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method GetCompileDir
+* 
+* Returns directory of compiled templates
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns directory of compiled templates
+*/
+
+/**
+* Returns directory of compiled templates
+* 
+* @return array compiled template folder
+*/
+function  Smarty_Method_GetCompileDir($smarty)
+{
+    return $this->smarty->compile_dir;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_getconfigdir.php b/gosa-core/include/smarty/sysplugins/smarty_method_getconfigdir.php
new file mode 100644 (file)
index 0000000..79e55b6
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method GetConfigDir
+* 
+* Returns directory of config files
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns directory of config files
+*/
+
+/**
+* Returns directory of config files
+* 
+* @return array config folder
+*/
+function  Smarty_Method_GetConfigDir($smarty)
+{
+    return $smarty->config_dir;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_getdebugtemplate.php b/gosa-core/include/smarty/sysplugins/smarty_method_getdebugtemplate.php
new file mode 100644 (file)
index 0000000..8109169
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method GetDebugTemplate
+* 
+* Returns debug template filepath
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns debug template filepath
+*/
+
+/**
+* Returns directory of cache files
+* 
+* @return string debug template filepath
+*/
+function  Smarty_Method_GetDebugTemplate($smarty)
+{
+    return $smarty->debug_tpl;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_getpluginsdir.php b/gosa-core/include/smarty/sysplugins/smarty_method_getpluginsdir.php
new file mode 100644 (file)
index 0000000..6fa98a3
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method GetPluginsDir
+* 
+* Returns directory of plugins
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns directory of plugins
+*/
+
+/**
+* Returns directory of plugins
+* 
+* @return array plugins folder
+*/
+function  Smarty_Method_GetPluginsDir($smarty)
+{
+    return $smarty->plugins_dir;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_gettemplatedir.php b/gosa-core/include/smarty/sysplugins/smarty_method_gettemplatedir.php
new file mode 100644 (file)
index 0000000..2fa1df8
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method GetTemplateDir
+* 
+* Returns template directory
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Returns template directory
+*/
+
+/**
+* Returns template directory
+* 
+* @return array template folders
+*/
+function  Smarty_Method_GetTemplateDir($smarty)
+{
+    return $smarty->template_dir;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_getvariablefilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_getvariablefilter.php
new file mode 100644 (file)
index 0000000..9d7d0c4
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+/**
+* Smarty method GetVariableFilter
+* 
+* get status of filter on variable output
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Smarty class getVariableFilter
+* 
+* get status of filter on variable output
+*/
+function  Smarty_Method_GetVariableFilter($smarty)
+{
+    return $smarty->variable_filter;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_iscachemodifycheck.php b/gosa-core/include/smarty/sysplugins/smarty_method_iscachemodifycheck.php
new file mode 100644 (file)
index 0000000..4e93b17
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsCacheModifyCheck
+* 
+* is cache modify check
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is cache modify check
+*/
+function  Smarty_Method_IsCacheModifyCheck()
+{
+    return $smarty->cache_modified_check;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_iscaching.php b/gosa-core/include/smarty/sysplugins/smarty_method_iscaching.php
new file mode 100644 (file)
index 0000000..e27bd0a
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsCaching
+* 
+* is caching
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is caching
+*/
+function  Smarty_Method_IsCaching($smarty)
+{
+    return $smarty->caching;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_iscompilecheck.php b/gosa-core/include/smarty/sysplugins/smarty_method_iscompilecheck.php
new file mode 100644 (file)
index 0000000..904ad4c
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsCompileCheck
+* 
+* is compile checking
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is compile checking
+*/
+function  Smarty_Method_IsCompileCheck($smarty)
+{
+    return $smarty->compile_check;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_isconfigbooleanize.php b/gosa-core/include/smarty/sysplugins/smarty_method_isconfigbooleanize.php
new file mode 100644 (file)
index 0000000..605474b
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsConfigBooleanize
+* 
+* is config booleanize mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is config booleanize mode
+*/
+function  Smarty_Method_IsConfigBooleanize($smarty)
+{
+    return $smarty->config_booleanize;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_isconfigoverwrite.php b/gosa-core/include/smarty/sysplugins/smarty_method_isconfigoverwrite.php
new file mode 100644 (file)
index 0000000..fb10f0e
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsConfigOverwrite
+* 
+* is config overwrite mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is config overwrite mode
+*/
+function  Smarty_Method_IsConfigOverwrite($smarty)
+{
+    return $smarty->config_overwrite;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_isconfigreadhidden.php b/gosa-core/include/smarty/sysplugins/smarty_method_isconfigreadhidden.php
new file mode 100644 (file)
index 0000000..e13c84d
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsConfigReadHidden
+* 
+* is config read hidden mode
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* 
+* is config read hidden mode
+*/
+function  Smarty_Method_IsConfigReadHidden($smarty)
+    {
+        return $smarty->config_read_hidden;
+    } 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_isdebugging.php b/gosa-core/include/smarty/sysplugins/smarty_method_isdebugging.php
new file mode 100644 (file)
index 0000000..9d36eb4
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsDebugging
+* 
+* is debugging
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is debugging
+*/
+function  Smarty_Method_IsDebugging($smarty)
+{
+    return $smarty->debugging;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_isdebuggingurlctrl.php b/gosa-core/include/smarty/sysplugins/smarty_method_isdebuggingurlctrl.php
new file mode 100644 (file)
index 0000000..5487cd1
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsDebuggingUrlCtrl
+* 
+* is possibility to is debugging by SMARTY_DEBUG attribute
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is possibility to is debugging by SMARTY_DEBUG attribute
+*/
+function  Smarty_Method_IsDebuggingUrlCtrl($smarty)
+{
+    return $smarty->debugging_ctrl != 'none';
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_isdefaulttimezone.php b/gosa-core/include/smarty/sysplugins/smarty_method_isdefaulttimezone.php
new file mode 100644 (file)
index 0000000..dd22117
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+/**
+* Smarty method IsDefaultTimezone
+* 
+* is setting of default timezone
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* is setting of default timezone
+*/
+function  Smarty_Method_IsDefaultTimezone($smarty)
+{
+    return $smarty->set_timezone = false;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_isforcecompile.php b/gosa-core/include/smarty/sysplugins/smarty_method_isforcecompile.php
new file mode 100644 (file)
index 0000000..94c62a0
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+/**
+* Smarty method IsForceCompile
+* 
+* is forced compiling
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* 
+* is forced compiling
+*/
+function  Smarty_Method_IsForceCompile($smarty)
+    {
+        return $smarty->force_compile;
+    } 
+
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_load_filter.php b/gosa-core/include/smarty/sysplugins/smarty_method_load_filter.php
new file mode 100644 (file)
index 0000000..cb82ea1
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+/**
+* Smarty method Load_Filter
+* 
+* Loads a filter plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* load a filter of specified type and name
+* 
+* @param string $type filter type
+* @param string $name filter name
+*/
+function  Smarty_Method_Load_Filter($smarty, $type, $name)
+{
+    $_plugin = "smarty_{$type}filter_{$name}";
+    $_filter_name = $_plugin;
+    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;
+        } 
+    } 
+    throw new Exception("{$type}filter \"{$name}\" not callable");
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_block.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_block.php
new file mode 100644 (file)
index 0000000..466f8c3
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+/**
+* Smarty method Register_Block
+* 
+* Registers a PHP function as Smarty block function plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Register a PHP function as Smarty block function plugin
+*/
+
+/**
+* Registers block function to be used in templates
+* 
+* @param string $block_tag name of template block
+* @param string $block_impl PHP function to register
+* @param boolean $cacheable if true (default) this fuction is cachable
+*/
+function  Smarty_Method_Register_Block($smarty, $block_tag, $block_impl, $cacheable = true, $cache_attr = array())
+{
+    if (isset($smarty->registered_plugins['block'][$block_tag])) {
+        throw new Exception("Plugin tag \"{$block_tag}\" already registered");
+    } elseif (!is_callable($block_impl)) {
+        throw new Exception("Plugin \"{$block_tag}\" not callable");
+    } else {
+        $smarty->registered_plugins['block'][$block_tag] =
+        array($block_impl, $cacheable, $cache_attr);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_compiler_function.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_compiler_function.php
new file mode 100644 (file)
index 0000000..b338504
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+/**
+* Smarty method Register_Compiler_Function
+* 
+* Registers a PHP function as Smarty compiler function plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Register a PHP function as Smarty compiler function plugin
+*/
+
+/**
+* Registers compiler function
+* 
+* @param string $compiler_tag of template function
+* @param string $compiler_impl name of PHP function to register
+*/
+function  Smarty_Method_Register_Compiler_Function($smarty, $compiler_tag, $compiler_impl, $cacheable = true)
+{
+    if (isset($smarty->registered_plugins['compiler'][$compiler_tag])) {
+        throw new Exception("Plugin tag \"{$compiler_tag}\" already registered");
+    } elseif (!is_callable($compiler_impl)) {
+        throw new Exception("Plugin \"{$compiler_tag}\" not callable");
+    } else {
+        $smarty->registered_plugins['compiler'][$compiler_tag] =
+        array($compiler_impl, $cacheable);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_function.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_function.php
new file mode 100644 (file)
index 0000000..fbdb781
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+/**
+* Smarty method Register_Function
+* 
+* Registers a PHP function as Smarty function plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers custom function to be used in templates
+* 
+* @param object $smarty 
+* @param string $function_tag the name of the template function
+* @param string $function_impl the name of the PHP function to register
+* @param boolean $cacheable if true (default) this fuction is cachable
+*/
+function  Smarty_Method_Register_Function($smarty, $function_tag, $function_impl, $cacheable = true, $cache_attr = array())
+{
+    if (isset($smarty->registered_plugins['function'][$function_tag])) {
+        throw new Exception("Plugin tag \"{$function_tag}\" already registered");
+    } elseif (!is_callable($function_impl)) {
+        throw new Exception("Plugin \"{$function_tag}\" not callable");
+    } else {
+        $smarty->registered_plugins['function'][$function_tag] =
+        array($function_impl, $cacheable, $cache_attr);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_modifier.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_modifier.php
new file mode 100644 (file)
index 0000000..022f4f3
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+/**
+* Smarty method Register_Modifier
+* 
+* Registers a PHP function as Smarty modifier plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers modifier to be used in templates
+* 
+* @param object $smarty 
+* @param string $modifier name of template modifier
+* @param string $modifier_impl name of PHP function to register
+*/
+function  Smarty_Method_Register_Modifier($smarty, $modifier, $modifier_impl)
+{
+    if (isset($smarty->registered_plugins['modifier'][$modifier])) {
+        throw new Exception("Plugin \"{$modifier}\" already registered");
+    } elseif (!is_callable($modifier_impl)) {
+        throw new Exception("Plugin \"{$modifier}\" not callable");
+    } else {
+        $smarty->registered_plugins['modifier'][$modifier] =
+        array($modifier_impl);
+    } 
+} 
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_object.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_object.php
new file mode 100644 (file)
index 0000000..a4d0e60
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+
+/**
+* Smarty method Register_Object
+* 
+* Registers a PHP object
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers object to be used in templates
+* 
+* @param object $smarty 
+* @param string $object name of template object
+* @param object $ &$object_impl the referenced PHP object to register
+* @param null $ |array $allowed list of allowed methods (empty = all)
+* @param boolean $smarty_args smarty argument format, else traditional
+* @param null $ |array $block_functs list of methods that are block format
+*/
+function  Smarty_Method_Register_Object($smarty, $object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+{ 
+    // test if allowed methodes callable
+    if (!empty($allowed)) {
+        foreach ((array)$allowed as $methode) {
+            if (!is_callable(array($object_impl, $methode))) {
+                throw new Exception("Undefined methode '$methode' in registered object");
+            } 
+        } 
+    } 
+    // test if block methodes callable
+    if (!empty($block_methods)) {
+        foreach ((array)$block_methods as $methode) {
+            if (!is_callable(array($object_impl, $methode))) {
+                throw new Exception("Undefined methode '$methode' in registered object");
+            } 
+        } 
+    } 
+    // register the object
+    $smarty->registered_objects[$object] =
+    array($object_impl, (array)$allowed, (boolean)$smarty_args, (array)$block_methods);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_outputfilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_outputfilter.php
new file mode 100644 (file)
index 0000000..4601264
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+/**
+* Smarty method Register_Outputfilter
+* 
+* Registers a PHP function as outputfilter
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers an output filter function to apply
+* to a template output
+* 
+* @param object $smarty 
+* @param callback $function 
+*/
+function  Smarty_Method_Register_Outputfilter($smarty, $function)
+{
+    $smarty->registered_filters['output'][$smarty->_get_filter_name($function)] = $function;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_postfilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_postfilter.php
new file mode 100644 (file)
index 0000000..1d8c2e7
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+/**
+* Smarty method Register_Postfilter
+* 
+* Registers a PHP function as postfilter
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers a postfilter function to apply
+* to a compiled template after compilation
+* 
+* @param object $smarty 
+* @param callback $function 
+*/
+function  Smarty_Method_Register_Postfilter($smarty, $function)
+{
+    $smarty->registered_filters['post'][$smarty->_get_filter_name($function)] = $function;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_prefilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_prefilter.php
new file mode 100644 (file)
index 0000000..781700d
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+/**
+* Smarty method Register_Prefilter
+* 
+* Registers a PHP function as prefilter
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers a prefilter function to apply
+* to a template before compiling
+* 
+* @param object $smarty 
+* @param callback $function 
+*/
+function  Smarty_Method_Register_Prefilter($smarty, $function)
+{
+    $smarty->registered_filters['pre'][$smarty->_get_filter_name($function)] = $function;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_resource.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_resource.php
new file mode 100644 (file)
index 0000000..09f5e89
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+/**
+* Smarty method Register_Resource
+* 
+* Registers a Smarty template resource
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers a resource to fetch a template
+* 
+* @param object $smarty 
+* @param string $type name of resource
+* @param array $functions array of functions to handle resource
+*/
+function  Smarty_Method_Register_Resource($smarty, $type, $functions)
+{
+    if (count($functions) == 4) {
+        $smarty->_plugins['resource'][$type] =
+        array($functions, false);
+    } elseif (count($functions) == 5) {
+        $smarty->_plugins['resource'][$type] =
+        array(array(array(&$functions[0], $functions[1]) , array(&$functions[0], $functions[2]) , array(&$functions[0], $functions[3]) , array(&$functions[0], $functions[4])) , false);
+    } else {
+        throw new Exception("malformed function-list for '$type' in register_resource");
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_register_variablefilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_register_variablefilter.php
new file mode 100644 (file)
index 0000000..3052d34
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+/**
+* Smarty method Register_Variablefilter
+* 
+* Registers a PHP function as an output filter for variables
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers an output filter function which
+* runs over any variable output
+* 
+* @param object $smarty 
+* @param callback $function 
+*/
+function  Smarty_Method_Register_Variablefilter($smarty, $function)
+{
+    $smarty->registered_filters['variable'][$smarty->_get_filter_name($function)] = $function;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_registerdefaultpluginhandler.php b/gosa-core/include/smarty/sysplugins/smarty_method_registerdefaultpluginhandler.php
new file mode 100644 (file)
index 0000000..fe1e25b
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+* Smarty method RegisterDefaultPluginhandlerHandler
+* 
+* Registers a default plugin handler
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers a default plugin handler
+* 
+* @param object $smarty 
+* @param string $ |array $plugin class/methode name
+*/
+function  Smarty_Method_RegisterDefaultPluginHandler($smarty, $plugin)
+{
+    if (is_callable($plugin)) {
+        $smarty->default_plugin_handler_func = $plugin;
+    } else {
+        throw new Exception('Default plugin handler "' . $plugin . '" not callable');
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_registerdefaulttemplatehandler.php b/gosa-core/include/smarty/sysplugins/smarty_method_registerdefaulttemplatehandler.php
new file mode 100644 (file)
index 0000000..1b716af
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+* Smarty method RegisterDefaultTemplateHandler
+* 
+* Registers a default template handler
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Registers a default template handler
+* 
+* @param object $smarty 
+* @param string $ |array $function class/methode name
+*/
+function  Smarty_Method_RegisterDefaultTemplateHandler($smarty, $function)
+{
+    if (is_callable($function)) {
+        $smarty->default_template_handler_func = $function;
+    } else {
+        throw new Exception('Default template handler "' . $function . '" not callable');
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_setconfigdir.php b/gosa-core/include/smarty/sysplugins/smarty_method_setconfigdir.php
new file mode 100644 (file)
index 0000000..6e501f6
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+/**
+* Smarty method SetConfigDir
+* 
+* Sets directory of config files
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Sets directory of config files
+* 
+* @param object $smarty 
+* @param string $ config folder
+* @return 
+*/
+function  Smarty_Method_SetConfigDir($smarty, $config_dir)
+{
+    $this->smarty->config_dir = $config_dir;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_setdebugtemplate.php b/gosa-core/include/smarty/sysplugins/smarty_method_setdebugtemplate.php
new file mode 100644 (file)
index 0000000..4e9cc1f
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+* Smarty method SetDebugTemplate
+* 
+* Sets debug template filepath
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Sets debug template filepath
+*/
+
+/**
+* Sets debug template filepath
+* 
+* @param string $ array debug template filepath
+*/
+function  Smarty_Method_SetDebugTemplate($smarty, $debug_tpl)
+{
+    $smarty->debug_tpl = $debug_tpl;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_setpluginsdir.php b/gosa-core/include/smarty/sysplugins/smarty_method_setpluginsdir.php
new file mode 100644 (file)
index 0000000..57ed8f2
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+* Smarty method SetPluginsDir
+* 
+* Sets directory of plugin files
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Sets directory of plugin files
+*/
+
+/**
+* Sets directory of plugin files
+* 
+* @param string $ plugins folder
+* @return 
+*/
+function  Smarty_Method_SetPluginsDir($smarty, $plugins_dir)
+{
+    $smarty->plugins_dir = (array)$plugins_dir;
+    return;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_template_exists.php b/gosa-core/include/smarty/sysplugins/smarty_method_template_exists.php
new file mode 100644 (file)
index 0000000..8ece1ae
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+/**
+* Smarty method Template_Exists
+* 
+* Checks if a template resource exists
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Checks if a template resource exists
+*/
+
+/**
+* Check if a template resource exists
+* 
+* @param string $resource_name template name
+* @return boolean status
+*/
+function  Smarty_Method_Template_Exists($smarty, $resource_name)
+{ 
+    // create template object
+    $tpl = new $smarty->template_class($resource_name, $smarty); 
+    // check if it does exists 
+        return $tpl->isExisting();
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_test.php b/gosa-core/include/smarty/sysplugins/smarty_method_test.php
new file mode 100644 (file)
index 0000000..53f8594
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+
+/**
+* Smarty plugin
+* 
+* @ignore 
+* @package Smarty
+* @subpackage plugins
+*/
+
+function  Smarty_Method_Test($smarty)
+{
+    echo "<PRE>\n";
+
+    echo "Smarty Installation test...\n";
+
+    echo "Testing template directory...\n";
+
+    foreach((array)$smarty->template_dir as $template_dir) {
+        if (!is_dir($template_dir))
+            echo "FAILED: $template_dir is not a directory.\n";
+        elseif (!is_readable($template_dir))
+            echo "FAILED: $template_dir is not readable.\n";
+        else
+            echo "$template_dir is OK.\n";
+    } 
+
+    echo "Testing compile directory...\n";
+
+    if (!is_dir($smarty->compile_dir))
+        echo "FAILED: $smarty->compile_dir is not a directory.\n";
+    elseif (!is_readable($smarty->compile_dir))
+        echo "FAILED: $smarty->compile_dir is not readable.\n";
+    elseif (!is_writable($smarty->compile_dir))
+        echo "FAILED: $smarty->compile_dir is not writable.\n";
+    else
+        echo "{$smarty->compile_dir} is OK.\n";
+
+    echo "Testing plugins directory...\n";
+
+    foreach((array)$smarty->plugins_dir as $plugin_dir) {
+        if (!is_dir($plugin_dir))
+            echo "FAILED: $plugin_dir is not a directory.\n";
+        elseif (!is_readable($plugin_dir))
+            echo "FAILED: $plugin_dir is not readable.\n";
+        else
+            echo "$plugin_dir is OK.\n";
+    } 
+
+    echo "Testing cache directory...\n";
+
+    if (!is_dir($smarty->cache_dir))
+        echo "FAILED: $smarty->cache_dir is not a directory.\n";
+    elseif (!is_readable($smarty->cache_dir))
+        echo "FAILED: $smarty->cache_dir is not readable.\n";
+    elseif (!is_writable($smarty->cache_dir))
+        echo "FAILED: $smarty->cache_dir is not writable.\n";
+    else
+        echo "{$smarty->cache_dir} is OK.\n";
+
+    echo "Testing configs directory...\n";
+
+    if (!is_dir($smarty->config_dir))
+        echo "FAILED: $smarty->config_dir is not a directory.\n";
+    elseif (!is_readable($smarty->config_dir))
+        echo "FAILED: $smarty->config_dir is not readable.\n";
+    else
+        echo "{$smarty->config_dir} is OK.\n";
+
+    echo "Tests complete.\n";
+
+    echo "</PRE>\n";
+
+    return true;
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_block.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_block.php
new file mode 100644 (file)
index 0000000..d1fecb7
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+* Smarty method Unregister_Block
+* 
+* Unregister a Smarty block function plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a Smarty block function plugin
+*/
+
+/**
+* Unregisters block function
+* 
+* @param string $block_tag name of template function
+*/
+function  Smarty_Method_Unregister_Block($smarty, $block_tag)
+{
+    if (isset($smarty->registered_plugins['block'][$block_tag])) {
+        unset($smarty->registered_plugins['block'][$block_tag]);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_compiler_function.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_compiler_function.php
new file mode 100644 (file)
index 0000000..049214b
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+* Smarty method Unregister_Compiler_Function
+* 
+* Unregister a Smarty compiler function plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a Smarty compiler function plugin
+*/
+
+/**
+* Unregisters compiler function
+* 
+* @param string $compiler_tag name of template function
+*/
+function  Smarty_Method_Unregister_Compiler_Function($smarty, $compiler_tag)
+{
+    if (isset($smarty->registered_plugins['compiler'][$compiler_tag])) {
+        unset($smarty->registered_plugins['compiler'][$compiler_tag]);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_function.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_function.php
new file mode 100644 (file)
index 0000000..f91b9bb
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+* Smarty method Unregister_Function
+* 
+* Unregister a Smarty function plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a Smarty function plugin
+*/
+
+/**
+* Unregisters custom function
+* 
+* @param string $function_tag name of template function
+*/
+function  Smarty_Method_Unregister_Function($smarty, $function_tag)
+{
+    if (isset($smarty->registered_plugins['function'][$function_tag])) {
+        unset($smarty->registered_plugins['function'][$function_tag]);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_modifier.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_modifier.php
new file mode 100644 (file)
index 0000000..46191c9
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+/**
+* Smarty method Unregister_Modifier
+* 
+* Unregister a Smarty modifier plugin
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a Smarty modifier plugin
+*/
+
+/**
+* Unregisters modifier
+* 
+* @param string $modifier name of template modifier
+*/
+function  Smarty_Method_Unregister_Modifier($smarty, $modifier)
+{
+    if (isset($smarty->registered_plugins['modifier'][$modifier])) {
+        unset($smarty->registered_plugins['modifier'][$modifier]);
+    } 
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_object.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_object.php
new file mode 100644 (file)
index 0000000..0be5c25
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+* Smarty method Unregister_Object
+* 
+* Unregister a PHP object
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* 
+* Unregister a PHP object
+*/
+
+    /**
+    * Unregisters object
+    * 
+    * @param string $object name of template object
+    */
+     function  Smarty_Method_Unregister_Object($smarty, $object)
+    {
+        unset($smarty->registered_objects[$object]);
+    } 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_outputfilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_outputfilter.php
new file mode 100644 (file)
index 0000000..b71a779
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+/**
+* Smarty method Unregister_Outputfilter
+* 
+* Unregister a outputfilter
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a outputfilter
+*/
+
+/**
+* Registers an output filter function to apply
+* to a template output
+* 
+* @param callback $function 
+*/
+function  Smarty_Method_Unregister_Outputfilter($smarty, $function)
+{
+    unset($smarty->registered_filters['output'][$smarty->_get_filter_name($function)]);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_postfilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_postfilter.php
new file mode 100644 (file)
index 0000000..17aa49b
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method Unregister_Postfilter
+* 
+* Unregister a postfilter
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a postfilter
+*/
+
+/**
+* Unregisters a postfilter function
+* 
+* @param callback $function 
+*/
+function  Smarty_Method_Unregister_Postfilter($smarty, $function)
+{
+    unset($smarty->registered_filters['post'][$smarty->_get_filter_name($function)]);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_prefilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_prefilter.php
new file mode 100644 (file)
index 0000000..b77eaf6
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method Unregister_Prefilter
+* 
+* Unregister a prefilter
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a prefilter
+*/
+
+/**
+* Unregisters a prefilter function
+* 
+* @param callback $function 
+*/
+function  Smarty_Method_Unregister_Prefilter($smarty, $function)
+{
+    unset($smarty->registered_filters['pre'][$smarty->_get_filter_name($function)]);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_resource.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_resource.php
new file mode 100644 (file)
index 0000000..b17875a
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method Unregister_Resource
+* 
+* Unregister a template resource
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a template resource
+*/
+
+/**
+* Unregisters a resource
+* 
+* @param string $type name of resource
+*/
+function  Smarty_Method_Unregister_Resource($smarty, $type)
+{
+    unset($smarty->plugins['resource'][$type]);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_method_unregister_variablefilter.php b/gosa-core/include/smarty/sysplugins/smarty_method_unregister_variablefilter.php
new file mode 100644 (file)
index 0000000..032943b
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+* Smarty method Unregister_Variablefilter
+* 
+* Unregister a variablefilter
+* 
+* @package Smarty
+* @subpackage SmartyMethod
+* @author Uwe Tews 
+*/
+
+/**
+* Unregister a variablefilter
+*/
+
+/**
+* Unregisters a variablefilter function
+* 
+* @param callback $function 
+*/
+function  Smarty_Method_Unregister_Variablefilter($smarty, $function)
+{
+    unset($smarty->registered_filters['variable'][$smarty->_get_filter_name($function)]);
+} 
+
+?>
diff --git a/gosa-core/include/smarty/sysplugins/smarty_security.php b/gosa-core/include/smarty/sysplugins/smarty_security.php
new file mode 100644 (file)
index 0000000..2c99fbc
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+/**
+* Smarty plugin
+* 
+* @package Smarty
+* @subpackage Security
+* @author Uwe Tews 
+*/ 
+
+/**
+* This class does contain the security settings
+*/
+class Smarty_Security {
+    /**
+    * This determines how Smarty handles "<?php ... ?>" tags in templates.
+    * possible values:
+    * <ul>
+    *   <li>SMARTY_PHP_PASSTHRU -> echo PHP tags as they are</li>
+    *   <li>SMARTY_PHP_QUOTE    -> escape tags as entities</li>
+    *   <li>SMARTY_PHP_REMOVE   -> remove php tags</li>
+    *   <li>SMARTY_PHP_ALLOW    -> execute php tags</li>
+    * </ul>
+    * 
+    * @var integer 
+    */
+    public $php_handling = SMARTY_PHP_PASSTHRU;
+
+    /**
+    * This is the list of template directories that are considered secure.
+    * One directory per array element. 
+    * $template_dir is in this list implicitly.
+    * 
+    * @var array 
+    */
+    public $secure_dir = array();
+
+
+    /**
+    * This is an array of directories where trusted php scripts reside.
+    * {@link $security} is disabled during their inclusion/execution.
+    * 
+    * @var array 
+    */
+    public $trusted_dir = array();
+
+
+    /**
+    * This is an array of trusted PHP functions.
+    *
+    * If empty all functions are allowed.
+    * If set to 'none' none is allowed.
+    * @var array 
+    */
+    public $php_functions = array('isset', 'empty',
+            'count', 'sizeof','in_array', 'is_array','time','nl2br');
+
+    /**
+    * This is an array of trusted modifers.
+    *
+    * If empty all modifiers are allowed.
+    * If set to 'none' none is allowed.
+    * @var array 
+    */
+    public $modifiers = array('escape','count');
+
+    /**
+    * This is an array of trusted streams.
+    *
+    * If empty all streams are allowed.
+    * If set to 'none' none is allowed.
+    * @var array 
+    */
+    public $streams = array('file');
+    /**
+    + flag if constants can be accessed from template
+    */
+    public $allow_constants = true;
+    /**
+    + flag if super globals can be accessed from template
+    */
+    public $allow_super_globals = true;
+    /**
+    + flag if {php} tag can be executed
+    */
+    public $allow_php_tag = false;
+} 
+
+?>