| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943 | 
							- <?php
 
- /**
 
-  * Project:     Smarty: the PHP compiling template engine
 
-  * File:        Smarty.class.php
 
-  *
 
-  * 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-general-subscribe@lists.php.net
 
-  *
 
-  * @link http://smarty.php.net/
 
-  * @copyright 2001-2005 New Digital Group, Inc.
 
-  * @author Monte Ohrt <monte at ohrt dot com>
 
-  * @author Andrei Zmievski <andrei@php.net>
 
-  * @package Smarty
 
-  * @version 2.6.17
 
-  */
 
- /* $Id: Smarty.class.php,v 1.527 2006/12/01 15:40:05 mohrt Exp $ */
 
- /**
 
-  * DIR_SEP isn't used anymore, but third party apps might
 
-  */
 
- if(!defined('DIR_SEP')) {
 
-     define('DIR_SEP', DIRECTORY_SEPARATOR);
 
- }
 
- /**
 
-  * set SMARTY_DIR to absolute path to Smarty library files.
 
-  * if not defined, include_path will be used. Sets SMARTY_DIR only if user
 
-  * application has not already defined it.
 
-  */
 
- if (!defined('SMARTY_DIR')) {
 
-     define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
 
- }
 
- if (!defined('SMARTY_CORE_DIR')) {
 
-     define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);
 
- }
 
- define('SMARTY_PHP_PASSTHRU',   0);
 
- define('SMARTY_PHP_QUOTE',      1);
 
- define('SMARTY_PHP_REMOVE',     2);
 
- define('SMARTY_PHP_ALLOW',      3);
 
- /**
 
-  * @package Smarty
 
-  */
 
- class Smarty
 
- {
 
-     /**#@+
 
-      * Smarty Configuration Section
 
-      */
 
-     /**
 
-      * The name of the directory where templates are located.
 
-      *
 
-      * @var string
 
-      */
 
-     var $template_dir    =  'TEMPLATE';
 
-     /**
 
-      * The directory where compiled templates are located.
 
-      *
 
-      * @var string
 
-      */
 
-     var $compile_dir     =  'TEMPLATE_C';
 
-     /**
 
-      * The directory where config files are located.
 
-      *
 
-      * @var string
 
-      */
 
-     var $config_dir      =  'configs';
 
-     /**
 
-      * An array of directories searched for plugins.
 
-      *
 
-      * @var array
 
-      */
 
-     var $plugins_dir     =  array('plugins');
 
-     /**
 
-      * If debugging is enabled, a debug console window will display
 
-      * when the page loads (make sure your browser allows unrequested
 
-      * popup windows)
 
-      *
 
-      * @var boolean
 
-      */
 
-     var $debugging       =  false;
 
-     /**
 
-      * When set, smarty does uses this value as error_reporting-level.
 
-      *
 
-      * @var boolean
 
-      */
 
-     var $error_reporting  =  null;
 
-     /**
 
-      * This is the path to the debug console template. If not set,
 
-      * the default one will be used.
 
-      *
 
-      * @var string
 
-      */
 
-     var $debug_tpl       =  '';
 
-     /**
 
-      * This determines if debugging is enable-able from the browser.
 
-      * <ul>
 
-      *  <li>NONE => no debugging control allowed</li>
 
-      *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
 
-      * </ul>
 
-      * @link http://www.foo.dom/index.php?SMARTY_DEBUG
 
-      * @var string
 
-      */
 
-     var $debugging_ctrl  =  'NONE';
 
-     /**
 
-      * This tells Smarty whether to check for recompiling or not. Recompiling
 
-      * does not need to happen unless a template or config file is changed.
 
-      * Typically you enable this during development, and disable for
 
-      * production.
 
-      *
 
-      * @var boolean
 
-      */
 
-     var $compile_check   =  true;
 
-     /**
 
-      * This forces templates to compile every time. Useful for development
 
-      * or debugging.
 
-      *
 
-      * @var boolean
 
-      */
 
-     var $force_compile   =  false;
 
-     /**
 
-      * This enables template caching.
 
-      * <ul>
 
-      *  <li>0 = no caching</li>
 
-      *  <li>1 = use class cache_lifetime value</li>
 
-      *  <li>2 = use cache_lifetime in cache file</li>
 
-      * </ul>
 
-      * @var integer
 
-      */
 
-     var $caching         =  0;
 
-     /**
 
-      * The name of the directory for cache files.
 
-      *
 
-      * @var string
 
-      */
 
-     var $cache_dir       =  'cache';
 
-     /**
 
-      * This is the number of seconds cached content will persist.
 
-      * <ul>
 
-      *  <li>0 = always regenerate cache</li>
 
-      *  <li>-1 = never expires</li>
 
-      * </ul>
 
-      *
 
-      * @var integer
 
-      */
 
-     var $cache_lifetime  =  3600;
 
-     /**
 
-      * Only used when $caching is enabled. If true, then If-Modified-Since headers
 
-      * are respected with cached content, and appropriate HTTP headers are sent.
 
-      * This way repeated hits to a cached page do not send the entire page to the
 
-      * client every time.
 
-      *
 
-      * @var boolean
 
-      */
 
-     var $cache_modified_check = false;
 
-     /**
 
-      * This determines how Smarty handles "<?php ... ?>" tags in templates.
 
-      * possible values:
 
-      * <ul>
 
-      *  <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</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
 
-      */
 
-     var $php_handling    =  SMARTY_PHP_PASSTHRU;
 
-     /**
 
-      * This enables template security. When enabled, many things are restricted
 
-      * in the templates that normally would go unchecked. This is useful when
 
-      * untrusted parties are editing templates and you want a reasonable level
 
-      * of security. (no direct execution of PHP in templates for example)
 
-      *
 
-      * @var boolean
 
-      */
 
-     var $security       =   false;
 
-     /**
 
-      * This is the list of template directories that are considered secure. This
 
-      * is used only if {@link $security} is enabled. One directory per array
 
-      * element.  {@link $template_dir} is in this list implicitly.
 
-      *
 
-      * @var array
 
-      */
 
-     var $secure_dir     =   array();
 
-     /**
 
-      * These are the security settings for Smarty. They are used only when
 
-      * {@link $security} is enabled.
 
-      *
 
-      * @var array
 
-      */
 
-     var $security_settings  = array(
 
-                                     'PHP_HANDLING'    => false,
 
-                                     'IF_FUNCS'        => array('array', 'list',
 
-                                                                'isset', 'empty',
 
-                                                                'count', 'sizeof',
 
-                                                                'in_array', 'is_array',
 
-                                                                'true', 'false', 'null'),
 
-                                     'INCLUDE_ANY'     => false,
 
-                                     'PHP_TAGS'        => false,
 
-                                     'MODIFIER_FUNCS'  => array('count'),
 
-                                     'ALLOW_CONSTANTS'  => false
 
-                                    );
 
-     /**
 
-      * This is an array of directories where trusted php scripts reside.
 
-      * {@link $security} is disabled during their inclusion/execution.
 
-      *
 
-      * @var array
 
-      */
 
-     var $trusted_dir        = array();
 
-     /**
 
-      * The left delimiter used for the template tags.
 
-      *
 
-      * @var string
 
-      */
 
-     var $left_delimiter  =  '{';
 
-     /**
 
-      * The right delimiter used for the template tags.
 
-      *
 
-      * @var string
 
-      */
 
-     var $right_delimiter =  '}';
 
-     /**
 
-      * The order in which request variables are registered, similar to
 
-      * variables_order in php.ini E = Environment, G = GET, P = POST,
 
-      * C = Cookies, S = Server
 
-      *
 
-      * @var string
 
-      */
 
-     var $request_vars_order    = 'EGPCS';
 
-     /**
 
-      * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
 
-      * are uses as request-vars or $_*[]-vars. note: if
 
-      * request_use_auto_globals is true, then $request_vars_order has
 
-      * no effect, but the php-ini-value "gpc_order"
 
-      *
 
-      * @var boolean
 
-      */
 
-     var $request_use_auto_globals      = true;
 
-     /**
 
-      * Set this if you want different sets of compiled files for the same
 
-      * templates. This is useful for things like different languages.
 
-      * Instead of creating separate sets of templates per language, you
 
-      * set different compile_ids like 'en' and 'de'.
 
-      *
 
-      * @var string
 
-      */
 
-     var $compile_id            = null;
 
-     /**
 
-      * This tells Smarty whether or not to use sub dirs in the cache/ and
 
-      * templates_c/ directories. sub directories better organized, but
 
-      * may not work well with PHP safe mode enabled.
 
-      *
 
-      * @var boolean
 
-      *
 
-      */
 
-     var $use_sub_dirs          = false;
 
-     /**
 
-      * This is a list of the modifiers to apply to all template variables.
 
-      * Put each modifier in a separate array element in the order you want
 
-      * them applied. example: <code>array('escape:"htmlall"');</code>
 
-      *
 
-      * @var array
 
-      */
 
-     var $default_modifiers        = array();
 
-     /**
 
-      * This is the resource type to be used when not specified
 
-      * at the beginning of the resource path. examples:
 
-      * $smarty->display('file:index.tpl');
 
-      * $smarty->display('db:index.tpl');
 
-      * $smarty->display('index.tpl'); // will use default resource type
 
-      * {include file="file:index.tpl"}
 
-      * {include file="db:index.tpl"}
 
-      * {include file="index.tpl"} {* will use default resource type *}
 
-      *
 
-      * @var array
 
-      */
 
-     var $default_resource_type    = 'file';
 
-     /**
 
-      * The function used for cache file handling. If not set, built-in caching is used.
 
-      *
 
-      * @var null|string function name
 
-      */
 
-     var $cache_handler_func   = null;
 
-     /**
 
-      * This indicates which filters are automatically loaded into Smarty.
 
-      *
 
-      * @var array array of filter names
 
-      */
 
-     var $autoload_filters = array();
 
-     /**#@+
 
-      * @var boolean
 
-      */
 
-     /**
 
-      * This tells if config file vars of the same name overwrite each other or not.
 
-      * if disabled, same name variables are accumulated in an array.
 
-      */
 
-     var $config_overwrite = true;
 
-     /**
 
-      * This tells whether or not to automatically booleanize config file variables.
 
-      * If enabled, then the strings "on", "true", and "yes" are treated as boolean
 
-      * true, and "off", "false" and "no" are treated as boolean false.
 
-      */
 
-     var $config_booleanize = true;
 
-     /**
 
-      * This tells whether hidden sections [.foobar] are readable from the
 
-      * tempalates or not. Normally you would never allow this since that is
 
-      * the point behind hidden sections: the application can access them, but
 
-      * the templates cannot.
 
-      */
 
-     var $config_read_hidden = false;
 
-     /**
 
-      * This tells whether or not automatically fix newlines in config files.
 
-      * It basically converts \r (mac) or \r\n (dos) to \n
 
-      */
 
-     var $config_fix_newlines = true;
 
-     /**#@-*/
 
-     /**
 
-      * If a template cannot be found, this PHP function will be executed.
 
-      * Useful for creating templates on-the-fly or other special action.
 
-      *
 
-      * @var string function name
 
-      */
 
-     var $default_template_handler_func = '';
 
-     /**
 
-      * The file that contains the compiler class. This can a full
 
-      * pathname, or relative to the php_include path.
 
-      *
 
-      * @var string
 
-      */
 
-     var $compiler_file        =    'Smarty_Compiler.class.php';
 
-     /**
 
-      * The class used for compiling templates.
 
-      *
 
-      * @var string
 
-      */
 
-     var $compiler_class        =   'Smarty_Compiler';
 
-     /**
 
-      * The class used to load config vars.
 
-      *
 
-      * @var string
 
-      */
 
-     var $config_class          =   'Config_File';
 
- /**#@+
 
-  * END Smarty Configuration Section
 
-  * There should be no need to touch anything below this line.
 
-  * @access private
 
-  */
 
-     /**
 
-      * where assigned template vars are kept
 
-      *
 
-      * @var array
 
-      */
 
-     var $_tpl_vars             = array();
 
-     /**
 
-      * stores run-time $smarty.* vars
 
-      *
 
-      * @var null|array
 
-      */
 
-     var $_smarty_vars          = null;
 
-     /**
 
-      * keeps track of sections
 
-      *
 
-      * @var array
 
-      */
 
-     var $_sections             = array();
 
-     /**
 
-      * keeps track of foreach blocks
 
-      *
 
-      * @var array
 
-      */
 
-     var $_foreach              = array();
 
-     /**
 
-      * keeps track of tag hierarchy
 
-      *
 
-      * @var array
 
-      */
 
-     var $_tag_stack            = array();
 
-     /**
 
-      * configuration object
 
-      *
 
-      * @var Config_file
 
-      */
 
-     var $_conf_obj             = null;
 
-     /**
 
-      * loaded configuration settings
 
-      *
 
-      * @var array
 
-      */
 
-     var $_config               = array(array('vars'  => array(), 'files' => array()));
 
-     /**
 
-      * md5 checksum of the string 'Smarty'
 
-      *
 
-      * @var string
 
-      */
 
-     var $_smarty_md5           = 'f8d698aea36fcbead2b9d5359ffca76f';
 
-     /**
 
-      * Smarty version number
 
-      *
 
-      * @var string
 
-      */
 
-     var $_version              = '2.6.17';
 
-     /**
 
-      * current template inclusion depth
 
-      *
 
-      * @var integer
 
-      */
 
-     var $_inclusion_depth      = 0;
 
-     /**
 
-      * for different compiled templates
 
-      *
 
-      * @var string
 
-      */
 
-     var $_compile_id           = null;
 
-     /**
 
-      * text in URL to enable debug mode
 
-      *
 
-      * @var string
 
-      */
 
-     var $_smarty_debug_id      = 'SMARTY_DEBUG';
 
-     /**
 
-      * debugging information for debug console
 
-      *
 
-      * @var array
 
-      */
 
-     var $_smarty_debug_info    = array();
 
-     /**
 
-      * info that makes up a cache file
 
-      *
 
-      * @var array
 
-      */
 
-     var $_cache_info           = array();
 
-     /**
 
-      * default file permissions
 
-      *
 
-      * @var integer
 
-      */
 
-     var $_file_perms           = 0644;
 
-     /**
 
-      * default dir permissions
 
-      *
 
-      * @var integer
 
-      */
 
-     var $_dir_perms               = 0771;
 
-     /**
 
-      * registered objects
 
-      *
 
-      * @var array
 
-      */
 
-     var $_reg_objects           = array();
 
-     /**
 
-      * table keeping track of plugins
 
-      *
 
-      * @var array
 
-      */
 
-     var $_plugins              = array(
 
-                                        'modifier'      => array(),
 
-                                        'function'      => array(),
 
-                                        'block'         => array(),
 
-                                        'compiler'      => array(),
 
-                                        'prefilter'     => array(),
 
-                                        'postfilter'    => array(),
 
-                                        'outputfilter'  => array(),
 
-                                        'resource'      => array(),
 
-                                        'insert'        => array());
 
-     /**
 
-      * cache serials
 
-      *
 
-      * @var array
 
-      */
 
-     var $_cache_serials = array();
 
-     /**
 
-      * name of optional cache include file
 
-      *
 
-      * @var string
 
-      */
 
-     var $_cache_include = null;
 
-     /**
 
-      * indicate if the current code is used in a compiled
 
-      * include
 
-      *
 
-      * @var string
 
-      */
 
-     var $_cache_including = false;
 
-     /**#@-*/
 
-     /**
 
-      * The class constructor.
 
-      */
 
-     function Smarty()
 
-     {
 
-       $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
 
-                     : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
 
-     }
 
-     /**
 
-      * assigns values to template variables
 
-      *
 
-      * @param array|string $tpl_var the template variable name(s)
 
-      * @param mixed $value the value to assign
 
-      */
 
-     function assign($tpl_var, $value = null)
 
-     {
 
-         if (is_array($tpl_var)){
 
-             foreach ($tpl_var as $key => $val) {
 
-                 if ($key != '') {
 
-                     $this->_tpl_vars[$key] = $val;
 
-                 }
 
-             }
 
-         } else {
 
-             if ($tpl_var != '')
 
-                 $this->_tpl_vars[$tpl_var] = $value;
 
-         }
 
-     }
 
-     /**
 
-      * assigns values to template variables by reference
 
-      *
 
-      * @param string $tpl_var the template variable name
 
-      * @param mixed $value the referenced value to assign
 
-      */
 
-     function assign_by_ref($tpl_var, &$value)
 
-     {
 
-         if ($tpl_var != '')
 
-             $this->_tpl_vars[$tpl_var] = &$value;
 
-     }
 
-     /**
 
-      * appends values to template variables
 
-      *
 
-      * @param array|string $tpl_var the template variable name(s)
 
-      * @param mixed $value the value to append
 
-      */
 
-     function append($tpl_var, $value=null, $merge=false)
 
-     {
 
-         if (is_array($tpl_var)) {
 
-             // $tpl_var is an array, ignore $value
 
-             foreach ($tpl_var as $_key => $_val) {
 
-                 if ($_key != '') {
 
-                     if(!@is_array($this->_tpl_vars[$_key])) {
 
-                         settype($this->_tpl_vars[$_key],'array');
 
-                     }
 
-                     if($merge && is_array($_val)) {
 
-                         foreach($_val as $_mkey => $_mval) {
 
-                             $this->_tpl_vars[$_key][$_mkey] = $_mval;
 
-                         }
 
-                     } else {
 
-                         $this->_tpl_vars[$_key][] = $_val;
 
-                     }
 
-                 }
 
-             }
 
-         } else {
 
-             if ($tpl_var != '' && isset($value)) {
 
-                 if(!@is_array($this->_tpl_vars[$tpl_var])) {
 
-                     settype($this->_tpl_vars[$tpl_var],'array');
 
-                 }
 
-                 if($merge && is_array($value)) {
 
-                     foreach($value as $_mkey => $_mval) {
 
-                         $this->_tpl_vars[$tpl_var][$_mkey] = $_mval;
 
-                     }
 
-                 } else {
 
-                     $this->_tpl_vars[$tpl_var][] = $value;
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     /**
 
-      * appends values to template variables by reference
 
-      *
 
-      * @param string $tpl_var the template variable name
 
-      * @param mixed $value the referenced value to append
 
-      */
 
-     function append_by_ref($tpl_var, &$value, $merge=false)
 
-     {
 
-         if ($tpl_var != '' && isset($value)) {
 
-             if(!@is_array($this->_tpl_vars[$tpl_var])) {
 
-              settype($this->_tpl_vars[$tpl_var],'array');
 
-             }
 
-             if ($merge && is_array($value)) {
 
-                 foreach($value as $_key => $_val) {
 
-                     $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key];
 
-                 }
 
-             } else {
 
-                 $this->_tpl_vars[$tpl_var][] = &$value;
 
-             }
 
-         }
 
-     }
 
-     /**
 
-      * clear the given assigned template variable.
 
-      *
 
-      * @param string $tpl_var the template variable to clear
 
-      */
 
-     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]);
 
-     }
 
-     /**
 
-      * Registers custom function to be used in templates
 
-      *
 
-      * @param string $function the name of the template function
 
-      * @param string $function_impl the name of the PHP function to register
 
-      */
 
-     function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
 
-     {
 
-         $this->_plugins['function'][$function] =
 
-             array($function_impl, null, null, false, $cacheable, $cache_attrs);
 
-     }
 
-     /**
 
-      * Unregisters custom function
 
-      *
 
-      * @param string $function name of template function
 
-      */
 
-     function unregister_function($function)
 
-     {
 
-         unset($this->_plugins['function'][$function]);
 
-     }
 
-     /**
 
-      * Registers object to be used in templates
 
-      *
 
-      * @param string $object name of template object
 
-      * @param object &$object_impl the referenced PHP object to register
 
-      * @param 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 register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
 
-     {
 
-         settype($allowed, 'array');
 
-         settype($smarty_args, 'boolean');
 
-         $this->_reg_objects[$object] =
 
-             array(&$object_impl, $allowed, $smarty_args, $block_methods);
 
-     }
 
-     /**
 
-      * Unregisters object
 
-      *
 
-      * @param string $object name of template object
 
-      */
 
-     function unregister_object($object)
 
-     {
 
-         unset($this->_reg_objects[$object]);
 
-     }
 
-     /**
 
-      * Registers block function to be used in templates
 
-      *
 
-      * @param string $block name of template block
 
-      * @param string $block_impl PHP function to register
 
-      */
 
-     function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
 
-     {
 
-         $this->_plugins['block'][$block] =
 
-             array($block_impl, null, null, false, $cacheable, $cache_attrs);
 
-     }
 
-     /**
 
-      * Unregisters block function
 
-      *
 
-      * @param string $block name of template function
 
-      */
 
-     function unregister_block($block)
 
-     {
 
-         unset($this->_plugins['block'][$block]);
 
-     }
 
-     /**
 
-      * Registers compiler function
 
-      *
 
-      * @param string $function name of template function
 
-      * @param string $function_impl name of PHP function to register
 
-      */
 
-     function register_compiler_function($function, $function_impl, $cacheable=true)
 
-     {
 
-         $this->_plugins['compiler'][$function] =
 
-             array($function_impl, null, null, false, $cacheable);
 
-     }
 
-     /**
 
-      * Unregisters compiler function
 
-      *
 
-      * @param string $function name of template function
 
-      */
 
-     function unregister_compiler_function($function)
 
-     {
 
-         unset($this->_plugins['compiler'][$function]);
 
-     }
 
-     /**
 
-      * Registers modifier to be used in templates
 
-      *
 
-      * @param string $modifier name of template modifier
 
-      * @param string $modifier_impl name of PHP function to register
 
-      */
 
-     function register_modifier($modifier, $modifier_impl)
 
-     {
 
-         $this->_plugins['modifier'][$modifier] =
 
-             array($modifier_impl, null, null, false);
 
-     }
 
-     /**
 
-      * Unregisters modifier
 
-      *
 
-      * @param string $modifier name of template modifier
 
-      */
 
-     function unregister_modifier($modifier)
 
-     {
 
-         unset($this->_plugins['modifier'][$modifier]);
 
-     }
 
-     /**
 
-      * Registers a resource to fetch a template
 
-      *
 
-      * @param string $type name of resource
 
-      * @param array $functions array of functions to handle resource
 
-      */
 
-     function register_resource($type, $functions)
 
-     {
 
-         if (count($functions)==4) {
 
-             $this->_plugins['resource'][$type] =
 
-                 array($functions, false);
 
-         } elseif (count($functions)==5) {
 
-             $this->_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 {
 
-             $this->trigger_error("malformed function-list for '$type' in register_resource");
 
-         }
 
-     }
 
-     /**
 
-      * Unregisters a resource
 
-      *
 
-      * @param string $type name of resource
 
-      */
 
-     function unregister_resource($type)
 
-     {
 
-         unset($this->_plugins['resource'][$type]);
 
-     }
 
-     /**
 
-      * Registers a prefilter function to apply
 
-      * to a template before compiling
 
-      *
 
-      * @param string $function name of PHP function to register
 
-      */
 
-     function register_prefilter($function)
 
-     {
 
-     $_name = (is_array($function)) ? $function[1] : $function;
 
-         $this->_plugins['prefilter'][$_name]
 
-             = array($function, null, null, false);
 
-     }
 
-     /**
 
-      * Unregisters a prefilter function
 
-      *
 
-      * @param string $function name of PHP function
 
-      */
 
-     function unregister_prefilter($function)
 
-     {
 
-         unset($this->_plugins['prefilter'][$function]);
 
-     }
 
-     /**
 
-      * Registers a postfilter function to apply
 
-      * to a compiled template after compilation
 
-      *
 
-      * @param string $function name of PHP function to register
 
-      */
 
-     function register_postfilter($function)
 
-     {
 
-     $_name = (is_array($function)) ? $function[1] : $function;
 
-         $this->_plugins['postfilter'][$_name]
 
-             = array($function, null, null, false);
 
-     }
 
-     /**
 
-      * Unregisters a postfilter function
 
-      *
 
-      * @param string $function name of PHP function
 
-      */
 
-     function unregister_postfilter($function)
 
-     {
 
-         unset($this->_plugins['postfilter'][$function]);
 
-     }
 
-     /**
 
-      * Registers an output filter function to apply
 
-      * to a template output
 
-      *
 
-      * @param string $function name of PHP function
 
-      */
 
-     function register_outputfilter($function)
 
-     {
 
-     $_name = (is_array($function)) ? $function[1] : $function;
 
-         $this->_plugins['outputfilter'][$_name]
 
-             = array($function, null, null, false);
 
-     }
 
-     /**
 
-      * Unregisters an outputfilter function
 
-      *
 
-      * @param string $function name of PHP function
 
-      */
 
-     function unregister_outputfilter($function)
 
-     {
 
-         unset($this->_plugins['outputfilter'][$function]);
 
-     }
 
-     /**
 
-      * load a filter of specified type and name
 
-      *
 
-      * @param string $type filter type
 
-      * @param string $name filter name
 
-      */
 
-     function load_filter($type, $name)
 
-     {
 
-         switch ($type) {
 
-             case 'output':
 
-                 $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false)));
 
-                 require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
 
-                 smarty_core_load_plugins($_params, $this);
 
-                 break;
 
-             case 'pre':
 
-             case 'post':
 
-                 if (!isset($this->_plugins[$type . 'filter'][$name]))
 
-                     $this->_plugins[$type . 'filter'][$name] = false;
 
-                 break;
 
-         }
 
-     }
 
-     /**
 
-      * clear cached content for the given template and cache id
 
-      *
 
-      * @param string $tpl_file name of template file
 
-      * @param string $cache_id name of cache_id
 
-      * @param string $compile_id name of compile_id
 
-      * @param string $exp_time expiration time
 
-      * @return boolean
 
-      */
 
-     function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
 
-     {
 
-         if (!isset($compile_id))
 
-             $compile_id = $this->compile_id;
 
-         if (!isset($tpl_file))
 
-             $compile_id = null;
 
-         $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
 
-         if (!empty($this->cache_handler_func)) {
 
-             return call_user_func_array($this->cache_handler_func,
 
-                                   array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time));
 
-         } else {
 
-             $_params = array('auto_base' => $this->cache_dir,
 
-                             'auto_source' => $tpl_file,
 
-                             'auto_id' => $_auto_id,
 
-                             'exp_time' => $exp_time);
 
-             require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
 
-             return smarty_core_rm_auto($_params, $this);
 
-         }
 
-     }
 
-     /**
 
-      * clear the entire contents of cache (all templates)
 
-      *
 
-      * @param string $exp_time expire time
 
-      * @return boolean results of {@link smarty_core_rm_auto()}
 
-      */
 
-     function clear_all_cache($exp_time = null)
 
-     {
 
-         return $this->clear_cache(null, null, null, $exp_time);
 
-     }
 
-     /**
 
-      * test to see if valid cache exists for this template
 
-      *
 
-      * @param string $tpl_file name of template file
 
-      * @param string $cache_id
 
-      * @param string $compile_id
 
-      * @return string|false results of {@link _read_cache_file()}
 
-      */
 
-     function is_cached($tpl_file, $cache_id = null, $compile_id = null)
 
-     {
 
-         if (!$this->caching)
 
-             return false;
 
-         if (!isset($compile_id))
 
-             $compile_id = $this->compile_id;
 
-         $_params = array(
 
-             'tpl_file' => $tpl_file,
 
-             'cache_id' => $cache_id,
 
-             'compile_id' => $compile_id
 
-         );
 
-         require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
 
-         return smarty_core_read_cache_file($_params, $this);
 
-     }
 
-     /**
 
-      * clear all the assigned template variables.
 
-      *
 
-      */
 
-     function clear_all_assign()
 
-     {
 
-         $this->_tpl_vars = array();
 
-     }
 
-     /**
 
-      * clears compiled version of specified template resource,
 
-      * or all compiled template files if one is not specified.
 
-      * This function is for advanced use only, not normally needed.
 
-      *
 
-      * @param string $tpl_file
 
-      * @param string $compile_id
 
-      * @param string $exp_time
 
-      * @return boolean results of {@link smarty_core_rm_auto()}
 
-      */
 
-     function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
 
-     {
 
-         if (!isset($compile_id)) {
 
-             $compile_id = $this->compile_id;
 
-         }
 
-         $_params = array('auto_base' => $this->compile_dir,
 
-                         'auto_source' => $tpl_file,
 
-                         'auto_id' => $compile_id,
 
-                         'exp_time' => $exp_time,
 
-                         'extensions' => array('.inc', '.php'));
 
-         require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
 
-         return smarty_core_rm_auto($_params, $this);
 
-     }
 
-     /**
 
-      * Checks whether requested template exists.
 
-      *
 
-      * @param string $tpl_file
 
-      * @return boolean
 
-      */
 
-     function template_exists($tpl_file)
 
-     {
 
-         $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false);
 
-         return $this->_fetch_resource_info($_params);
 
-     }
 
-     /**
 
-      * Returns an array containing template variables
 
-      *
 
-      * @param string $name
 
-      * @param string $type
 
-      * @return array
 
-      */
 
-     function &get_template_vars($name=null)
 
-     {
 
-         if(!isset($name)) {
 
-             return $this->_tpl_vars;
 
-         } elseif(isset($this->_tpl_vars[$name])) {
 
-             return $this->_tpl_vars[$name];
 
-         } else {
 
-             // var non-existant, return valid reference
 
-             $_tmp = null;
 
-             return $_tmp;   
 
-         }
 
-     }
 
-     /**
 
-      * Returns an array containing config variables
 
-      *
 
-      * @param string $name
 
-      * @param string $type
 
-      * @return array
 
-      */
 
-     function &get_config_vars($name=null)
 
-     {
 
-         if(!isset($name) && is_array($this->_config[0])) {
 
-             return $this->_config[0]['vars'];
 
-         } else if(isset($this->_config[0]['vars'][$name])) {
 
-             return $this->_config[0]['vars'][$name];
 
-         } else {
 
-             // var non-existant, return valid reference
 
-             $_tmp = null;
 
-             return $_tmp;
 
-         }
 
-     }
 
-     /**
 
-      * trigger Smarty error
 
-      *
 
-      * @param string $error_msg
 
-      * @param integer $error_type
 
-      */
 
-     function trigger_error($error_msg, $error_type = E_USER_WARNING)
 
-     {
 
-         trigger_error("Smarty error: $error_msg", $error_type);
 
-     }
 
-     /**
 
-      * executes & displays the template results
 
-      *
 
-      * @param string $resource_name
 
-      * @param string $cache_id
 
-      * @param string $compile_id
 
-      */
 
-     function display($resource_name, $cache_id = null, $compile_id = null)
 
-     {
 
-         $this->fetch($resource_name, $cache_id, $compile_id, true);
 
-     }
 
-     /**
 
-      * executes & returns or displays the template results
 
-      *
 
-      * @param string $resource_name
 
-      * @param string $cache_id
 
-      * @param string $compile_id
 
-      * @param boolean $display
 
-      */
 
-     function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
 
-     {
 
-         static $_cache_info = array();
 
-         
 
-         $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
 
-                ? $this->error_reporting : error_reporting() & ~E_NOTICE);
 
-         if (!$this->debugging && $this->debugging_ctrl == 'URL') {
 
-             $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
 
-             if (@strstr($_query_string, $this->_smarty_debug_id)) {
 
-                 if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
 
-                     // enable debugging for this browser session
 
-                     @setcookie('SMARTY_DEBUG', true);
 
-                     $this->debugging = true;
 
-                 } elseif (@strstr($_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 {
 
-                 $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
 
-             }
 
-         }
 
-         if ($this->debugging) {
 
-             // capture time for debugging info
 
-             $_params = array();
 
-             require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
 
-             $_debug_start_time = smarty_core_get_microtime($_params, $this);
 
-             $this->_smarty_debug_info[] = array('type'      => 'template',
 
-                                                 'filename'  => $resource_name,
 
-                                                 'depth'     => 0);
 
-             $_included_tpls_idx = count($this->_smarty_debug_info) - 1;
 
-         }
 
-         if (!isset($compile_id)) {
 
-             $compile_id = $this->compile_id;
 
-         }
 
-         $this->_compile_id = $compile_id;
 
-         $this->_inclusion_depth = 0;
 
-         if ($this->caching) {
 
-             // save old cache_info, initialize cache_info
 
-             array_push($_cache_info, $this->_cache_info);
 
-             $this->_cache_info = array();
 
-             $_params = array(
 
-                 'tpl_file' => $resource_name,
 
-                 'cache_id' => $cache_id,
 
-                 'compile_id' => $compile_id,
 
-                 'results' => null
 
-             );
 
-             require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
 
-             if (smarty_core_read_cache_file($_params, $this)) {
 
-                 $_smarty_results = $_params['results'];
 
-                 if (!empty($this->_cache_info['insert_tags'])) {
 
-                     $_params = array('plugins' => $this->_cache_info['insert_tags']);
 
-                     require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
 
-                     smarty_core_load_plugins($_params, $this);
 
-                     $_params = array('results' => $_smarty_results);
 
-                     require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
 
-                     $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
 
-                 }
 
-                 if (!empty($this->_cache_info['cache_serials'])) {
 
-                     $_params = array('results' => $_smarty_results);
 
-                     require_once(SMARTY_CORE_DIR . 'core.process_compiled_include.php');
 
-                     $_smarty_results = smarty_core_process_compiled_include($_params, $this);
 
-                 }
 
-                 if ($display) {
 
-                     if ($this->debugging)
 
-                     {
 
-                         // capture time for debugging info
 
-                         $_params = array();
 
-                         require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
 
-                         $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
 
-                         require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
 
-                         $_smarty_results .= smarty_core_display_debug_console($_params, $this);
 
-                     }
 
-                     if ($this->cache_modified_check) {
 
-                         $_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
 
-                         $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
 
-                         $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT';
 
-                         if (@count($this->_cache_info['insert_tags']) == 0
 
-                             && !$this->_cache_serials
 
-                             && $_gmt_mtime == $_last_modified_date) {
 
-                             if (php_sapi_name()=='cgi')
 
-                                 header('Status: 304 Not Modified');
 
-                             else
 
-                                 header('HTTP/1.1 304 Not Modified');
 
-                         } else {
 
-                             header('Last-Modified: '.$_gmt_mtime);
 
-                             echo $_smarty_results;
 
-                         }
 
-                     } else {
 
-                             echo $_smarty_results;
 
-                     }
 
-                     error_reporting($_smarty_old_error_level);
 
-                     // restore initial cache_info
 
-                     $this->_cache_info = array_pop($_cache_info);
 
-                     return true;
 
-                 } else {
 
-                     error_reporting($_smarty_old_error_level);
 
-                     // restore initial cache_info
 
-                     $this->_cache_info = array_pop($_cache_info);
 
-                     return $_smarty_results;
 
-                 }
 
-             } else {
 
-                 $this->_cache_info['template'][$resource_name] = true;
 
-                 if ($this->cache_modified_check && $display) {
 
-                     header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
 
-                 }
 
-             }
 
-         }
 
-         // load filters that are marked as autoload
 
-         if (count($this->autoload_filters)) {
 
-             foreach ($this->autoload_filters as $_filter_type => $_filters) {
 
-                 foreach ($_filters as $_filter) {
 
-                     $this->load_filter($_filter_type, $_filter);
 
-                 }
 
-             }
 
-         }
 
-         $_smarty_compile_path = $this->_get_compile_path($resource_name);
 
-         // if we just need to display the results, don't perform output
 
-         // buffering - for speed
 
-         $_cache_including = $this->_cache_including;
 
-         $this->_cache_including = false;
 
-         if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) {
 
-             if ($this->_is_compiled($resource_name, $_smarty_compile_path)
 
-                     || $this->_compile_resource($resource_name, $_smarty_compile_path))
 
-             {
 
-                 include($_smarty_compile_path);
 
-             }
 
-         } else {
 
-             ob_start();
 
-             if ($this->_is_compiled($resource_name, $_smarty_compile_path)
 
-                     || $this->_compile_resource($resource_name, $_smarty_compile_path))
 
-             {
 
-                 include($_smarty_compile_path);
 
-             }
 
-             $_smarty_results = ob_get_contents();
 
-             ob_end_clean();
 
-             foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) {
 
-                 $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this));
 
-             }
 
-         }
 
-         if ($this->caching) {
 
-             $_params = array('tpl_file' => $resource_name,
 
-                         'cache_id' => $cache_id,
 
-                         'compile_id' => $compile_id,
 
-                         'results' => $_smarty_results);
 
-             require_once(SMARTY_CORE_DIR . 'core.write_cache_file.php');
 
-             smarty_core_write_cache_file($_params, $this);
 
-             require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
 
-             $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
 
-             if ($this->_cache_serials) {
 
-                 // strip nocache-tags from output
 
-                 $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s'
 
-                                                 ,''
 
-                                                 ,$_smarty_results);
 
-             }
 
-             // restore initial cache_info
 
-             $this->_cache_info = array_pop($_cache_info);
 
-         }
 
-         $this->_cache_including = $_cache_including;
 
-         if ($display) {
 
-             if (isset($_smarty_results)) { echo $_smarty_results; }
 
-             if ($this->debugging) {
 
-                 // capture time for debugging info
 
-                 $_params = array();
 
-                 require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
 
-                 $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time);
 
-                 require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
 
-                 echo smarty_core_display_debug_console($_params, $this);
 
-             }
 
-             error_reporting($_smarty_old_error_level);
 
-             return;
 
-         } else {
 
-             error_reporting($_smarty_old_error_level);
 
-             if (isset($_smarty_results)) { return $_smarty_results; }
 
-         }
 
-     }
 
-     /**
 
-      * load configuration values
 
-      *
 
-      * @param string $file
 
-      * @param string $section
 
-      * @param string $scope
 
-      */
 
-     function config_load($file, $section = null, $scope = 'global')
 
-     {
 
-         require_once($this->_get_plugin_filepath('function', 'config_load'));
 
-         smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this);
 
-     }
 
-     /**
 
-      * return a reference to a registered object
 
-      *
 
-      * @param string $name
 
-      * @return object
 
-      */
 
-     function &get_registered_object($name) {
 
-         if (!isset($this->_reg_objects[$name]))
 
-         $this->_trigger_fatal_error("'$name' is not a registered object");
 
-         if (!is_object($this->_reg_objects[$name][0]))
 
-         $this->_trigger_fatal_error("registered '$name' is not an object");
 
-         return $this->_reg_objects[$name][0];
 
-     }
 
-     /**
 
-      * clear configuration values
 
-      *
 
-      * @param string $var
 
-      */
 
-     function clear_config($var = null)
 
-     {
 
-         if(!isset($var)) {
 
-             // clear all values
 
-             $this->_config = array(array('vars'  => array(),
 
-                                          'files' => array()));
 
-         } else {
 
-             unset($this->_config[0]['vars'][$var]);
 
-         }
 
-     }
 
-     /**
 
-      * get filepath of requested plugin
 
-      *
 
-      * @param string $type
 
-      * @param string $name
 
-      * @return string|false
 
-      */
 
-     function _get_plugin_filepath($type, $name)
 
-     {
 
-         $_params = array('type' => $type, 'name' => $name);
 
-         require_once(SMARTY_CORE_DIR . 'core.assemble_plugin_filepath.php');
 
-         return smarty_core_assemble_plugin_filepath($_params, $this);
 
-     }
 
-    /**
 
-      * test if resource needs compiling
 
-      *
 
-      * @param string $resource_name
 
-      * @param string $compile_path
 
-      * @return boolean
 
-      */
 
-     function _is_compiled($resource_name, $compile_path)
 
-     {
 
-         if (!$this->force_compile && file_exists($compile_path)) {
 
-             if (!$this->compile_check) {
 
-                 // no need to check compiled file
 
-                 return true;
 
-             } else {
 
-                 // get file source and timestamp
 
-                 $_params = array('resource_name' => $resource_name, 'get_source'=>false);
 
-                 if (!$this->_fetch_resource_info($_params)) {
 
-                     return false;
 
-                 }
 
-                 if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
 
-                     // template not expired, no recompile
 
-                     return true;
 
-                 } else {
 
-                     // compile template
 
-                     return false;
 
-                 }
 
-             }
 
-         } else {
 
-             // compiled template does not exist, or forced compile
 
-             return false;
 
-         }
 
-     }
 
-    /**
 
-      * compile the template
 
-      *
 
-      * @param string $resource_name
 
-      * @param string $compile_path
 
-      * @return boolean
 
-      */
 
-     function _compile_resource($resource_name, $compile_path)
 
-     {
 
-         $_params = array('resource_name' => $resource_name);
 
-         if (!$this->_fetch_resource_info($_params)) {
 
-             return false;
 
-         }
 
-         $_source_content = $_params['source_content'];
 
-         $_cache_include    = substr($compile_path, 0, -4).'.inc';
 
-         if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
 
-             // if a _cache_serial was set, we also have to write an include-file:
 
-             if ($this->_cache_include_info) {
 
-                 require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php');
 
-                 smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)),  $this);
 
-             }
 
-             $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content);
 
-             require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
 
-             smarty_core_write_compiled_resource($_params, $this);
 
-             return true;
 
-         } else {
 
-             return false;
 
-         }
 
-     }
 
-    /**
 
-      * compile the given source
 
-      *
 
-      * @param string $resource_name
 
-      * @param string $source_content
 
-      * @param string $compiled_content
 
-      * @return boolean
 
-      */
 
-     function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null)
 
-     {
 
-         if (file_exists(SMARTY_DIR . $this->compiler_file)) {
 
-             require_once(SMARTY_DIR . $this->compiler_file);
 
-         } else {
 
-             // use include_path
 
-             require_once($this->compiler_file);
 
-         }
 
-         $smarty_compiler = new $this->compiler_class;
 
-         $smarty_compiler->template_dir      = $this->template_dir;
 
-         $smarty_compiler->compile_dir       = $this->compile_dir;
 
-         $smarty_compiler->plugins_dir       = $this->plugins_dir;
 
-         $smarty_compiler->config_dir        = $this->config_dir;
 
-         $smarty_compiler->force_compile     = $this->force_compile;
 
-         $smarty_compiler->caching           = $this->caching;
 
-         $smarty_compiler->php_handling      = $this->php_handling;
 
-         $smarty_compiler->left_delimiter    = $this->left_delimiter;
 
-         $smarty_compiler->right_delimiter   = $this->right_delimiter;
 
-         $smarty_compiler->_version          = $this->_version;
 
-         $smarty_compiler->security          = $this->security;
 
-         $smarty_compiler->secure_dir        = $this->secure_dir;
 
-         $smarty_compiler->security_settings = $this->security_settings;
 
-         $smarty_compiler->trusted_dir       = $this->trusted_dir;
 
-         $smarty_compiler->use_sub_dirs      = $this->use_sub_dirs;
 
-         $smarty_compiler->_reg_objects      = &$this->_reg_objects;
 
-         $smarty_compiler->_plugins          = &$this->_plugins;
 
-         $smarty_compiler->_tpl_vars         = &$this->_tpl_vars;
 
-         $smarty_compiler->default_modifiers = $this->default_modifiers;
 
-         $smarty_compiler->compile_id        = $this->_compile_id;
 
-         $smarty_compiler->_config            = $this->_config;
 
-         $smarty_compiler->request_use_auto_globals  = $this->request_use_auto_globals;
 
-         if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) {
 
-             $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path];
 
-         }
 
-         $smarty_compiler->_cache_include = $cache_include_path;
 
-         $_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content);
 
-         if ($smarty_compiler->_cache_serial) {
 
-             $this->_cache_include_info = array(
 
-                 'cache_serial'=>$smarty_compiler->_cache_serial
 
-                 ,'plugins_code'=>$smarty_compiler->_plugins_code
 
-                 ,'include_file_path' => $cache_include_path);
 
-         } else {
 
-             $this->_cache_include_info = null;
 
-         }
 
-         return $_results;
 
-     }
 
-     /**
 
-      * Get the compile path for this resource
 
-      *
 
-      * @param string $resource_name
 
-      * @return string results of {@link _get_auto_filename()}
 
-      */
 
-     function _get_compile_path($resource_name)
 
-     {
 
-         return $this->_get_auto_filename($this->compile_dir, $resource_name,
 
-                                          $this->_compile_id) . '.php';
 
-     }
 
-     /**
 
-      * fetch the template info. Gets timestamp, and source
 
-      * if get_source is true
 
-      *
 
-      * sets $source_content to the source of the template, and
 
-      * $resource_timestamp to its time stamp
 
-      * @param string $resource_name
 
-      * @param string $source_content
 
-      * @param integer $resource_timestamp
 
-      * @param boolean $get_source
 
-      * @param boolean $quiet
 
-      * @return boolean
 
-      */
 
-     function _fetch_resource_info(&$params)
 
-     {
 
-         if(!isset($params['get_source'])) { $params['get_source'] = true; }
 
-         if(!isset($params['quiet'])) { $params['quiet'] = false; }
 
-         $_return = false;
 
-         $_params = array('resource_name' => $params['resource_name']) ;
 
-         if (isset($params['resource_base_path']))
 
-             $_params['resource_base_path'] = $params['resource_base_path'];
 
-         else
 
-             $_params['resource_base_path'] = $this->template_dir;
 
-         if ($this->_parse_resource_name($_params)) {
 
-             $_resource_type = $_params['resource_type'];
 
-             $_resource_name = $_params['resource_name'];
 
-             switch ($_resource_type) {
 
-                 case 'file':
 
-                     if ($params['get_source']) {
 
-                         $params['source_content'] = $this->_read_file($_resource_name);
 
-                     }
 
-                     $params['resource_timestamp'] = filemtime($_resource_name);
 
-                     $_return = is_file($_resource_name);
 
-                     break;
 
-                 default:
 
-                     // call resource functions to fetch the template source and timestamp
 
-                     if ($params['get_source']) {
 
-                         $_source_return = isset($this->_plugins['resource'][$_resource_type]) &&
 
-                             call_user_func_array($this->_plugins['resource'][$_resource_type][0][0],
 
-                                                  array($_resource_name, &$params['source_content'], &$this));
 
-                     } else {
 
-                         $_source_return = true;
 
-                     }
 
-                     $_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) &&
 
-                         call_user_func_array($this->_plugins['resource'][$_resource_type][0][1],
 
-                                              array($_resource_name, &$params['resource_timestamp'], &$this));
 
-                     $_return = $_source_return && $_timestamp_return;
 
-                     break;
 
-             }
 
-         }
 
-         if (!$_return) {
 
-             // see if we can get a template with the default template handler
 
-             if (!empty($this->default_template_handler_func)) {
 
-                 if (!is_callable($this->default_template_handler_func)) {
 
-                     $this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist.");
 
-                 } else {
 
-                     $_return = call_user_func_array(
 
-                         $this->default_template_handler_func,
 
-                         array($_params['resource_type'], $_params['resource_name'], &$params['source_content'], &$params['resource_timestamp'], &$this));
 
-                 }
 
-             }
 
-         }
 
-         if (!$_return) {
 
-             if (!$params['quiet']) {
 
-                 $this->trigger_error('unable to read resource: "' . $params['resource_name'] . '"');
 
-             }
 
-         } else if ($_return && $this->security) {
 
-             require_once(SMARTY_CORE_DIR . 'core.is_secure.php');
 
-             if (!smarty_core_is_secure($_params, $this)) {
 
-                 if (!$params['quiet'])
 
-                     $this->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed');
 
-                 $params['source_content'] = null;
 
-                 $params['resource_timestamp'] = null;
 
-                 return false;
 
-             }
 
-         }
 
-         return $_return;
 
-     }
 
-     /**
 
-      * parse out the type and name from the resource
 
-      *
 
-      * @param string $resource_base_path
 
-      * @param string $resource_name
 
-      * @param string $resource_type
 
-      * @param string $resource_name
 
-      * @return boolean
 
-      */
 
-     function _parse_resource_name(&$params)
 
-     {
 
-         // split tpl_path by the first colon
 
-         $_resource_name_parts = explode(':', $params['resource_name'], 2);
 
-         if (count($_resource_name_parts) == 1) {
 
-             // no resource type given
 
-             $params['resource_type'] = $this->default_resource_type;
 
-             $params['resource_name'] = $_resource_name_parts[0];
 
-         } else {
 
-             if(strlen($_resource_name_parts[0]) == 1) {
 
-                 // 1 char is not resource type, but part of filepath
 
-                 $params['resource_type'] = $this->default_resource_type;
 
-                 $params['resource_name'] = $params['resource_name'];
 
-             } else {
 
-                 $params['resource_type'] = $_resource_name_parts[0];
 
-                 $params['resource_name'] = $_resource_name_parts[1];
 
-             }
 
-         }
 
-         if ($params['resource_type'] == 'file') {
 
-             if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $params['resource_name'])) {
 
-                 // relative pathname to $params['resource_base_path']
 
-                 // use the first directory where the file is found
 
-                 foreach ((array)$params['resource_base_path'] as $_curr_path) {
 
-                     $_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
 
-                     if (file_exists($_fullpath) && is_file($_fullpath)) {
 
-                         $params['resource_name'] = $_fullpath;
 
-                         return true;
 
-                     }
 
-                     // didn't find the file, try include_path
 
-                     $_params = array('file_path' => $_fullpath);
 
-                     require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
 
-                     if(smarty_core_get_include_path($_params, $this)) {
 
-                         $params['resource_name'] = $_params['new_file_path'];
 
-                         return true;
 
-                     }
 
-                 }
 
-                 return false;
 
-             } else {
 
-                 /* absolute path */
 
-                 return file_exists($params['resource_name']);
 
-             }
 
-         } elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
 
-             $_params = array('type' => $params['resource_type']);
 
-             require_once(SMARTY_CORE_DIR . 'core.load_resource_plugin.php');
 
-             smarty_core_load_resource_plugin($_params, $this);
 
-         }
 
-         return true;
 
-     }
 
-     /**
 
-      * Handle modifiers
 
-      *
 
-      * @param string|null $modifier_name
 
-      * @param array|null $map_array
 
-      * @return string result of modifiers
 
-      */
 
-     function _run_mod_handler()
 
-     {
 
-         $_args = func_get_args();
 
-         list($_modifier_name, $_map_array) = array_splice($_args, 0, 2);
 
-         list($_func_name, $_tpl_file, $_tpl_line) =
 
-             $this->_plugins['modifier'][$_modifier_name];
 
-         $_var = $_args[0];
 
-         foreach ($_var as $_key => $_val) {
 
-             $_args[0] = $_val;
 
-             $_var[$_key] = call_user_func_array($_func_name, $_args);
 
-         }
 
-         return $_var;
 
-     }
 
-     /**
 
-      * Remove starting and ending quotes from the string
 
-      *
 
-      * @param string $string
 
-      * @return string
 
-      */
 
-     function _dequote($string)
 
-     {
 
-         if ((substr($string, 0, 1) == "'" || substr($string, 0, 1) == '"') &&
 
-             substr($string, -1) == substr($string, 0, 1))
 
-             return substr($string, 1, -1);
 
-         else
 
-             return $string;
 
-     }
 
-     /**
 
-      * read in a file
 
-      *
 
-      * @param string $filename
 
-      * @return string
 
-      */
 
-     function _read_file($filename)
 
-     {
 
-         if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
 
-             $contents = '';
 
-             while (!feof($fd)) {
 
-                 $contents .= fread($fd, 8192);
 
-             }
 
-             fclose($fd);
 
-             return $contents;
 
-         } else {
 
-             return false;
 
-         }
 
-     }
 
-     /**
 
-      * get a concrete filename for automagically created content
 
-      *
 
-      * @param string $auto_base
 
-      * @param string $auto_source
 
-      * @param string $auto_id
 
-      * @return string
 
-      * @staticvar string|null
 
-      * @staticvar string|null
 
-      */
 
-     function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null)
 
-     {
 
-         $_compile_dir_sep =  $this->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
 
-         $_return = $auto_base . DIRECTORY_SEPARATOR;
 
-         if(isset($auto_id)) {
 
-             // make auto_id safe for directory names
 
-             $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id)));
 
-             // split into separate directories
 
-             $_return .= $auto_id . $_compile_dir_sep;
 
-         }
 
-         if(isset($auto_source)) {
 
-             // make source name safe for filename
 
-             $_filename = urlencode(basename($auto_source));
 
-             $_crc32 = sprintf('%08X', crc32($auto_source));
 
-             // prepend %% to avoid name conflicts with
 
-             // with $params['auto_id'] names
 
-             $_crc32 = substr($_crc32, 0, 2) . $_compile_dir_sep .
 
-                       substr($_crc32, 0, 3) . $_compile_dir_sep . $_crc32;
 
-             $_return .= '%%' . $_crc32 . '%%' . $_filename;
 
-         }
 
-         return $_return;
 
-     }
 
-     /**
 
-      * unlink a file, possibly using expiration time
 
-      *
 
-      * @param string $resource
 
-      * @param integer $exp_time
 
-      */
 
-     function _unlink($resource, $exp_time = null)
 
-     {
 
-         if(isset($exp_time)) {
 
-             if(time() - @filemtime($resource) >= $exp_time) {
 
-                 return @unlink($resource);
 
-             }
 
-         } else {
 
-             return @unlink($resource);
 
-         }
 
-     }
 
-     /**
 
-      * returns an auto_id for auto-file-functions
 
-      *
 
-      * @param string $cache_id
 
-      * @param string $compile_id
 
-      * @return string|null
 
-      */
 
-     function _get_auto_id($cache_id=null, $compile_id=null) {
 
-     if (isset($cache_id))
 
-         return (isset($compile_id)) ? $cache_id . '|' . $compile_id  : $cache_id;
 
-     elseif(isset($compile_id))
 
-         return $compile_id;
 
-     else
 
-         return null;
 
-     }
 
-     /**
 
-      * trigger Smarty plugin error
 
-      *
 
-      * @param string $error_msg
 
-      * @param string $tpl_file
 
-      * @param integer $tpl_line
 
-      * @param string $file
 
-      * @param integer $line
 
-      * @param integer $error_type
 
-      */
 
-     function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = null,
 
-             $file = null, $line = null, $error_type = E_USER_ERROR)
 
-     {
 
-         if(isset($file) && isset($line)) {
 
-             $info = ' ('.basename($file).", line $line)";
 
-         } else {
 
-             $info = '';
 
-         }
 
-         if (isset($tpl_line) && isset($tpl_file)) {
 
-             $this->trigger_error('[in ' . $tpl_file . ' line ' . $tpl_line . "]: $error_msg$info", $error_type);
 
-         } else {
 
-             $this->trigger_error($error_msg . $info, $error_type);
 
-         }
 
-     }
 
-     /**
 
-      * callback function for preg_replace, to call a non-cacheable block
 
-      * @return string
 
-      */
 
-     function _process_compiled_include_callback($match) {
 
-         $_func = '_smarty_tplfunc_'.$match[2].'_'.$match[3];
 
-         ob_start();
 
-         $_func($this);
 
-         $_ret = ob_get_contents();
 
-         ob_end_clean();
 
-         return $_ret;
 
-     }
 
-     /**
 
-      * called for included templates
 
-      *
 
-      * @param string $_smarty_include_tpl_file
 
-      * @param string $_smarty_include_vars
 
-      */
 
-     // $_smarty_include_tpl_file, $_smarty_include_vars
 
-     function _smarty_include($params)
 
-     {
 
-         if ($this->debugging) {
 
-             $_params = array();
 
-             require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
 
-             $debug_start_time = smarty_core_get_microtime($_params, $this);
 
-             $this->_smarty_debug_info[] = array('type'      => 'template',
 
-                                                   'filename'  => $params['smarty_include_tpl_file'],
 
-                                                   'depth'     => ++$this->_inclusion_depth);
 
-             $included_tpls_idx = count($this->_smarty_debug_info) - 1;
 
-         }
 
-         $this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']);
 
-         // config vars are treated as local, so push a copy of the
 
-         // current ones onto the front of the stack
 
-         array_unshift($this->_config, $this->_config[0]);
 
-         $_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']);
 
-         if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path)
 
-             || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path))
 
-         {
 
-             include($_smarty_compile_path);
 
-         }
 
-         // pop the local vars off the front of the stack
 
-         array_shift($this->_config);
 
-         $this->_inclusion_depth--;
 
-         if ($this->debugging) {
 
-             // capture time for debugging info
 
-             $_params = array();
 
-             require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
 
-             $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time;
 
-         }
 
-         if ($this->caching) {
 
-             $this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
 
-         }
 
-     }
 
-     /**
 
-      * get or set an array of cached attributes for function that is
 
-      * not cacheable
 
-      * @return array
 
-      */
 
-     function &_smarty_cache_attrs($cache_serial, $count) {
 
-         $_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count];
 
-         if ($this->_cache_including) {
 
-             /* return next set of cache_attrs */
 
-             $_return = current($_cache_attrs);
 
-             next($_cache_attrs);
 
-             return $_return;
 
-         } else {
 
-             /* add a reference to a new set of cache_attrs */
 
-             $_cache_attrs[] = array();
 
-             return $_cache_attrs[count($_cache_attrs)-1];
 
-         }
 
-     }
 
-     /**
 
-      * wrapper for include() retaining $this
 
-      * @return mixed
 
-      */
 
-     function _include($filename, $once=false, $params=null)
 
-     {
 
-         if ($once) {
 
-             return include_once($filename);
 
-         } else {
 
-             return include($filename);
 
-         }
 
-     }
 
-     /**
 
-      * wrapper for eval() retaining $this
 
-      * @return mixed
 
-      */
 
-     function _eval($code, $params=null)
 
-     {
 
-         return eval($code);
 
-     }
 
-     /**#@-*/
 
- }
 
- /* vim: set expandtab: */
 
- ?>
 
 
  |