Upgraded Smarty from 2.6.20 to 2.6.25
git-svn-id: http://svn.cleancode.org/svn/pickles@126 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
parent
435eff72cf
commit
2c3766df0a
101 changed files with 80 additions and 565 deletions
|
@ -1,6 +0,0 @@
|
|||
Feel free to put the smarty icon on your site.
|
||||
You can cut-and-paste the following code, be sure
|
||||
to adjust the path to the image:
|
||||
|
||||
<a href="http://smarty.php.net/">
|
||||
<img src="smarty_icon.gif" border="0" height="31" width="88" /></a>
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,32 +0,0 @@
|
|||
Smarty Unit Testing
|
||||
-------------------
|
||||
|
||||
Smarty unit tests require the PEAR PHPUnit
|
||||
package to be installed. See if you have that
|
||||
installed with the following command:
|
||||
|
||||
$> pear list
|
||||
|
||||
If you don't see PHPUnit, install with this:
|
||||
|
||||
$> pear install PHPUnit
|
||||
|
||||
Edit the config.php file,
|
||||
be sure everything is defined correctly.
|
||||
|
||||
Be sure the following directories are present:
|
||||
|
||||
templates
|
||||
configs
|
||||
templates_c (writable)
|
||||
cache (writable)
|
||||
|
||||
Then run from the command line:
|
||||
php -q smarty_unit_test.php
|
||||
|
||||
Or from the web browser:
|
||||
http://www.your_domain.com/path/to/smarty_unit_test_gui.php
|
||||
|
||||
This will run a unit test for every component
|
||||
of Smarty and dump the results. All should pass
|
||||
with flying colors. :)
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
define('SMARTY_DIR', '../libs/');
|
||||
|
||||
?>
|
|
@ -1 +0,0 @@
|
|||
foo = "bar"
|
|
@ -1 +0,0 @@
|
|||
foo = 'bar'
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'test_cases.php';
|
||||
require_once 'PHPUnit.php';
|
||||
|
||||
$suite = new PHPUnit_TestSuite("SmartyTest");
|
||||
$result = PHPUnit::run($suite);
|
||||
|
||||
echo $result -> toString();
|
||||
?>
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'test_cases.php';
|
||||
require_once 'PHPUnit.php';
|
||||
|
||||
$suite = new PHPUnit_TestSuite("SmartyTest");
|
||||
$result = PHPUnit::run($suite);
|
||||
|
||||
echo $result -> toHTML();
|
||||
?>
|
|
@ -1 +0,0 @@
|
|||
{$foo}
|
|
@ -1 +0,0 @@
|
|||
{$smarty.const.TEST_CONSTANT}
|
|
@ -1 +0,0 @@
|
|||
TEST STRING
|
|
@ -1,12 +0,0 @@
|
|||
{foreach name=loop from=$items item=i}
|
||||
{$smarty.foreach.loop.iteration+2}
|
||||
{$smarty.foreach.loop.iteration+$flt}
|
||||
{$smarty.foreach.loop.iteration+$obj->six()}
|
||||
{$smarty.foreach.loop.iteration+$obj->ten}
|
||||
{/foreach}
|
||||
{$obj->ten+$flt}
|
||||
{$obj->ten*$flt}
|
||||
{$obj->six()+$obj->ten}
|
||||
{$obj->ten+$obj->ten}
|
||||
{$obj->six()+$flt}
|
||||
{$obj->six()+$items.0}
|
|
@ -1,8 +0,0 @@
|
|||
{$obj->meth($foo, 2.5)}
|
||||
{$obj->meth(2.5, $foo)}
|
||||
{$obj->meth(2.5)}
|
||||
{$obj->meth($obj->val, "foo")}
|
||||
{$obj->meth("foo", $obj->val)}
|
||||
{$obj->meth("foo", $foo)}
|
||||
{$obj->meth($obj->arr.one, 2)}
|
||||
{$obj->meth($obj->meth("foo", $foo))}
|
|
@ -1,450 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once './config.php';
|
||||
require_once SMARTY_DIR . 'Smarty.class.php';
|
||||
require_once 'PHPUnit.php';
|
||||
|
||||
class Obj {
|
||||
var $val = 'val';
|
||||
var $arr = array('one' => 'one', 'two' => 2);
|
||||
var $ten = 10;
|
||||
|
||||
function meth($a="a", $b="b") {
|
||||
return "$a:$b";
|
||||
}
|
||||
|
||||
function six() {
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SmartyTest extends PHPUnit_TestCase {
|
||||
// contains the object handle of the string class
|
||||
var $abc;
|
||||
// contains the last triggered error's errorlevel
|
||||
var $errorlevel;
|
||||
|
||||
// constructor of the test suite
|
||||
function SmartyTest($name) {
|
||||
$this->PHPUnit_TestCase($name);
|
||||
}
|
||||
|
||||
// called before the test functions will be executed
|
||||
// this function is defined in PHPUnit_TestCase and overwritten
|
||||
// here
|
||||
function setUp() {
|
||||
// create a new instance of String with the
|
||||
// string 'abc'
|
||||
$this->smarty = new Smarty;
|
||||
}
|
||||
// called after the test functions are executed
|
||||
// this function is defined in PHPUnit_TestCase and overwritten
|
||||
// here
|
||||
function tearDown() {
|
||||
// delete your instance
|
||||
unset($this->smarty);
|
||||
}
|
||||
|
||||
// dummy errorhandler for functions that are supposed to call trigger_error()
|
||||
function error_handler($errorlevel) {
|
||||
if ($errorlevel) $this->errorlevel = $errorlevel;
|
||||
}
|
||||
|
||||
/* DIRECTORY TESTS */
|
||||
|
||||
// test that template_dir exists
|
||||
function test_template_dir_exists() {
|
||||
$this->assertTrue(file_exists($this->smarty->template_dir));
|
||||
}
|
||||
// test that template_dir is a directory
|
||||
function test_template_dir_is_dir() {
|
||||
$this->assertTrue(is_dir($this->smarty->template_dir));
|
||||
}
|
||||
// test that template_dir is readable
|
||||
function test_template_dir_is_readable() {
|
||||
$this->assertTrue(is_readable($this->smarty->template_dir));
|
||||
}
|
||||
// test that config_dir exists
|
||||
function test_config_dir_exists() {
|
||||
$this->assertTrue(file_exists($this->smarty->config_dir));
|
||||
}
|
||||
// test that config_dir is a directory
|
||||
function test_config_dir_is_dir() {
|
||||
$this->assertTrue(is_dir($this->smarty->config_dir));
|
||||
}
|
||||
// test that config_dir is readable
|
||||
function test_config_dir_is_readable() {
|
||||
$this->assertTrue(is_readable($this->smarty->config_dir));
|
||||
}
|
||||
// test that compile_dir exists
|
||||
function test_compile_dir_exists() {
|
||||
$this->assertTrue(file_exists($this->smarty->compile_dir));
|
||||
}
|
||||
// test that compile_dir is a directory
|
||||
function test_compile_dir_is_dir() {
|
||||
$this->assertTrue(is_dir($this->smarty->compile_dir));
|
||||
}
|
||||
// test that compile_dir is readable
|
||||
function test_compile_dir_is_readable() {
|
||||
$this->assertTrue(is_readable($this->smarty->compile_dir));
|
||||
}
|
||||
// test that compile_dir is writable
|
||||
function test_compile_dir_is_writable() {
|
||||
$this->assertTrue(is_writable($this->smarty->compile_dir));
|
||||
}
|
||||
// test that cache_dir exists
|
||||
function test_cache_dir_exists() {
|
||||
$this->assertTrue(file_exists($this->smarty->cache_dir));
|
||||
}
|
||||
// test that cache_dir is a directory
|
||||
function test_cache_dir_is_dir() {
|
||||
$this->assertTrue(is_dir($this->smarty->cache_dir));
|
||||
}
|
||||
// test that cache_dir is readable
|
||||
function test_cache_dir_is_readable() {
|
||||
$this->assertTrue(is_readable($this->smarty->cache_dir));
|
||||
}
|
||||
// test that cache_dir is writable
|
||||
function test_cache_dir_is_writable() {
|
||||
$this->assertTrue(is_writable($this->smarty->cache_dir));
|
||||
}
|
||||
|
||||
/* METHOD EXISTS TESTS */
|
||||
function test_assign_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'assign'));
|
||||
}
|
||||
function test_assign_by_ref_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'assign_by_ref'));
|
||||
}
|
||||
function test_append_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'append'));
|
||||
}
|
||||
function test_append_by_ref_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'append_by_ref'));
|
||||
}
|
||||
function test_clear_assign_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'clear_assign'));
|
||||
}
|
||||
function test_register_function_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_function'));
|
||||
}
|
||||
function test_unregister_function_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_function'));
|
||||
}
|
||||
function test_register_object_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_object'));
|
||||
}
|
||||
function test_unregister_object_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_object'));
|
||||
}
|
||||
function test_register_block_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_block'));
|
||||
}
|
||||
function test_unregister_block_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_block'));
|
||||
}
|
||||
function test_register_compiler_function_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_compiler_function'));
|
||||
}
|
||||
function test_unregister_compiler_function_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_compiler_function'));
|
||||
}
|
||||
function test_register_modifier_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_modifier'));
|
||||
}
|
||||
function test_unregister_modifier_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_modifier'));
|
||||
}
|
||||
function test_register_resource_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_resource'));
|
||||
}
|
||||
function test_unregister_resource_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_resource'));
|
||||
}
|
||||
function test_register_prefilter_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_prefilter'));
|
||||
}
|
||||
function test_unregister_prefilter_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_prefilter'));
|
||||
}
|
||||
function test_register_postfilter_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_postfilter'));
|
||||
}
|
||||
function test_unregister_postfilter_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_postfilter'));
|
||||
}
|
||||
function test_register_outputfilter_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'register_outputfilter'));
|
||||
}
|
||||
function test_unregister_outputfilter_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'unregister_outputfilter'));
|
||||
}
|
||||
function test_load_filter_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'load_filter'));
|
||||
}
|
||||
function test_clear_cache_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'clear_cache'));
|
||||
}
|
||||
function test_clear_all_cache_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'clear_all_cache'));
|
||||
}
|
||||
function test_is_cached_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'is_cached'));
|
||||
}
|
||||
function test_clear_all_assign_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'clear_all_assign'));
|
||||
}
|
||||
function test_clear_compiled_tpl_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'clear_compiled_tpl'));
|
||||
}
|
||||
function test_template_exists_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'template_exists'));
|
||||
}
|
||||
function test_get_template_vars_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'get_template_vars'));
|
||||
}
|
||||
function test_get_config_vars_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'get_config_vars'));
|
||||
}
|
||||
function test_trigger_error_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'trigger_error'));
|
||||
}
|
||||
function test_display_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'display'));
|
||||
}
|
||||
function test_fetch_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'fetch'));
|
||||
}
|
||||
function test_config_load_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'config_load'));
|
||||
}
|
||||
function test_get_registered_object_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'get_registered_object'));
|
||||
}
|
||||
function test_clear_config_method_exists() {
|
||||
$this->assertTrue(method_exists($this->smarty, 'clear_config'));
|
||||
}
|
||||
function test_get_plugin_filepath() {
|
||||
$this->assertTrue(method_exists($this->smarty, '_get_plugin_filepath'));
|
||||
}
|
||||
|
||||
|
||||
function test_clear_compiled_tpl() {
|
||||
$this->assertTrue($this->smarty->clear_compiled_tpl());
|
||||
}
|
||||
|
||||
/* DISPLAY TESTS */
|
||||
|
||||
// test that display() executes properly
|
||||
function test_call_to_display() {
|
||||
ob_start();
|
||||
$this->smarty->display('index.tpl');
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$this->assertEquals($output, 'TEST STRING');
|
||||
}
|
||||
|
||||
/* FETCH TESTS */
|
||||
|
||||
// test that fetch() executes properly
|
||||
function test_call_to_fetch() {
|
||||
$this->assertEquals($this->smarty->fetch('index.tpl'), 'TEST STRING');
|
||||
}
|
||||
|
||||
/* ASSIGN TESTS */
|
||||
|
||||
// test assigning a simple template variable
|
||||
function test_assign_var() {
|
||||
$this->smarty->assign('foo', 'bar');
|
||||
$this->assertEquals($this->smarty->fetch('assign_var.tpl'), 'bar');
|
||||
}
|
||||
|
||||
/* PARSING TESTS */
|
||||
|
||||
// test assigning and calling an object
|
||||
function test_parse_obj_meth() {
|
||||
$obj = new Obj();
|
||||
$this->smarty->assign('obj', $obj);
|
||||
$this->smarty->assign('foo', 'foo');
|
||||
$this->assertEquals('foo:2.5
|
||||
2.5:foo
|
||||
2.5:b
|
||||
val:foo
|
||||
foo:val
|
||||
foo:foo
|
||||
one:2
|
||||
foo:foo:b', $this->smarty->fetch('parse_obj_meth.tpl'));
|
||||
}
|
||||
|
||||
// test assigning and calling an object
|
||||
function test_parse_math() {
|
||||
$obj = new Obj();
|
||||
$this->smarty->assign('obj', $obj);
|
||||
$this->smarty->assign('flt', 2.5);
|
||||
$this->smarty->assign('items', array(1, 2));
|
||||
$this->assertEquals('3
|
||||
3.5
|
||||
7
|
||||
11
|
||||
4
|
||||
4.5
|
||||
8
|
||||
12
|
||||
12.5
|
||||
25
|
||||
16
|
||||
20
|
||||
8.5
|
||||
7', $this->smarty->fetch('parse_math.tpl'));
|
||||
}
|
||||
|
||||
/* CONFIG FILE TESTS */
|
||||
|
||||
// test assigning a double quoted global variable
|
||||
function test_config_load_globals_double_quotes() {
|
||||
// load the global var
|
||||
$this->smarty->config_load('globals_double_quotes.conf');
|
||||
// test that it is assigned
|
||||
$this->assertEquals($this->smarty->_config[0]['vars']['foo'], 'bar');
|
||||
}
|
||||
|
||||
// test assigning a single quoted global variable
|
||||
function test_config_load_globals_single_quotes() {
|
||||
// load the global var
|
||||
$this->smarty->config_load('globals_single_quotes.conf');
|
||||
// test that it is assigned
|
||||
$this->assertEquals($this->smarty->_config[0]['vars']['foo'], 'bar');
|
||||
}
|
||||
|
||||
// test loading and running modifier.escape.php
|
||||
function test_escape_modifier_get_plugins_filepath() {
|
||||
$filepath = $this->smarty->_get_plugin_filepath('modifier', 'escape');
|
||||
$this->assertTrue($filepath);
|
||||
}
|
||||
|
||||
function test_escape_modifier_include_file() {
|
||||
$filepath = $this->smarty->_get_plugin_filepath('modifier', 'escape');
|
||||
$this->assertTrue(include($filepath));
|
||||
}
|
||||
|
||||
function test_escape_modifier_function_exists() {
|
||||
$this->assertTrue(function_exists('smarty_modifier_escape'));
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_default() {
|
||||
$string = smarty_modifier_escape("<html><body></body></html>");
|
||||
$this->assertEquals('<html><body></body></html>',
|
||||
$string);
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_html() {
|
||||
$string = smarty_modifier_escape("<html><body></body></html>", 'html');
|
||||
$this->assertEquals('<html><body></body></html>',
|
||||
$string);
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_htmlall() {
|
||||
$string = smarty_modifier_escape("<html><body></body></html>", 'htmlall');
|
||||
$this->assertEquals('<html><body></body></html>',
|
||||
$string);
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_url() {
|
||||
$string = smarty_modifier_escape("http://test.com?foo=bar", 'url');
|
||||
$this->assertEquals('http%3A%2F%2Ftest.com%3Ffoo%3Dbar', $string);
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_quotes() {
|
||||
$string = smarty_modifier_escape("'\\'\\''", 'quotes');
|
||||
$this->assertEquals("\\'\\'\\'\\'", $string);
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_hex() {
|
||||
$string = smarty_modifier_escape("abcd", 'hex');
|
||||
$this->assertEquals('%61%62%63%64', $string);
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_hexentity() {
|
||||
$string = smarty_modifier_escape("ABCD", 'hexentity');
|
||||
$this->assertEquals('ABCD', $string);
|
||||
}
|
||||
|
||||
function test_escape_modifier_escape_javascript() {
|
||||
$string = smarty_modifier_escape("\r\n\\", 'javascript');
|
||||
$this->assertEquals('\\r\\n\\\\', $string);
|
||||
}
|
||||
|
||||
|
||||
function test_core_is_secure_file_exists() {
|
||||
$file = SMARTY_CORE_DIR . 'core.is_secure.php';
|
||||
$this->assertTrue(file_exists($file));
|
||||
}
|
||||
|
||||
function test_core_is_secure_file_include() {
|
||||
$file = SMARTY_CORE_DIR . 'core.is_secure.php';
|
||||
$this->assertTrue(include($file));
|
||||
}
|
||||
|
||||
function test_core_is_secure_function_exists() {
|
||||
$this->assertTrue(function_exists('smarty_core_is_secure'));
|
||||
}
|
||||
|
||||
function test_core_is_secure_function_is_secure_true() {
|
||||
$security = $this->smarty->security;
|
||||
$this->smarty->security = true;
|
||||
|
||||
/* check if index.tpl is secure (should be true) */
|
||||
$params = array('resource_type' => 'file',
|
||||
'resource_base_path' => dirname(__FILE__) . '/templates',
|
||||
'resource_name' => dirname(__FILE__) . '/templates/index.tpl');
|
||||
$this->assertTrue(smarty_core_is_secure($params, $this->smarty));
|
||||
$this->smarty->security = $security;
|
||||
}
|
||||
|
||||
function test_core_is_secure_function_is_secure_false() {
|
||||
$security = $this->smarty->security;
|
||||
$this->smarty->security = true;
|
||||
/* check if test_cases.php is secure (should be false) */
|
||||
$params = array('resource_type' => 'file',
|
||||
'resource_base_path' => dirname(__FILE__) . '/templates',
|
||||
'resource_name' => __FILE__);
|
||||
$this->assertFalse(smarty_core_is_secure($params, $this->smarty));
|
||||
$this->smarty->security = $security;
|
||||
|
||||
}
|
||||
|
||||
// test constants and security
|
||||
function test_core_is_secure_function_smarty_var_const() {
|
||||
define('TEST_CONSTANT', 'test constant');
|
||||
$this->assertEquals('test constant', $this->smarty->fetch('constant.tpl',
|
||||
null, 'var_const'));
|
||||
}
|
||||
|
||||
function test_core_is_secure_function_smarty_var_const_allowed() {
|
||||
$security = $this->smarty->security;
|
||||
$security_settings = $this->smarty->security_settings;
|
||||
$this->smarty->security_settings['ALLOW_CONSTANTS'] = true;
|
||||
$this->smarty->security = true;
|
||||
$this->assertEquals('test constant', $this->smarty->fetch('constant.tpl',
|
||||
null, 'var_const_allowed'));
|
||||
$this->smarty->security_settings = $security_settings;
|
||||
$this->smarty->security = $security;
|
||||
}
|
||||
|
||||
function test_core_is_secure_function_smarty_var_const_not_allowed() {
|
||||
$security = $this->smarty->security;
|
||||
$this->smarty->security = true;
|
||||
/* catch errors: */
|
||||
$this->errorlevel = null;
|
||||
set_error_handler(array(&$this, 'error_handler'));
|
||||
$this->smarty->fetch('constant.tpl', null, 'var_const_not_allowed');
|
||||
restore_error_handler();
|
||||
|
||||
$this->assertEquals( $this->errorlevel, E_USER_WARNING);
|
||||
$this->smarty->security = $security;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,4 +1,30 @@
|
|||
Version 2.6.20 (Aug 15th, 2008)
|
||||
Version 2.6.25 (May 19th, 2009)
|
||||
-------------------------------
|
||||
- fix E_NOTICE when sessions are disabled (mohrt)
|
||||
|
||||
Version 2.6.24 (May 16th, 2009)
|
||||
-------------------------------
|
||||
- fix problem introduced with super global changes (mohrt)
|
||||
|
||||
Version 2.6.23 (May 13th, 2009)
|
||||
-------------------------------
|
||||
- strip backticks from {math} equations (mohrt)
|
||||
- make PHP super globals read-only from template (mohrt)
|
||||
- throw error when template exists but not readable (mohrt)
|
||||
|
||||
Version 2.6.22 (Dec 17th, 2008)
|
||||
-------------------------------
|
||||
|
||||
- back out method chaining, bug in some versions of PCRE causes errors (mohrt)
|
||||
|
||||
Version 2.6.21 (Dec 2nd, 2008)
|
||||
------------------------------
|
||||
|
||||
- fix function injection security hole closed (U.Tews)
|
||||
- fix pass expiration time at cache_handler_fuc call in core.write_cache_file.php (U.Tews)
|
||||
- Update of compiler.class.php to allow method chaining for PHP4 and PHP5 (U.Tews)
|
||||
|
||||
Version 2.6.20 (Feb 15th, 2008)
|
||||
-------------------------------
|
||||
|
||||
- fix cache tag bug when multiple cache tags on a page (mankyd,
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
NAME:
|
||||
|
||||
Smarty - the PHP compiling template engine
|
||||
|
||||
VERSION: 2.6.20
|
||||
VERSION: 2.6.25
|
||||
|
||||
AUTHORS:
|
||||
|
|
@ -17,15 +17,19 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* @link http://smarty.php.net/
|
||||
* @version 2.6.20
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://www.smarty.net/
|
||||
* @version 2.6.25
|
||||
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
* @access public
|
||||
* @package Smarty
|
||||
*/
|
||||
|
||||
/* $Id: Config_File.class.php 2702 2007-03-08 19:11:22Z mohrt $ */
|
||||
/* $Id: Config_File.class.php 3149 2009-05-23 20:59:25Z monte.ohrt $ */
|
||||
|
||||
/**
|
||||
* Config file reading class
|
|
@ -20,17 +20,17 @@
|
|||
*
|
||||
* For questions, help, comments, discussion, etc., please join the
|
||||
* Smarty mailing list. Send a blank e-mail to
|
||||
* smarty-general-subscribe@lists.php.net
|
||||
* smarty-discussion-subscribe@googlegroups.com
|
||||
*
|
||||
* @link http://smarty.php.net/
|
||||
* @link http://www.smarty.net/
|
||||
* @copyright 2001-2005 New Digital Group, Inc.
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
* @package Smarty
|
||||
* @version 2.6.20
|
||||
* @version 2.6.25
|
||||
*/
|
||||
|
||||
/* $Id: Smarty.class.php 2722 2007-06-18 14:29:00Z danilo $ */
|
||||
/* $Id: Smarty.class.php 3149 2009-05-23 20:59:25Z monte.ohrt $ */
|
||||
|
||||
/**
|
||||
* DIR_SEP isn't used anymore, but third party apps might
|
||||
|
@ -107,7 +107,7 @@ class Smarty
|
|||
/**
|
||||
* When set, smarty does uses this value as error_reporting-level.
|
||||
*
|
||||
* @var boolean
|
||||
* @var integer
|
||||
*/
|
||||
var $error_reporting = null;
|
||||
|
||||
|
@ -236,7 +236,8 @@ class Smarty
|
|||
'INCLUDE_ANY' => false,
|
||||
'PHP_TAGS' => false,
|
||||
'MODIFIER_FUNCS' => array('count'),
|
||||
'ALLOW_CONSTANTS' => false
|
||||
'ALLOW_CONSTANTS' => false,
|
||||
'ALLOW_SUPER_GLOBALS' => true
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -464,7 +465,7 @@ class Smarty
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
var $_version = '2.6.20';
|
||||
var $_version = '2.6.25';
|
||||
|
||||
/**
|
||||
* current template inclusion depth
|
||||
|
@ -561,6 +562,14 @@ class Smarty
|
|||
*/
|
||||
var $_cache_including = false;
|
||||
|
||||
/**
|
||||
* array of super globals internally
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $_supers = array();
|
||||
|
||||
|
||||
/**#@-*/
|
||||
/**
|
||||
* The class constructor.
|
||||
|
@ -569,6 +578,18 @@ class Smarty
|
|||
{
|
||||
$this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
|
||||
: @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
|
||||
|
||||
$this->_supers['get'] = $this->request_use_auto_globals ? $_GET : $GLOBALS['HTTP_GET_VARS'];
|
||||
$this->_supers['post'] = $this->request_use_auto_globals ? $_POST : $GLOBALS['HTTP_POST_VARS'];
|
||||
$this->_supers['server'] = $this->request_use_auto_globals ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
|
||||
if(isset($_SESSION))
|
||||
$this->_supers['session'] = $this->request_use_auto_globals ? $_SESSION : $GLOBALS['HTTP_SESSION_VARS'];
|
||||
else
|
||||
$this->_supers['session'] = array();
|
||||
$this->_supers['request'] = $this->request_use_auto_globals ? $_REQUEST : $GLOBALS['HTTP_REQUEST_VARS'];
|
||||
$this->_supers['cookies'] = $this->request_use_auto_globals ? $_COOKIE : $GLOBALS['HTTP_COOKIE_VARS'];
|
||||
$this->_supers['env'] = $this->request_use_auto_globals ? $_ENV : $GLOBALS['HTTP_ENV_VARS'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1548,7 +1569,7 @@ class Smarty
|
|||
$params['source_content'] = $this->_read_file($_resource_name);
|
||||
}
|
||||
$params['resource_timestamp'] = filemtime($_resource_name);
|
||||
$_return = is_file($_resource_name);
|
||||
$_return = is_file($_resource_name) && is_readable($_resource_name);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1711,7 +1732,7 @@ class Smarty
|
|||
*/
|
||||
function _read_file($filename)
|
||||
{
|
||||
if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) {
|
||||
if ( file_exists($filename) && is_readable($filename) && ($fd = @fopen($filename, 'rb')) ) {
|
||||
$contents = '';
|
||||
while (!feof($fd)) {
|
||||
$contents .= fread($fd, 8192);
|
||||
|
@ -1950,7 +1971,7 @@ class Smarty
|
|||
return $function;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**#@-*/
|
||||
|
||||
}
|
|
@ -21,12 +21,12 @@
|
|||
* @link http://smarty.php.net/
|
||||
* @author Monte Ohrt <monte at ohrt dot com>
|
||||
* @author Andrei Zmievski <andrei@php.net>
|
||||
* @version 2.6.20
|
||||
* @version 2.6.25
|
||||
* @copyright 2001-2005 New Digital Group, Inc.
|
||||
* @package Smarty
|
||||
*/
|
||||
|
||||
/* $Id: Smarty_Compiler.class.php 2773 2008-08-12 18:17:51Z Uwe.Tews $ */
|
||||
/* $Id: Smarty_Compiler.class.php 3149 2009-05-23 20:59:25Z monte.ohrt $ */
|
||||
|
||||
/**
|
||||
* Template compiling class
|
||||
|
@ -2047,27 +2047,27 @@ class Smarty_Compiler extends Smarty {
|
|||
break;
|
||||
|
||||
case 'get':
|
||||
$compiled_ref = ($this->request_use_auto_globals) ? '$_GET' : "\$GLOBALS['HTTP_GET_VARS']";
|
||||
$compiled_ref = "\$this->_supers['get']";
|
||||
break;
|
||||
|
||||
case 'post':
|
||||
$compiled_ref = ($this->request_use_auto_globals) ? '$_POST' : "\$GLOBALS['HTTP_POST_VARS']";
|
||||
$compiled_ref = "\$this->_supers['post']";
|
||||
break;
|
||||
|
||||
case 'cookies':
|
||||
$compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' : "\$GLOBALS['HTTP_COOKIE_VARS']";
|
||||
$compiled_ref = "\$this->_supers['cookies']";
|
||||
break;
|
||||
|
||||
case 'env':
|
||||
$compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' : "\$GLOBALS['HTTP_ENV_VARS']";
|
||||
$compiled_ref = "\$this->_supers['env']";
|
||||
break;
|
||||
|
||||
case 'server':
|
||||
$compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' : "\$GLOBALS['HTTP_SERVER_VARS']";
|
||||
$compiled_ref = "\$this->_supers['server']";
|
||||
break;
|
||||
|
||||
case 'session':
|
||||
$compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' : "\$GLOBALS['HTTP_SESSION_VARS']";
|
||||
$compiled_ref = "\$this->_supers['session']";
|
||||
break;
|
||||
|
||||
/*
|
||||
|
@ -2076,7 +2076,7 @@ class Smarty_Compiler extends Smarty {
|
|||
*/
|
||||
case 'request':
|
||||
if ($this->request_use_auto_globals) {
|
||||
$compiled_ref = '$_REQUEST';
|
||||
$compiled_ref = "\$this->_supers['request']";
|
||||
break;
|
||||
} else {
|
||||
$this->_init_smarty_vars = true;
|
|
@ -68,7 +68,7 @@ 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'], null));
|
||||
array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], $smarty->_cache_info['expires']));
|
||||
} else {
|
||||
// use local cache file
|
||||
|
|
@ -27,7 +27,8 @@ function smarty_function_math($params, &$smarty)
|
|||
return;
|
||||
}
|
||||
|
||||
$equation = $params['equation'];
|
||||
// strip out backticks, not necessary for math
|
||||
$equation = str_replace('`','',$params['equation']);
|
||||
|
||||
// make sure parenthesis are balanced
|
||||
if (substr_count($equation,"(") != substr_count($equation,")")) {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue