<?php
/**
* Project: Smarty: the PHP compiling template engine
* File: Smarty.class.php
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-general-subscribe@lists.php.net
*
* 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:
* http://smarty.php.net/
*
* @link http://smarty.php.net/
* @copyright 2001,2002 ispi of Lincoln, Inc.
* @author Monte Ohrt <monte@ispi.net>
* @author Andrei Zmievski <andrei@php.net rel='nofollow' onclick='return false;'>
* @package Smarty
* @version 2.5.0
*/
/* $Id: Smarty.class.php,v 1.1.1.1 2003/05/19 19:46:29 atur Exp $ */
/**
* set SMARTY_DIR to absolute path to Smarty library files.
* if not defined, include_path will be used.
*/
define('DIR_SEP', DIRECTORY_SEPARATOR);
/**
* Sets SMARTY_DIR only if user application has not already defined it
*/
if (!defined('SMARTY_DIR')) {
define('SMARTY_DIR', dirname(__FILE__) . DIR_SEP);
}
define('SMARTY_PHP_PASSTHRU', 0);
define('SMARTY_PHP_QUOTE', 1);
define('SMARTY_PHP_REMOVE', 2);
define('SMARTY_PHP_ALLOW', 3);
/**
* @package Smarty
*/
class Smarty
{
/**#@+
* Smarty Configuration Section
*/
/**
* The name of the directory where templates are located.
*
* @var string
*/
var $template_dir = 'templates';
/**
* The directory where compiled templates are located.
*
* @var string
*/
var $compile_dir = 'templates_c';
/**
* The directory where config files are located.
*
* @var string
*/
var $config_dir = 'configs';
/**
* An array of directories searched for plugins.
*
* @var array
*/
var $plugins_dir = array('plugins');
/**
* If debugging is enabled, a debug console window will display
* when the page loads (make sure your browser allows unrequested
* popup windows)
*
* @var boolean
*/
var $debugging = false;
/**
* This is the path to the debug console template. If not set,
* the default one will be used.
*
* @var string
*/
var $debug_tpl = '';
/**
* This determines if debugging is enable-able from the browser.
* <ul>
* <li>NONE => no debugging control allowed</li>
* <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
* </ul>
* @link http://www.foo.dom/index.php?SMARTY_DEBUG
* @var string
*/
var $debugging_ctrl = 'NONE';
/**
* This tells Smarty whether to check for recompiling or not. Recompiling
* does not need to happen unless a template or config file is changed.
* Typically you enable this during development, and disable for
* production.
*
* @var boolean
*/
var $compile_check = true;
/**
* This forces templates to compile every time. Useful for development
* or debugging.
*
* @var boolean
*/
var $force_compile = false;
/**
* This enables template caching.
* <ul>
* <li>0 = no caching</li>
* <li>1 = use class cache_lifetime value</li>
* <li >2 = use cache_lifetime in cache file</li>
* </ul>
* @var integer
*/
var $caching = 0;
/**
* The name of the directory for cache files.
*
* @var string
*/
var $cache_dir = 'cache';
/**
* This is the number of seconds cached content will persist.
* <ul>
* <li>0 = always regenerate cache</li>
* <li>-1 = never expires</li>
* </ul>
*
* @var integer
*/
var $cache_lifetime = 3600;
/**
* Only used when $caching is enabled. If true, then If-Modified-Since headers
* are respected with cached content, and appropriate HTTP headers are sent.
* This way repeated hits to a cached page do not send the entire page to the
* client every time.
*
* @var boolean
*/
var $cache_modified_check = false;
/**
* This determines how Smarty handles <?php ?> tags in templates.
* possible values:
* <ul>
* <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>
* <li>SMARTY_PHP_QUOTE -> escape tags as entities</li>
* <li>SMARTY_PHP_REMOVE -> remove php tags</li>
* <li>SMARTY_PHP_ALLOW -> execute php tags</li>
* </ul>
*
* @var integer
*/
var $php_handling = SMARTY_PHP_PASSTHRU;
/**
* This enables template security. When enabled, many things are restricted
* in the templates that normally would go unchecked. This is useful when
* untrusted parties are editing templates and you want a reasonable level
* of security. (no direct execution of PHP in templates for example)
*
* @var boolean
*/
var $security = false;
/**
* This is the list of template directories that are considered secure. This
* is used only if {@link $security} is enabled. One directory per array
* element. {@link $template_dir} is in this list implicitly.
*
* @var array
*/
var $secure_dir = array();
/**
* These are the security settings for Smarty. They are used only when
* {@link $security} is enabled.
*
* @var array
*/
var $security_settings = array(
'PHP_HANDLING' => false,
'IF_FUNCS' => array('array', 'list',
'isset', 'empty',
'count', 'sizeof',
'in_array', 'is_array',
'true','false'),
'INCLUDE_ANY' => false,
'PHP_TAGS' => false,
'MODIFIER_FUNCS' => array('count'),
'ALLOW_CONSTANTS' => false
);
/**
* This is an array of directories where trusted php scripts reside.
* {@link $security} is disabled during their inclusion/execution.
*
* @var array
*/
var $trusted_dir = array();
/**
* The left delimiter used for the template tags.
*
* @var string
*/
var $left_delimiter = '{';
/**
* The right delimiter used for the template tags.
*
* @var string
*/
var $right_delimiter = '}';
/**
* The order in which request variables are registered, similar to
* variables_order in php.ini E = Environment, G = GET, P = POST,
* C = Cookies, S = Server
*
* @var string
*/
var $request_vars_order = "EGPCS";
/**
* 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 te