Fix linting
This commit is contained in:
parent
5b17a7dbd7
commit
1614145b18
262 changed files with 45324 additions and 42695 deletions
|
|
@ -21,7 +21,6 @@ function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
|||
$_return = false;
|
||||
|
||||
foreach ((array)$smarty->plugins_dir as $_plugin_dir) {
|
||||
|
||||
$_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
|
||||
|
||||
// see if path is relative
|
||||
|
|
@ -40,16 +39,15 @@ function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
|||
}
|
||||
}
|
||||
|
||||
if($_return === false) {
|
||||
if ($_return === false) {
|
||||
// still not found, try PHP include_path
|
||||
if(isset($_relative_paths)) {
|
||||
if (isset($_relative_paths)) {
|
||||
foreach ((array)$_relative_paths as $_plugin_dir) {
|
||||
|
||||
$_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename;
|
||||
|
||||
$_params = array('file_path' => $_plugin_filepath);
|
||||
require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
|
||||
if(smarty_core_get_include_path($_params, $smarty)) {
|
||||
if (smarty_core_get_include_path($_params, $smarty)) {
|
||||
$_return = $_params['new_file_path'];
|
||||
break;
|
||||
}
|
||||
|
|
@ -61,5 +59,3 @@ function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -16,28 +16,26 @@
|
|||
*/
|
||||
function smarty_core_assign_smarty_interface($params, &$smarty)
|
||||
{
|
||||
if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) {
|
||||
return;
|
||||
}
|
||||
if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$_globals_map = array('g' => 'HTTP_GET_VARS',
|
||||
$_globals_map = array('g' => 'HTTP_GET_VARS',
|
||||
'p' => 'HTTP_POST_VARS',
|
||||
'c' => 'HTTP_COOKIE_VARS',
|
||||
's' => 'HTTP_SERVER_VARS',
|
||||
'e' => 'HTTP_ENV_VARS');
|
||||
|
||||
$_smarty_vars_request = array();
|
||||
$_smarty_vars_request = array();
|
||||
|
||||
foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) {
|
||||
if (isset($_globals_map[$_c])) {
|
||||
$_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]);
|
||||
}
|
||||
foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) {
|
||||
if (isset($_globals_map[$_c])) {
|
||||
$_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]);
|
||||
}
|
||||
$_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']);
|
||||
}
|
||||
$_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']);
|
||||
|
||||
$smarty->_smarty_vars['request'] = $_smarty_vars_request;
|
||||
$smarty->_smarty_vars['request'] = $_smarty_vars_request;
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -23,29 +23,27 @@ function smarty_core_create_dir_structure($params, &$smarty)
|
|||
$_dir = $params['dir'];
|
||||
$_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/';
|
||||
if($_use_open_basedir = !empty($_open_basedir_ini)) {
|
||||
if ($_use_open_basedir = !empty($_open_basedir_ini)) {
|
||||
$_open_basedirs = explode(':', $_open_basedir_ini);
|
||||
}
|
||||
|
||||
} else {
|
||||
/* other-style paths */
|
||||
$_dir = str_replace('\\','/', $params['dir']);
|
||||
$_dir = str_replace('\\', '/', $params['dir']);
|
||||
$_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY);
|
||||
if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) {
|
||||
/* leading "//" for network volume, or "[letter]:/" for full path */
|
||||
$_new_dir = $_root_dir[1];
|
||||
/* remove drive-letter from _dir_parts */
|
||||
if (isset($_root_dir[3])) array_shift($_dir_parts);
|
||||
|
||||
if (isset($_root_dir[3])) {
|
||||
array_shift($_dir_parts);
|
||||
}
|
||||
} else {
|
||||
$_new_dir = str_replace('\\', '/', getcwd()).'/';
|
||||
|
||||
}
|
||||
|
||||
if($_use_open_basedir = !empty($_open_basedir_ini)) {
|
||||
if ($_use_open_basedir = !empty($_open_basedir_ini)) {
|
||||
$_open_basedirs = explode(';', str_replace('\\', '/', $_open_basedir_ini));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* all paths use "/" only from here */
|
||||
|
|
@ -75,5 +73,3 @@ function smarty_core_create_dir_structure($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ function smarty_core_display_debug_console($params, &$smarty)
|
|||
// we must force compile the debug template in case the environment
|
||||
// changed between separate applications.
|
||||
|
||||
if(empty($smarty->debug_tpl)) {
|
||||
if (empty($smarty->debug_tpl)) {
|
||||
// set path to debug template from SMARTY_DIR
|
||||
$smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
|
||||
if($smarty->security && is_file($smarty->debug_tpl)) {
|
||||
if ($smarty->security && is_file($smarty->debug_tpl)) {
|
||||
$smarty->secure_dir[] = realpath($smarty->debug_tpl);
|
||||
}
|
||||
$smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
|
||||
|
|
@ -38,8 +38,7 @@ function smarty_core_display_debug_console($params, &$smarty)
|
|||
$smarty->_compile_id = null;
|
||||
|
||||
$_compile_path = $smarty->_get_compile_path($smarty->debug_tpl);
|
||||
if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path))
|
||||
{
|
||||
if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) {
|
||||
ob_start();
|
||||
$smarty->_include($_compile_path);
|
||||
$_results = ob_get_contents();
|
||||
|
|
@ -57,5 +56,3 @@ function smarty_core_display_debug_console($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -20,19 +20,19 @@ function smarty_core_get_include_path(&$params, &$smarty)
|
|||
{
|
||||
static $_path_array = null;
|
||||
|
||||
if(!isset($_path_array)) {
|
||||
if (!isset($_path_array)) {
|
||||
$_ini_include_path = ini_get('include_path');
|
||||
|
||||
if(strstr($_ini_include_path,';')) {
|
||||
if (strstr($_ini_include_path, ';')) {
|
||||
// windows pathnames
|
||||
$_path_array = explode(';',$_ini_include_path);
|
||||
$_path_array = explode(';', $_ini_include_path);
|
||||
} else {
|
||||
$_path_array = explode(':',$_ini_include_path);
|
||||
$_path_array = explode(':', $_ini_include_path);
|
||||
}
|
||||
}
|
||||
foreach ($_path_array as $_include_path) {
|
||||
if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
|
||||
$params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
|
||||
$params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -40,5 +40,3 @@ function smarty_core_get_include_path(&$params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -19,5 +19,3 @@ function smarty_core_get_microtime($params, &$smarty)
|
|||
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
function smarty_core_get_php_resource(&$params, &$smarty)
|
||||
{
|
||||
|
||||
$params['resource_base_path'] = $smarty->trusted_dir;
|
||||
$smarty->_parse_resource_name($params, $smarty);
|
||||
|
||||
|
|
@ -27,22 +26,24 @@ function smarty_core_get_php_resource(&$params, &$smarty)
|
|||
|
||||
if ($params['resource_type'] == 'file') {
|
||||
$_readable = false;
|
||||
if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) {
|
||||
if (file_exists($params['resource_name']) && is_readable($params['resource_name'])) {
|
||||
$_readable = true;
|
||||
} else {
|
||||
// test for file in include_path
|
||||
$_params = array('file_path' => $params['resource_name']);
|
||||
require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
|
||||
if(smarty_core_get_include_path($_params, $smarty)) {
|
||||
if (smarty_core_get_include_path($_params, $smarty)) {
|
||||
$_include_path = $_params['new_file_path'];
|
||||
$_readable = true;
|
||||
}
|
||||
}
|
||||
} else if ($params['resource_type'] != 'file') {
|
||||
} elseif ($params['resource_type'] != 'file') {
|
||||
$_template_source = null;
|
||||
$_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0])
|
||||
&& call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],
|
||||
array($params['resource_name'], &$_template_source, &$smarty));
|
||||
&& call_user_func_array(
|
||||
$smarty->_plugins['resource'][$params['resource_type']][0][0],
|
||||
array($params['resource_name'], &$_template_source, &$smarty)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -76,5 +77,3 @@ function smarty_core_get_php_resource(&$params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -25,17 +25,17 @@ function smarty_core_is_secure($params, &$smarty)
|
|||
$_rp = realpath($params['resource_name']);
|
||||
if (isset($params['resource_base_path'])) {
|
||||
foreach ((array)$params['resource_base_path'] as $curr_dir) {
|
||||
if ( ($_cd = realpath($curr_dir)) !== false &&
|
||||
if (($_cd = realpath($curr_dir)) !== false &&
|
||||
strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
||||
substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
|
||||
substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($smarty->secure_dir)) {
|
||||
foreach ((array)$smarty->secure_dir as $curr_dir) {
|
||||
if ( ($_cd = realpath($curr_dir)) !== false) {
|
||||
if($_cd == $_rp) {
|
||||
if (($_cd = realpath($curr_dir)) !== false) {
|
||||
if ($_cd == $_rp) {
|
||||
return true;
|
||||
} elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
|
||||
substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
|
||||
|
|
@ -48,12 +48,11 @@ function smarty_core_is_secure($params, &$smarty)
|
|||
// resource is not on local file system
|
||||
return call_user_func_array(
|
||||
$smarty->_plugins['resource'][$params['resource_type']][0][2],
|
||||
array($params['resource_name'], &$smarty));
|
||||
array($params['resource_name'], &$smarty)
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -22,26 +22,25 @@ function smarty_core_is_trusted($params, &$smarty)
|
|||
if (!empty($smarty->trusted_dir)) {
|
||||
$_rp = realpath($params['resource_name']);
|
||||
foreach ((array)$smarty->trusted_dir as $curr_dir) {
|
||||
if (!empty($curr_dir) && is_readable ($curr_dir)) {
|
||||
if (!empty($curr_dir) && is_readable($curr_dir)) {
|
||||
$_cd = realpath($curr_dir);
|
||||
if (strncmp($_rp, $_cd, strlen($_cd)) == 0
|
||||
&& substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) {
|
||||
&& substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) {
|
||||
$_smarty_trusted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// resource is not on local file system
|
||||
$_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
|
||||
array($params['resource_name'], $smarty));
|
||||
$_smarty_trusted = call_user_func_array(
|
||||
$smarty->_plugins['resource'][$params['resource_type']][0][3],
|
||||
array($params['resource_name'], $smarty)
|
||||
);
|
||||
}
|
||||
|
||||
return $_smarty_trusted;
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
function smarty_core_load_plugins($params, &$smarty)
|
||||
{
|
||||
|
||||
foreach ($params['plugins'] as $_plugin_info) {
|
||||
list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info;
|
||||
$_plugin = &$smarty->_plugins[$_type][$_name];
|
||||
|
|
@ -38,11 +37,13 @@ function smarty_core_load_plugins($params, &$smarty)
|
|||
$_plugin[1] = $_tpl_file;
|
||||
$_plugin[2] = $_tpl_line;
|
||||
$_plugin[3] = true;
|
||||
if (!isset($_plugin[4])) $_plugin[4] = true; /* cacheable */
|
||||
if (!isset($_plugin[4])) {
|
||||
$_plugin[4] = true;
|
||||
} /* cacheable */
|
||||
}
|
||||
}
|
||||
continue;
|
||||
} else if ($_type == 'insert') {
|
||||
} elseif ($_type == 'insert') {
|
||||
/*
|
||||
* For backwards compatibility, we check for insert functions in
|
||||
* the symbol table before trying to load them as a plugin.
|
||||
|
|
@ -78,7 +79,7 @@ function smarty_core_load_plugins($params, &$smarty)
|
|||
* In case of insert plugins, their code may be loaded later via
|
||||
* 'script' attribute.
|
||||
*/
|
||||
else if ($_type == 'insert' && $_delayed_loading) {
|
||||
elseif ($_type == 'insert' && $_delayed_loading) {
|
||||
$_plugin_func = 'smarty_' . $_type . '_' . $_name;
|
||||
$_found = true;
|
||||
}
|
||||
|
|
@ -103,7 +104,7 @@ function smarty_core_load_plugins($params, &$smarty)
|
|||
$_found = true;
|
||||
}
|
||||
}
|
||||
} else if ($_type == 'function') {
|
||||
} elseif ($_type == 'function') {
|
||||
/*
|
||||
* This is a catch-all situation.
|
||||
*/
|
||||
|
|
@ -121,5 +122,3 @@ function smarty_core_load_plugins($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -70,5 +70,3 @@ function smarty_core_load_resource_plugin($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@
|
|||
*/
|
||||
function smarty_core_process_cached_inserts($params, &$smarty)
|
||||
{
|
||||
preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
|
||||
$params['results'], $match);
|
||||
preg_match_all(
|
||||
'!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
|
||||
$params['results'],
|
||||
$match
|
||||
);
|
||||
list($cached_inserts, $insert_args) = $match;
|
||||
|
||||
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
|
||||
|
|
@ -30,7 +33,7 @@ function smarty_core_process_cached_inserts($params, &$smarty)
|
|||
if (isset($args['script'])) {
|
||||
$_params = array('resource_name' => $smarty->_dequote($args['script']));
|
||||
require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
|
||||
if(!smarty_core_get_php_resource($_params, $smarty)) {
|
||||
if (!smarty_core_get_php_resource($_params, $smarty)) {
|
||||
return false;
|
||||
}
|
||||
$resource_type = $_params['resource_type'];
|
||||
|
|
@ -67,5 +70,3 @@ function smarty_core_process_cached_inserts($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ function smarty_core_process_compiled_include($params, &$smarty)
|
|||
}
|
||||
|
||||
foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
|
||||
$_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
|
||||
array(&$smarty, '_process_compiled_include_callback'),
|
||||
$_return);
|
||||
$_return = preg_replace_callback(
|
||||
'!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
|
||||
array(&$smarty, '_process_compiled_include_callback'),
|
||||
$_return
|
||||
);
|
||||
}
|
||||
$smarty->_cache_including = $_cache_including;
|
||||
return $_return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -34,8 +34,10 @@ function smarty_core_read_cache_file(&$params, &$smarty)
|
|||
|
||||
if (!empty($smarty->cache_handler_func)) {
|
||||
// use cache_handler function
|
||||
call_user_func_array($smarty->cache_handler_func,
|
||||
array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null));
|
||||
call_user_func_array(
|
||||
$smarty->cache_handler_func,
|
||||
array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)
|
||||
);
|
||||
} else {
|
||||
// use local cache file
|
||||
$_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']);
|
||||
|
|
@ -54,7 +56,7 @@ function smarty_core_read_cache_file(&$params, &$smarty)
|
|||
$_cache_info = unserialize(substr($_contents, $_info_start, $_info_len));
|
||||
$params['results'] = substr($_contents, $_info_start + $_info_len);
|
||||
|
||||
if ($smarty->caching == 2 && isset ($_cache_info['expires'])){
|
||||
if ($smarty->caching == 2 && isset($_cache_info['expires'])) {
|
||||
// caching by expiration time
|
||||
if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) {
|
||||
// cache expired, regenerate
|
||||
|
|
@ -97,5 +99,3 @@ function smarty_core_read_cache_file(&$params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -19,10 +19,11 @@
|
|||
|
||||
function smarty_core_rm_auto($params, &$smarty)
|
||||
{
|
||||
if (!@is_dir($params['auto_base']))
|
||||
return false;
|
||||
if (!@is_dir($params['auto_base'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isset($params['auto_id']) && !isset($params['auto_source'])) {
|
||||
if (!isset($params['auto_id']) && !isset($params['auto_source'])) {
|
||||
$_params = array(
|
||||
'dirname' => $params['auto_base'],
|
||||
'level' => 0,
|
||||
|
|
@ -33,11 +34,12 @@ function smarty_core_rm_auto($params, &$smarty)
|
|||
} else {
|
||||
$_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']);
|
||||
|
||||
if(isset($params['auto_source'])) {
|
||||
if (isset($params['auto_source'])) {
|
||||
if (isset($params['extensions'])) {
|
||||
$_res = false;
|
||||
foreach ((array)$params['extensions'] as $_extension)
|
||||
foreach ((array)$params['extensions'] as $_extension) {
|
||||
$_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']);
|
||||
}
|
||||
} else {
|
||||
$_res = $smarty->_unlink($_tname, $params['exp_time']);
|
||||
}
|
||||
|
|
@ -54,7 +56,7 @@ function smarty_core_rm_auto($params, &$smarty)
|
|||
$_handle = opendir($params['auto_base']);
|
||||
$_res = true;
|
||||
while (false !== ($_filename = readdir($_handle))) {
|
||||
if($_filename == '.' || $_filename == '..') {
|
||||
if ($_filename == '.' || $_filename == '..') {
|
||||
continue;
|
||||
} elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) {
|
||||
$_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']);
|
||||
|
|
@ -67,5 +69,3 @@ function smarty_core_rm_auto($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@
|
|||
|
||||
function smarty_core_rmdir($params, &$smarty)
|
||||
{
|
||||
if(!isset($params['level'])) { $params['level'] = 1; }
|
||||
if(!isset($params['exp_time'])) { $params['exp_time'] = null; }
|
||||
|
||||
if($_handle = @opendir($params['dirname'])) {
|
||||
if (!isset($params['level'])) {
|
||||
$params['level'] = 1;
|
||||
}
|
||||
if (!isset($params['exp_time'])) {
|
||||
$params['exp_time'] = null;
|
||||
}
|
||||
|
||||
if ($_handle = @opendir($params['dirname'])) {
|
||||
while (false !== ($_entry = readdir($_handle))) {
|
||||
if ($_entry != '.' && $_entry != '..') {
|
||||
if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) {
|
||||
|
|
@ -33,22 +36,18 @@ function smarty_core_rmdir($params, &$smarty)
|
|||
'exp_time' => $params['exp_time']
|
||||
);
|
||||
smarty_core_rmdir($_params, $smarty);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($_handle);
|
||||
}
|
||||
|
||||
if ($params['level']) {
|
||||
return @rmdir($params['dirname']);
|
||||
}
|
||||
return (bool)$_handle;
|
||||
}
|
||||
|
||||
if ($params['level']) {
|
||||
return @rmdir($params['dirname']);
|
||||
}
|
||||
return (bool)$_handle;
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
*/
|
||||
function smarty_core_run_insert_handler($params, &$smarty)
|
||||
{
|
||||
|
||||
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
|
||||
if ($smarty->debugging) {
|
||||
$_params = array();
|
||||
|
|
@ -35,7 +34,7 @@ function smarty_core_run_insert_handler($params, &$smarty)
|
|||
if (isset($params['args']['script'])) {
|
||||
$_params = array('resource_name' => $smarty->_dequote($params['args']['script']));
|
||||
require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php');
|
||||
if(!smarty_core_get_php_resource($_params, $smarty)) {
|
||||
if (!smarty_core_get_php_resource($_params, $smarty)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -67,5 +66,3 @@ function smarty_core_run_insert_handler($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -46,5 +46,3 @@ function smarty_core_smarty_include_php($params, &$smarty)
|
|||
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function smarty_core_write_cache_file($params, &$smarty)
|
|||
|
||||
// put timestamp in cache header
|
||||
$smarty->_cache_info['timestamp'] = time();
|
||||
if ($smarty->cache_lifetime > -1){
|
||||
if ($smarty->cache_lifetime > -1) {
|
||||
// expiration set
|
||||
$smarty->_cache_info['expires'] = $smarty->_cache_info['timestamp'] + $smarty->cache_lifetime;
|
||||
} else {
|
||||
|
|
@ -50,7 +50,9 @@ function smarty_core_write_cache_file($params, &$smarty)
|
|||
$level--;
|
||||
unset($results[$i]);
|
||||
} else { // opening tag
|
||||
if ($level++ > 0) unset($results[$i]);
|
||||
if ($level++ > 0) {
|
||||
unset($results[$i]);
|
||||
}
|
||||
}
|
||||
$j++;
|
||||
} elseif ($level > 0) {
|
||||
|
|
@ -67,14 +69,16 @@ function smarty_core_write_cache_file($params, &$smarty)
|
|||
|
||||
if (!empty($smarty->cache_handler_func)) {
|
||||
// use cache_handler function
|
||||
call_user_func_array($smarty->cache_handler_func,
|
||||
array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], $smarty->_cache_info['expires']));
|
||||
call_user_func_array(
|
||||
$smarty->cache_handler_func,
|
||||
array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], $smarty->_cache_info['expires'])
|
||||
);
|
||||
} else {
|
||||
// use local cache file
|
||||
|
||||
if(!@is_writable($smarty->cache_dir)) {
|
||||
if (!@is_writable($smarty->cache_dir)) {
|
||||
// cache_dir not writable, see if it exists
|
||||
if(!@is_dir($smarty->cache_dir)) {
|
||||
if (!@is_dir($smarty->cache_dir)) {
|
||||
$smarty->trigger_error('the $cache_dir \'' . $smarty->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -92,5 +96,3 @@ function smarty_core_write_cache_file($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -18,11 +18,17 @@ function smarty_core_write_compiled_include($params, &$smarty)
|
|||
$_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; endif;';
|
||||
$_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\)\: echo \'\{/nocache\:(\\2)#(\\3)\}\'; endif;';
|
||||
|
||||
preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us',
|
||||
$params['compiled_content'], $_match_source, PREG_SET_ORDER);
|
||||
preg_match_all(
|
||||
'!('.$_tag_start.'(.*)'.$_tag_end.')!Us',
|
||||
$params['compiled_content'],
|
||||
$_match_source,
|
||||
PREG_SET_ORDER
|
||||
);
|
||||
|
||||
// no nocache-parts found: done
|
||||
if (count($_match_source)==0) return;
|
||||
if (count($_match_source)==0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// convert the matched php-code to functions
|
||||
$_include_compiled = "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
|
||||
|
|
@ -53,7 +59,9 @@ function smarty_core_write_compiled_include($params, &$smarty)
|
|||
} else {
|
||||
$open_tag .= $token;
|
||||
}
|
||||
if ($open_tag == '<?php ') break;
|
||||
if ($open_tag == '<?php ') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i=0, $count = count($tokens); $i < $count; $i++) {
|
||||
|
|
@ -62,7 +70,7 @@ function smarty_core_write_compiled_include($params, &$smarty)
|
|||
$tokens[$i] = '$' . $this_varname;
|
||||
} else {
|
||||
$tokens[$i] = $tokens[$i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$source = implode('', $tokens);
|
||||
|
|
@ -86,6 +94,3 @@ $source
|
|||
smarty_core_write_file($_params, $smarty);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
*/
|
||||
function smarty_core_write_compiled_resource($params, &$smarty)
|
||||
{
|
||||
if(!@is_writable($smarty->compile_dir)) {
|
||||
if (!@is_writable($smarty->compile_dir)) {
|
||||
// compile_dir not writable, see if it exists
|
||||
if(!@is_dir($smarty->compile_dir)) {
|
||||
if (!@is_dir($smarty->compile_dir)) {
|
||||
$smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -31,5 +31,3 @@ function smarty_core_write_compiled_resource($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ function smarty_core_write_file($params, &$smarty)
|
|||
fclose($fd);
|
||||
|
||||
if (DIRECTORY_SEPARATOR == '\\' || !@rename($_tmp_file, $params['filename'])) {
|
||||
// On platforms and filesystems that cannot overwrite with rename()
|
||||
// On platforms and filesystems that cannot overwrite with rename()
|
||||
// delete the file before renaming it -- because windows always suffers
|
||||
// this, it is short-circuited to avoid the initial rename() attempt
|
||||
@unlink($params['filename']);
|
||||
|
|
@ -50,5 +50,3 @@ function smarty_core_write_file($params, &$smarty)
|
|||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue