fixed issue with php tags executed in literal blocks

This commit is contained in:
mohrt
2001-02-22 21:25:19 +00:00
parent e83c234e94
commit 3bee10770c
7 changed files with 21 additions and 20 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- fixed issue with php executing in literal blocks (Monte)
Version 1.3.0 Version 1.3.0
------------- -------------
- moved license from GPL to LGPL (Monte) - moved license from GPL to LGPL (Monte)

3
README
View File

@@ -55,8 +55,9 @@ DESCRIPTION:
* it is possible to imbed PHP code right in your template files, * it is possible to imbed PHP code right in your template files,
although not recommended and doubtfully needed since the engine although not recommended and doubtfully needed since the engine
is so customizable. is so customizable.
* built in caching
COPYRIGHT: COPYRIGHT:
Copyright (c) 2001 ispi of Lincoln, Inc. All rights reserved. Copyright (c) 2001 ispi of Lincoln, Inc. All rights reserved.
This software is released under the GNU General Public License. This software is released under the GNU Lesser General Public License.
Please read the disclaimer at the top of the Smarty.class.php file. Please read the disclaimer at the top of the Smarty.class.php file.

View File

@@ -85,8 +85,7 @@ class Smarty
var $custom_funcs = array( 'html_options' => 'smarty_func_html_options', var $custom_funcs = array( 'html_options' => 'smarty_func_html_options',
'html_select_date' => 'smarty_func_html_select_date', 'html_select_date' => 'smarty_func_html_select_date'
'header' => 'smarty_func_header'
); );
var $custom_mods = array( 'lower' => 'strtolower', var $custom_mods = array( 'lower' => 'strtolower',
@@ -683,7 +682,7 @@ class Smarty
case 'literal': case 'literal':
list (,$literal_block) = each($this->_literal_blocks); list (,$literal_block) = each($this->_literal_blocks);
$this->_current_line_no += substr_count($literal_block, "\n"); $this->_current_line_no += substr_count($literal_block, "\n");
return $literal_block; return "<?php echo '".str_replace("'","\'",$literal_block)."'; ?>\n";
case 'insert': case 'insert':
return $this->_compile_insert_tag($tag_args); return $this->_compile_insert_tag($tag_args);

View File

@@ -16,11 +16,11 @@ hello, my name is {$Name|upper}
My interests are: My interests are:
{section name=outer loop=$FirstName} {section name=outer loop=$FirstName}
{if %outer.index% is odd by 2} {if %outer.index% is odd by 2}
{%outer.rownum%} . {$outer/FirstName} {$outer/LastName} {%outer.rownum%} . {$outer/FirstName} {$outer/LastName}
{else} {else}
{%outer.rownum%} * {$outer/FirstName} {$outer/LastName} {%outer.rownum%} * {$outer/FirstName} {$outer/LastName}
{/if} {/if}
{sectionelse} {sectionelse}
none none
{/section} {/section}

View File

@@ -189,9 +189,9 @@
not have the CGI version of PHP available and you are concerned about not have the CGI version of PHP available and you are concerned about
world-writable directory access, you can chmod 777 the compile_dir, let world-writable directory access, you can chmod 777 the compile_dir, let
the templates compile once as the web server user, then change the the templates compile once as the web server user, then change the
directory mode back to 700. If you are using the caching feature of directory mode to 755. If you are using the caching feature of Smarty,
Smarty, the cache directory must always have write access for the web the cache directory must always have write access for the web server
server user. user.
</para> </para>
<para> <para>
TECHNICAL NOTE: If you do not have access to the php.ini file, you can TECHNICAL NOTE: If you do not have access to the php.ini file, you can

View File

@@ -85,8 +85,7 @@ class Smarty
var $custom_funcs = array( 'html_options' => 'smarty_func_html_options', var $custom_funcs = array( 'html_options' => 'smarty_func_html_options',
'html_select_date' => 'smarty_func_html_select_date', 'html_select_date' => 'smarty_func_html_select_date'
'header' => 'smarty_func_header'
); );
var $custom_mods = array( 'lower' => 'strtolower', var $custom_mods = array( 'lower' => 'strtolower',
@@ -683,7 +682,7 @@ class Smarty
case 'literal': case 'literal':
list (,$literal_block) = each($this->_literal_blocks); list (,$literal_block) = each($this->_literal_blocks);
$this->_current_line_no += substr_count($literal_block, "\n"); $this->_current_line_no += substr_count($literal_block, "\n");
return $literal_block; return "<?php echo '".str_replace("'","\'",$literal_block)."'; ?>\n";
case 'insert': case 'insert':
return $this->_compile_insert_tag($tag_args); return $this->_compile_insert_tag($tag_args);

View File

@@ -16,11 +16,11 @@ hello, my name is {$Name|upper}
My interests are: My interests are:
{section name=outer loop=$FirstName} {section name=outer loop=$FirstName}
{if %outer.index% is odd by 2} {if %outer.index% is odd by 2}
{%outer.rownum%} . {$outer/FirstName} {$outer/LastName} {%outer.rownum%} . {$outer/FirstName} {$outer/LastName}
{else} {else}
{%outer.rownum%} * {$outer/FirstName} {$outer/LastName} {%outer.rownum%} * {$outer/FirstName} {$outer/LastName}
{/if} {/if}
{sectionelse} {sectionelse}
none none
{/section} {/section}