upgrade to Smarty-3.1.6
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
Smarty 3.1.4
|
||||
Smarty 3.1.6
|
||||
|
||||
Author: Monte Ohrt <monte at ohrt dot com >
|
||||
Author: Uwe Tews
|
||||
|
109
bundled-libs/Smarty/SMARTY_2_BC_NOTES.txt
Normal file
109
bundled-libs/Smarty/SMARTY_2_BC_NOTES.txt
Normal file
@ -0,0 +1,109 @@
|
||||
= Known incompatibilities with Smarty 2 =
|
||||
|
||||
== Syntax ==
|
||||
|
||||
Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported
|
||||
by a wrapper but deprecated. See the README that comes with Smarty 3 for more
|
||||
information.
|
||||
|
||||
The {$array|@mod} syntax has always been a bit confusing, where an "@" is required
|
||||
to apply a modifier to an array instead of the individual elements. Normally you
|
||||
always want the modifier to apply to the variable regardless of its type. In Smarty 3,
|
||||
{$array|mod} and {$array|@mod} behave identical. It is safe to drop the "@" and the
|
||||
modifier will still apply to the array. If you really want the modifier to apply to
|
||||
each array element, you must loop the array in-template, or use a custom modifier that
|
||||
supports array iteration. Most smarty functions already escape values where necessary
|
||||
such as {html_options}
|
||||
|
||||
== PHP Version ==
|
||||
Smarty 3 is PHP 5 only. It will not work with PHP 4.
|
||||
|
||||
== {php} Tag ==
|
||||
The {php} tag is disabled by default. The use of {php} tags is
|
||||
deprecated. It can be enabled with $smarty->allow_php_tag=true.
|
||||
|
||||
But if you scatter PHP code which belongs together into several
|
||||
{php} tags it may not work any longer.
|
||||
|
||||
== Delimiters and whitespace ==
|
||||
Delimiters surrounded by whitespace are no longer treated as Smarty tags.
|
||||
Therefore, { foo } will not compile as a tag, you must use {foo}. This change
|
||||
Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
|
||||
This can be disabled by setting $smarty->auto_literal = false;
|
||||
|
||||
== Unquoted Strings ==
|
||||
Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings
|
||||
in parameters. Smarty3 is more restrictive. You can still pass strings without quotes
|
||||
so long as they contain no special characters. (anything outside of A-Za-z0-9_)
|
||||
|
||||
For example filename strings must be quoted
|
||||
<source lang="smarty">
|
||||
{include file='path/foo.tpl'}
|
||||
</source>
|
||||
|
||||
== Extending the Smarty class ==
|
||||
Smarty 3 makes use of the __construct method for initialization. If you are extending
|
||||
the Smarty class, its constructor is not called implicitly if the your child class defines
|
||||
its own constructor. In order to run Smarty's constructor, a call to parent::__construct()
|
||||
within your child constructor is required.
|
||||
|
||||
<source lang="php">
|
||||
class MySmarty extends Smarty {
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
// your initialization code goes here
|
||||
|
||||
}
|
||||
}
|
||||
</source>
|
||||
|
||||
== Autoloader ==
|
||||
Smarty 3 does register its own autoloader with spl_autoload_register. If your code has
|
||||
an existing __autoload function then this function must be explicitly registered on
|
||||
the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php
|
||||
for further details.
|
||||
|
||||
== Plugin Filenames ==
|
||||
Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames
|
||||
to be lower case. Because of this, Smarty plugin file names must also be lowercase.
|
||||
In Smarty 2, mixed case file names did work.
|
||||
|
||||
== Scope of Special Smarty Variables ==
|
||||
In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach...
|
||||
had global scope. If you had loops with the same name in subtemplates you could accidentally
|
||||
overwrite values of parent template.
|
||||
|
||||
In Smarty 3 these special Smarty variable have only local scope in the template which
|
||||
is defining the loop. If you need their value in a subtemplate you have to pass them
|
||||
as parameter.
|
||||
<source lang="smarty">
|
||||
{include file='path/foo.tpl' index=$smarty.section.foo.index}
|
||||
</source>
|
||||
|
||||
== SMARTY_RESOURCE_CHAR_SET ==
|
||||
Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset.
|
||||
This is now used also on modifiers like escape as default charset. If your templates use
|
||||
other charsets make sure that you define the constant accordingly. Otherwise you may not
|
||||
get any output.
|
||||
|
||||
== newline at {if} tags ==
|
||||
A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source.
|
||||
If one of the {if} tags is at the line end you will now get a newline in the HTML output.
|
||||
|
||||
== trigger_error() ==
|
||||
The API function trigger_error() has been removed because it did just map to PHP trigger_error.
|
||||
However it's still included in the Smarty2 API wrapper.
|
||||
|
||||
== Smarty constants ==
|
||||
The constants
|
||||
SMARTY_PHP_PASSTHRU
|
||||
SMARTY_PHP_QUOTE
|
||||
SMARTY_PHP_REMOVE
|
||||
SMARTY_PHP_ALLOW
|
||||
have been replaced with class constants
|
||||
Smarty::PHP_PASSTHRU
|
||||
Smarty::PHP_QUOTE
|
||||
Smarty::PHP_REMOVE
|
||||
Smarty::PHP_ALLOW
|
||||
|
24
bundled-libs/Smarty/SMARTY_3.0_BC_NOTES.txt
Normal file
24
bundled-libs/Smarty/SMARTY_3.0_BC_NOTES.txt
Normal file
@ -0,0 +1,24 @@
|
||||
== Smarty2 backward compatibility ==
|
||||
All Smarty2 specific API functions and deprecated functionallity has been moved
|
||||
to the SmartyBC class.
|
||||
|
||||
== {php} Tag ==
|
||||
The {php} tag is no longer available in the standard Smarty calls.
|
||||
The use of {php} tags is deprecated and only available in the SmartyBC class.
|
||||
|
||||
== {include_php} Tag ==
|
||||
The {include_php} tag is no longer available in the standard Smarty calls.
|
||||
The use of {include_php} tags is deprecated and only available in the SmartyBC class.
|
||||
|
||||
== php template resource ==
|
||||
The support of the php template resource is removed.
|
||||
|
||||
== $cache_dir, $compile_dir, $config_dir, $template_dir access ==
|
||||
The mentioned properties can't be accessed directly any longer. You must use
|
||||
corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir()
|
||||
|
||||
== obsolete Smarty class properties ==
|
||||
The following no longer used properties are removed:
|
||||
$allow_php_tag
|
||||
$allow_php_template
|
||||
$deprecation_notices
|
@ -1,9 +1,64 @@
|
||||
===== trunk =====
|
||||
===== Smarty-3.1.4 =====
|
||||
===== Smarty-3.1.6 =====
|
||||
30.11.2011
|
||||
- bugfix is_cache() for individual cached subtemplates with $smarty->caching = CACHING_OFF did produce
|
||||
an exception (Forum Topic 20531)
|
||||
|
||||
29.11.2011
|
||||
- bugfix added exception if the default plugin handler did return a not static callback (Forum Topic 20512)
|
||||
|
||||
25.11.2011
|
||||
- bugfix {html_select_date} and {html_slecet_time} did not default to current time if "time" was not specified
|
||||
since r4432 (issue 60)
|
||||
|
||||
24.11.2011
|
||||
- bugfix a subtemplate later used as main template did use old variable values
|
||||
|
||||
21.11.2011
|
||||
- bugfix cache file could include unneeded modifier plugins under certain condition
|
||||
|
||||
18.11.2011
|
||||
- bugfix declare all directory properties private to map direct access to getter/setter also on extended Smarty class
|
||||
|
||||
16.11.2011
|
||||
- bugfix Smarty_Resource::load() did not always return a proper resource handler (Forum Topic 20414)
|
||||
- added escape argument to html_checkboxes and html_radios (Forum Topic 20425)
|
||||
|
||||
===== Smarty-3.1.5 =====
|
||||
14.11.2011
|
||||
- bugfix allow space between function name and open bracket (forum topic 20375)
|
||||
|
||||
09.11.2011
|
||||
- bugfix different behaviour of uniqid() on cygwin. See https://bugs.php.net/bug.php?id=34908
|
||||
(forum topic 20343)
|
||||
|
||||
01.11.2011
|
||||
- bugfix {if} and {while} tags without condition did not throw a SmartyCompilerException (Issue #57)
|
||||
- bugfix multiline strings in config files could fail on longer strings (reopened Issue #55)
|
||||
|
||||
22.10.2011
|
||||
- bugfix smarty_mb_from_unicode() would not decode unicode-points properly
|
||||
- bugfix use catch Exception instead UnexpectedValueException in
|
||||
clearCompiledTemplate to be PHP 5.2 compatible
|
||||
|
||||
21.10.2011
|
||||
- bugfix apostrophe in plugins_dir path name failed (forum topic 20199)
|
||||
- improvement sha1() for array keys longer than 150 characters
|
||||
- add Smarty::$allow_ambiguous_resources to activate unique resource handling (Forum Topic 20128)
|
||||
|
||||
20.10.2011
|
||||
- @silenced unlink() in Smarty_Internal_Write_File since debuggers go haywire without it.
|
||||
- bugfix Smarty::clearCompiledTemplate() threw an Exception if $cache_id was not present in $compile_dir when $use_sub_dirs = true.
|
||||
- bugfix {html_select_date} and {html_select_time} did not properly handle empty time arguments (Forum Topic 20190)
|
||||
- improvement removed unnecessary sha1()
|
||||
|
||||
19.10.2011
|
||||
- revert PHP4 constructor message
|
||||
- fixed PHP4 constructor message
|
||||
|
||||
===== Smarty-3.1.4 =====
|
||||
19.10.2011
|
||||
- added exception when using PHP4 style constructor
|
||||
|
||||
16.10.2011
|
||||
- bugfix testInstall() did not propery check cache_dir and compile_dir
|
||||
|
||||
@ -1681,7 +1736,7 @@ NOTICE: existing compiled template and cache files must be deleted
|
||||
- autoappend a directory separator if the xxxxx_dir definition have no trailing one
|
||||
|
||||
03/19/2009
|
||||
- allow array definition as modifer paramter
|
||||
- allow array definition as modifer parameter
|
||||
- changed modifier to use multi byte string funktions.
|
||||
|
||||
03/17/2009
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Project: Smarty: the PHP compiling template engine
|
||||
* File: Smarty.class.php
|
||||
* SVN: $Id: Smarty.class.php 4426 2011-10-19 19:20:58Z monte.ohrt $
|
||||
* SVN: $Id: Smarty.class.php 4478 2011-11-24 21:08:26Z uwe.tews@googlemail.com $
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -28,7 +28,7 @@
|
||||
* @author Uwe Tews
|
||||
* @author Rodney Rehm
|
||||
* @package Smarty
|
||||
* @version 3.1.4
|
||||
* @version 3.1.6
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -107,7 +107,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = 'Smarty 3.1.4';
|
||||
const SMARTY_VERSION = 'Smarty-3.1.6';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
@ -157,7 +157,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
* assigned global tpl vars
|
||||
*/
|
||||
public static $global_tpl_vars = array();
|
||||
|
||||
|
||||
/**
|
||||
* error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()
|
||||
*/
|
||||
@ -190,7 +190,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
* template directory
|
||||
* @var array
|
||||
*/
|
||||
protected $template_dir = array();
|
||||
private $template_dir = array();
|
||||
/**
|
||||
* joined template directory string used in cache keys
|
||||
* @var string
|
||||
@ -220,22 +220,22 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
* compile directory
|
||||
* @var string
|
||||
*/
|
||||
protected $compile_dir = null;
|
||||
private $compile_dir = null;
|
||||
/**
|
||||
* plugins directory
|
||||
* @var array
|
||||
*/
|
||||
protected $plugins_dir = array();
|
||||
private $plugins_dir = array();
|
||||
/**
|
||||
* cache directory
|
||||
* @var string
|
||||
*/
|
||||
protected $cache_dir = null;
|
||||
private $cache_dir = null;
|
||||
/**
|
||||
* config directory
|
||||
* @var array
|
||||
*/
|
||||
protected $config_dir = array();
|
||||
private $config_dir = array();
|
||||
/**
|
||||
* force template compiling?
|
||||
* @var boolean
|
||||
@ -251,6 +251,11 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
* @var boolean
|
||||
*/
|
||||
public $use_sub_dirs = false;
|
||||
/**
|
||||
* allow ambiguous resources (that are made unique by the resource handler)
|
||||
* @var boolean
|
||||
*/
|
||||
public $allow_ambiguous_resources = false;
|
||||
/**
|
||||
* caching enabled
|
||||
* @var boolean
|
||||
@ -588,13 +593,13 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
->setPluginsDir(SMARTY_PLUGINS_DIR)
|
||||
->setCacheDir('.' . DS . 'cache' . DS)
|
||||
->setConfigDir('.' . DS . 'configs' . DS);
|
||||
|
||||
|
||||
$this->debug_tpl = 'file:' . dirname(__FILE__) . '/debug.tpl';
|
||||
if (isset($_SERVER['SCRIPT_NAME'])) {
|
||||
$this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class destructor
|
||||
@ -857,7 +862,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
foreach ((array) $config_dir as $k => $v) {
|
||||
$this->config_dir[$k] = rtrim($v, '/\\') . DS;
|
||||
}
|
||||
|
||||
|
||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||
return $this;
|
||||
}
|
||||
@ -891,7 +896,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
// append new directory
|
||||
$this->config_dir[] = rtrim($config_dir, '/\\') . DS;
|
||||
}
|
||||
|
||||
|
||||
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
|
||||
return $this;
|
||||
}
|
||||
@ -1172,14 +1177,22 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
$cache_id = $cache_id === null ? $this->cache_id : $cache_id;
|
||||
$compile_id = $compile_id === null ? $this->compile_id : $compile_id;
|
||||
// already in template cache?
|
||||
$unique_template_name = Smarty_Resource::getUniqueTemplateName($this, $template);
|
||||
$_templateId = sha1($unique_template_name . $cache_id . $compile_id);
|
||||
if ($this->allow_ambiguous_resources) {
|
||||
$_templateId = Smarty_Resource::getUniqueTemplateName($this, $template) . $cache_id . $compile_id;
|
||||
} else {
|
||||
$_templateId = $this->joined_template_dir . '#' . $template . $cache_id . $compile_id;
|
||||
}
|
||||
if (isset($_templateId[150])) {
|
||||
$_templateId = sha1($_templateId);
|
||||
}
|
||||
if ($do_clone) {
|
||||
if (isset($this->template_objects[$_templateId])) {
|
||||
// return cached template object
|
||||
$tpl = clone $this->template_objects[$_templateId];
|
||||
$tpl->smarty = clone $tpl->smarty;
|
||||
$tpl->parent = $parent;
|
||||
$tpl->tpl_vars = array();
|
||||
$tpl->config_vars = array();
|
||||
} else {
|
||||
$tpl = new $this->template_class($template, clone $this, $parent, $cache_id, $compile_id);
|
||||
}
|
||||
@ -1187,6 +1200,9 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
if (isset($this->template_objects[$_templateId])) {
|
||||
// return cached template object
|
||||
$tpl = $this->template_objects[$_templateId];
|
||||
$tpl->parent = $parent;
|
||||
$tpl->tpl_vars = array();
|
||||
$tpl->config_vars = array();
|
||||
} else {
|
||||
$tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);
|
||||
}
|
||||
@ -1336,7 +1352,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||
{
|
||||
$_is_muted_directory = false;
|
||||
|
||||
|
||||
// add the SMARTY_DIR to the list of muted directories
|
||||
if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) {
|
||||
$smarty_dir = realpath(SMARTY_DIR);
|
||||
@ -1345,7 +1361,7 @@ class Smarty extends Smarty_Internal_TemplateBase {
|
||||
'length' => strlen($smarty_dir),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// walk the muted directories and test against $errfile
|
||||
foreach (Smarty::$_muted_directories as $key => &$dir) {
|
||||
if (!$dir) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
* - separator (optional) - ie <br> or
|
||||
* - output (optional) - the output next to each checkbox
|
||||
* - assign (optional) - assign the output as an array to this variable
|
||||
* - escape (optional) - escape the content (not value), defaults to true
|
||||
* </pre>
|
||||
*
|
||||
* @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
|
||||
@ -50,6 +51,7 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
$options = null;
|
||||
$selected = array();
|
||||
$separator = '';
|
||||
$escape = true;
|
||||
$labels = true;
|
||||
$label_ids = false;
|
||||
$output = null;
|
||||
@ -63,6 +65,7 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
$$_key = (string) $_val;
|
||||
break;
|
||||
|
||||
case 'escape':
|
||||
case 'labels':
|
||||
case 'label_ids':
|
||||
$$_key = (bool) $_val;
|
||||
@ -130,12 +133,12 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key=>$_val) {
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i=>$_key) {
|
||||
$_val = isset($output[$_i]) ? $output[$_i] : '';
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
|
||||
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,7 +150,7 @@ function smarty_function_html_checkboxes($params, $template)
|
||||
|
||||
}
|
||||
|
||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
|
||||
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true) {
|
||||
$_output = '';
|
||||
|
||||
if (is_object($value)) {
|
||||
@ -183,7 +186,9 @@ function smarty_function_html_checkboxes_output($name, $value, $output, $selecte
|
||||
|
||||
$name = smarty_function_escape_special_chars($name);
|
||||
$value = smarty_function_escape_special_chars($value);
|
||||
$output = smarty_function_escape_special_chars($output);
|
||||
if ($escape) {
|
||||
$output = smarty_function_escape_special_chars($output);
|
||||
}
|
||||
|
||||
$_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
* - separator (optional) - ie <br> or
|
||||
* - output (optional) - the output next to each radio button
|
||||
* - assign (optional) - assign the output as an array to this variable
|
||||
* - escape (optional) - escape the content (not value), defaults to true
|
||||
* </pre>
|
||||
* Examples:
|
||||
* <pre>
|
||||
@ -50,6 +51,7 @@ function smarty_function_html_radios($params, $template)
|
||||
$options = null;
|
||||
$selected = null;
|
||||
$separator = '';
|
||||
$escape = true;
|
||||
$labels = true;
|
||||
$label_ids = false;
|
||||
$output = null;
|
||||
@ -77,6 +79,7 @@ function smarty_function_html_radios($params, $template)
|
||||
}
|
||||
break;
|
||||
|
||||
case 'escape':
|
||||
case 'labels':
|
||||
case 'label_ids':
|
||||
$$_key = (bool) $_val;
|
||||
@ -118,12 +121,12 @@ function smarty_function_html_radios($params, $template)
|
||||
|
||||
if (isset($options)) {
|
||||
foreach ($options as $_key => $_val) {
|
||||
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
|
||||
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $_i => $_key) {
|
||||
$_val = isset($output[$_i]) ? $output[$_i] : '';
|
||||
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
|
||||
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +137,7 @@ function smarty_function_html_radios($params, $template)
|
||||
}
|
||||
}
|
||||
|
||||
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids)
|
||||
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
|
||||
{
|
||||
$_output = '';
|
||||
|
||||
@ -171,7 +174,9 @@ function smarty_function_html_radios_output($name, $value, $output, $selected, $
|
||||
|
||||
$name = smarty_function_escape_special_chars($name);
|
||||
$value = smarty_function_escape_special_chars($value);
|
||||
$output = smarty_function_escape_special_chars($output);
|
||||
if ($escape) {
|
||||
$output = smarty_function_escape_special_chars($output);
|
||||
}
|
||||
|
||||
$_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
|
||||
|
||||
|
@ -116,7 +116,7 @@ function smarty_function_html_select_date($params, $template)
|
||||
foreach ($params as $_key => $_value) {
|
||||
switch ($_key) {
|
||||
case 'time':
|
||||
if (!is_array($_value)) {
|
||||
if (!is_array($_value) && $_value !== null) {
|
||||
$time = smarty_make_timestamp($_value);
|
||||
}
|
||||
break;
|
||||
@ -202,7 +202,11 @@ function smarty_function_html_select_date($params, $template)
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||
}
|
||||
} elseif ($time === null) {
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||
if (array_key_exists('time', $params)) {
|
||||
$_year = $_month = $_day = $time = null;
|
||||
} else {
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||
}
|
||||
} else {
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d', $time));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ function smarty_function_html_select_time($params, $template)
|
||||
foreach ($params as $_key => $_value) {
|
||||
switch ($_key) {
|
||||
case 'time':
|
||||
if (!is_array($_value)) {
|
||||
if (!is_array($_value) && $_value !== null) {
|
||||
$time = smarty_make_timestamp($_value);
|
||||
}
|
||||
break;
|
||||
@ -180,7 +180,11 @@ function smarty_function_html_select_time($params, $template)
|
||||
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
|
||||
}
|
||||
} elseif ($time === null) {
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));
|
||||
if (array_key_exists('time', $params)) {
|
||||
$_hour = $_minute = $_second = $time = null;
|
||||
} else {
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));
|
||||
}
|
||||
} else {
|
||||
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
|
||||
}
|
||||
@ -219,15 +223,13 @@ function smarty_function_html_select_time($params, $template)
|
||||
$_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i);
|
||||
$_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);
|
||||
|
||||
if ($use_24_hours) {
|
||||
$selected = $_hour == $_val;
|
||||
} else {
|
||||
if (!$use_24_hours) {
|
||||
$_hour12 = $_hour == 0
|
||||
? 12
|
||||
: ($_hour <= 12 ? $_hour : $_hour -12);
|
||||
}
|
||||
|
||||
$selected = $use_24_hours ? $_hour == $_val : $_hour12 == $_val;
|
||||
$selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
|
||||
$_html_hours .= '<option value="' . $_value . '"'
|
||||
. ($selected ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
@ -263,13 +265,13 @@ function smarty_function_html_select_time($params, $template)
|
||||
$_html_minutes .= '<option value="">' . ( isset($minute_empty) ? $minute_empty : $all_empty ) . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$selected = $_minute - $_minute % $minute_interval;
|
||||
$selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
|
||||
for ($i=0; $i <= 59; $i += $minute_interval) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i);
|
||||
$_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i);
|
||||
$_html_minutes .= '<option value="' . $_value . '"'
|
||||
. ($selected == $i ? ' selected="selected"' : '')
|
||||
. ($selected === $i ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
@ -303,13 +305,13 @@ function smarty_function_html_select_time($params, $template)
|
||||
$_html_seconds .= '<option value="">' . ( isset($second_empty) ? $second_empty : $all_empty ) . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
$selected = $_second - $_second % $second_interval;
|
||||
$selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
|
||||
for ($i=0; $i <= 59; $i += $second_interval) {
|
||||
$_val = sprintf('%02d', $i);
|
||||
$_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i);
|
||||
$_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i);
|
||||
$_html_seconds .= '<option value="' . $_value . '"'
|
||||
. ($selected == $i ? ' selected="selected"' : '')
|
||||
. ($selected === $i ? ' selected="selected"' : '')
|
||||
. '>' . $_text . '</option>' . $option_separator;
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,11 @@
|
||||
/**
|
||||
* evaluate compiler parameter
|
||||
*
|
||||
* @param array $params paramter array as given to the compiler function
|
||||
* @param integer $index array index of the paramter to convert
|
||||
* @param mixed $default value to be returned if the paramter is not present
|
||||
* @return mixed evaluated value of paramter or $default
|
||||
* @throws SmartyException if paramter is not a literal (but an expression, variable, …)
|
||||
* @param array $params parameter array as given to the compiler function
|
||||
* @param integer $index array index of the parameter to convert
|
||||
* @param mixed $default value to be returned if the parameter is not present
|
||||
* @return mixed evaluated value of parameter or $default
|
||||
* @throws SmartyException if parameter is not a literal (but an expression, variable, …)
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
function smarty_literal_compiler_param($params, $index, $default=null)
|
||||
|
@ -39,7 +39,7 @@ function smarty_mb_from_unicode($unicode, $encoding=null) {
|
||||
$encoding = mb_internal_encoding();
|
||||
}
|
||||
foreach((array) $unicode as $utf32be) {
|
||||
$character = pack("N", $utf32be);
|
||||
$character = pack("N*", $utf32be);
|
||||
$t .= mb_convert_encoding($character, $encoding, "UTF-32BE");
|
||||
}
|
||||
return $t;
|
||||
|
@ -299,6 +299,7 @@ class Smarty_Template_Cached {
|
||||
// check if cache is valid
|
||||
//
|
||||
if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->recompiled) {
|
||||
$handler->populate($this, $_template);
|
||||
return;
|
||||
}
|
||||
while (true) {
|
||||
|
@ -178,7 +178,14 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
|
||||
}
|
||||
|
||||
// remove from template cache
|
||||
$_templateId = sha1($tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id);
|
||||
if ($smarty->allow_ambiguous_resources) {
|
||||
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
||||
} else {
|
||||
$_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;
|
||||
}
|
||||
if (isset($_templateId[150])) {
|
||||
$_templateId = sha1($_templateId);
|
||||
}
|
||||
unset($smarty->template_objects[$_templateId]);
|
||||
}
|
||||
return $uid;
|
||||
|
@ -154,7 +154,14 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
|
||||
|
||||
// remove from template cache
|
||||
$tpl->source; // have the template registered before unset()
|
||||
$_templateId = sha1($tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id);
|
||||
if ($smarty->allow_ambiguous_resources) {
|
||||
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
||||
} else {
|
||||
$_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;
|
||||
}
|
||||
if (isset($_templateId[150])) {
|
||||
$_templateId = sha1($_templateId);
|
||||
}
|
||||
unset($smarty->template_objects[$_templateId]);
|
||||
|
||||
if ($tpl->source->exists) {
|
||||
|
@ -1,30 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Compile If
|
||||
*
|
||||
* Compiles the {if} {else} {elseif} {/if} tags
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
* Smarty Internal Plugin Compile If
|
||||
*
|
||||
* Compiles the {if} {else} {elseif} {/if} tags
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Compile If Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
* Smarty Internal Plugin Compile If Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
||||
|
||||
/**
|
||||
* Compiles code for the {if} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
* Compiles code for the {if} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, $compiler, $parameter)
|
||||
{
|
||||
// check and get attributes
|
||||
@ -32,6 +32,11 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
||||
$this->openTag($compiler, 'if', array(1, $compiler->nocache));
|
||||
// must whole block be nocache ?
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
|
||||
if (!array_key_exists("if condition",$parameter)) {
|
||||
$compiler->trigger_template_error("missing if condition", $compiler->lex->taglineno);
|
||||
}
|
||||
|
||||
if (is_array($parameter['if condition'])) {
|
||||
if ($compiler->nocache) {
|
||||
$_nocache = ',true';
|
||||
@ -60,21 +65,21 @@ class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Else Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
* Smarty Internal Plugin Compile Else Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
|
||||
|
||||
/**
|
||||
* Compiles code for the {else} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
* Compiles code for the {else} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, $compiler, $parameter)
|
||||
{
|
||||
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
|
||||
@ -86,21 +91,21 @@ class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Compile ElseIf Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
* Smarty Internal Plugin Compile ElseIf Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
|
||||
/**
|
||||
* Compiles code for the {elseif} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
* Compiles code for the {elseif} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, $compiler, $parameter)
|
||||
{
|
||||
// check and get attributes
|
||||
@ -108,6 +113,10 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
|
||||
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
|
||||
|
||||
if (!array_key_exists("if condition",$parameter)) {
|
||||
$compiler->trigger_template_error("missing elseif condition", $compiler->lex->taglineno);
|
||||
}
|
||||
|
||||
if (is_array($parameter['if condition'])) {
|
||||
$condition_by_assign = true;
|
||||
if ($compiler->nocache) {
|
||||
@ -143,7 +152,7 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
} else {
|
||||
$tmp = '';
|
||||
foreach ($compiler->prefix_code as $code)
|
||||
$tmp .= $code;
|
||||
$tmp .= $code;
|
||||
$compiler->prefix_code = array();
|
||||
$this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));
|
||||
if ($condition_by_assign) {
|
||||
@ -164,21 +173,21 @@ class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Compile Ifclose Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
* Smarty Internal Plugin Compile Ifclose Class
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage Compiler
|
||||
*/
|
||||
class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {
|
||||
|
||||
/**
|
||||
* Compiles code for the {/if} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
* Compiles code for the {/if} tag
|
||||
*
|
||||
* @param array $args array with attributes from parser
|
||||
* @param object $compiler compiler object
|
||||
* @param array $parameter array with compilation parameter
|
||||
* @return string compiled code
|
||||
*/
|
||||
public function compile($args, $compiler, $parameter)
|
||||
{
|
||||
// must endblock be nocache?
|
||||
|
@ -132,7 +132,7 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
|
||||
if (!isset($compiler->smarty->merged_templates_func[$tpl_name]) || $compiler->inheritance) {
|
||||
$tpl = new $compiler->smarty->template_class ($tpl_name, $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id);
|
||||
// save unique function name
|
||||
$compiler->smarty->merged_templates_func[$tpl_name]['func'] = $tpl->properties['unifunc'] = 'content_'.uniqid();
|
||||
$compiler->smarty->merged_templates_func[$tpl_name]['func'] = $tpl->properties['unifunc'] = 'content_'.uniqid('', false);
|
||||
// use current nocache hash for inlined code
|
||||
$compiler->smarty->merged_templates_func[$tpl_name]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
|
||||
if ($compiler->template->caching) {
|
||||
|
@ -31,6 +31,10 @@ class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
|
||||
$_attr = $this->getAttributes($compiler, $args);
|
||||
$this->openTag($compiler, 'while', $compiler->nocache);
|
||||
|
||||
if (!array_key_exists("if condition",$parameter)) {
|
||||
$compiler->trigger_template_error("missing while condition", $compiler->lex->taglineno);
|
||||
}
|
||||
|
||||
// maybe nocache because of nocache variables
|
||||
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
|
||||
if (is_array($parameter['if condition'])) {
|
||||
|
@ -184,15 +184,15 @@ class Smarty_Internal_Configfilelexer
|
||||
3 => 0,
|
||||
4 => 0,
|
||||
5 => 0,
|
||||
6 => 1,
|
||||
6 => 0,
|
||||
7 => 0,
|
||||
8 => 0,
|
||||
9 => 0,
|
||||
10 => 0,
|
||||
);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
$yy_global_pattern = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G(\"\"\"(\\w+|[^\"]|\\\\\"|\"{1,2}[^\"])*\"\"\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS";
|
||||
$yy_global_pattern = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS";
|
||||
|
||||
do {
|
||||
if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
|
||||
@ -262,22 +262,22 @@ class Smarty_Internal_Configfilelexer
|
||||
function yy_r2_4($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
|
||||
$this->yypushstate(self::TRIPPLE);
|
||||
}
|
||||
function yy_r2_5($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_6($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_DOUBLE_QUOTED_STRING;
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_8($yy_subpatterns)
|
||||
function yy_r2_7($yy_subpatterns)
|
||||
{
|
||||
|
||||
if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) {
|
||||
@ -289,13 +289,13 @@ class Smarty_Internal_Configfilelexer
|
||||
$this->yypopstate();
|
||||
}
|
||||
}
|
||||
function yy_r2_9($yy_subpatterns)
|
||||
function yy_r2_8($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
$this->yypopstate();
|
||||
}
|
||||
function yy_r2_10($yy_subpatterns)
|
||||
function yy_r2_9($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
|
||||
@ -523,5 +523,84 @@ class Smarty_Internal_Configfilelexer
|
||||
}
|
||||
|
||||
|
||||
function yylex6()
|
||||
{
|
||||
$tokenMap = array (
|
||||
1 => 0,
|
||||
2 => 0,
|
||||
3 => 2,
|
||||
);
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
$yy_global_pattern = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([ \t\r]*\n)|\G(([\S\s]*?)(?=([ \t\r]*\n|\"\"\")))/iS";
|
||||
|
||||
do {
|
||||
if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
|
||||
$yysubmatches = $yymatches;
|
||||
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
|
||||
if (!count($yymatches)) {
|
||||
throw new Exception('Error: lexing failed because a rule matched' .
|
||||
' an empty string. Input "' . substr($this->data,
|
||||
$this->counter, 5) . '... state TRIPPLE');
|
||||
}
|
||||
next($yymatches); // skip global match
|
||||
$this->token = key($yymatches); // token number
|
||||
if ($tokenMap[$this->token]) {
|
||||
// extract sub-patterns for passing to lex function
|
||||
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
|
||||
$tokenMap[$this->token]);
|
||||
} else {
|
||||
$yysubmatches = array();
|
||||
}
|
||||
$this->value = current($yymatches); // token value
|
||||
$r = $this->{'yy_r6_' . $this->token}($yysubmatches);
|
||||
if ($r === null) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
// accept this token
|
||||
return true;
|
||||
} elseif ($r === true) {
|
||||
// we have changed state
|
||||
// process this token in the new state
|
||||
return $this->yylex();
|
||||
} elseif ($r === false) {
|
||||
$this->counter += strlen($this->value);
|
||||
$this->line += substr_count($this->value, "\n");
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
// skip this token
|
||||
continue;
|
||||
} } else {
|
||||
throw new Exception('Unexpected input at line' . $this->line .
|
||||
': ' . $this->data[$this->counter]);
|
||||
}
|
||||
break;
|
||||
} while (true);
|
||||
|
||||
} // end function
|
||||
|
||||
|
||||
const TRIPPLE = 6;
|
||||
function yy_r6_1($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
|
||||
$this->yypopstate();
|
||||
$this->yypushstate(self::START);
|
||||
}
|
||||
function yy_r6_2($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_CONTENT;
|
||||
}
|
||||
function yy_r6_3($yy_subpatterns)
|
||||
{
|
||||
|
||||
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_CONTENT;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
@ -145,8 +145,7 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
}
|
||||
|
||||
private static function parse_tripple_double_quoted_string($qstr) {
|
||||
$inner_str = substr($qstr, 3, strlen($qstr)-6);
|
||||
return stripcslashes($inner_str);
|
||||
return stripcslashes($qstr);
|
||||
}
|
||||
|
||||
private function set_var(Array $var, Array &$target_array) {
|
||||
@ -178,7 +177,7 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
$this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
|
||||
}
|
||||
}
|
||||
#line 174 "smarty_internal_configfileparser.php"
|
||||
#line 173 "smarty_internal_configfileparser.php"
|
||||
|
||||
const TPC_OPENB = 1;
|
||||
const TPC_SECTION = 2;
|
||||
@ -191,60 +190,62 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser
|
||||
const TPC_BOOL = 9;
|
||||
const TPC_SINGLE_QUOTED_STRING = 10;
|
||||
const TPC_DOUBLE_QUOTED_STRING = 11;
|
||||
const TPC_TRIPPLE_DOUBLE_QUOTED_STRING = 12;
|
||||
const TPC_NAKED_STRING = 13;
|
||||
const TPC_NEWLINE = 14;
|
||||
const TPC_COMMENTSTART = 15;
|
||||
const YY_NO_ACTION = 54;
|
||||
const YY_ACCEPT_ACTION = 53;
|
||||
const YY_ERROR_ACTION = 52;
|
||||
const TPC_TRIPPLE_QUOTES = 12;
|
||||
const TPC_TRIPPLE_QUOTES_END = 13;
|
||||
const TPC_NAKED_STRING = 14;
|
||||
const TPC_TRIPPLE_CONTENT = 15;
|
||||
const TPC_NEWLINE = 16;
|
||||
const TPC_COMMENTSTART = 17;
|
||||
const YY_NO_ACTION = 61;
|
||||
const YY_ACCEPT_ACTION = 60;
|
||||
const YY_ERROR_ACTION = 59;
|
||||
|
||||
const YY_SZ_ACTTAB = 35;
|
||||
const YY_SZ_ACTTAB = 39;
|
||||
static public $yy_action = array(
|
||||
/* 0 */ 26, 27, 21, 30, 29, 28, 31, 16, 53, 8,
|
||||
/* 10 */ 19, 2, 20, 11, 24, 23, 20, 11, 17, 15,
|
||||
/* 20 */ 3, 14, 13, 18, 4, 6, 5, 1, 12, 22,
|
||||
/* 30 */ 9, 47, 10, 25, 7,
|
||||
/* 0 */ 29, 30, 34, 33, 24, 7, 19, 21, 60, 9,
|
||||
/* 10 */ 16, 1, 20, 14, 15, 6, 23, 20, 14, 32,
|
||||
/* 20 */ 17, 31, 18, 27, 26, 2, 3, 5, 25, 22,
|
||||
/* 30 */ 35, 4, 13, 11, 10, 12, 53, 28, 8,
|
||||
);
|
||||
static public $yy_lookahead = array(
|
||||
/* 0 */ 7, 8, 9, 10, 11, 12, 13, 5, 17, 18,
|
||||
/* 10 */ 14, 20, 14, 15, 22, 23, 14, 15, 2, 2,
|
||||
/* 20 */ 20, 4, 13, 14, 6, 3, 3, 20, 1, 24,
|
||||
/* 30 */ 22, 25, 22, 21, 19,
|
||||
/* 0 */ 7, 8, 9, 10, 11, 12, 5, 14, 19, 20,
|
||||
/* 10 */ 2, 22, 16, 17, 14, 3, 16, 16, 17, 13,
|
||||
/* 20 */ 2, 15, 4, 24, 25, 22, 22, 3, 26, 16,
|
||||
/* 30 */ 15, 6, 27, 24, 24, 1, 28, 23, 21,
|
||||
);
|
||||
const YY_SHIFT_USE_DFLT = -8;
|
||||
const YY_SHIFT_MAX = 17;
|
||||
const YY_SHIFT_MAX = 19;
|
||||
static public $yy_shift_ofst = array(
|
||||
/* 0 */ -8, 2, 2, 2, -7, -2, -2, 27, -8, -8,
|
||||
/* 10 */ -8, 9, 17, -4, 16, 23, 18, 22,
|
||||
/* 0 */ -8, 1, 1, 1, -7, -4, -4, 15, 34, -8,
|
||||
/* 10 */ -8, -8, 18, 6, 0, 13, 24, 12, 8, 25,
|
||||
);
|
||||
const YY_REDUCE_USE_DFLT = -10;
|
||||
const YY_REDUCE_MAX = 10;
|
||||
const YY_REDUCE_USE_DFLT = -12;
|
||||
const YY_REDUCE_MAX = 11;
|
||||
static public $yy_reduce_ofst = array(
|
||||
/* 0 */ -9, -8, -8, -8, 5, 10, 8, 12, 15, 0,
|
||||
/* 10 */ 7,
|
||||
/* 0 */ -11, -1, -1, -1, 2, 10, 9, 5, 14, 17,
|
||||
/* 10 */ 3, 4,
|
||||
);
|
||||
static public $yyExpectedTokens = array(
|
||||
/* 0 */ array(),
|
||||
/* 1 */ array(5, 14, 15, ),
|
||||
/* 2 */ array(5, 14, 15, ),
|
||||
/* 3 */ array(5, 14, 15, ),
|
||||
/* 4 */ array(7, 8, 9, 10, 11, 12, 13, ),
|
||||
/* 5 */ array(14, 15, ),
|
||||
/* 6 */ array(14, 15, ),
|
||||
/* 7 */ array(1, ),
|
||||
/* 8 */ array(),
|
||||
/* 1 */ array(5, 16, 17, ),
|
||||
/* 2 */ array(5, 16, 17, ),
|
||||
/* 3 */ array(5, 16, 17, ),
|
||||
/* 4 */ array(7, 8, 9, 10, 11, 12, 14, ),
|
||||
/* 5 */ array(16, 17, ),
|
||||
/* 6 */ array(16, 17, ),
|
||||
/* 7 */ array(15, ),
|
||||
/* 8 */ array(1, ),
|
||||
/* 9 */ array(),
|
||||
/* 10 */ array(),
|
||||
/* 11 */ array(13, 14, ),
|
||||
/* 11 */ array(),
|
||||
/* 12 */ array(2, 4, ),
|
||||
/* 13 */ array(14, ),
|
||||
/* 14 */ array(2, ),
|
||||
/* 15 */ array(3, ),
|
||||
/* 16 */ array(6, ),
|
||||
/* 13 */ array(13, 15, ),
|
||||
/* 14 */ array(14, 16, ),
|
||||
/* 15 */ array(16, ),
|
||||
/* 16 */ array(3, ),
|
||||
/* 17 */ array(3, ),
|
||||
/* 18 */ array(),
|
||||
/* 19 */ array(),
|
||||
/* 18 */ array(2, ),
|
||||
/* 19 */ array(6, ),
|
||||
/* 20 */ array(),
|
||||
/* 21 */ array(),
|
||||
/* 22 */ array(),
|
||||
@ -257,18 +258,22 @@ static public $yy_action = array(
|
||||
/* 29 */ array(),
|
||||
/* 30 */ array(),
|
||||
/* 31 */ array(),
|
||||
/* 32 */ array(),
|
||||
/* 33 */ array(),
|
||||
/* 34 */ array(),
|
||||
/* 35 */ array(),
|
||||
);
|
||||
static public $yy_default = array(
|
||||
/* 0 */ 40, 36, 33, 37, 52, 52, 52, 32, 35, 40,
|
||||
/* 10 */ 40, 52, 52, 52, 52, 52, 52, 52, 50, 51,
|
||||
/* 20 */ 49, 44, 41, 39, 38, 34, 42, 43, 47, 46,
|
||||
/* 30 */ 45, 48,
|
||||
/* 0 */ 44, 37, 41, 40, 59, 59, 59, 55, 36, 39,
|
||||
/* 10 */ 44, 44, 59, 59, 59, 59, 59, 59, 59, 59,
|
||||
/* 20 */ 56, 52, 58, 57, 50, 45, 43, 42, 38, 46,
|
||||
/* 30 */ 47, 53, 51, 49, 48, 54,
|
||||
);
|
||||
const YYNOCODE = 26;
|
||||
const YYNOCODE = 29;
|
||||
const YYSTACKDEPTH = 100;
|
||||
const YYNSTATE = 32;
|
||||
const YYNRULE = 20;
|
||||
const YYERRORSYMBOL = 16;
|
||||
const YYNSTATE = 36;
|
||||
const YYNRULE = 23;
|
||||
const YYERRORSYMBOL = 18;
|
||||
const YYERRSYMDT = 'yy0';
|
||||
const YYFALLBACK = 0;
|
||||
static public $yyFallback = array(
|
||||
@ -300,10 +305,10 @@ static public $yy_action = array(
|
||||
'$', 'OPENB', 'SECTION', 'CLOSEB',
|
||||
'DOT', 'ID', 'EQUAL', 'FLOAT',
|
||||
'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
|
||||
'TRIPPLE_DOUBLE_QUOTED_STRING', 'NAKED_STRING', 'NEWLINE', 'COMMENTSTART',
|
||||
'error', 'start', 'global_vars', 'sections',
|
||||
'var_list', 'section', 'newline', 'var',
|
||||
'value',
|
||||
'TRIPPLE_QUOTES', 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'TRIPPLE_CONTENT',
|
||||
'NEWLINE', 'COMMENTSTART', 'error', 'start',
|
||||
'global_vars', 'sections', 'var_list', 'section',
|
||||
'newline', 'var', 'value', 'tripple_content',
|
||||
);
|
||||
|
||||
static public $yyRuleName = array(
|
||||
@ -322,11 +327,14 @@ static public $yy_action = array(
|
||||
/* 12 */ "value ::= BOOL",
|
||||
/* 13 */ "value ::= SINGLE_QUOTED_STRING",
|
||||
/* 14 */ "value ::= DOUBLE_QUOTED_STRING",
|
||||
/* 15 */ "value ::= TRIPPLE_DOUBLE_QUOTED_STRING",
|
||||
/* 15 */ "value ::= TRIPPLE_QUOTES tripple_content TRIPPLE_QUOTES_END",
|
||||
/* 16 */ "value ::= NAKED_STRING",
|
||||
/* 17 */ "newline ::= NEWLINE",
|
||||
/* 18 */ "newline ::= COMMENTSTART NEWLINE",
|
||||
/* 19 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
|
||||
/* 17 */ "tripple_content ::= tripple_content TRIPPLE_CONTENT",
|
||||
/* 18 */ "tripple_content ::= TRIPPLE_CONTENT",
|
||||
/* 19 */ "tripple_content ::=",
|
||||
/* 20 */ "newline ::= NEWLINE",
|
||||
/* 21 */ "newline ::= COMMENTSTART NEWLINE",
|
||||
/* 22 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
|
||||
);
|
||||
|
||||
function tokenName($tokenType)
|
||||
@ -582,11 +590,11 @@ static public $yy_action = array(
|
||||
while ($this->yyidx >= 0) {
|
||||
$this->yy_pop_parser_stack();
|
||||
}
|
||||
#line 126 "smarty_internal_configfileparser.y"
|
||||
#line 125 "smarty_internal_configfileparser.y"
|
||||
|
||||
$this->internalError = true;
|
||||
$this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
|
||||
#line 585 "smarty_internal_configfileparser.php"
|
||||
#line 593 "smarty_internal_configfileparser.php"
|
||||
return;
|
||||
}
|
||||
$yytos = new TPC_yyStackEntry;
|
||||
@ -607,35 +615,38 @@ static public $yy_action = array(
|
||||
}
|
||||
|
||||
static public $yyRuleInfo = array(
|
||||
array( 'lhs' => 17, 'rhs' => 2 ),
|
||||
array( 'lhs' => 18, 'rhs' => 1 ),
|
||||
array( 'lhs' => 19, 'rhs' => 2 ),
|
||||
array( 'lhs' => 19, 'rhs' => 0 ),
|
||||
array( 'lhs' => 21, 'rhs' => 5 ),
|
||||
array( 'lhs' => 21, 'rhs' => 6 ),
|
||||
array( 'lhs' => 20, 'rhs' => 2 ),
|
||||
array( 'lhs' => 20, 'rhs' => 2 ),
|
||||
array( 'lhs' => 20, 'rhs' => 0 ),
|
||||
array( 'lhs' => 23, 'rhs' => 3 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 22, 'rhs' => 1 ),
|
||||
array( 'lhs' => 20, 'rhs' => 1 ),
|
||||
array( 'lhs' => 21, 'rhs' => 2 ),
|
||||
array( 'lhs' => 21, 'rhs' => 0 ),
|
||||
array( 'lhs' => 23, 'rhs' => 5 ),
|
||||
array( 'lhs' => 23, 'rhs' => 6 ),
|
||||
array( 'lhs' => 22, 'rhs' => 2 ),
|
||||
array( 'lhs' => 22, 'rhs' => 3 ),
|
||||
array( 'lhs' => 22, 'rhs' => 2 ),
|
||||
array( 'lhs' => 22, 'rhs' => 0 ),
|
||||
array( 'lhs' => 25, 'rhs' => 3 ),
|
||||
array( 'lhs' => 26, 'rhs' => 1 ),
|
||||
array( 'lhs' => 26, 'rhs' => 1 ),
|
||||
array( 'lhs' => 26, 'rhs' => 1 ),
|
||||
array( 'lhs' => 26, 'rhs' => 1 ),
|
||||
array( 'lhs' => 26, 'rhs' => 1 ),
|
||||
array( 'lhs' => 26, 'rhs' => 3 ),
|
||||
array( 'lhs' => 26, 'rhs' => 1 ),
|
||||
array( 'lhs' => 27, 'rhs' => 2 ),
|
||||
array( 'lhs' => 27, 'rhs' => 1 ),
|
||||
array( 'lhs' => 27, 'rhs' => 0 ),
|
||||
array( 'lhs' => 24, 'rhs' => 1 ),
|
||||
array( 'lhs' => 24, 'rhs' => 2 ),
|
||||
array( 'lhs' => 24, 'rhs' => 3 ),
|
||||
);
|
||||
|
||||
static public $yyReduceMap = array(
|
||||
0 => 0,
|
||||
2 => 0,
|
||||
3 => 0,
|
||||
17 => 0,
|
||||
18 => 0,
|
||||
19 => 0,
|
||||
20 => 0,
|
||||
21 => 0,
|
||||
22 => 0,
|
||||
1 => 1,
|
||||
4 => 4,
|
||||
5 => 5,
|
||||
@ -650,86 +661,99 @@ static public $yy_action = array(
|
||||
14 => 14,
|
||||
15 => 15,
|
||||
16 => 16,
|
||||
18 => 16,
|
||||
17 => 17,
|
||||
19 => 19,
|
||||
);
|
||||
#line 132 "smarty_internal_configfileparser.y"
|
||||
#line 131 "smarty_internal_configfileparser.y"
|
||||
function yy_r0(){
|
||||
$this->_retvalue = null;
|
||||
}
|
||||
#line 654 "smarty_internal_configfileparser.php"
|
||||
#line 137 "smarty_internal_configfileparser.y"
|
||||
#line 668 "smarty_internal_configfileparser.php"
|
||||
#line 136 "smarty_internal_configfileparser.y"
|
||||
function yy_r1(){
|
||||
$this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;
|
||||
}
|
||||
#line 659 "smarty_internal_configfileparser.php"
|
||||
#line 150 "smarty_internal_configfileparser.y"
|
||||
#line 673 "smarty_internal_configfileparser.php"
|
||||
#line 149 "smarty_internal_configfileparser.y"
|
||||
function yy_r4(){
|
||||
$this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
|
||||
$this->_retvalue = null;
|
||||
}
|
||||
#line 665 "smarty_internal_configfileparser.php"
|
||||
#line 155 "smarty_internal_configfileparser.y"
|
||||
#line 679 "smarty_internal_configfileparser.php"
|
||||
#line 154 "smarty_internal_configfileparser.y"
|
||||
function yy_r5(){
|
||||
if ($this->smarty->config_read_hidden) {
|
||||
$this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
$this->_retvalue = null;
|
||||
}
|
||||
#line 673 "smarty_internal_configfileparser.php"
|
||||
#line 163 "smarty_internal_configfileparser.y"
|
||||
#line 687 "smarty_internal_configfileparser.php"
|
||||
#line 162 "smarty_internal_configfileparser.y"
|
||||
function yy_r6(){
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
|
||||
}
|
||||
#line 678 "smarty_internal_configfileparser.php"
|
||||
#line 167 "smarty_internal_configfileparser.y"
|
||||
#line 692 "smarty_internal_configfileparser.php"
|
||||
#line 166 "smarty_internal_configfileparser.y"
|
||||
function yy_r7(){
|
||||
$this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
|
||||
}
|
||||
#line 683 "smarty_internal_configfileparser.php"
|
||||
#line 171 "smarty_internal_configfileparser.y"
|
||||
#line 697 "smarty_internal_configfileparser.php"
|
||||
#line 170 "smarty_internal_configfileparser.y"
|
||||
function yy_r8(){
|
||||
$this->_retvalue = Array();
|
||||
}
|
||||
#line 688 "smarty_internal_configfileparser.php"
|
||||
#line 177 "smarty_internal_configfileparser.y"
|
||||
#line 702 "smarty_internal_configfileparser.php"
|
||||
#line 176 "smarty_internal_configfileparser.y"
|
||||
function yy_r9(){
|
||||
$this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 693 "smarty_internal_configfileparser.php"
|
||||
#line 182 "smarty_internal_configfileparser.y"
|
||||
#line 707 "smarty_internal_configfileparser.php"
|
||||
#line 181 "smarty_internal_configfileparser.y"
|
||||
function yy_r10(){
|
||||
$this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
#line 698 "smarty_internal_configfileparser.php"
|
||||
#line 186 "smarty_internal_configfileparser.y"
|
||||
#line 712 "smarty_internal_configfileparser.php"
|
||||
#line 185 "smarty_internal_configfileparser.y"
|
||||
function yy_r11(){
|
||||
$this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
#line 703 "smarty_internal_configfileparser.php"
|
||||
#line 190 "smarty_internal_configfileparser.y"
|
||||
#line 717 "smarty_internal_configfileparser.php"
|
||||
#line 189 "smarty_internal_configfileparser.y"
|
||||
function yy_r12(){
|
||||
$this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 708 "smarty_internal_configfileparser.php"
|
||||
#line 194 "smarty_internal_configfileparser.y"
|
||||
#line 722 "smarty_internal_configfileparser.php"
|
||||
#line 193 "smarty_internal_configfileparser.y"
|
||||
function yy_r13(){
|
||||
$this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 713 "smarty_internal_configfileparser.php"
|
||||
#line 198 "smarty_internal_configfileparser.y"
|
||||
#line 727 "smarty_internal_configfileparser.php"
|
||||
#line 197 "smarty_internal_configfileparser.y"
|
||||
function yy_r14(){
|
||||
$this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
|
||||
}
|
||||
#line 718 "smarty_internal_configfileparser.php"
|
||||
#line 202 "smarty_internal_configfileparser.y"
|
||||
#line 732 "smarty_internal_configfileparser.php"
|
||||
#line 201 "smarty_internal_configfileparser.y"
|
||||
function yy_r15(){
|
||||
$this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
|
||||
$this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor);
|
||||
}
|
||||
#line 723 "smarty_internal_configfileparser.php"
|
||||
#line 206 "smarty_internal_configfileparser.y"
|
||||
#line 737 "smarty_internal_configfileparser.php"
|
||||
#line 205 "smarty_internal_configfileparser.y"
|
||||
function yy_r16(){
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
#line 728 "smarty_internal_configfileparser.php"
|
||||
#line 742 "smarty_internal_configfileparser.php"
|
||||
#line 210 "smarty_internal_configfileparser.y"
|
||||
function yy_r17(){
|
||||
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor . $this->yystack[$this->yyidx + 0]->minor;
|
||||
}
|
||||
#line 747 "smarty_internal_configfileparser.php"
|
||||
#line 216 "smarty_internal_configfileparser.y"
|
||||
function yy_r19(){
|
||||
$this->_retvalue = '';
|
||||
}
|
||||
#line 752 "smarty_internal_configfileparser.php"
|
||||
|
||||
private $_retvalue;
|
||||
|
||||
@ -786,12 +810,12 @@ static public $yy_action = array(
|
||||
|
||||
function yy_syntax_error($yymajor, $TOKEN)
|
||||
{
|
||||
#line 119 "smarty_internal_configfileparser.y"
|
||||
#line 118 "smarty_internal_configfileparser.y"
|
||||
|
||||
$this->internalError = true;
|
||||
$this->yymajor = $yymajor;
|
||||
$this->compiler->trigger_config_file_error();
|
||||
#line 791 "smarty_internal_configfileparser.php"
|
||||
#line 815 "smarty_internal_configfileparser.php"
|
||||
}
|
||||
|
||||
function yy_accept()
|
||||
@ -802,13 +826,13 @@ static public $yy_action = array(
|
||||
while ($this->yyidx >= 0) {
|
||||
$stack = $this->yy_pop_parser_stack();
|
||||
}
|
||||
#line 111 "smarty_internal_configfileparser.y"
|
||||
#line 110 "smarty_internal_configfileparser.y"
|
||||
|
||||
$this->successful = !$this->internalError;
|
||||
$this->internalError = false;
|
||||
$this->retvalue = $this->_retvalue;
|
||||
//echo $this->retvalue."\n\n";
|
||||
#line 809 "smarty_internal_configfileparser.php"
|
||||
#line 833 "smarty_internal_configfileparser.php"
|
||||
}
|
||||
|
||||
function doParse($yymajor, $yytokenvalue)
|
||||
|
@ -21,7 +21,7 @@ class Smarty_Internal_Function_Call_Handler {
|
||||
*
|
||||
* @param string $_name template function name
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
* @param array $_params Smarty variables passed as call paramter
|
||||
* @param array $_params Smarty variables passed as call parameter
|
||||
* @param string $_hash nocache hash value
|
||||
* @param bool $_nocache nocache flag
|
||||
*/
|
||||
@ -52,4 +52,4 @@ class Smarty_Internal_Function_Call_Handler {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -21,7 +21,7 @@ class Smarty_Internal_Nocache_Insert {
|
||||
* Compiles code for the {insert} tag into cache file
|
||||
*
|
||||
* @param string $_function insert function name
|
||||
* @param array $_attr array with paramter
|
||||
* @param array $_attr array with parameter
|
||||
* @param Smarty_Internal_Template $_template template object
|
||||
* @param string $_script script name to load or 'null'
|
||||
* @param string $_assign optional variable name
|
||||
@ -50,4 +50,4 @@ class Smarty_Internal_Nocache_Insert {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -221,7 +221,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
return false;
|
||||
}
|
||||
$this->properties['cache_lifetime'] = $this->cache_lifetime;
|
||||
$this->properties['unifunc'] = 'content_' . uniqid();
|
||||
$this->properties['unifunc'] = 'content_' . uniqid('', false);
|
||||
$content = $this->createTemplateCodeFrame($content, true);
|
||||
$_smarty_tpl = $this;
|
||||
eval("?>" . $content);
|
||||
@ -245,8 +245,15 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
public function getSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope)
|
||||
{
|
||||
// already in template cache?
|
||||
$unique_template_name = Smarty_Resource::getUniqueTemplateName($this->smarty, $template);
|
||||
$_templateId = sha1($unique_template_name . $cache_id . $compile_id);
|
||||
if ($this->smarty->allow_ambiguous_resources) {
|
||||
$_templateId = Smarty_Resource::getUniqueTemplateName($this->smarty, $template) . $cache_id . $compile_id;
|
||||
} else {
|
||||
$_templateId = $this->smarty->joined_template_dir . '#' . $template . $cache_id . $compile_id;
|
||||
}
|
||||
|
||||
if (isset($_templateId[150])) {
|
||||
$_templateId = sha1($_templateId);
|
||||
}
|
||||
if (isset($this->smarty->template_objects[$_templateId])) {
|
||||
// clone cached template object because of possible recursive call
|
||||
$tpl = clone $this->smarty->template_objects[$_templateId];
|
||||
@ -334,7 +341,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
$plugins_string = '<?php ';
|
||||
foreach ($this->required_plugins['compiled'] as $tmp) {
|
||||
foreach ($tmp as $data) {
|
||||
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
|
||||
$file = addslashes($data['file']);
|
||||
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$file}';\n";
|
||||
}
|
||||
}
|
||||
$plugins_string .= '?>';
|
||||
@ -344,7 +352,8 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
$plugins_string .= "<?php echo '/*%%SmartyNocache:{$this->properties['nocache_hash']}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
|
||||
foreach ($this->required_plugins['nocache'] as $tmp) {
|
||||
foreach ($tmp as $data) {
|
||||
$plugins_string .= "if (!is_callable(\'{$data['function']}\')) include \'{$data['file']}\';\n";
|
||||
$file = addslashes($data['file']);
|
||||
$plugins_string .= addslashes("if (!is_callable('{$data['function']}')) include '{$file}';\n");
|
||||
}
|
||||
}
|
||||
$plugins_string .= "?>/*/%%SmartyNocache:{$this->properties['nocache_hash']}%%*/';?>\n";
|
||||
@ -381,7 +390,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
}
|
||||
$this->properties['version'] = Smarty::SMARTY_VERSION;
|
||||
if (!isset($this->properties['unifunc'])) {
|
||||
$this->properties['unifunc'] = 'content_' . uniqid();
|
||||
$this->properties['unifunc'] = 'content_' . uniqid('', false);
|
||||
}
|
||||
if (!$this->source->recompiled) {
|
||||
$output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($this->properties, true) . ',' . ($cache ? 'true' : 'false') . "); /*/%%SmartyHeaderCode%%*/?>\n";
|
||||
@ -564,7 +573,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
{
|
||||
throw new SmartyException("Not matching {capture} open/close in \"{$this->template_resource}\"");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Empty cache for this template
|
||||
*
|
||||
@ -576,7 +585,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
Smarty_CacheResource::invalidLoadedCache($this->smarty);
|
||||
return $this->cached->handler->clear($this->smarty, $this->template_name, $this->cache_id, $this->compile_id, $exp_time);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set Smarty property in template context
|
||||
*
|
||||
@ -620,7 +629,15 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
|
||||
// cache template object under a unique ID
|
||||
// do not cache eval resources
|
||||
if ($this->source->type != 'eval') {
|
||||
$_templateId = sha1($this->source->unique_resource . $this->cache_id . $this->compile_id);
|
||||
if ($this->smarty->allow_ambiguous_resources) {
|
||||
$_templateId = $this->source->unique_resource . $this->cache_id . $this->compile_id;
|
||||
} else {
|
||||
$_templateId = $this->smarty->joined_template_dir . '#' . $this->template_resource . $this->cache_id . $this->compile_id;
|
||||
}
|
||||
|
||||
if (isset($_templateId[150])) {
|
||||
$_templateId = sha1($_templateId);
|
||||
}
|
||||
$this->smarty->template_objects[$_templateId] = $this;
|
||||
}
|
||||
return $this->source;
|
||||
|
@ -751,6 +751,9 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($name == 'Smarty') {
|
||||
throw new SmartyException("PHP5 requires you to call __construct() instead of Smarty()");
|
||||
}
|
||||
// must be unknown
|
||||
throw new SmartyException("Call of unknown method '$name'.");
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ abstract class Smarty_Internal_TemplateCompilerBase {
|
||||
// save template object in compiler class
|
||||
$this->template = $template;
|
||||
// reset has noche code flag
|
||||
$this->template->has_nocache_code = false;
|
||||
$this->template->has_nocache_code = false;
|
||||
$this->smarty->_current_file = $saved_filepath = $this->template->source->filepath;
|
||||
// template header code
|
||||
$template_header = '';
|
||||
@ -521,14 +521,17 @@ abstract class Smarty_Internal_TemplateCompilerBase {
|
||||
}
|
||||
include_once $script;
|
||||
} else {
|
||||
throw new SmartyCompilerException("Plugin or modifer script file $script not found");
|
||||
$this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found");
|
||||
}
|
||||
}
|
||||
if (!is_string($callback) && !(is_array($callback) && is_string($callback[0]) && is_string($callback[1]))) {
|
||||
$this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" must be a static function name or array of class and function name");
|
||||
}
|
||||
if (is_callable($callback)) {
|
||||
$this->default_handler_plugins[$plugin_type][$tag] = array($callback, true, array());
|
||||
return true;
|
||||
} else {
|
||||
throw new SmartyCompilerException("Function for plugin or modifier $tag not callable");
|
||||
$this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -569,6 +572,7 @@ abstract class Smarty_Internal_TemplateCompilerBase {
|
||||
} else {
|
||||
$_output = $content;
|
||||
}
|
||||
$this->modifier_plugins = array();
|
||||
$this->suppressNocacheProcessing = false;
|
||||
$this->tag_nocache = false;
|
||||
return $_output;
|
||||
|
@ -460,7 +460,7 @@ class Smarty_Internal_Templatelexer
|
||||
if ($this->counter >= strlen($this->data)) {
|
||||
return false; // end of input
|
||||
}
|
||||
$yy_global_pattern = "/\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s{1,})|\G(\\s{1,}".$this->rdel.")|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(".$this->rdel.")|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*===\\s*)|\G(\\s*!==\\s*)|\G(\\s*==\\s*|\\s+eq\\s+)|\G(\\s*!=\\s*|\\s*<>\\s*|\\s+(ne|neq)\\s+)|\G(\\s*>=\\s*|\\s+(ge|gte)\\s+)|\G(\\s*<=\\s*|\\s+(le|lte)\\s+)|\G(\\s*>\\s*|\\s+gt\\s+)|\G(\\s*<\\s*|\\s+lt\\s+)|\G(\\s+mod\\s+)|\G(!\\s*|not\\s+)|\G(\\s*&&\\s*|\\s*and\\s+)|\G(\\s*\\|\\|\\s*|\\s*or\\s+)|\G(\\s*xor\\s+)|\G(\\s+is\\s+odd\\s+by\\s+)|\G(\\s+is\\s+not\\s+odd\\s+by\\s+)|\G(\\s+is\\s+odd)|\G(\\s+is\\s+not\\s+odd)|\G(\\s+is\\s+even\\s+by\\s+)|\G(\\s+is\\s+not\\s+even\\s+by\\s+)|\G(\\s+is\\s+even)|\G(\\s+is\\s+not\\s+even)|\G(\\s+is\\s+div\\s+by\\s+)|\G(\\s+is\\s+not\\s+div\\s+by\\s+)|\G(\\((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)\\)\\s*)|\G(\\(\\s*)|\G(\\s*\\))|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*->\\s*)|\G(\\s*=>\\s*)|\G(\\s*=\\s*)|\G(\\+\\+|--)|\G(\\s*(\\+|-)\\s*)|\G(\\s*(\\*|\/|%)\\s*)|\G(\\$)|\G(\\s*;)|\G(::)|\G(\\s*:\\s*)|\G(@)|\G(#)|\G(\")|\G(`)|\G(\\|)|\G(\\.)|\G(\\s*,\\s*)|\G(\\s*&\\s*)|\G(\\s*\\?\\s*)|\G(0[xX][0-9a-fA-F]+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G(\\s+)|\G(.)/iS";
|
||||
$yy_global_pattern = "/\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s{1,})|\G(\\s{1,}".$this->rdel.")|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(".$this->rdel.")|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*===\\s*)|\G(\\s*!==\\s*)|\G(\\s*==\\s*|\\s+eq\\s+)|\G(\\s*!=\\s*|\\s*<>\\s*|\\s+(ne|neq)\\s+)|\G(\\s*>=\\s*|\\s+(ge|gte)\\s+)|\G(\\s*<=\\s*|\\s+(le|lte)\\s+)|\G(\\s*>\\s*|\\s+gt\\s+)|\G(\\s*<\\s*|\\s+lt\\s+)|\G(\\s+mod\\s+)|\G(!\\s*|not\\s+)|\G(\\s*&&\\s*|\\s*and\\s+)|\G(\\s*\\|\\|\\s*|\\s*or\\s+)|\G(\\s*xor\\s+)|\G(\\s+is\\s+odd\\s+by\\s+)|\G(\\s+is\\s+not\\s+odd\\s+by\\s+)|\G(\\s+is\\s+odd)|\G(\\s+is\\s+not\\s+odd)|\G(\\s+is\\s+even\\s+by\\s+)|\G(\\s+is\\s+not\\s+even\\s+by\\s+)|\G(\\s+is\\s+even)|\G(\\s+is\\s+not\\s+even)|\G(\\s+is\\s+div\\s+by\\s+)|\G(\\s+is\\s+not\\s+div\\s+by\\s+)|\G(\\((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)\\)\\s*)|\G(\\s*\\(\\s*)|\G(\\s*\\))|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*->\\s*)|\G(\\s*=>\\s*)|\G(\\s*=\\s*)|\G(\\+\\+|--)|\G(\\s*(\\+|-)\\s*)|\G(\\s*(\\*|\/|%)\\s*)|\G(\\$)|\G(\\s*;)|\G(::)|\G(\\s*:\\s*)|\G(@)|\G(#)|\G(\")|\G(`)|\G(\\|)|\G(\\.)|\G(\\s*,\\s*)|\G(\\s*&\\s*)|\G(\\s*\\?\\s*)|\G(0[xX][0-9a-fA-F]+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G(\\s+)|\G(.)/iS";
|
||||
|
||||
do {
|
||||
if ($this->mbstring_overload ? preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
|
||||
|
@ -189,19 +189,26 @@ class Smarty_Internal_Utility {
|
||||
$smarty->caching = false;
|
||||
$tpl = new $smarty->template_class($resource_name, $smarty);
|
||||
$smarty->caching = $_save_stat;
|
||||
|
||||
|
||||
// remove from template cache
|
||||
$tpl->source; // have the template registered before unset()
|
||||
$_templateId = sha1($tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id);
|
||||
if ($smarty->allow_ambiguous_resources) {
|
||||
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
|
||||
} else {
|
||||
$_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;
|
||||
}
|
||||
if (isset($_templateId[150])) {
|
||||
$_templateId = sha1($_templateId);
|
||||
}
|
||||
unset($smarty->template_objects[$_templateId]);
|
||||
|
||||
|
||||
if ($tpl->source->exists) {
|
||||
$_resource_part_1 = basename(str_replace('^', '/', $tpl->compiled->filepath));
|
||||
$_resource_part_1_length = strlen($_resource_part_1);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
$_resource_part_2 = str_replace('.php','.cache.php',$_resource_part_1);
|
||||
$_resource_part_2_length = strlen($_resource_part_2);
|
||||
} else {
|
||||
@ -216,14 +223,19 @@ class Smarty_Internal_Utility {
|
||||
$_compile_id_part_length = strlen($_compile_id_part);
|
||||
}
|
||||
$_count = 0;
|
||||
$_compileDirs = new RecursiveDirectoryIterator($_dir);
|
||||
try {
|
||||
$_compileDirs = new RecursiveDirectoryIterator($_dir);
|
||||
// NOTE: UnexpectedValueException thrown for PHP >= 5.3
|
||||
} catch (Exception $e) {
|
||||
return 0;
|
||||
}
|
||||
$_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
|
||||
foreach ($_compile as $_file) {
|
||||
if (substr($_file->getBasename(), 0, 1) == '.' || strpos($_file, '.svn') !== false)
|
||||
continue;
|
||||
|
||||
|
||||
$_filepath = (string) $_file;
|
||||
|
||||
|
||||
if ($_file->isDir()) {
|
||||
if (!$_compile->isDot()) {
|
||||
// delete folder if empty
|
||||
@ -232,10 +244,10 @@ class Smarty_Internal_Utility {
|
||||
} else {
|
||||
$unlink = false;
|
||||
if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
|
||||
&& (!isset($resource_name)
|
||||
|| (isset($_filepath[$_resource_part_1_length])
|
||||
&& substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)
|
||||
|| (isset($_filepath[$_resource_part_2_length])
|
||||
&& (!isset($resource_name)
|
||||
|| (isset($_filepath[$_resource_part_1_length])
|
||||
&& substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)
|
||||
|| (isset($_filepath[$_resource_part_2_length])
|
||||
&& substr_compare($_filepath, $_resource_part_2, -$_resource_part_2_length, $_resource_part_2_length) == 0))) {
|
||||
if (isset($exp_time)) {
|
||||
if (time() - @filemtime($_filepath) >= $exp_time) {
|
||||
@ -245,7 +257,7 @@ class Smarty_Internal_Utility {
|
||||
$unlink = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($unlink && @unlink($_filepath)) {
|
||||
$_count++;
|
||||
}
|
||||
@ -302,7 +314,7 @@ class Smarty_Internal_Utility {
|
||||
if ($errors === null) {
|
||||
echo "$template_dir is OK.\n";
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
} else {
|
||||
$status = false;
|
||||
@ -323,11 +335,11 @@ class Smarty_Internal_Utility {
|
||||
} else {
|
||||
$errors['template_dir'] = $message;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is_dir($template_dir)) {
|
||||
$status = false;
|
||||
$message = "FAILED: $template_dir is not a directory";
|
||||
@ -417,7 +429,7 @@ class Smarty_Internal_Utility {
|
||||
if ($errors === null) {
|
||||
echo "$plugin_dir is OK.\n";
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
} else {
|
||||
$status = false;
|
||||
@ -438,11 +450,11 @@ class Smarty_Internal_Utility {
|
||||
} else {
|
||||
$errors['plugins_dir'] = $message;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is_dir($plugin_dir)) {
|
||||
$status = false;
|
||||
$message = "FAILED: $plugin_dir is not a directory";
|
||||
@ -484,7 +496,7 @@ class Smarty_Internal_Utility {
|
||||
echo "Testing cache directory...\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// test if all registered cache_dir is accessible
|
||||
$__cache_dir = $smarty->getCacheDir();
|
||||
$_cache_dir = realpath($__cache_dir);
|
||||
@ -543,7 +555,7 @@ class Smarty_Internal_Utility {
|
||||
if ($errors === null) {
|
||||
echo "$config_dir is OK.\n";
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
} else {
|
||||
$status = false;
|
||||
@ -564,11 +576,11 @@ class Smarty_Internal_Utility {
|
||||
} else {
|
||||
$errors['config_dir'] = $message;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is_dir($config_dir)) {
|
||||
$status = false;
|
||||
$message = "FAILED: $config_dir is not a directory";
|
||||
|
@ -46,7 +46,7 @@ class Smarty_Internal_Write_File {
|
||||
}
|
||||
|
||||
// remove original file
|
||||
unlink($_filepath);
|
||||
@unlink($_filepath);
|
||||
|
||||
// rename tmp file
|
||||
$success = rename($_tmp_file, $_filepath);
|
||||
|
@ -349,10 +349,14 @@ abstract class Smarty_Resource {
|
||||
// note registered to smarty is not kept unique!
|
||||
return $smarty->_resource_handlers[$type];
|
||||
}
|
||||
|
||||
if (!isset(self::$resources['registered'])) {
|
||||
self::$resources['registered'] = new Smarty_Internal_Resource_Registered();
|
||||
}
|
||||
if (!isset($smarty->_resource_handlers[$type])) {
|
||||
$smarty->_resource_handlers[$type] = self::$resources['registered'];
|
||||
}
|
||||
|
||||
return $smarty->_resource_handlers[$type];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user