mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
remove built-in exception handling, add DS as shorthand to DIRECTORY_SEPARATOR
This commit is contained in:
@@ -30,13 +30,20 @@
|
|||||||
* @version 3.0-alpha1
|
* @version 3.0-alpha1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* define shorthand directory separator constant
|
||||||
|
*/
|
||||||
|
if (!defined('DS')) {
|
||||||
|
define('DS',DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set SMARTY_DIR to absolute path to Smarty library files.
|
* set SMARTY_DIR to absolute path to Smarty library files.
|
||||||
* if not defined, include_path will be used. Sets SMARTY_DIR only if user
|
* if not defined, include_path will be used. Sets SMARTY_DIR only if user
|
||||||
* application has not already defined it.
|
* application has not already defined it.
|
||||||
*/
|
*/
|
||||||
if (!defined('SMARTY_DIR')) {
|
if (!defined('SMARTY_DIR')) {
|
||||||
define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
define('SMARTY_DIR', dirname(__FILE__) . DS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,17 +61,10 @@ define('SMARTY_CACHING_OFF', 0);
|
|||||||
define('SMARTY_CACHING_LIFETIME_CURRENT', 1);
|
define('SMARTY_CACHING_LIFETIME_CURRENT', 1);
|
||||||
define('SMARTY_CACHING_LIVETIME_SAVED', 2);
|
define('SMARTY_CACHING_LIVETIME_SAVED', 2);
|
||||||
|
|
||||||
/**
|
|
||||||
* define exception handling
|
|
||||||
*/
|
|
||||||
if (!defined('SMARTY_EXCEPTION_HANDLER')) {
|
|
||||||
define('SMARTY_EXCEPTION_HANDLER', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load required base class for creation of the smarty object
|
* load required base class for creation of the smarty object
|
||||||
*/
|
*/
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_SEPARATOR . 'internal.templatebase.php');
|
require_once(dirname(__FILE__) . DS . 'sysplugins' . DS . 'internal.templatebase.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main Smarty class
|
* This is the main Smarty class
|
||||||
@@ -153,8 +153,8 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
public $default_config_type = 'file';
|
public $default_config_type = 'file';
|
||||||
// class used for cacher
|
// class used for cacher
|
||||||
public $cacher_class = 'Smarty_Internal_Cacher_InlineCode';
|
public $cacher_class = 'Smarty_Internal_Cacher_InlineCode';
|
||||||
// exception handler: define SMARTY_EXCEPTION_HANDLER to 0 to disable
|
// exception handler: array('ExceptionClass','ExceptionMethod');
|
||||||
public $exception_handler = array('SmartyException', 'getStaticException');
|
public $exception_handler = null;
|
||||||
// cached template objects
|
// cached template objects
|
||||||
public $template_objects = null;
|
public $template_objects = null;
|
||||||
// check If-Modified-Since headers
|
// check If-Modified-Since headers
|
||||||
@@ -203,23 +203,23 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
|||||||
}
|
}
|
||||||
$this->start_time = $this->_get_time();
|
$this->start_time = $this->_get_time();
|
||||||
// set exception handler
|
// set exception handler
|
||||||
if (SMARTY_EXCEPTION_HANDLER && !empty($this->exception_handler))
|
if (!empty($this->exception_handler))
|
||||||
set_exception_handler($this->exception_handler);
|
set_exception_handler($this->exception_handler);
|
||||||
// set default dirs
|
// set default dirs
|
||||||
$this->template_dir = array('.' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR);
|
$this->template_dir = array('.' . DS . 'templates' . DS);
|
||||||
$this->compile_dir = '.' . DIRECTORY_SEPARATOR . 'templates_c' . DIRECTORY_SEPARATOR;
|
$this->compile_dir = '.' . DS . 'templates_c' . DS;
|
||||||
$this->plugins_dir = array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR);
|
$this->plugins_dir = array(dirname(__FILE__) . DS . 'plugins' . DS);
|
||||||
$this->cache_dir = '.' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR;
|
$this->cache_dir = '.' . DS . 'cache' . DS;
|
||||||
$this->config_dir = '.' . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR;
|
$this->config_dir = '.' . DS . 'configs' . DS;
|
||||||
$this->sysplugins_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_SEPARATOR;
|
$this->sysplugins_dir = dirname(__FILE__) . DS . 'sysplugins' . DS;
|
||||||
$this->debug_tpl = SMARTY_DIR . 'debug.tpl';
|
$this->debug_tpl = SMARTY_DIR . 'debug.tpl';
|
||||||
// load basic plugins
|
// load basic plugins
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_SEPARATOR . 'internal.template.php');
|
require_once(dirname(__FILE__) . DS . 'sysplugins' . DS . 'internal.template.php');
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_SEPARATOR . 'internal.plugin_handler.php');
|
require_once(dirname(__FILE__) . DS . 'sysplugins' . DS . 'internal.plugin_handler.php');
|
||||||
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_SEPARATOR . 'internal.run_filter.php');
|
require_once(dirname(__FILE__) . DS . 'sysplugins' . DS . 'internal.run_filter.php');
|
||||||
// $this->loadPlugin($this->template_class);
|
// $this->loadPlugin($this->template_class);
|
||||||
// $this->loadPlugin('Smarty_Internal_Plugin_Handler');
|
// $this->loadPlugin('Smarty_Internal_Plugin_Handler');
|
||||||
// $this->loadPlugin('Smarty_Internal_Run_Filter');
|
// $this->loadPlugin('Smarty_Internal_Run_Filter');
|
||||||
$this->plugin_handler = new Smarty_Internal_Plugin_Handler($this);
|
$this->plugin_handler = new Smarty_Internal_Plugin_Handler($this);
|
||||||
$this->filter_handler = new Smarty_Internal_Run_Filter($this);
|
$this->filter_handler = new Smarty_Internal_Run_Filter($this);
|
||||||
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
|
if (!$this->debugging && $this->debugging_ctrl == 'URL') {
|
||||||
@@ -256,7 +256,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_
|
|||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
// restore to previous exception handler, if any
|
// restore to previous exception handler, if any
|
||||||
if (SMARTY_EXCEPTION_HANDLER && !empty($this->exception_handler))
|
if (!empty($this->exception_handler))
|
||||||
restore_exception_handler();
|
restore_exception_handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_
|
|||||||
// loop through plugin dirs and find the plugin
|
// loop through plugin dirs and find the plugin
|
||||||
foreach((array)$this->plugins_dir as $_plugin_dir) {
|
foreach((array)$this->plugins_dir as $_plugin_dir) {
|
||||||
if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
|
if (strpos('/\\', substr($_plugin_dir, -1)) === false) {
|
||||||
$_plugin_dir .= DIRECTORY_SEPARATOR;
|
$_plugin_dir .= DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($_plugin_dir . $_plugin_filename)) {
|
if (file_exists($_plugin_dir . $_plugin_filename)) {
|
||||||
@@ -508,28 +508,4 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'sysplugins' . DIRECTORY_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Smarty Exception Handler
|
|
||||||
*
|
|
||||||
* All errors thrown in Smarty will be handled here.
|
|
||||||
*
|
|
||||||
* @param string $message the error message
|
|
||||||
* @param string $code the error code
|
|
||||||
*/
|
|
||||||
class SmartyException {
|
|
||||||
public static function printException($e)
|
|
||||||
{
|
|
||||||
echo "Code: " . $e->getCode() . "<br />Error: " . htmlentities($e->getMessage()) . "<br />"
|
|
||||||
. "File: " . $e->getFile() . "<br />"
|
|
||||||
. "Line: " . $e->getLine() . "<br />"
|
|
||||||
// . "Trace" . $e->getTraceAsString() . "<br />"
|
|
||||||
. "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getStaticException($e)
|
|
||||||
{
|
|
||||||
self::printException($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -38,7 +38,7 @@ function smarty_modifier_date_format($string, $format = '%b %e, %Y', $default_da
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DIRECTORY_SEPARATOR == '\\') {
|
if (DS == '\\') {
|
||||||
$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
|
$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
|
||||||
$_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
|
$_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
|
||||||
if (strpos($format, '%e') !== false) {
|
if (strpos($format, '%e') !== false) {
|
||||||
|
@@ -92,15 +92,15 @@ class Smarty_Internal_CacheResource_File {
|
|||||||
*/
|
*/
|
||||||
public function clear($resource_name, $cache_id, $compile_id, $exp_time)
|
public function clear($resource_name, $cache_id, $compile_id, $exp_time)
|
||||||
{
|
{
|
||||||
$_dir_sep = $this->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
$_dir_sep = $this->smarty->use_sub_dirs ? DS : '^';
|
||||||
if (isset($resource_name)) {
|
if (isset($resource_name)) {
|
||||||
$_resource_part = (string)abs(crc32($resource_name)) . '.' . $resource_name . $this->smarty->php_ext;
|
$_resource_part = (string)abs(crc32($resource_name)) . '.' . $resource_name . $this->smarty->php_ext;
|
||||||
} else {
|
} else {
|
||||||
$_resource_part = null;
|
$_resource_part = null;
|
||||||
}
|
}
|
||||||
$_dir = $this->smarty->cache_dir;
|
$_dir = $this->smarty->cache_dir;
|
||||||
if (substr($_dir, -1) != DIRECTORY_SEPARATOR) {
|
if (substr($_dir, -1) != DS) {
|
||||||
$_dir .= DIRECTORY_SEPARATOR;
|
$_dir .= DS;
|
||||||
}
|
}
|
||||||
if ($this->smarty->use_sub_dirs && isset($cache_id)) {
|
if ($this->smarty->use_sub_dirs && isset($cache_id)) {
|
||||||
$_dir .= str_replace('|', $_dir_sep, $cache_id) . $_dir_sep;
|
$_dir .= str_replace('|', $_dir_sep, $cache_id) . $_dir_sep;
|
||||||
@@ -152,12 +152,12 @@ class Smarty_Internal_CacheResource_File {
|
|||||||
$_filepath = (string)abs(crc32($resource_name));
|
$_filepath = (string)abs(crc32($resource_name));
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($this->smarty->use_sub_dirs) {
|
if ($this->smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 2) . DIRECTORY_SEPARATOR
|
$_filepath = substr($_filepath, 0, 2) . DS
|
||||||
. substr($_filepath, 2, 2) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 2, 2) . DS
|
||||||
. substr($_filepath, 4, 2) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 4, 2) . DS
|
||||||
. $_filepath;
|
. $_filepath;
|
||||||
}
|
}
|
||||||
$_compile_dir_sep = $this->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
$_compile_dir_sep = $this->smarty->use_sub_dirs ? DS : '^';
|
||||||
if (isset($cache_id)) {
|
if (isset($cache_id)) {
|
||||||
$_cache_id = str_replace('|', $_compile_dir_sep, $cache_id) . $_compile_dir_sep;
|
$_cache_id = str_replace('|', $_compile_dir_sep, $cache_id) . $_compile_dir_sep;
|
||||||
} else {
|
} else {
|
||||||
@@ -170,7 +170,7 @@ class Smarty_Internal_CacheResource_File {
|
|||||||
}
|
}
|
||||||
$_cache_dir = $this->smarty->cache_dir;
|
$_cache_dir = $this->smarty->cache_dir;
|
||||||
if (strpos('/\\',substr($_cache_dir, -1)) === false) {
|
if (strpos('/\\',substr($_cache_dir, -1)) === false) {
|
||||||
$_cache_dir .= DIRECTORY_SEPARATOR;
|
$_cache_dir .= DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_files[0]) . $this->smarty->php_ext;
|
return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_files[0]) . $this->smarty->php_ext;
|
||||||
|
@@ -75,7 +75,7 @@ class Smarty_Internal_Config {
|
|||||||
{
|
{
|
||||||
foreach((array)$this->smarty->config_dir as $_config_dir) {
|
foreach((array)$this->smarty->config_dir as $_config_dir) {
|
||||||
if (strpos('/\\', substr($_config_dir, -1)) === false) {
|
if (strpos('/\\', substr($_config_dir, -1)) === false) {
|
||||||
$_config_dir .= DIRECTORY_SEPARATOR;
|
$_config_dir .= DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_filepath = $_config_dir . $this->config_resource_name;
|
$_filepath = $_config_dir . $this->config_resource_name;
|
||||||
@@ -134,14 +134,14 @@ class Smarty_Internal_Config {
|
|||||||
$_filepath = (string)abs(crc32($this->config_resource_name));
|
$_filepath = (string)abs(crc32($this->config_resource_name));
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($this->smarty->use_sub_dirs) {
|
if ($this->smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR
|
$_filepath = substr($_filepath, 0, 3) . DS
|
||||||
. substr($_filepath, 0, 2) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 2) . DS
|
||||||
. substr($_filepath, 0, 1) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 1) . DS
|
||||||
. $_filepath;
|
. $_filepath;
|
||||||
}
|
}
|
||||||
$_compile_dir = $this->smarty->compile_dir;
|
$_compile_dir = $this->smarty->compile_dir;
|
||||||
if (substr($_compile_dir, -1) != DIRECTORY_SEPARATOR) {
|
if (substr($_compile_dir, -1) != DS) {
|
||||||
$_compile_dir .= DIRECTORY_SEPARATOR;
|
$_compile_dir .= DS;
|
||||||
}
|
}
|
||||||
return $_compile_dir . $_filepath . '.' . basename($this->config_resource_name) . '.config' . $this->smarty->php_ext;
|
return $_compile_dir . $_filepath . '.' . basename($this->config_resource_name) . '.config' . $this->smarty->php_ext;
|
||||||
}
|
}
|
||||||
|
@@ -138,12 +138,12 @@ class Smarty_Internal_Resource_Extend extends Smarty_Internal_Base {
|
|||||||
$_filepath = (string)abs(crc32($_template->resource_name));
|
$_filepath = (string)abs(crc32($_template->resource_name));
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($_template->smarty->use_sub_dirs) {
|
if ($_template->smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR
|
$_filepath = substr($_filepath, 0, 3) . DS
|
||||||
. substr($_filepath, 0, 2) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 2) . DS
|
||||||
. substr($_filepath, 0, 1) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 1) . DS
|
||||||
. $_filepath;
|
. $_filepath;
|
||||||
}
|
}
|
||||||
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
|
||||||
if (isset($_template->compile_id)) {
|
if (isset($_template->compile_id)) {
|
||||||
$_filepath = $_template->compile_id . $_compile_dir_sep . $_filepath;
|
$_filepath = $_template->compile_id . $_compile_dir_sep . $_filepath;
|
||||||
}
|
}
|
||||||
@@ -153,8 +153,8 @@ class Smarty_Internal_Resource_Extend extends Smarty_Internal_Base {
|
|||||||
$_cache = '';
|
$_cache = '';
|
||||||
}
|
}
|
||||||
$_compile_dir = $_template->smarty->compile_dir;
|
$_compile_dir = $_template->smarty->compile_dir;
|
||||||
if (substr($_compile_dir, -1) != DIRECTORY_SEPARATOR) {
|
if (substr($_compile_dir, -1) != DS) {
|
||||||
$_compile_dir .= DIRECTORY_SEPARATOR;
|
$_compile_dir .= DS;
|
||||||
}
|
}
|
||||||
return $_compile_dir . $_filepath . '.' . basename($_files[0]) . $_cache . $_template->smarty->php_ext;
|
return $_compile_dir . $_filepath . '.' . basename($_files[0]) . $_cache . $_template->smarty->php_ext;
|
||||||
}
|
}
|
||||||
|
@@ -100,12 +100,12 @@ class Smarty_Internal_Resource_File {
|
|||||||
$_filepath = (string)abs(crc32($_template->resource_name));
|
$_filepath = (string)abs(crc32($_template->resource_name));
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($_template->smarty->use_sub_dirs) {
|
if ($_template->smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR
|
$_filepath = substr($_filepath, 0, 3) . DS
|
||||||
. substr($_filepath, 0, 2) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 2) . DS
|
||||||
. substr($_filepath, 0, 1) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 1) . DS
|
||||||
. $_filepath;
|
. $_filepath;
|
||||||
}
|
}
|
||||||
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
|
||||||
if (isset($_template->compile_id)) {
|
if (isset($_template->compile_id)) {
|
||||||
$_filepath = $_template->compile_id . $_compile_dir_sep . $_filepath;
|
$_filepath = $_template->compile_id . $_compile_dir_sep . $_filepath;
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ class Smarty_Internal_Resource_File {
|
|||||||
}
|
}
|
||||||
$_compile_dir = $_template->smarty->compile_dir;
|
$_compile_dir = $_template->smarty->compile_dir;
|
||||||
if (strpos('/\\', substr($_compile_dir, -1)) === false) {
|
if (strpos('/\\', substr($_compile_dir, -1)) === false) {
|
||||||
$_compile_dir .= DIRECTORY_SEPARATOR;
|
$_compile_dir .= DS;
|
||||||
}
|
}
|
||||||
return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . $_cache . $_template->smarty->php_ext;
|
return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . $_cache . $_template->smarty->php_ext;
|
||||||
}
|
}
|
||||||
|
@@ -114,12 +114,12 @@ class Smarty_Internal_Resource_Registered {
|
|||||||
$_filepath = (string)abs(crc32($_template->resource_name));
|
$_filepath = (string)abs(crc32($_template->resource_name));
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($_template->smarty->use_sub_dirs) {
|
if ($_template->smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR
|
$_filepath = substr($_filepath, 0, 3) . DS
|
||||||
. substr($_filepath, 0, 2) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 2) . DS
|
||||||
. substr($_filepath, 0, 1) . DIRECTORY_SEPARATOR
|
. substr($_filepath, 0, 1) . DS
|
||||||
. $_filepath;
|
. $_filepath;
|
||||||
}
|
}
|
||||||
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
|
||||||
if (isset($_template->compile_id)) {
|
if (isset($_template->compile_id)) {
|
||||||
$_filepath = $_template->compile_id . $_compile_dir_sep . $_filepath;
|
$_filepath = $_template->compile_id . $_compile_dir_sep . $_filepath;
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ class Smarty_Internal_Resource_Registered {
|
|||||||
}
|
}
|
||||||
$_compile_dir = $_template->smarty->compile_dir;
|
$_compile_dir = $_template->smarty->compile_dir;
|
||||||
if (strpos('/\\', substr($_compile_dir, -1)) === false) {
|
if (strpos('/\\', substr($_compile_dir, -1)) === false) {
|
||||||
$_compile_dir .= DIRECTORY_SEPARATOR;
|
$_compile_dir .= DS;
|
||||||
}
|
}
|
||||||
return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . '.' . $_template->resource_type . $_cache . $_template->smarty->php_ext;
|
return $_compile_dir . $_filepath . '.' . basename($_template->resource_name) . '.' . $_template->resource_type . $_cache . $_template->smarty->php_ext;
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ class Smarty_Internal_Security_Handler {
|
|||||||
foreach ((array)$this->smarty->template_dir as $curr_dir) {
|
foreach ((array)$this->smarty->template_dir as $curr_dir) {
|
||||||
if (($_cd = realpath($curr_dir)) !== false &&
|
if (($_cd = realpath($curr_dir)) !== false &&
|
||||||
strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
||||||
(strlen($_rp) == strlen($_cd) || substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR)) {
|
(strlen($_rp) == strlen($_cd) || substr($_rp, strlen($_cd), 1) == DS)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ class Smarty_Internal_Security_Handler {
|
|||||||
if ($_cd == $_rp) {
|
if ($_cd == $_rp) {
|
||||||
return true;
|
return true;
|
||||||
} elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
} elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
||||||
(strlen($_rp) == strlen($_cd) || substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR)) {
|
(strlen($_rp) == strlen($_cd) || substr($_rp, strlen($_cd), 1) == DS)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ class Smarty_Internal_Security_Handler {
|
|||||||
if ($_cd == $_rp) {
|
if ($_cd == $_rp) {
|
||||||
return true;
|
return true;
|
||||||
} elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
} elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
||||||
substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
|
substr($_rp, strlen($_cd), 1) == DS) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -613,7 +613,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
|||||||
}
|
}
|
||||||
foreach((array)$this->smarty->template_dir as $_template_dir) {
|
foreach((array)$this->smarty->template_dir as $_template_dir) {
|
||||||
if (strpos('/\\', substr($_template_dir, -1)) === false) {
|
if (strpos('/\\', substr($_template_dir, -1)) === false) {
|
||||||
$_template_dir .= DIRECTORY_SEPARATOR;
|
$_template_dir .= DS;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_filepath = $_template_dir . $file;
|
$_filepath = $_template_dir . $file;
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
function clear_compiled_tpl($smarty, $resource_name = null, $compile_id = null, $exp_time = null)
|
function clear_compiled_tpl($smarty, $resource_name = null, $compile_id = null, $exp_time = null)
|
||||||
{
|
{
|
||||||
$_dir_sep = $smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
|
$_dir_sep = $smarty->use_sub_dirs ? DS : '^';
|
||||||
if (isset($resource_name)) {
|
if (isset($resource_name)) {
|
||||||
$_resource_part_1 = $resource_name . $smarty->php_ext;
|
$_resource_part_1 = $resource_name . $smarty->php_ext;
|
||||||
$_resource_part_2 = $resource_name . '.cache' . $smarty->php_ext;
|
$_resource_part_2 = $resource_name . '.cache' . $smarty->php_ext;
|
||||||
|
Reference in New Issue
Block a user