@@ -27,8 +27,8 @@ |
||
27 | 27 | |
28 | 28 | foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) { |
29 | 29 | $_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s', |
30 | - array(&$smarty, '_process_compiled_include_callback'), |
|
31 | - $_return); |
|
30 | + array(&$smarty, '_process_compiled_include_callback'), |
|
31 | + $_return); |
|
32 | 32 | } |
33 | 33 | $smarty->_cache_including = $_cache_including; |
34 | 34 | return $_return; |
@@ -25,17 +25,17 @@ |
||
25 | 25 | $_rp = realpath($params['resource_name']); |
26 | 26 | if (isset($params['resource_base_path'])) { |
27 | 27 | foreach ((array)$params['resource_base_path'] as $curr_dir) { |
28 | - if ( ($_cd = realpath($curr_dir)) !== false && |
|
28 | + if (($_cd = realpath($curr_dir)) !== false && |
|
29 | 29 | strncmp($_rp, $_cd, strlen($_cd)) == 0 && |
30 | - substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { |
|
30 | + substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) { |
|
31 | 31 | return true; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
35 | 35 | if (!empty($smarty->secure_dir)) { |
36 | 36 | foreach ((array)$smarty->secure_dir as $curr_dir) { |
37 | - if ( ($_cd = realpath($curr_dir)) !== false) { |
|
38 | - if($_cd == $_rp) { |
|
37 | + if (($_cd = realpath($curr_dir)) !== false) { |
|
38 | + if ($_cd == $_rp) { |
|
39 | 39 | return true; |
40 | 40 | } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 && |
41 | 41 | substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | if (!$_plugin[1]) { |
38 | - $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__); |
|
38 | + $smarty->_trigger_fatal_error("[plugin] resource '".$params['type']."' is not implemented", null, null, __FILE__, __LINE__); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | return; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $_resource_ops = array('source', 'timestamp', 'secure', 'trusted'); |
57 | 57 | $_resource_funcs = array(); |
58 | 58 | foreach ($_resource_ops as $_op) { |
59 | - $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op; |
|
59 | + $_plugin_func = 'smarty_resource_'.$params['type'].'_'.$_op; |
|
60 | 60 | if (!function_exists($_plugin_func)) { |
61 | 61 | $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__); |
62 | 62 | return; |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | |
20 | 20 | function smarty_core_rmdir($params, &$smarty) |
21 | 21 | { |
22 | - if(!isset($params['level'])) { $params['level'] = 1; } |
|
23 | - if(!isset($params['exp_time'])) { $params['exp_time'] = null; } |
|
22 | + if(!isset($params['level'])) { $params['level'] = 1; } |
|
23 | + if(!isset($params['exp_time'])) { $params['exp_time'] = null; } |
|
24 | 24 | |
25 | - if($_handle = @opendir($params['dirname'])) { |
|
25 | + if($_handle = @opendir($params['dirname'])) { |
|
26 | 26 | |
27 | 27 | while (false !== ($_entry = readdir($_handle))) { |
28 | 28 | if ($_entry != '.' && $_entry != '..') { |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | closedir($_handle); |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - if ($params['level']) { |
|
46 | - return @rmdir($params['dirname']); |
|
47 | - } |
|
48 | - return (bool)$_handle; |
|
45 | + if ($params['level']) { |
|
46 | + return @rmdir($params['dirname']); |
|
47 | + } |
|
48 | + return (bool)$_handle; |
|
49 | 49 | |
50 | 50 | } |
51 | 51 |
@@ -19,23 +19,23 @@ |
||
19 | 19 | |
20 | 20 | function smarty_core_rmdir($params, &$smarty) |
21 | 21 | { |
22 | - if(!isset($params['level'])) { $params['level'] = 1; } |
|
23 | - if(!isset($params['exp_time'])) { $params['exp_time'] = null; } |
|
22 | + if (!isset($params['level'])) { $params['level'] = 1; } |
|
23 | + if (!isset($params['exp_time'])) { $params['exp_time'] = null; } |
|
24 | 24 | |
25 | - if($_handle = @opendir($params['dirname'])) { |
|
25 | + if ($_handle = @opendir($params['dirname'])) { |
|
26 | 26 | |
27 | 27 | while (false !== ($_entry = readdir($_handle))) { |
28 | 28 | if ($_entry != '.' && $_entry != '..') { |
29 | - if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) { |
|
29 | + if (@is_dir($params['dirname'].DIRECTORY_SEPARATOR.$_entry)) { |
|
30 | 30 | $_params = array( |
31 | - 'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry, |
|
31 | + 'dirname' => $params['dirname'].DIRECTORY_SEPARATOR.$_entry, |
|
32 | 32 | 'level' => $params['level'] + 1, |
33 | 33 | 'exp_time' => $params['exp_time'] |
34 | 34 | ); |
35 | 35 | smarty_core_rmdir($_params, $smarty); |
36 | 36 | } |
37 | 37 | else { |
38 | - $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']); |
|
38 | + $smarty->_unlink($params['dirname'].DIRECTORY_SEPARATOR.$_entry, $params['exp_time']); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
@@ -33,8 +33,7 @@ |
||
33 | 33 | 'exp_time' => $params['exp_time'] |
34 | 34 | ); |
35 | 35 | smarty_core_rmdir($_params, $smarty); |
36 | - } |
|
37 | - else { |
|
36 | + } else { |
|
38 | 37 | $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']); |
39 | 38 | } |
40 | 39 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | if (!empty($smarty->cache_handler_func)) { |
36 | 36 | // use cache_handler function |
37 | 37 | call_user_func_array($smarty->cache_handler_func, |
38 | - array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)); |
|
38 | + array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)); |
|
39 | 39 | } else { |
40 | 40 | // use local cache file |
41 | 41 | $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $_cache_info = unserialize(substr($_contents, $_info_start, $_info_len)); |
55 | 55 | $params['results'] = substr($_contents, $_info_start + $_info_len); |
56 | 56 | |
57 | - if ($smarty->caching == 2 && isset ($_cache_info['expires'])){ |
|
57 | + if ($smarty->caching == 2 && isset ($_cache_info['expires'])) { |
|
58 | 58 | // caching by expiration time |
59 | 59 | if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) { |
60 | 60 | // cache expired, regenerate |
@@ -25,10 +25,10 @@ |
||
25 | 25 | $_name = $params['args']['name']; |
26 | 26 | if (!isset($smarty->_cache_info['insert_tags'][$_name])) { |
27 | 27 | $smarty->_cache_info['insert_tags'][$_name] = array('insert', |
28 | - $_name, |
|
29 | - $smarty->_plugins['insert'][$_name][1], |
|
30 | - $smarty->_plugins['insert'][$_name][2], |
|
31 | - !empty($params['args']['script']) ? true : false); |
|
28 | + $_name, |
|
29 | + $smarty->_plugins['insert'][$_name][1], |
|
30 | + $smarty->_plugins['insert'][$_name][2], |
|
31 | + !empty($params['args']['script']) ? true : false); |
|
32 | 32 | } |
33 | 33 | return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5; |
34 | 34 | } else { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | function smarty_core_run_insert_handler($params, &$smarty) |
15 | 15 | { |
16 | 16 | |
17 | - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); |
|
17 | + require_once(SMARTY_CORE_DIR.'core.get_microtime.php'); |
|
18 | 18 | if ($smarty->debugging) { |
19 | 19 | $_params = array(); |
20 | 20 | $_debug_start_time = smarty_core_get_microtime($_params, $smarty); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } else { |
35 | 35 | if (isset($params['args']['script'])) { |
36 | 36 | $_params = array('resource_name' => $smarty->_dequote($params['args']['script'])); |
37 | - require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); |
|
38 | - if(!smarty_core_get_php_resource($_params, $smarty)) { |
|
37 | + require_once(SMARTY_CORE_DIR.'core.get_php_resource.php'); |
|
38 | + if (!smarty_core_get_php_resource($_params, $smarty)) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $_content = $_funcname($params['args'], $smarty); |
52 | 52 | if ($smarty->debugging) { |
53 | 53 | $_params = array(); |
54 | - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); |
|
54 | + require_once(SMARTY_CORE_DIR.'core.get_microtime.php'); |
|
55 | 55 | $smarty->_smarty_debug_info[] = array('type' => 'insert', |
56 | 56 | 'filename' => 'insert_'.$params['args']['name'], |
57 | 57 | 'depth' => $smarty->_inclusion_depth, |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | if (!file_exists($params['dir'])) { |
19 | 19 | $_open_basedir_ini = ini_get('open_basedir'); |
20 | 20 | |
21 | - if (DIRECTORY_SEPARATOR=='/') { |
|
21 | + if (DIRECTORY_SEPARATOR == '/') { |
|
22 | 22 | /* unix-style paths */ |
23 | 23 | $_dir = $params['dir']; |
24 | 24 | $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY); |
25 | - $_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/'; |
|
26 | - if($_use_open_basedir = !empty($_open_basedir_ini)) { |
|
25 | + $_new_dir = (substr($_dir, 0, 1) == '/') ? '/' : getcwd().'/'; |
|
26 | + if ($_use_open_basedir = !empty($_open_basedir_ini)) { |
|
27 | 27 | $_open_basedirs = explode(':', $_open_basedir_ini); |
28 | 28 | } |
29 | 29 | |
30 | 30 | } else { |
31 | 31 | /* other-style paths */ |
32 | - $_dir = str_replace('\\','/', $params['dir']); |
|
32 | + $_dir = str_replace('\\', '/', $params['dir']); |
|
33 | 33 | $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY); |
34 | 34 | if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) { |
35 | 35 | /* leading "//" for network volume, or "[letter]:/" for full path */ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | - if($_use_open_basedir = !empty($_open_basedir_ini)) { |
|
45 | + if ($_use_open_basedir = !empty($_open_basedir_ini)) { |
|
46 | 46 | $_open_basedirs = explode(';', str_replace('\\', '/', $_open_basedir_ini)); |
47 | 47 | } |
48 | 48 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | if ($_make_new_dir && !file_exists($_new_dir) && !@mkdir($_new_dir, $smarty->_dir_perms) && !is_dir($_new_dir)) { |
69 | - $smarty->trigger_error("problem creating directory '" . $_new_dir . "'"); |
|
69 | + $smarty->trigger_error("problem creating directory '".$_new_dir."'"); |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | $_new_dir .= '/'; |
@@ -35,7 +35,9 @@ |
||
35 | 35 | /* leading "//" for network volume, or "[letter]:/" for full path */ |
36 | 36 | $_new_dir = $_root_dir[1]; |
37 | 37 | /* remove drive-letter from _dir_parts */ |
38 | - if (isset($_root_dir[3])) array_shift($_dir_parts); |
|
38 | + if (isset($_root_dir[3])) { |
|
39 | + array_shift($_dir_parts); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | } else { |
41 | 43 | $_new_dir = str_replace('\\', '/', getcwd()).'/'; |
@@ -14,18 +14,18 @@ |
||
14 | 14 | */ |
15 | 15 | function smarty_core_write_compiled_resource($params, &$smarty) |
16 | 16 | { |
17 | - if(!@is_writable($smarty->compile_dir)) { |
|
17 | + if (!@is_writable($smarty->compile_dir)) { |
|
18 | 18 | // compile_dir not writable, see if it exists |
19 | - if(!@is_dir($smarty->compile_dir)) { |
|
20 | - $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); |
|
19 | + if (!@is_dir($smarty->compile_dir)) { |
|
20 | + $smarty->trigger_error('the $compile_dir \''.$smarty->compile_dir.'\' does not exist, or is not a directory.', E_USER_ERROR); |
|
21 | 21 | return false; |
22 | 22 | } |
23 | - $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); |
|
23 | + $smarty->trigger_error('unable to write to $compile_dir \''.realpath($smarty->compile_dir).'\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); |
|
24 | 24 | return false; |
25 | 25 | } |
26 | 26 | |
27 | 27 | $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true); |
28 | - require_once(SMARTY_CORE_DIR . 'core.write_file.php'); |
|
28 | + require_once(SMARTY_CORE_DIR.'core.write_file.php'); |
|
29 | 29 | smarty_core_write_file($_params, $smarty); |
30 | 30 | return true; |
31 | 31 | } |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | |
28 | 28 | if ($params['resource_type'] == 'file') { |
29 | 29 | $_readable = false; |
30 | - if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) { |
|
30 | + if (file_exists($params['resource_name']) && is_readable($params['resource_name'])) { |
|
31 | 31 | $_readable = true; |
32 | 32 | } else { |
33 | 33 | // test for file in include_path |
34 | 34 | $_params = array('file_path' => $params['resource_name']); |
35 | - require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); |
|
36 | - if(smarty_core_get_include_path($_params, $smarty)) { |
|
35 | + require_once(SMARTY_CORE_DIR.'core.get_include_path.php'); |
|
36 | + if (smarty_core_get_include_path($_params, $smarty)) { |
|
37 | 37 | $_include_path = $_params['new_file_path']; |
38 | 38 | $_readable = true; |
39 | 39 | } |
@@ -56,14 +56,14 @@ discard block |
||
56 | 56 | |
57 | 57 | if ($_readable) { |
58 | 58 | if ($smarty->security) { |
59 | - require_once(SMARTY_CORE_DIR . 'core.is_trusted.php'); |
|
59 | + require_once(SMARTY_CORE_DIR.'core.is_trusted.php'); |
|
60 | 60 | if (!smarty_core_is_trusted($params, $smarty)) { |
61 | - $smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted'); |
|
61 | + $smarty->$_error_funcc('(secure mode) '.$params['resource_type'].':'.$params['resource_name'].' is not trusted'); |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | } |
65 | 65 | } else { |
66 | - $smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable'); |
|
66 | + $smarty->$_error_funcc($params['resource_type'].':'.$params['resource_name'].' is not readable'); |
|
67 | 67 | return false; |
68 | 68 | } |
69 | 69 |