| 
									
										
										
										
											2001-12-04 16:44:15 +00:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2001-12-04 16:44:15 +00:00
										 |  |  |  * 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. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2002-04-15 17:28:50 +00:00
										 |  |  |  * This library is distributed in the hope that it will be useful, | 
					
						
							| 
									
										
										
										
											2001-12-04 16:44:15 +00:00
										 |  |  |  * 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 | 
					
						
							| 
									
										
										
										
											2002-03-28 19:53:27 +00:00
										 |  |  |  * Smarty mailing list. Send a blank e-mail to | 
					
						
							|  |  |  |  * smarty-general-subscribe@lists.php.net | 
					
						
							| 
									
										
										
										
											2001-12-04 16:44:15 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * You may contact the authors of Smarty by e-mail at: | 
					
						
							|  |  |  |  * monte@ispi.net | 
					
						
							|  |  |  |  * andrei@php.net | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Or, write to: | 
					
						
							|  |  |  |  * Monte Ohrt | 
					
						
							|  |  |  |  * Director of Technology, ispi | 
					
						
							|  |  |  |  * 237 S. 70th suite 220 | 
					
						
							|  |  |  |  * Lincoln, NE 68510 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The latest version of Smarty can be obtained from: | 
					
						
							| 
									
										
										
										
											2003-02-20 15:30:46 +00:00
										 |  |  |  * http://smarty.php.net/ | 
					
						
							| 
									
										
										
										
											2001-12-04 16:44:15 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2003-02-20 15:30:46 +00:00
										 |  |  |  * @link http://smarty.php.net/ | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |  * @copyright 2001,2002 ispi of Lincoln, Inc. | 
					
						
							|  |  |  |  * @author Monte Ohrt <monte@ispi.net> | 
					
						
							|  |  |  |  * @author Andrei Zmievski <andrei@php.net> | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							| 
									
										
										
										
											2003-04-11 13:40:40 +00:00
										 |  |  |  * @version 2.5.0 | 
					
						
							| 
									
										
										
										
											2001-12-04 16:44:15 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-08-08 17:05:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-04-01 15:23:16 +00:00
										 |  |  | /* $Id$ */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2003-05-05 14:49:38 +00:00
										 |  |  |  * DIR_SEP isn't used anymore, but third party apps might | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2003-05-05 14:41:22 +00:00
										 |  |  | if(!defined('DIR_SEP')) { | 
					
						
							|  |  |  | 	define('DIR_SEP', DIRECTORY_SEPARATOR); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2003-05-05 14:49:38 +00:00
										 |  |  |  * 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. | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2003-05-05 14:49:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | if (!defined('SMARTY_DIR')) { | 
					
						
							| 
									
										
										
										
											2003-05-05 14:37:57 +00:00
										 |  |  |     define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR); | 
					
						
							| 
									
										
										
										
											2001-06-29 22:52:45 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | define('SMARTY_PHP_PASSTHRU',   0); | 
					
						
							|  |  |  | define('SMARTY_PHP_QUOTE',      1); | 
					
						
							|  |  |  | define('SMARTY_PHP_REMOVE',     2); | 
					
						
							|  |  |  | define('SMARTY_PHP_ALLOW',      3); | 
					
						
							| 
									
										
										
										
											2001-02-20 21:20:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2000-08-08 17:05:38 +00:00
										 |  |  | class Smarty | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /**#@+
 | 
					
						
							|  |  |  |      * Smarty Configuration Section | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * The name of the directory where templates are located. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $template_dir    =  'templates'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The directory where compiled templates are located. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $compile_dir     =  'templates_c'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The directory where config files are located. | 
					
						
							|  |  |  |      *  | 
					
						
							| 
									
										
										
										
											2003-06-11 22:17:52 +00:00
										 |  |  | reques     * @var string | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $config_dir      =  'configs'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * An array of directories searched for plugins. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $plugins_dir     =  array('plugins'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * If debugging is enabled, a debug console window will display | 
					
						
							|  |  |  |      * when the page loads (make sure your browser allows unrequested | 
					
						
							|  |  |  |      * popup windows) | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var boolean | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $debugging       =  false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This is the path to the debug console template. If not set, | 
					
						
							|  |  |  |      * the default one will be used. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $debug_tpl       =  ''; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This determines if debugging is enable-able from the browser. | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * <ul> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      *  <li>NONE => no debugging control allowed</li> | 
					
						
							|  |  |  |      *  <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li> | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * </ul> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * @link http://www.foo.dom/index.php?SMARTY_DEBUG | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $debugging_ctrl  =  'NONE'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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 | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $compile_check   =  true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This forces templates to compile every time. Useful for development | 
					
						
							|  |  |  |      * or debugging. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var boolean | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $force_compile   =  false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This enables template caching. | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * <ul> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      *  <li>0 = no caching</li> | 
					
						
							|  |  |  |      *  <li>1 = use class cache_lifetime value</li> | 
					
						
							| 
									
										
										
										
											2003-04-21 19:04:47 +00:00
										 |  |  |      *  <li>2 = use cache_lifetime in cache file</li> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * </ul> | 
					
						
							|  |  |  |      * @var integer | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $caching         =  0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The name of the directory for cache files. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $cache_dir       =  'cache'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This is the number of seconds cached content will persist. | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * <ul> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      *  <li>0 = always regenerate cache</li> | 
					
						
							|  |  |  |      *  <li>-1 = never expires</li> | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * </ul> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      *  | 
					
						
							|  |  |  |      * @var integer | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $cache_lifetime  =  3600; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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 | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $cache_modified_check = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-04-18 10:03:09 +00:00
										 |  |  |      * This determines how Smarty handles "<?php ... ?>" tags in templates. | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * possible values: | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * <ul> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      *  <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> | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * </ul> | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @var integer | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  |     var $php_handling    =  SMARTY_PHP_PASSTHRU; | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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 | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $security       =   false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This is the list of template directories that are considered secure. This | 
					
						
							|  |  |  |      * is used only if {@link $security} is enabled. One directory per array | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * element.  {@link $template_dir} is in this list implicitly. | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      *  | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $secure_dir     =   array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * These are the security settings for Smarty. They are used only when | 
					
						
							|  |  |  |      * {@link $security} is enabled. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2001-06-15 14:52:48 +00:00
										 |  |  |     var $security_settings  = array( | 
					
						
							|  |  |  |                                     'PHP_HANDLING'    => false, | 
					
						
							|  |  |  |                                     'IF_FUNCS'        => array('array', 'list', | 
					
						
							|  |  |  |                                                                'isset', 'empty', | 
					
						
							| 
									
										
										
										
											2001-07-10 15:15:42 +00:00
										 |  |  |                                                                'count', 'sizeof', | 
					
						
							| 
									
										
										
										
											2003-02-18 19:58:32 +00:00
										 |  |  |                                                                'in_array', 'is_array', | 
					
						
							|  |  |  | 															   'true','false'), | 
					
						
							| 
									
										
										
										
											2001-06-15 14:52:48 +00:00
										 |  |  |                                     'INCLUDE_ANY'     => false, | 
					
						
							|  |  |  |                                     'PHP_TAGS'        => false, | 
					
						
							| 
									
										
										
										
											2002-12-18 16:51:48 +00:00
										 |  |  |                                     'MODIFIER_FUNCS'  => array('count'), | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |                                     'ALLOW_CONSTANTS' => false | 
					
						
							| 
									
										
										
										
											2001-06-15 14:52:48 +00:00
										 |  |  |                                    ); | 
					
						
							| 
									
										
										
										
											2000-08-08 17:05:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This is an array of directories where trusted php scripts reside. | 
					
						
							|  |  |  |      * {@link $security} is disabled during their inclusion/execution. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $trusted_dir        = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The left delimiter used for the template tags. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $left_delimiter  =  '{'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The right delimiter used for the template tags. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2001-02-06 21:17:37 +00:00
										 |  |  |     var $right_delimiter =  '}'; | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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 | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $request_vars_order    = "EGPCS";  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-11 22:17:52 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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      = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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 | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $compile_id            = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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          = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * 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(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-06 15:49:29 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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';	 | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The function used for cache file handling. If not set, built-in caching is used. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var null|string function name | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $cache_handler_func   = null; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |       | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * These are the variables from the globals array that are | 
					
						
							|  |  |  |      * assigned to all templates automatically. This isn't really | 
					
						
							|  |  |  |      * necessary any more, you can use the $smarty var to access them | 
					
						
							|  |  |  |      * directly. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $global_assign   =  array('HTTP_SERVER_VARS' => array('SCRIPT_NAME')); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The value of "undefined". Leave it alone :-) | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var null | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $undefined       =  null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This indicates which filters are automatically loaded into Smarty. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var array array of filter names | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $autoload_filters = array(); | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /**#@+
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * @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; | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |     /**#@-*/ | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |       | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * 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 | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $default_template_handler_func = ''; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The file that contains the compiler class. This can a full | 
					
						
							|  |  |  |      * pathname, or relative to the php_include path. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $compiler_file        =    'Smarty_Compiler.class.php'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The class used for compiling templates. | 
					
						
							|  |  |  |      *  | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $compiler_class        =   'Smarty_Compiler'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The class used to load config vars. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $config_class          =   'Config_File'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  | /**#@+
 | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |  * END Smarty Configuration Section | 
					
						
							|  |  |  |  * There should be no need to touch anything below this line. | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |  * @access private | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * error messages. true/false | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var boolean | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_error_msg            = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * where assigned template vars are kept | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_tpl_vars             = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * stores run-time $smarty.* vars | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var null|array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_smarty_vars          = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * keeps track of sections | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_sections             = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * keeps track of foreach blocks | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_foreach              = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * keeps track of tag hierarchy | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_tag_stack            = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * configuration object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var Config_file | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_conf_obj             = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * loaded configuration settings | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_config               = array(array('vars'  => array(), 'files' => array())); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * md5 checksum of the string 'Smarty' | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_smarty_md5           = 'f8d698aea36fcbead2b9d5359ffca76f'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Smarty version number | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-04-11 13:40:40 +00:00
										 |  |  |     var $_version              = '2.5.0'; | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * current template inclusion depth | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var integer | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_inclusion_depth      = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * for different compiled templates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_compile_id           = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * text in URL to enable debug mode | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var string | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_smarty_debug_id      = 'SMARTY_DEBUG'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * debugging information for debug console | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_smarty_debug_info    = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * info that makes up a cache file | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @var array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_cache_info           = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * 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 | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     var $_plugins              = array( | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  |                                        'modifier'      => array(), | 
					
						
							|  |  |  |                                        'function'      => array(), | 
					
						
							|  |  |  |                                        'block'         => array(), | 
					
						
							|  |  |  |                                        'compiler'      => array(), | 
					
						
							|  |  |  |                                        'prefilter'     => array(), | 
					
						
							|  |  |  |                                        'postfilter'    => array(), | 
					
						
							|  |  |  |                                        'outputfilter'  => array(), | 
					
						
							|  |  |  |                                        'resource'      => array(), | 
					
						
							|  |  |  |                                        'insert'        => array()); | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     var $_cache_serial = null; | 
					
						
							|  |  |  |     var $_cache_serials = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |     /**#@-*/ | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * The class constructor. | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @uses $global_assign uses {@link assign()} to assign each corresponding | 
					
						
							|  |  |  |      *                      value from $GLOBALS to the template vars | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     function Smarty() | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2001-04-24 15:16:14 +00:00
										 |  |  |         foreach ($this->global_assign as $key => $var_name) { | 
					
						
							|  |  |  |             if (is_array($var_name)) { | 
					
						
							|  |  |  |                 foreach ($var_name as $var) { | 
					
						
							|  |  |  |                     if (isset($GLOBALS[$key][$var])) { | 
					
						
							|  |  |  |                         $this->assign($var, $GLOBALS[$key][$var]); | 
					
						
							|  |  |  |                     } else { | 
					
						
							|  |  |  |                         $this->assign($var, $this->undefined); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 if (isset($GLOBALS[$var_name])) { | 
					
						
							|  |  |  |                     $this->assign($var_name, $GLOBALS[$var_name]); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     $this->assign($var_name, $this->undefined); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2001-03-02 18:07:51 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2002-12-12 16:28:29 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-11-22 16:23:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * assigns values to template variables | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param array|string $tpl_var the template variable name(s) | 
					
						
							|  |  |  |      * @param mixed $value the value to assign | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |     function assign($tpl_var, $value = null) | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (is_array($tpl_var)){ | 
					
						
							|  |  |  |             foreach ($tpl_var as $key => $val) { | 
					
						
							| 
									
										
										
										
											2002-11-21 15:12:12 +00:00
										 |  |  |                 if ($key != '') { | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |                     $this->_tpl_vars[$key] = $val; | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  |             if ($tpl_var != '') | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |                 $this->_tpl_vars[$tpl_var] = $value; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * assigns values to template variables by reference | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $tpl_var the template variable name | 
					
						
							|  |  |  |      * @param mixed $value the referenced value to assign | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-08-02 18:17:40 +00:00
										 |  |  |     function assign_by_ref($tpl_var, &$value) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2002-11-21 15:12:12 +00:00
										 |  |  |         if ($tpl_var != '') | 
					
						
							| 
									
										
										
										
											2002-08-02 18:17:40 +00:00
										 |  |  |             $this->_tpl_vars[$tpl_var] = &$value; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * appends values to template variables | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param array|string $tpl_var the template variable name(s) | 
					
						
							|  |  |  |      * @param mixed $value the value to append | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  |     function append($tpl_var, $value=null, $merge=false) | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if (is_array($tpl_var)) { | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  | 			// $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'); | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  | 					if($merge && is_array($_val)) { | 
					
						
							|  |  |  | 						foreach($_val as $_mkey => $_mval) { | 
					
						
							|  |  |  | 							$this->_tpl_vars[$_key][$_mkey] = $_mval; | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 					} else { | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  | 						$this->_tpl_vars[$_key][] = $_val; | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2002-07-12 15:20:15 +00:00
										 |  |  |             if ($tpl_var != '' && isset($value)) { | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 				if(!@is_array($this->_tpl_vars[$tpl_var])) { | 
					
						
							|  |  |  | 					settype($this->_tpl_vars[$tpl_var],'array'); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  | 				if($merge && is_array($value)) { | 
					
						
							|  |  |  | 					foreach($value as $_mkey => $_mval) { | 
					
						
							|  |  |  | 						$this->_tpl_vars[$tpl_var][$_mkey] = $_mval; | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 				} else { | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  | 					$this->_tpl_vars[$tpl_var][] = $value; | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-11-21 15:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * appends values to template variables by reference | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $tpl_var the template variable name | 
					
						
							|  |  |  |      * @param mixed $value the referenced value to append | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  |     function append_by_ref($tpl_var, &$value, $merge=false) | 
					
						
							| 
									
										
										
										
											2002-08-02 18:17:40 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         if ($tpl_var != '' && isset($value)) { | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 			if(!@is_array($this->_tpl_vars[$tpl_var])) { | 
					
						
							| 
									
										
										
										
											2003-02-20 16:39:36 +00:00
										 |  |  | 			 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; | 
					
						
							| 
									
										
										
										
											2003-02-19 23:05:46 +00:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2002-08-02 18:17:40 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-11-21 15:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * clear the given assigned template variable. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $tpl_var the template variable to clear | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     function clear_assign($tpl_var) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2001-04-12 20:53:21 +00:00
										 |  |  |         if (is_array($tpl_var)) | 
					
						
							|  |  |  |             foreach ($tpl_var as $curr_var) | 
					
						
							| 
									
										
										
										
											2001-02-08 14:18:25 +00:00
										 |  |  |                 unset($this->_tpl_vars[$curr_var]); | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |             unset($this->_tpl_vars[$tpl_var]); | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-08-08 17:05:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * 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 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |     function register_function($function, $function_impl, $cacheable=true) | 
					
						
							| 
									
										
										
										
											2001-02-02 16:55:55 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         $this->_plugins['function'][$function] = | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |             array($function_impl, null, null, false, $cacheable); | 
					
						
							| 
									
										
										
										
											2001-02-02 16:55:55 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters custom function
 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of template function
 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-03-02 17:02:44 +00:00
										 |  |  |     function unregister_function($function) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         unset($this->_plugins['function'][$function]); | 
					
						
							| 
									
										
										
										
											2001-03-02 17:02:44 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * 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 | 
					
						
							| 
									
										
										
										
											2003-06-08 01:07:39 +00:00
										 |  |  |      * @param null|array $block_functs list of methods that are block format | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-06-08 01:07:39 +00:00
										 |  |  |     function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) | 
					
						
							| 
									
										
										
										
											2003-01-25 20:31:45 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         settype($allowed, 'array');         | 
					
						
							|  |  |  |         settype($smarty_args, 'boolean');         | 
					
						
							| 
									
										
										
										
											2003-01-24 15:02:15 +00:00
										 |  |  |         $this->_reg_objects[$object] = | 
					
						
							| 
									
										
										
										
											2003-06-08 01:07:39 +00:00
										 |  |  |             array(&$object_impl, $allowed, $smarty_args, $block_methods); | 
					
						
							| 
									
										
										
										
											2003-01-23 23:33:29 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $object name of template object | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-01-23 23:33:29 +00:00
										 |  |  |     function unregister_object($object) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-01-24 15:02:15 +00:00
										 |  |  |         unset($this->_reg_objects[$object]); | 
					
						
							| 
									
										
										
										
											2003-01-23 23:33:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Registers block function to be used in templates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $block name of template block | 
					
						
							|  |  |  |      * @param string $block_impl PHP function to register | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |     function register_block($block, $block_impl, $cacheable=true) | 
					
						
							| 
									
										
										
										
											2002-03-26 21:01:52 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         $this->_plugins['block'][$block] = | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |             array($block_impl, null, null, false, $cacheable); | 
					
						
							| 
									
										
										
										
											2002-03-26 21:01:52 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters block function
 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $block name of template function
 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-03-26 21:01:52 +00:00
										 |  |  |     function unregister_block($block) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         unset($this->_plugins['block'][$block]); | 
					
						
							| 
									
										
										
										
											2002-03-26 21:01:52 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Registers compiler function
 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of template function
 | 
					
						
							|  |  |  |      * @param string $function_impl name of PHP function to register | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-06-19 10:35:23 +00:00
										 |  |  |     function register_compiler_function($function, $function_impl, $cacheable=true) | 
					
						
							| 
									
										
										
										
											2001-04-24 16:43:05 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         $this->_plugins['compiler'][$function] = | 
					
						
							| 
									
										
										
										
											2003-06-19 10:35:23 +00:00
										 |  |  |             array($function_impl, null, null, false, $cacheable); | 
					
						
							| 
									
										
										
										
											2001-04-24 16:43:05 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters compiler function
 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of template function
 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-04-24 16:43:05 +00:00
										 |  |  |     function unregister_compiler_function($function) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         unset($this->_plugins['compiler'][$function]); | 
					
						
							| 
									
										
										
										
											2001-04-24 16:43:05 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Registers modifier to be used in templates | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $modifier name of template modifier | 
					
						
							|  |  |  |      * @param string $modifier_impl name of PHP function to register | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-02-07 20:55:39 +00:00
										 |  |  |     function register_modifier($modifier, $modifier_impl) | 
					
						
							| 
									
										
										
										
											2001-02-02 16:55:55 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         $this->_plugins['modifier'][$modifier] = | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |             array($modifier_impl, null, null, false); | 
					
						
							| 
									
										
										
										
											2001-02-02 16:55:55 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters modifier | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * @param string $modifier name of template modifier | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-03-02 17:02:44 +00:00
										 |  |  |     function unregister_modifier($modifier) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-29 17:00:30 +00:00
										 |  |  |         unset($this->_plugins['modifier'][$modifier]); | 
					
						
							| 
									
										
										
										
											2001-03-02 17:02:44 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Registers a resource to fetch a template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $type name of resource | 
					
						
							|  |  |  |      * @param array $functions array of functions to handle resource | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     function register_resource($type, $functions) | 
					
						
							| 
									
										
										
										
											2001-04-19 16:18:17 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-28 01:33:17 +00:00
										 |  |  |         if (sizeof($functions)<5) { | 
					
						
							| 
									
										
										
										
											2003-04-28 00:22:41 +00:00
										 |  |  |             $this->_plugins['resource'][$type] = | 
					
						
							|  |  |  |                 array($functions, false); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } elseif (sizeof($functions)==5 && is_object($functions[0])) { | 
					
						
							|  |  |  |             $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"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-04-19 16:18:17 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters a resource | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $type name of resource | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     function unregister_resource($type) | 
					
						
							| 
									
										
										
										
											2001-04-19 16:18:17 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         unset($this->_plugins['resource'][$type]); | 
					
						
							| 
									
										
										
										
											2001-04-19 16:18:17 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Registers a prefilter function to apply | 
					
						
							| 
									
										
										
										
											2003-01-29 22:51:20 +00:00
										 |  |  |      * to a template before compiling | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of PHP function to register | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     function register_prefilter($function) | 
					
						
							| 
									
										
										
										
											2001-04-19 21:08:17 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-15 10:41:13 +00:00
										 |  |  | 	$_name = (is_array($function)) ? $function[1] : $function; | 
					
						
							|  |  |  |         $this->_plugins['prefilter'][$_name] | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |             = array($function, null, null, false); | 
					
						
							| 
									
										
										
										
											2001-04-19 21:08:17 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters a prefilter function
 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of PHP function
 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     function unregister_prefilter($function) | 
					
						
							| 
									
										
										
										
											2001-04-19 21:08:17 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2002-04-16 20:06:31 +00:00
										 |  |  |         unset($this->_plugins['prefilter'][$function]); | 
					
						
							| 
									
										
										
										
											2001-04-19 21:08:17 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Registers a postfilter function to apply | 
					
						
							|  |  |  |      * to a compiled template after compilation | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of PHP function to register | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     function register_postfilter($function) | 
					
						
							| 
									
										
										
										
											2001-09-28 21:39:57 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-15 10:41:13 +00:00
										 |  |  | 	$_name = (is_array($function)) ? $function[1] : $function; | 
					
						
							|  |  |  |         $this->_plugins['postfilter'][$_name] | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |             = array($function, null, null, false); | 
					
						
							| 
									
										
										
										
											2001-09-28 21:39:57 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters a postfilter function
 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of PHP function
 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     function unregister_postfilter($function) | 
					
						
							| 
									
										
										
										
											2001-09-28 21:39:57 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2002-04-16 20:06:31 +00:00
										 |  |  |         unset($this->_plugins['postfilter'][$function]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Registers an output filter function to apply | 
					
						
							|  |  |  |      * to a template output | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of PHP function
 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-04-16 20:06:31 +00:00
										 |  |  |     function register_outputfilter($function) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-15 10:41:13 +00:00
										 |  |  | 	$_name = (is_array($function)) ? $function[1] : $function; | 
					
						
							|  |  |  |         $this->_plugins['outputfilter'][$_name] | 
					
						
							| 
									
										
										
										
											2002-04-16 20:06:31 +00:00
										 |  |  |             = array($function, null, null, false); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Unregisters an outputfilter function
 | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $function name of PHP function
 | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-04-16 20:06:31 +00:00
										 |  |  |     function unregister_outputfilter($function) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         unset($this->_plugins['outputfilter'][$function]); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     }     | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * load a filter of specified type and name | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $type filter type | 
					
						
							|  |  |  |      * @param string $name filter name | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  |     function load_filter($type, $name) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         switch ($type) { | 
					
						
							|  |  |  |             case 'output': | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 				$_params = array('plugins' => array(array($type . 'filter', $name, null, null, false))); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 				require_once(SMARTY_DIR . 'core/core.load_plugins.php'); | 
					
						
							|  |  |  |                 smarty_core_load_plugins($_params, $this); | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  |                 break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             case 'pre': | 
					
						
							|  |  |  |             case 'post': | 
					
						
							|  |  |  |                 if (!isset($this->_plugins[$type . 'filter'][$name])) | 
					
						
							|  |  |  |                     $this->_plugins[$type . 'filter'][$name] = false; | 
					
						
							|  |  |  |                 break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * 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 | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return boolean | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-07-16 15:04:02 +00:00
										 |  |  |     function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-03-21 08:55:56 +00:00
										 |  |  |          | 
					
						
							|  |  |  |         if (!isset($compile_id)) | 
					
						
							|  |  |  |             $compile_id = $this->compile_id; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-24 16:32:14 +00:00
										 |  |  | 	if (!isset($tpl_file)) | 
					
						
							|  |  |  | 	    $compile_id = null; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-21 15:39:29 +00:00
										 |  |  | 	$_auto_id = $this->_get_auto_id($cache_id, $compile_id); | 
					
						
							| 
									
										
										
										
											2003-03-21 08:55:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |         if (!empty($this->cache_handler_func)) { | 
					
						
							| 
									
										
										
										
											2003-04-15 10:41:13 +00:00
										 |  |  |             return call_user_func_array($this->cache_handler_func, | 
					
						
							|  |  |  |                                   array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id)); | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 			$_params = array('auto_base' => $this->cache_dir, | 
					
						
							|  |  |  | 							'auto_source' => $tpl_file, | 
					
						
							|  |  |  | 							'auto_id' => $_auto_id, | 
					
						
							|  |  |  | 							'exp_time' => $exp_time); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 			require_once(SMARTY_DIR . 'core/core.rm_auto.php'); | 
					
						
							|  |  |  | 			return smarty_core_rm_auto($_params, $this); | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |          | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * clear the entire contents of cache (all templates) | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $exp_time expire time | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @return boolean results of {@link smarty_core_rm_auto()} | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-07-16 15:04:02 +00:00
										 |  |  |     function clear_all_cache($exp_time = null) | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |         if (!empty($this->cache_handler_func)) { | 
					
						
							| 
									
										
										
										
											2003-04-15 10:41:13 +00:00
										 |  |  |             call_user_func_array($this->cache_handler_func, | 
					
						
							|  |  |  |                            array('clear', &$this, &$dummy)); | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 			$_params = array('auto_base' => $this->cache_dir, | 
					
						
							|  |  |  | 							'auto_source' => null, | 
					
						
							|  |  |  | 							'auto_id' => null, | 
					
						
							|  |  |  | 							'exp_time' => $exp_time); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 			require_once(SMARTY_DIR . 'core/core.rm_auto.php'); | 
					
						
							|  |  |  | 			return smarty_core_rm_auto($_params, $this); | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-02-05 21:10:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-07 20:55:39 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * test to see if valid cache exists for this template | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $tpl_file name of template file | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $cache_id | 
					
						
							|  |  |  |      * @param string $compile_id | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return string|false results of {@link _read_cache_file()} | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-08-31 03:33:41 +00:00
										 |  |  |     function is_cached($tpl_file, $cache_id = null, $compile_id = null) | 
					
						
							| 
									
										
										
										
											2001-02-05 21:10:20 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2001-02-07 23:08:00 +00:00
										 |  |  |         if (!$this->caching) | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-12-03 20:20:06 +00:00
										 |  |  |         if (!isset($compile_id)) | 
					
						
							|  |  |  |             $compile_id = $this->compile_id; | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 		$_params = array( | 
					
						
							|  |  |  | 			'tpl_file' => $tpl_file, | 
					
						
							|  |  |  | 			'cache_id' => $cache_id, | 
					
						
							|  |  |  | 			'compile_id' => $compile_id | 
					
						
							|  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 		require_once(SMARTY_DIR . 'core/core.read_cache_file.php'); | 
					
						
							|  |  |  |         return smarty_core_read_cache_file($_params, $this); | 
					
						
							| 
									
										
										
										
											2001-02-05 21:10:20 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * clear all the assigned template variables. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     function clear_all_assign() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->_tpl_vars = array(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-08-08 17:05:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * 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. | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $tpl_file | 
					
						
							|  |  |  |      * @param string $compile_id | 
					
						
							|  |  |  |      * @param string $exp_time | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @return boolean results of {@link smarty_core_rm_auto()} | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-07-16 15:04:02 +00:00
										 |  |  |     function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) | 
					
						
							| 
									
										
										
										
											2001-04-26 17:27:40 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         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); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 		require_once(SMARTY_DIR . 'core/core.rm_auto.php'); | 
					
						
							|  |  |  | 		return smarty_core_rm_auto($_params, $this);		 | 
					
						
							| 
									
										
										
										
											2001-04-26 17:27:40 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-11-21 15:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Checks whether requested template exists. | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $tpl_file | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return boolean | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-04-03 19:31:11 +00:00
										 |  |  |     function template_exists($tpl_file) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-06-18 19:45:12 +00:00
										 |  |  | 		$_params = array('file_path' => $tpl_file); | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  | 		require_once(SMARTY_DIR . 'core/core.fetch_file_info.php'); | 
					
						
							|  |  |  |         return smarty_core_fetch_file_info($_params, $this); | 
					
						
							| 
									
										
										
										
											2002-04-03 19:31:11 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * Returns an array containing template variables | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-20 21:59:09 +00:00
										 |  |  |      * @param string $name | 
					
						
							|  |  |  |      * @param string $type | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return array | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-02-20 21:59:09 +00:00
										 |  |  |     function &get_template_vars($name=null) | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-02-20 21:59:09 +00:00
										 |  |  | 		if(!isset($name)) { | 
					
						
							|  |  |  |         	return $this->_tpl_vars; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if(isset($this->_tpl_vars[$name])) { | 
					
						
							|  |  |  | 			return $this->_tpl_vars[$name]; | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-11-21 15:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-20 21:59:09 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Returns an array containing config variables | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $name | 
					
						
							|  |  |  |      * @param string $type | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return array | 
					
						
							| 
									
										
										
										
											2003-02-20 21:59:09 +00:00
										 |  |  |      */     | 
					
						
							|  |  |  |     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]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-11-21 15:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * trigger Smarty error | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $error_msg | 
					
						
							|  |  |  |      * @param integer $error_type | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-02-20 22:24:32 +00:00
										 |  |  |     function trigger_error($error_msg, $error_type = E_USER_WARNING) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         trigger_error("Smarty error: $error_msg", $error_type); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * executes & displays the template results | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $tpl_file | 
					
						
							|  |  |  |      * @param string $cache_id | 
					
						
							|  |  |  |      * @param string $compile_id | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2001-08-31 03:33:41 +00:00
										 |  |  |     function display($tpl_file, $cache_id = null, $compile_id = null) | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2001-08-31 03:33:41 +00:00
										 |  |  |         $this->fetch($tpl_file, $cache_id, $compile_id, true); | 
					
						
							| 
									
										
										
										
											2001-06-19 15:30:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * executes & returns or displays the template results | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |      * @param string $file_path | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |      * @param string $cache_id | 
					
						
							|  |  |  |      * @param string $compile_id | 
					
						
							|  |  |  |      * @param boolean $display | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |     function fetch($file_path, $cache_id = null, $compile_id = null, $display = false) | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-14 07:31:42 +00:00
										 |  |  |         static $_cache_info = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-04-15 16:39:16 +00:00
										 |  |  |         $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(error_reporting() & ~E_NOTICE); | 
					
						
							| 
									
										
										
										
											2003-01-23 23:33:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-01-20 19:03:03 +00:00
										 |  |  |         if($this->security && !in_array($this->template_dir, $this->secure_dir)) { | 
					
						
							|  |  |  |             // add template_dir to secure_dir array
 | 
					
						
							|  |  |  |             array_unshift($this->secure_dir, $this->template_dir); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2003-01-23 23:33:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-12-12 17:25:23 +00:00
										 |  |  |         if (!$this->debugging && $this->debugging_ctrl == 'URL' | 
					
						
							|  |  |  |                && strstr($GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'], $this->_smarty_debug_id)) { | 
					
						
							| 
									
										
										
										
											2003-01-20 19:03:03 +00:00
										 |  |  |             // enable debugging from URL
 | 
					
						
							| 
									
										
										
										
											2002-12-12 17:25:23 +00:00
										 |  |  |             $this->debugging = true; | 
					
						
							| 
									
										
										
										
											2003-06-11 21:52:09 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2001-11-27 17:17:53 +00:00
										 |  |  |         if ($this->debugging) { | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |             // capture time for debugging info
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 			$_params = array(); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 			require_once(SMARTY_DIR . 'core/core.get_microtime.php'); | 
					
						
							|  |  |  |             $_debug_start_time = smarty_core_get_microtime($_params, $this); | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |             $this->_smarty_debug_info[] = array('type'      => 'template', | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |                                                 'filename'  => $file_path, | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |                                                 'depth'     => 0); | 
					
						
							| 
									
										
										
										
											2003-05-07 16:37:07 +00:00
										 |  |  |             $_included_tpls_idx = count($this->_smarty_debug_info) - 1; | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |         if (!isset($compile_id)) { | 
					
						
							|  |  |  |             $compile_id = $this->compile_id; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-12-03 20:53:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |         $this->_compile_id = $compile_id; | 
					
						
							| 
									
										
										
										
											2001-12-03 20:53:56 +00:00
										 |  |  |         $this->_inclusion_depth = 0; | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-06 21:17:37 +00:00
										 |  |  |         if ($this->caching) { | 
					
						
							| 
									
										
										
										
											2003-04-14 07:31:42 +00:00
										 |  |  |             // save old cache_info, initialize cache_info
 | 
					
						
							|  |  |  |             array_push($_cache_info, $this->_cache_info); | 
					
						
							|  |  |  |             $this->_cache_info = array(); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 			$_params = array( | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  | 				'tpl_file' => $file_path, | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 				'cache_id' => $cache_id, | 
					
						
							|  |  |  | 				'compile_id' => $compile_id, | 
					
						
							| 
									
										
										
										
											2003-05-12 07:53:57 +00:00
										 |  |  | 				'results' => null | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 			); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 			require_once(SMARTY_DIR . 'core/core.read_cache_file.php');			 | 
					
						
							|  |  |  |             if (smarty_core_read_cache_file($_params, $this)) { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 				$_smarty_results = $_params['results']; | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |                 if (@count($this->_cache_info['insert_tags'])) { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 					$_params = array('plugins' => $this->_cache_info['insert_tags']); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 					require_once(SMARTY_DIR . 'core/core.load_plugins.php'); | 
					
						
							|  |  |  |                 	smarty_core_load_plugins($_params, $this); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 					$_params = array('results' => $_smarty_results); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 					require_once(SMARTY_DIR . 'core/core.process_cached_inserts.php'); | 
					
						
							|  |  |  |                     $_smarty_results = smarty_core_process_cached_inserts($_params, $this); | 
					
						
							| 
									
										
										
										
											2001-11-26 22:44:23 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |                 if (@count($this->_cache_info['cache_serials'])) { | 
					
						
							|  |  |  |                     $_params = array('results' => $_smarty_results); | 
					
						
							|  |  |  |                     require_once(SMARTY_DIR . 'core/core.process_compiled_include.php'); | 
					
						
							|  |  |  |                     $_smarty_results = smarty_core_process_compiled_include($_params, $this); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |                 if ($display) { | 
					
						
							| 
									
										
										
										
											2001-11-26 22:44:23 +00:00
										 |  |  |                     if ($this->debugging) | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         // capture time for debugging info
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 						$_params = array(); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 						require_once(SMARTY_DIR . 'core/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_DIR . 'core/core.display_debug_console.php'); | 
					
						
							|  |  |  |                         $_smarty_results .= smarty_core_display_debug_console($_params, $this); | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |                     } | 
					
						
							| 
									
										
										
										
											2002-02-19 22:40:49 +00:00
										 |  |  |                     if ($this->cache_modified_check) { | 
					
						
							| 
									
										
										
										
											2003-05-07 16:37:07 +00:00
										 |  |  |                         $_last_modified_date = substr($GLOBALS['HTTP_SERVER_VARS']['HTTP_IF_MODIFIED_SINCE'], 0, strpos($GLOBALS['HTTP_SERVER_VARS']['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); | 
					
						
							|  |  |  |                         $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT'; | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |                         if (@count($this->_cache_info['insert_tags']) == 0 | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |                             && !$this->_cache_serials | 
					
						
							| 
									
										
										
										
											2003-05-07 16:37:07 +00:00
										 |  |  |                             && $_gmt_mtime == $_last_modified_date) { | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |                             header("HTTP/1.1 304 Not Modified"); | 
					
						
							| 
									
										
										
										
											2002-02-15 20:50:44 +00:00
										 |  |  |                         } else { | 
					
						
							| 
									
										
										
										
											2003-05-07 16:37:07 +00:00
										 |  |  |                             header("Last-Modified: ".$_gmt_mtime); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |                             echo $_smarty_results; | 
					
						
							| 
									
										
										
										
											2002-02-15 20:50:44 +00:00
										 |  |  |                         } | 
					
						
							| 
									
										
										
										
											2002-06-07 14:02:37 +00:00
										 |  |  |                     } else { | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |                             echo $_smarty_results;                         | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2002-04-15 16:39:16 +00:00
										 |  |  |                     error_reporting($_smarty_old_error_level); | 
					
						
							| 
									
										
										
										
											2003-04-14 07:31:42 +00:00
										 |  |  |                     // restore initial cache_info
 | 
					
						
							|  |  |  |                     $this->_cache_info = array_pop($_cache_info); | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |                     return true;     | 
					
						
							| 
									
										
										
										
											2001-11-26 22:44:23 +00:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2002-04-15 16:39:16 +00:00
										 |  |  |                     error_reporting($_smarty_old_error_level); | 
					
						
							| 
									
										
										
										
											2003-04-14 07:31:42 +00:00
										 |  |  |                     // restore initial cache_info
 | 
					
						
							|  |  |  |                     $this->_cache_info = array_pop($_cache_info); | 
					
						
							| 
									
										
										
										
											2001-12-03 20:29:51 +00:00
										 |  |  |                     return $_smarty_results; | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |                 $this->_cache_info['template'][$file_path] = true; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |                 if ($this->cache_modified_check) { | 
					
						
							|  |  |  |                     header("Last-Modified: ".gmdate('D, d M Y H:i:s', time()).' GMT'); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2003-06-11 21:52:09 +00:00
										 |  |  |         }		 | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 		// load filters that are marked as autoload
 | 
					
						
							| 
									
										
										
										
											2002-12-12 16:28:29 +00:00
										 |  |  |         if (count($this->autoload_filters)) { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         	foreach ($this->autoload_filters as $_filter_type => $_filters) { | 
					
						
							|  |  |  |             	foreach ($_filters as $_filter) { | 
					
						
							|  |  |  |                 	$this->load_filter($_filter_type, $_filter); | 
					
						
							|  |  |  |             	} | 
					
						
							|  |  |  |         	} | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |         $_smarty_compile_path = $this->_get_compile_path($file_path); | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |         // if we just need to display the results, don't perform output
 | 
					
						
							| 
									
										
										
										
											2001-02-06 22:17:51 +00:00
										 |  |  |         // buffering - for speed
 | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |         if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) { | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |             if ($this->_is_compiled($file_path, $_smarty_compile_path) | 
					
						
							|  |  |  | 					|| $this->_compile_file($file_path, $_smarty_compile_path)) | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  |                 include($_smarty_compile_path); | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2001-04-19 21:08:17 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2001-01-31 22:42:05 +00:00
										 |  |  |             ob_start(); | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |             if ($this->_is_compiled($file_path, $_smarty_compile_path) | 
					
						
							|  |  |  | 					|| $this->_compile_file($file_path, $_smarty_compile_path)) | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |             { | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  |                 include($_smarty_compile_path); | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2001-12-03 20:29:51 +00:00
										 |  |  |             $_smarty_results = ob_get_contents(); | 
					
						
							| 
									
										
										
										
											2001-01-31 22:42:05 +00:00
										 |  |  |             ob_end_clean(); | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-07 16:37:07 +00:00
										 |  |  |             foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) { | 
					
						
							|  |  |  |                 $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this)); | 
					
						
							| 
									
										
										
										
											2002-04-16 20:04:06 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2001-01-31 22:42:05 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-04-12 20:53:21 +00:00
										 |  |  |         if ($this->caching) { | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  | 			$_params = array('tpl_file' => $file_path, | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 						'cache_id' => $cache_id, | 
					
						
							|  |  |  | 						'compile_id' => $compile_id, | 
					
						
							|  |  |  | 						'results' => $_smarty_results);  | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 			require_once(SMARTY_DIR . 'core/core.write_cache_file.php'); | 
					
						
							|  |  |  | 			smarty_core_write_cache_file($_params, $this); | 
					
						
							|  |  |  | 			require_once(SMARTY_DIR . 'core/core.process_cached_inserts.php'); | 
					
						
							|  |  |  | 			$_smarty_results = smarty_core_process_cached_inserts($_params, $this); | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             if ($this->_cache_serials) { | 
					
						
							|  |  |  |                 // strip nocache-tags from output
 | 
					
						
							|  |  |  |                 $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s' | 
					
						
							|  |  |  |                                                 ,'' | 
					
						
							|  |  |  |                                                 ,$_smarty_results); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2003-04-14 07:31:42 +00:00
										 |  |  |             // restore initial cache_info
 | 
					
						
							|  |  |  |             $this->_cache_info = array_pop($_cache_info); | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |         if ($display) { | 
					
						
							| 
									
										
										
										
											2001-12-03 20:29:51 +00:00
										 |  |  |             if (isset($_smarty_results)) { echo $_smarty_results; } | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |             if ($this->debugging) { | 
					
						
							|  |  |  |                 // capture time for debugging info
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 				$_params = array(); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 				require_once(SMARTY_DIR . 'core/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_DIR . 'core/core.display_debug_console.php'); | 
					
						
							|  |  |  |                 echo smarty_core_display_debug_console($_params, $this); | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2002-04-15 16:39:16 +00:00
										 |  |  |             error_reporting($_smarty_old_error_level); | 
					
						
							| 
									
										
										
										
											2001-01-31 22:42:05 +00:00
										 |  |  |             return; | 
					
						
							| 
									
										
										
										
											2001-03-02 18:07:51 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2002-04-15 16:39:16 +00:00
										 |  |  |             error_reporting($_smarty_old_error_level); | 
					
						
							| 
									
										
										
										
											2001-12-03 20:29:51 +00:00
										 |  |  |             if (isset($_smarty_results)) { return $_smarty_results; } | 
					
						
							| 
									
										
										
										
											2001-03-02 18:07:51 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-06-20 18:38:00 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * load configuration values | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $file | 
					
						
							|  |  |  |      * @param string $section | 
					
						
							|  |  |  |      * @param string $scope | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |     function config_load($file, $section = null, $scope = 'global') | 
					
						
							| 
									
										
										
										
											2003-04-20 18:33:31 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-04-20 18:08:04 +00:00
										 |  |  | 		require_once($this->_get_plugin_filepath('function', 'config_load'));     | 
					
						
							|  |  |  | 		smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this); | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-17 17:56:35 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * return a reference to a registered object | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $name | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return object | 
					
						
							| 
									
										
										
										
											2003-02-17 17:56:35 +00:00
										 |  |  |      */     | 
					
						
							|  |  |  | 	function &get_registered_object($name) { | 
					
						
							| 
									
										
										
										
											2003-02-24 17:47:05 +00:00
										 |  |  | 		if (!isset($this->_reg_objects[$name])) | 
					
						
							|  |  |  | 		$this->_trigger_fatal_error("'$name' is not a registered object"); | 
					
						
							| 
									
										
										
										
											2003-02-17 18:03:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-24 17:47:05 +00:00
										 |  |  | 		if (!is_object($this->_reg_objects[$name][0])) | 
					
						
							|  |  |  | 		$this->_trigger_fatal_error("registered '$name' is not an object"); | 
					
						
							| 
									
										
										
										
											2003-02-17 18:03:00 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		return $this->_reg_objects[$name][0];		 | 
					
						
							| 
									
										
										
										
											2003-02-17 17:56:35 +00:00
										 |  |  | 	}	 | 
					
						
							| 
									
										
										
										
											2003-02-03 17:22:21 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * clear configuration values | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @param string $var | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |     function clear_config($var = null) | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         if(!isset($var)) { | 
					
						
							|  |  |  |             // clear all values
 | 
					
						
							|  |  |  |             $this->_config = array(array('vars'  => array(), | 
					
						
							|  |  |  |                                          'files' => array())); | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             unset($this->_config[0]['vars'][$var]);             | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |     }	 | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * Quote subpattern references | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @param string $string | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function quote_replace($string) | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         return preg_replace('![\\$]\d!', '\\\\\\0', $string); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * get filepath of requested plugin | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @param string $type | 
					
						
							|  |  |  |      * @param string $name | 
					
						
							|  |  |  |      * @return string|false | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |     function _get_plugin_filepath($type, $name) | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         $_plugin_filename = "$type.$name.php"; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |          | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         foreach ((array)$this->plugins_dir as $_plugin_dir) { | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             // see if path is relative
 | 
					
						
							|  |  |  |             if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { | 
					
						
							|  |  |  |                 $_relative_paths[] = $_plugin_dir; | 
					
						
							|  |  |  |                 // relative path, see if it is in the SMARTY_DIR
 | 
					
						
							|  |  |  |                 if (@is_readable(SMARTY_DIR . $_plugin_filepath)) { | 
					
						
							|  |  |  |                     return SMARTY_DIR . $_plugin_filepath; | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             // try relative to cwd (or absolute)
 | 
					
						
							|  |  |  |             if (@is_readable($_plugin_filepath)) { | 
					
						
							|  |  |  |                 return $_plugin_filepath; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         // still not found, try PHP include_path
 | 
					
						
							|  |  |  |         if(isset($_relative_paths)) { | 
					
						
							|  |  |  |             foreach ((array)$_relative_paths as $_plugin_dir) { | 
					
						
							| 
									
										
										
										
											2001-12-03 20:29:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |                 $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; | 
					
						
							| 
									
										
										
										
											2001-12-03 20:29:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 				$_params = array('file_path' => $_plugin_filepath); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 				require_once(SMARTY_DIR . 'core/core.get_include_path.php'); | 
					
						
							|  |  |  |             	if(smarty_core_get_include_path($_params, $this)) {				 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 					return $_params['new_file_path']; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }    | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     }	 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  |    /** | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |      * test if source file needs compiling | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $tpl_file | 
					
						
							|  |  |  |      * @param string $compile_path | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return boolean | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-06-17 14:11:57 +00:00
										 |  |  |     function _is_compiled($file_path, $compile_path) | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2002-02-15 20:50:44 +00:00
										 |  |  |         if (!$this->force_compile && file_exists($compile_path)) { | 
					
						
							| 
									
										
										
										
											2001-04-12 20:14:30 +00:00
										 |  |  |             if (!$this->compile_check) { | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |                 // no need to check compiled file
 | 
					
						
							| 
									
										
										
										
											2003-06-17 16:33:16 +00:00
										 |  |  |                 return true; | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |                 // get file source and timestamp
 | 
					
						
							|  |  |  | 				require_once(SMARTY_DIR . 'core/core.fetch_file_info.php'); | 
					
						
							|  |  |  | 				$_params = array('file_path' => $file_path); | 
					
						
							|  |  |  |                 if (!smarty_core_fetch_file_info($_params, $this)) { | 
					
						
							| 
									
										
										
										
											2003-06-17 16:33:16 +00:00
										 |  |  |                     return false; | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  | 				$_file_source = $_params['file_source']; | 
					
						
							|  |  |  | 				$_file_timestamp = $_params['file_timestamp']; | 
					
						
							| 
									
										
										
										
											2003-06-17 14:11:57 +00:00
										 |  |  |                 if ($_file_timestamp <= filemtime($compile_path)) { | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  |                     // template not expired, no recompile
 | 
					
						
							| 
									
										
										
										
											2003-06-17 16:33:16 +00:00
										 |  |  |                     return true; | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  |                 } else { | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  | 					// compile template
 | 
					
						
							| 
									
										
										
										
											2003-06-17 16:33:16 +00:00
										 |  |  |                     return false; | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             // compiled template does not exist, or forced compile
 | 
					
						
							| 
									
										
										
										
											2003-06-17 16:33:16 +00:00
										 |  |  |             return false; | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-06-19 15:30:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-10-25 16:32:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |    /** | 
					
						
							|  |  |  |      * compile the template | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |      * @param string $file_path | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |      * @param string $compile_path | 
					
						
							|  |  |  |      * @return boolean | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  |     function _compile_file($file_path, $compile_path) | 
					
						
							| 
									
										
										
										
											2001-10-25 16:32:00 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-06-17 14:11:57 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  | 		$_params = array('file_path' => $file_path); | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  | 		require_once(SMARTY_DIR . 'core/core.fetch_file_info.php'); | 
					
						
							|  |  |  |         if (!smarty_core_fetch_file_info($_params, $this)) { | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  | 		$_file_source = $_params['file_source']; | 
					
						
							|  |  |  | 		$_file_timestamp = $_params['file_timestamp']; | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if ($this->_compile_source($file_path, $_file_source, $_file_compiled)) { | 
					
						
							|  |  |  | 			$_params = array('compile_path' => $compile_path, 'file_compiled' => $_file_compiled, 'file_timestamp' => $_file_timestamp); | 
					
						
							|  |  |  | 			require_once(SMARTY_DIR . 'core/core.write_compiled_template.php'); | 
					
						
							|  |  |  | 			smarty_core_write_compiled_template($_params, $this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // if a _cache_serial was set, we also have to write an include-file:
 | 
					
						
							|  |  |  |             if ($this->_cache_serial = $smarty_compiler->_cache_serial) { | 
					
						
							|  |  |  |                 $_params['plugins_code'] = $smarty_compiler->_plugins_code; | 
					
						
							|  |  |  |                 $_params['include_file_path'] = $smarty_compiler->_cache_include;               | 
					
						
							|  |  |  |                 require_once(SMARTY_DIR . 'core/core.write_compiled_include.php'); | 
					
						
							|  |  |  |                 smarty_core_write_compiled_include($_params, $this); | 
					
						
							|  |  |  |             }           | 
					
						
							|  |  |  |             return true; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $this->trigger_error($smarty_compiler->_error_msg); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         }		 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     }	 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    /** | 
					
						
							|  |  |  |      * compile the given source | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $file_path | 
					
						
							|  |  |  |      * @param string $file_source | 
					
						
							|  |  |  |      * @param string $file_compiled | 
					
						
							|  |  |  |      * @return boolean | 
					
						
							|  |  |  |      */     | 
					
						
							|  |  |  |     function _compile_source($file_path, &$file_source, &$file_compiled) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |         if (file_exists(SMARTY_DIR . $this->compiler_file)) { | 
					
						
							|  |  |  |             require_once(SMARTY_DIR . $this->compiler_file); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             // use include_path
 | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |             require_once($this->compiler_file); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-04-12 21:00:47 +00:00
										 |  |  |         $smarty_compiler = new $this->compiler_class; | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-04-12 21:00:47 +00:00
										 |  |  |         $smarty_compiler->template_dir      = $this->template_dir; | 
					
						
							|  |  |  |         $smarty_compiler->compile_dir       = $this->compile_dir; | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         $smarty_compiler->plugins_dir       = $this->plugins_dir; | 
					
						
							| 
									
										
										
										
											2001-04-12 21:00:47 +00:00
										 |  |  |         $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; | 
					
						
							| 
									
										
										
										
											2001-06-11 14:33:47 +00:00
										 |  |  |         $smarty_compiler->_version          = $this->_version; | 
					
						
							| 
									
										
										
										
											2001-06-15 14:52:48 +00:00
										 |  |  |         $smarty_compiler->security          = $this->security; | 
					
						
							|  |  |  |         $smarty_compiler->secure_dir        = $this->secure_dir; | 
					
						
							| 
									
										
										
										
											2001-06-13 14:03:04 +00:00
										 |  |  |         $smarty_compiler->security_settings = $this->security_settings; | 
					
						
							| 
									
										
										
										
											2001-12-04 22:31:47 +00:00
										 |  |  |         $smarty_compiler->trusted_dir       = $this->trusted_dir; | 
					
						
							| 
									
										
										
										
											2003-01-24 15:02:15 +00:00
										 |  |  |         $smarty_compiler->_reg_objects      = &$this->_reg_objects; | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         $smarty_compiler->_plugins          = &$this->_plugins; | 
					
						
							| 
									
										
										
										
											2002-03-21 15:49:12 +00:00
										 |  |  |         $smarty_compiler->_tpl_vars         = &$this->_tpl_vars; | 
					
						
							| 
									
										
										
										
											2002-07-17 21:16:43 +00:00
										 |  |  |         $smarty_compiler->default_modifiers = $this->default_modifiers; | 
					
						
							| 
									
										
										
										
											2003-03-31 22:17:53 +00:00
										 |  |  |         $smarty_compiler->compile_id        = $this->_compile_id; | 
					
						
							| 
									
										
										
										
											2003-06-11 22:17:52 +00:00
										 |  |  |         $smarty_compiler->_config			= $this->_config; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $smarty_compiler->request_use_auto_globals  = $this->request_use_auto_globals; | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |         $smarty_compiler->_cache_serial = null; | 
					
						
							|  |  |  |         $smarty_compiler->_cache_include    = substr($compile_path, 0, -4).'.inc'; | 
					
						
							| 
									
										
										
										
											2003-06-19 14:04:49 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		return $smarty_compiler->_compile_file($file_path, $file_source, $file_compiled); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 	}	 | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2003-06-16 19:45:11 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * Get the compile path for this template file | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $tpl_file | 
					
						
							|  |  |  |      * @return string results of {@link _get_auto_filename()} | 
					
						
							|  |  |  |      */     | 
					
						
							|  |  |  |     function _get_compile_path($tpl_file) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->_get_auto_filename($this->compile_dir, $tpl_file, | 
					
						
							| 
									
										
										
										
											2003-06-18 20:31:27 +00:00
										 |  |  |                                          $this->_compile_id) . '.php'; | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2000-11-27 17:39:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * Handle modifiers | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @param string|null $modifier_name | 
					
						
							|  |  |  |      * @param array|null $map_array | 
					
						
							|  |  |  |      * @return string result of modifiers | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-06-17 15:23:25 +00:00
										 |  |  |     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]; | 
					
						
							| 
									
										
										
										
											2003-06-11 21:52:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if ($_map_array && is_array($_var)) { | 
					
						
							|  |  |  |             foreach ($_var as $_key => $_val) { | 
					
						
							| 
									
										
										
										
											2003-06-17 15:23:25 +00:00
										 |  |  |                 $_args[0] = $_val; | 
					
						
							|  |  |  |                 $_var[$_key] = call_user_func_array($_func_name, $_args); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2003-06-11 21:52:09 +00:00
										 |  |  |             return $_var; | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-06-17 15:23:25 +00:00
										 |  |  |             return call_user_func_array($_func_name, $_args); | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2001-04-11 18:35:17 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2001-10-26 14:12:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * Remove starting and ending quotes from the string | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @param string $string | 
					
						
							|  |  |  |      * @return string | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |     function _dequote($string) | 
					
						
							| 
									
										
										
										
											2002-04-03 16:31:59 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         if (($string{0} == "'" || $string{0} == '"') && | 
					
						
							|  |  |  |             $string{strlen($string)-1} == $string{0}) | 
					
						
							|  |  |  |             return substr($string, 1, -1); | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |             return $string; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2002-04-03 16:31:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-05 14:56:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * read in a file from line $start for $lines. | 
					
						
							|  |  |  |      * read the entire file if $start and $lines are null. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $filename | 
					
						
							|  |  |  |      * @param integer $start | 
					
						
							|  |  |  |      * @param integer $lines | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */     | 
					
						
							|  |  |  |     function _read_file($filename, $start=null, $lines=null) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         if (!($fd = @fopen($filename, 'r'))) { | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         flock($fd, LOCK_SH); | 
					
						
							|  |  |  |         if ($start == null && $lines == null) { | 
					
						
							|  |  |  |             // read the entire file
 | 
					
						
							|  |  |  |             $contents = fread($fd, filesize($filename)); | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             if ( $start > 1 ) { | 
					
						
							|  |  |  |                 // skip the first lines before $start
 | 
					
						
							|  |  |  |                 for ($loop=1; $loop < $start; $loop++) { | 
					
						
							|  |  |  |                     fgets($fd, 65536); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2002-04-03 16:31:59 +00:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             if ( $lines == null ) { | 
					
						
							|  |  |  |                 // read the rest of the file
 | 
					
						
							|  |  |  |                 while (!feof($fd)) { | 
					
						
							|  |  |  |                     $contents .= fgets($fd, 65536); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2002-04-03 16:31:59 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |                 // read up to $lines lines
 | 
					
						
							|  |  |  |                 for ($loop=0; $loop < $lines; $loop++) { | 
					
						
							|  |  |  |                     $contents .= fgets($fd, 65536); | 
					
						
							|  |  |  |                     if (feof($fd)) { | 
					
						
							|  |  |  |                         break; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2002-04-03 16:31:59 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         fclose($fd); | 
					
						
							|  |  |  |         return $contents; | 
					
						
							| 
									
										
										
										
											2002-04-03 16:31:59 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * get a concrete filename for automagically created content | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |      * @param string $auto_base | 
					
						
							|  |  |  |      * @param string $auto_source | 
					
						
							|  |  |  |      * @param string $auto_id | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      * @staticvar string|null | 
					
						
							|  |  |  |      * @staticvar string|null | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-06-11 20:06:34 +00:00
										 |  |  |     function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null) | 
					
						
							| 
									
										
										
										
											2001-08-31 03:33:41 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         static $_dir_sep = null; | 
					
						
							|  |  |  |         static $_dir_sep_enc = null; | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         if(!isset($_dir_sep)) { | 
					
						
							| 
									
										
										
										
											2003-05-05 14:37:57 +00:00
										 |  |  |             $_dir_sep_enc = urlencode(DIRECTORY_SEPARATOR); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |             if($this->use_sub_dirs) { | 
					
						
							| 
									
										
										
										
											2003-05-05 14:37:57 +00:00
										 |  |  |                 $_dir_sep = DIRECTORY_SEPARATOR; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |             } else { | 
					
						
							|  |  |  |                 $_dir_sep = '^';         | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         if(@is_dir($auto_base)) { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             $_res = $auto_base . DIRECTORY_SEPARATOR; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         } else { | 
					
						
							|  |  |  |             // auto_base not found, try include_path
 | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 			$_params = array('file_path' => $auto_base); | 
					
						
							| 
									
										
										
										
											2003-06-16 15:18:38 +00:00
										 |  |  | 			require_once(SMARTY_DIR . 'core/core.get_include_path.php'); | 
					
						
							|  |  |  |             smarty_core_get_include_path($_params, $this); | 
					
						
							| 
									
										
										
										
											2003-06-04 13:50:50 +00:00
										 |  |  |             $_res = isset($_params['new_file_path']) ? $_params['new_file_path'] . DIRECTORY_SEPARATOR : null; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         if(isset($auto_id)) { | 
					
						
							|  |  |  |             // make auto_id safe for directory names
 | 
					
						
							|  |  |  |             $auto_id = str_replace('%7C','|',(urlencode($auto_id))); | 
					
						
							|  |  |  |             // split into separate directories
 | 
					
						
							|  |  |  |             $auto_id = str_replace('|', $_dir_sep, $auto_id); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |             $_res .= $auto_id . $_dir_sep; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         if(isset($auto_source)) { | 
					
						
							|  |  |  |             // make source name safe for filename
 | 
					
						
							|  |  |  |             if($this->use_sub_dirs) { | 
					
						
							|  |  |  |                 $_filename = urlencode(basename($auto_source)); | 
					
						
							|  |  |  |                 $_crc32 = crc32($auto_source) . $_dir_sep; | 
					
						
							|  |  |  |                 // prepend %% to avoid name conflicts with
 | 
					
						
							|  |  |  |                 // with $auto_id names
 | 
					
						
							|  |  |  |                 $_crc32 = '%%' . substr($_crc32,0,3) . $_dir_sep . '%%' . $_crc32; | 
					
						
							| 
									
										
										
										
											2003-06-18 20:31:27 +00:00
										 |  |  |                 $_res .= $_crc32 . $_filename; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |             } else { | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |                 $_res .= str_replace($_dir_sep_enc,'^',urlencode($auto_source)); | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         return $_res; | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * unlink a file, possibly using expiration time | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $resource | 
					
						
							|  |  |  |      * @param integer $exp_time | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2002-07-16 15:04:02 +00:00
										 |  |  |     function _unlink($resource, $exp_time = null) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         if(isset($exp_time)) { | 
					
						
							|  |  |  |             if(time() - filemtime($resource) >= $exp_time) { | 
					
						
							|  |  |  |                 @unlink($resource); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } else {             | 
					
						
							|  |  |  |             @unlink($resource); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2002-07-16 15:04:02 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2003-03-21 15:39:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * returns an auto_id for auto-file-functions | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param string $cache_id | 
					
						
							|  |  |  |      * @param string $compile_id | 
					
						
							| 
									
										
										
										
											2003-04-20 21:12:13 +00:00
										 |  |  |      * @return string|null | 
					
						
							| 
									
										
										
										
											2003-03-21 15:50:03 +00:00
										 |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-03-21 15:39:29 +00:00
										 |  |  |     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; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      * trigger Smarty plugin error | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |      * @param string $error_msg | 
					
						
							|  |  |  |      * @param string $tpl_file | 
					
						
							|  |  |  |      * @param integer $tpl_line | 
					
						
							|  |  |  |      * @param string $file | 
					
						
							|  |  |  |      * @param integer $line | 
					
						
							|  |  |  |      * @param integer $error_type | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |      */     | 
					
						
							| 
									
										
										
										
											2003-01-25 20:31:45 +00:00
										 |  |  |     function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = null, | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |             $file = null, $line = null, $error_type = E_USER_ERROR) | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |         if(isset($file) && isset($line)) { | 
					
						
							|  |  |  |             $info = ' ('.basename($file).", line $line)"; | 
					
						
							|  |  |  |         } else { | 
					
						
							|  |  |  |             $info = null; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         if (isset($tpl_line) && isset($tpl_file)) { | 
					
						
							| 
									
										
										
										
											2003-01-25 20:31:45 +00:00
										 |  |  |             trigger_error("Smarty error: [in " . $tpl_file . " line " . | 
					
						
							| 
									
										
										
										
											2003-01-22 17:26:43 +00:00
										 |  |  |                           $tpl_line . "]: $error_msg$info", $error_type); | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-01-25 20:31:45 +00:00
										 |  |  |             trigger_error("Smarty error: $error_msg$info", $error_type); | 
					
						
							| 
									
										
										
										
											2002-01-31 20:49:40 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-02-16 05:09:19 +00:00
										 |  |  |     /** | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  |      * check if the function or method exists | 
					
						
							|  |  |  |      * @return bool | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2003-04-15 10:41:13 +00:00
										 |  |  |     function _plugin_implementation_exists($function) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return (is_array($function)) ? | 
					
						
							|  |  |  |             method_exists($function[0], $function[1]) : function_exists($function); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2003-02-14 14:51:47 +00:00
										 |  |  |     /**#@-*/ | 
					
						
							| 
									
										
										
										
											2003-06-18 23:01:42 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * 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; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-08-08 17:05:38 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-01 21:39:29 +00:00
										 |  |  | /* vim: set expandtab: */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2000-08-08 17:05:38 +00:00
										 |  |  | ?>
 |