38     define(
'DS', DIRECTORY_SEPARATOR);
 
   45 if (!defined(
'SMARTY_DIR')) {
 
   46     define(
'SMARTY_DIR', dirname(__FILE__) . DS);
 
   53 if (!defined(
'SMARTY_SYSPLUGINS_DIR')) {
 
   54     define(
'SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 
'sysplugins' . DS);
 
   56 if (!defined(
'SMARTY_PLUGINS_DIR')) {
 
   57     define(
'SMARTY_PLUGINS_DIR', SMARTY_DIR . 
'plugins' . DS);
 
   59 if (!defined(
'SMARTY_MBSTRING')) {
 
   60     define(
'SMARTY_MBSTRING', function_exists(
'mb_split'));
 
   62 if (!defined(
'SMARTY_RESOURCE_CHAR_SET')) {
 
   67     define(
'SMARTY_RESOURCE_CHAR_SET', SMARTY_MBSTRING ? 
'UTF-8' : 
'ISO-8859-1');
 
   69 if (!defined(
'SMARTY_RESOURCE_DATE_FORMAT')) {
 
   73     define(
'SMARTY_RESOURCE_DATE_FORMAT', 
'%b %e, %Y');
 
   79 if (!defined(
'SMARTY_SPL_AUTOLOAD')) {
 
   80     define(
'SMARTY_SPL_AUTOLOAD', 0);
 
   83 if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== 
false) {
 
   84     $registeredAutoLoadFunctions = spl_autoload_functions();
 
   85     if (!isset($registeredAutoLoadFunctions[
'spl_autoload'])) {
 
   86         spl_autoload_register();
 
   89     spl_autoload_register(
'smartyAutoload');
 
   95 include_once SMARTY_SYSPLUGINS_DIR.
'smarty_internal_data.php';
 
   96 include_once SMARTY_SYSPLUGINS_DIR.
'smarty_internal_templatebase.php';
 
   97 include_once SMARTY_SYSPLUGINS_DIR.
'smarty_internal_template.php';
 
   98 include_once SMARTY_SYSPLUGINS_DIR.
'smarty_resource.php';
 
   99 include_once SMARTY_SYSPLUGINS_DIR.
'smarty_internal_resource_file.php';
 
  100 include_once SMARTY_SYSPLUGINS_DIR.
'smarty_cacheresource.php';
 
  101 include_once SMARTY_SYSPLUGINS_DIR.
'smarty_internal_cacheresource_file.php';
 
  226     private $template_dir = array();
 
  256     private $compile_dir = null;
 
  261     private $plugins_dir = array();
 
  266     private $cache_dir = null;
 
  271     private $config_dir = array();
 
  618         $this->smarty = $this;
 
  619         if (is_callable(
'mb_internal_encoding')) {
 
  622         $this->start_time = microtime(
true);
 
  625             ->setCompileDir(
'.' . DS . 
'templates_c' . DS)
 
  626             ->setPluginsDir(SMARTY_PLUGINS_DIR)
 
  627             ->setCacheDir(
'.' . DS . 
'cache' . DS)
 
  628             ->setConfigDir(
'.' . DS . 
'configs' . DS);
 
  630         $this->debug_tpl = 
'file:' . dirname(__FILE__) . 
'/debug.tpl';
 
  631         if (isset($_SERVER[
'SCRIPT_NAME'])) {
 
  632             $this->
assignGlobal(
'SCRIPT_NAME', $_SERVER[
'SCRIPT_NAME']);
 
  650         $this->smarty = $this;
 
  666         'template_dir' => 
'getTemplateDir',
 
  667         'config_dir' => 
'getConfigDir',
 
  668         'plugins_dir' => 
'getPluginsDir',
 
  669         'compile_dir' => 
'getCompileDir',
 
  670         'cache_dir' => 
'getCacheDir',
 
  673         if (isset($allowed[$name])) {
 
  674             return $this->{$allowed[$name]}();
 
  676             trigger_error(
'Undefined property: '. get_class($this) .
'::$'. $name, E_USER_NOTICE);
 
  689     public function __set($name, $value)
 
  692         'template_dir' => 
'setTemplateDir',
 
  693         'config_dir' => 
'setConfigDir',
 
  694         'plugins_dir' => 
'setPluginsDir',
 
  695         'compile_dir' => 
'setCompileDir',
 
  696         'cache_dir' => 
'setCacheDir',
 
  699         if (isset($allowed[$name])) {
 
  700             $this->{$allowed[$name]}($value);
 
  702             trigger_error(
'Undefined property: ' . get_class($this) . 
'::$' . $name, E_USER_NOTICE);
 
  716         $tpl = 
new $this->template_class($resource_name, $this);
 
  719         $this->template_objects = $save;
 
  732         if (isset($varname)) {
 
  733             if (isset(self::$global_tpl_vars[$varname])) {
 
  734                 return self::$global_tpl_vars[$varname]->value;
 
  740             foreach (self::$global_tpl_vars AS $key => $var) {
 
  741                 $_result[$key] = $var->value;
 
  759         return $_cache_resource->clearAll($this, $exp_time);
 
  799             throw new SmartyException(
"Security class '$security_class' is not defined");
 
  801             throw new SmartyException(
"Class '$security_class' must extend Smarty_Security.");
 
  815         $this->security_policy = null;
 
  828         $this->template_dir = array();
 
  829         foreach ((array) $template_dir as $k => $v) {
 
  830             $this->template_dir[$k] = rtrim($v, 
'/\\') . DS;
 
  833         $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
 
  848         $this->template_dir = (array) $this->template_dir;
 
  850         if (is_array($template_dir)) {
 
  851             foreach ($template_dir as $k => $v) {
 
  854                     $this->template_dir[] = rtrim($v, 
'/\\') . DS;
 
  857                     $this->template_dir[$k] = rtrim($v, 
'/\\') . DS;
 
  860         } 
elseif ($key !== null) {
 
  862             $this->template_dir[$key] = rtrim($template_dir, 
'/\\') . DS;
 
  865             $this->template_dir[] = rtrim($template_dir, 
'/\\') . DS;
 
  867         $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
 
  879         if ($index !== null) {
 
  880             return isset($this->template_dir[$index]) ? $this->template_dir[$index] : null;
 
  883         return (array)$this->template_dir;
 
  894         $this->config_dir = array();
 
  895         foreach ((array) $config_dir as $k => $v) {
 
  896             $this->config_dir[$k] = rtrim($v, 
'/\\') . DS;
 
  899         $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
 
  913         $this->config_dir = (array) $this->config_dir;
 
  915         if (is_array($config_dir)) {
 
  916             foreach ($config_dir as $k => $v) {
 
  919                     $this->config_dir[] = rtrim($v, 
'/\\') . DS;
 
  922                     $this->config_dir[$k] = rtrim($v, 
'/\\') . DS;
 
  925         } 
elseif( $key !== null ) {
 
  927             $this->config_dir[$key] = rtrim($config_dir, 
'/\\') . DS;
 
  930             $this->config_dir[] = rtrim($config_dir, 
'/\\') . DS;
 
  933         $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
 
  945         if ($index !== null) {
 
  946             return isset($this->config_dir[$index]) ? $this->config_dir[$index] : null;
 
  949         return (array)$this->config_dir;
 
  960         $this->plugins_dir = array();
 
  961         foreach ((array)$plugins_dir as $k => $v) {
 
  962             $this->plugins_dir[$k] = rtrim($v, 
'/\\') . DS;
 
  978         $this->plugins_dir = (array) $this->plugins_dir;
 
  980         if (is_array($plugins_dir)) {
 
  981             foreach ($plugins_dir as $k => $v) {
 
  984                     $this->plugins_dir[] = rtrim($v, 
'/\\') . DS;
 
  987                     $this->plugins_dir[$k] = rtrim($v, 
'/\\') . DS;
 
  992             $this->plugins_dir[] = rtrim($plugins_dir, 
'/\\') . DS;
 
  995         $this->plugins_dir = array_unique($this->plugins_dir);
 
 1006         return (array)$this->plugins_dir;
 
 1017         $this->compile_dir = rtrim($compile_dir, 
'/\\') . DS;
 
 1031         return $this->compile_dir;
 
 1042         $this->cache_dir = rtrim($cache_dir, 
'/\\') . DS;
 
 1056         return $this->cache_dir;
 
 1067         $this->default_modifiers = (array) $modifiers;
 
 1079         if (is_array($modifiers)) {
 
 1080             $this->default_modifiers = array_merge($this->default_modifiers, $modifiers);
 
 1082             $this->default_modifiers[] = $modifiers;
 
 1108         if ($type !== null) {
 
 1109             $this->autoload_filters[$type] = (array) $filters;
 
 1111             $this->autoload_filters = (array) $filters;
 
 1126         if ($type !== null) {
 
 1127             if (!empty($this->autoload_filters[$type])) {
 
 1128                 $this->autoload_filters[$type] = array_merge($this->autoload_filters[$type], (array) $filters);
 
 1130                 $this->autoload_filters[$type] = (array) $filters;
 
 1133             foreach ((array) $filters as $key => $value) {
 
 1134                 if (!empty($this->autoload_filters[$key])) {
 
 1135                     $this->autoload_filters[$key] = array_merge($this->autoload_filters[$key], (array) $value);
 
 1137                     $this->autoload_filters[$key] = (array) $value;
 
 1153         if ($type !== null) {
 
 1154             return isset($this->autoload_filters[$type]) ? $this->autoload_filters[$type] : array();
 
 1179         if (!is_readable($tpl_name)) {
 
 1182         $this->debug_tpl = $tpl_name;
 
 1213         if ($this->allow_ambiguous_resources) {
 
 1218         if (isset($_templateId[150])) {
 
 1219             $_templateId = sha1($_templateId);
 
 1222             if (isset($this->template_objects[$_templateId])) {
 
 1224                 $tpl = clone $this->template_objects[$_templateId];
 
 1227                 $tpl->tpl_vars = array();
 
 1228                 $tpl->config_vars = array();
 
 1233             if (isset($this->template_objects[$_templateId])) {
 
 1235                 $tpl = $this->template_objects[$_templateId];
 
 1237                 $tpl->tpl_vars = array();
 
 1238                 $tpl->config_vars = array();
 
 1246             foreach (
$data as $_key => $_val) {
 
 1247                 $tpl->tpl_vars[$_key] = 
new Smarty_variable($_val);
 
 1266         if ($check && (is_callable($plugin_name) || class_exists($plugin_name, 
false))) {
 
 1270         $_name_parts = explode(
'_', $plugin_name, 3);
 
 1273         if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 
'smarty') {
 
 1274             throw new SmartyException(
"plugin {$plugin_name} is not a valid name format");
 
 1278         if (strtolower($_name_parts[1]) == 
'internal') {
 
 1279             $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . 
'.php';
 
 1280             if (file_exists($file)) {
 
 1281                 require_once($file);
 
 1288         $_plugin_filename = 
"{$_name_parts[1]}.{$_name_parts[2]}.php";
 
 1290         $_stream_resolve_include_path = function_exists(
'stream_resolve_include_path');
 
 1295                 $_plugin_dir . $_plugin_filename,
 
 1296                 $_plugin_dir . strtolower($_plugin_filename),
 
 1298             foreach ($names as $file) {
 
 1299                 if (file_exists($file)) {
 
 1300                     require_once($file);
 
 1303                 if ($this->use_include_path && !preg_match(
'/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
 
 1305                     if ($_stream_resolve_include_path) {
 
 1306                         $file = stream_resolve_include_path($file);
 
 1311                     if ($file !== 
false) {
 
 1312                         require_once($file);
 
 1395         $_is_muted_directory = 
false;
 
 1399             $smarty_dir = realpath(SMARTY_DIR);
 
 1400             if ($smarty_dir !== 
false) {
 
 1402                     'file' => $smarty_dir,
 
 1403                     'length' => strlen($smarty_dir),
 
 1412                 $file = realpath($key);
 
 1413                 if ($file === 
false) {
 
 1420                     'length' => strlen($file),
 
 1423             if (!strncmp($errfile, $dir[
'file'], $dir[
'length'])) {
 
 1424                 $_is_muted_directory = 
true;
 
 1431         if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
 
 1463         $error_handler = array(
'Smarty', 
'mutingErrorHandler');
 
 1464         $previous = set_error_handler($error_handler);
 
 1467         if ($previous !== $error_handler) {
 
 1479         restore_error_handler();
 
 1498         $this->message = self::$escape ? htmlentities($message) : $message;
 
 1514     $_class = strtolower(
$class);
 
 1516         'smarty_config_source' => 
true,
 
 1517         'smarty_config_compiled' => 
true,
 
 1518         'smarty_security' => 
true,
 
 1519         'smarty_cacheresource' => 
true,
 
 1520         'smarty_cacheresource_custom' => 
true,
 
 1521         'smarty_cacheresource_keyvaluestore' => 
true,
 
 1522         'smarty_resource' => 
true,
 
 1523         'smarty_resource_custom' => 
true,
 
 1524         'smarty_resource_uncompiled' => 
true,
 
 1525         'smarty_resource_recompiled' => 
true,
 
 1528     if (!strncmp($_class, 
'smarty_internal_', 16) || isset($_classes[$_class])) {
 
 1529         include SMARTY_SYSPLUGINS_DIR . $_class . 
'.php';
 
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
static $_UTF8_MODIFIER
Flag denoting if PCRE should run in UTF-8 mode. 
$allow_ambiguous_resources
__destruct()
Class destructor. 
static testInstall(Smarty $smarty, &$errors=null)
diagnose Smarty setup 
addTemplateDir($template_dir, $key=null)
Add template directory(s) 
createTemplate($template, $cache_id=null, $compile_id=null, $parent=null, $do_clone=true)
creates a template object 
setTemplateDir($template_dir)
Set template directory. 
__clone()
<> set selfpointer on cloned object 
static load(Smarty $smarty, $type=null)
Load Cache Resource Handler. 
static $_MBSTRING
Flag denoting if Multibyte String functions are available. 
if($rub=fetch_assoc($rub_query)) if(check_if_module_active('url_rewriting')) $class
loadPlugin($plugin_name, $check=true)
Takes unknown classes and loads plugin files for them class name format: Smarty_PluginType_PluginName...
addConfigDir($config_dir, $key=null)
Add config directory(s) 
static compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
Compile all template files. 
static unmuteExpectedErrors()
Disable error handler muting expected messages. 
static invalidLoadedCache(Smarty $smarty)
Invalid Loaded Cache Files. 
static getIncludePath($filepath)
Return full file path from PHP include_path. 
static getTags(Smarty_Internal_Template $template)
Return array of tag/attributes of all tags used by an template. 
clearCompiledTemplate($resource_name=null, $compile_id=null, $exp_time=null)
Delete compiled template file. 
setAutoloadFilters($filters, $type=null)
Set autoload filters. 
compileAllConfig($extension= '.conf', $force_compile=false, $time_limit=0, $max_errors=null)
Compile all config files. 
static $_DATE_FORMAT
The date format to be used internally (accepts date() and strftime()) 
assignGlobal($varname, $value=null, $nocache=false)
assigns a global Smarty variable 
getConfigDir($index=null)
Get config directory. 
enableSecurity($security_class=null)
Loads security class and enables security. 
setDefaultModifiers($modifiers)
Set default modifiers. 
const CACHING_OFF
define caching modes 
const PLUGIN_FUNCTION
plugin types 
disableSecurity()
Disable security. 
static $global_tpl_vars
#@- 
if(!empty($_GET['id'])) if(isset($_POST['form_name'], $_POST['form_subject'], $_POST['form_text'], $_POST['form_lang'])&&empty($_GET['id'])) if(empty($_GET['id'])) $tpl
static clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
Delete compiled template file. 
setDebugTemplate($tpl_name)
set the debug template 
static compileAllConfig($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
Compile all config files. 
clearCache($template_name, $cache_id=null, $compile_id=null, $exp_time=null, $type=null)
Empty cache for a specific template. 
getPluginsDir()
Get plugin directories. 
const CACHING_LIFETIME_CURRENT
Smarty plugin to format text blocks. 
const COMPILECHECK_OFF
define compile check modes 
templateExists($resource_name)
Check if a template resource exists. 
$default_config_handler_func
$direct_access_security
Should compiled-templates be prevented from being called directly? 
const FILTER_POST
filter types 
static getUniqueTemplateName($smarty, $template_resource)
modify resource_name according to resource handlers specifications 
const CACHING_LIFETIME_SAVED
static $_previous_error_handler
error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors() 
static $_muted_directories
contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() ...
const COMPILECHECK_CACHEMISS
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
const PHP_PASSTHRU
modes for handling of "" tags in templates. 
const CLEAR_EXPIRED
define constant for clearing cache files be saved expiration datees 
static mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
Error Handler to mute expected messages. 
getTemplateDir($index=null)
Get template directories. 
getGlobal($varname=null)
Returns a single or all global variables. 
compileAllTemplates($extension= '.tpl', $force_compile=false, $time_limit=0, $max_errors=null)
Compile all template files. 
smartyAutoload($class)
Autoloader. 
testInstall(&$errors=null)
Run installation test. 
clearAllCache($exp_time=null, $type=null)
Empty cache folder. 
static $_IS_WINDOWS
Flag denoting if operating system is windows. 
setCompileDir($compile_dir)
Set compile directory. 
$registered_cache_resources
addPluginsDir($plugins_dir)
Adds directory of plugin files. 
getDefaultModifiers()
Get default modifiers. 
const SCOPE_LOCAL
define variable scopes 
__set($name, $value)
<> Generic setter. 
getAutoloadFilters($type=null)
Get autoload filters. 
setConfigDir($config_dir)
Set config directory. 
static $_CHARSET
The character set to adhere to (e.g. 
const PLUGIN_MODIFIERCOMPILER
getCompileDir()
Get compiled directory. 
This class does contain the security settings. 
static muteExpectedErrors()
Enable error handler to mute expected messages. 
getDebugTemplate()
return name of debugging template 
const SMARTY_VERSION
#@+ constant definitions 
$default_plugin_handler_func
setPluginsDir($plugins_dir)
Set plugins directory. 
getTags(Smarty_Internal_Template $template)
Return array of tag/attributes of all tags used by an template. 
$default_template_handler_func
addAutoloadFilters($filters, $type=null)
Add autoload filters. 
getCacheDir()
Get cache directory. 
setCacheDir($cache_dir)
Set cache directory. 
addDefaultModifiers($modifiers)
Add default modifiers. 
__get($name)
<> Generic getter.