From 739688a4549e970a86d58655ff203d66a6270180 Mon Sep 17 00:00:00 2001 From: "monte.ohrt" Date: Fri, 28 Jun 2013 02:02:53 +0000 Subject: [PATCH 01/26] update change log --- change_log.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/change_log.txt b/change_log.txt index d2d37758..26eefe89 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,5 @@ ===== trunk ===== +===== Smarty-3.1.14 ===== 27.06.2013 - bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389) From a0f26a96cc8cf7cba0fa8349aed49c9971b7fbee Mon Sep 17 00:00:00 2001 From: "monte.ohrt" Date: Tue, 2 Jul 2013 14:11:12 +0000 Subject: [PATCH 02/26] fix order of replacements (mohrt) --- libs/plugins/outputfilter.trimwhitespace.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/plugins/outputfilter.trimwhitespace.php b/libs/plugins/outputfilter.trimwhitespace.php index 87cf8c78..78ecd441 100644 --- a/libs/plugins/outputfilter.trimwhitespace.php +++ b/libs/plugins/outputfilter.trimwhitespace.php @@ -74,13 +74,11 @@ function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $s // maybe a \0 byte or something is interfering? // $source = trim( $source ); - // capture html elements not to be messed with $_offset = 0; if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { foreach ($matches as $match) { - $store[] = $match[0][0]; $_length = strlen($match[0][0]); - $replace = array_shift($store); + $replace = $store[$match[1][0]]; $source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length); $_offset += strlen($replace) - $_length; From a74d8d5416fd4c93609b8f7d984df190e1af0120 Mon Sep 17 00:00:00 2001 From: "monte.ohrt" Date: Tue, 2 Jul 2013 14:16:49 +0000 Subject: [PATCH 03/26] update change log --- change_log.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/change_log.txt b/change_log.txt index 26eefe89..86deb7f0 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,6 @@ ===== trunk ===== +2.7.2013 +- bugfix trimwhitespace would replace captured items in wrong order (forum topic 24387) ===== Smarty-3.1.14 ===== 27.06.2013 - bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389) From 917f92d38b444007394f447b56c525de5aa9bf47 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews@googlemail.com" Date: Fri, 12 Jul 2013 00:16:43 +0000 Subject: [PATCH 04/26] - bugfix Do not remove '//' from file path at normalization (Issue 142) --- change_log.txt | 4 ++++ libs/sysplugins/smarty_resource.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 86deb7f0..cd854750 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,10 @@ ===== trunk ===== +12.7.2013 +- bugfix Do not remove '//' from file path at normalization (Issue 142) + 2.7.2013 - bugfix trimwhitespace would replace captured items in wrong order (forum topic 24387) + ===== Smarty-3.1.14 ===== 27.06.2013 - bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389) diff --git a/libs/sysplugins/smarty_resource.php b/libs/sysplugins/smarty_resource.php index 0a563dfc..0a5efdbc 100644 --- a/libs/sysplugins/smarty_resource.php +++ b/libs/sysplugins/smarty_resource.php @@ -162,7 +162,7 @@ abstract class Smarty_Resource { $offset = 0; // resolve simples - $_path = preg_replace('#(/\./(\./)*)|/{2,}#', '/', $_path); + $_path = preg_replace('#/\./(\./)*#', '/', $_path); // resolve parents while (true) { $_parent = strpos($_path, '/../', $offset); From f99e6a83ce734c089965a76941994e21f77b36da Mon Sep 17 00:00:00 2001 From: "Uwe.Tews@googlemail.com" Date: Sun, 14 Jul 2013 21:12:08 +0000 Subject: [PATCH 05/26] - bugfix increase of internal maximum parser stacksize to allow more complex tag code {forum topic 24426} --- change_log.txt | 3 + .../smarty_internal_configfilelexer.php | 102 +-- .../smarty_internal_configfileparser.php | 167 ++-- .../smarty_internal_templatelexer.php | 350 ++++--- .../smarty_internal_templateparser.php | 866 +++++++++++------- 5 files changed, 824 insertions(+), 664 deletions(-) diff --git a/change_log.txt b/change_log.txt index cd854750..a0c4553d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@ ===== trunk ===== +14.7.2013 +- bugfix increase of internal maximum parser stacksize to allow more complex tag code {forum topic 24426} + 12.7.2013 - bugfix Do not remove '//' from file path at normalization (Issue 142) diff --git a/libs/sysplugins/smarty_internal_configfilelexer.php b/libs/sysplugins/smarty_internal_configfilelexer.php index bade2fe7..4bc2b9e8 100644 --- a/libs/sysplugins/smarty_internal_configfilelexer.php +++ b/libs/sysplugins/smarty_internal_configfilelexer.php @@ -21,10 +21,9 @@ class Smarty_Internal_Configfilelexer public $line; private $state = 1; public $smarty_token_names = array ( // Text for parser error messages - ); + ); - - function __construct($data, $smarty) + public function __construct($data, $smarty) { // set instance object self::instance($this); @@ -39,39 +38,35 @@ class Smarty_Internal_Configfilelexer static $instance = null; if (isset($new_instance) && is_object($new_instance)) $instance = $new_instance; + return $instance; } - - private $_yy_state = 1; private $_yy_stack = array(); - function yylex() + public function yylex() { return $this->{'yylex' . $this->_yy_state}(); } - function yypushstate($state) + public function yypushstate($state) { array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; } - function yypopstate() + public function yypopstate() { $this->_yy_state = array_pop($this->_yy_stack); } - function yybegin($state) + public function yybegin($state) { $this->_yy_state = $state; } - - - - function yylex1() + public function yylex1() { $tokenMap = array ( 1 => 0, @@ -134,55 +129,51 @@ class Smarty_Internal_Configfilelexer } // end function - const START = 1; - function yy_r1_1($yy_subpatterns) + public function yy_r1_1($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART; $this->yypushstate(self::COMMENT); } - function yy_r1_2($yy_subpatterns) + public function yy_r1_2($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_OPENB; $this->yypushstate(self::SECTION); } - function yy_r1_3($yy_subpatterns) + public function yy_r1_3($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB; } - function yy_r1_4($yy_subpatterns) + public function yy_r1_4($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL; $this->yypushstate(self::VALUE); } - function yy_r1_5($yy_subpatterns) + public function yy_r1_5($yy_subpatterns) { - return false; } - function yy_r1_6($yy_subpatterns) + public function yy_r1_6($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; } - function yy_r1_7($yy_subpatterns) + public function yy_r1_7($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_ID; } - function yy_r1_8($yy_subpatterns) + public function yy_r1_8($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_OTHER; } - - - function yylex2() + public function yylex2() { $tokenMap = array ( 1 => 0, @@ -246,62 +237,61 @@ class Smarty_Internal_Configfilelexer } // end function - const VALUE = 2; - function yy_r2_1($yy_subpatterns) + public function yy_r2_1($yy_subpatterns) { - return false; } - function yy_r2_2($yy_subpatterns) + public function yy_r2_2($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT; $this->yypopstate(); } - function yy_r2_3($yy_subpatterns) + public function yy_r2_3($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_INT; $this->yypopstate(); } - function yy_r2_4($yy_subpatterns) + public function yy_r2_4($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES; $this->yypushstate(self::TRIPPLE); } - function yy_r2_5($yy_subpatterns) + public function yy_r2_5($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING; $this->yypopstate(); } - function yy_r2_6($yy_subpatterns) + public function yy_r2_6($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING; $this->yypopstate(); } - function yy_r2_7($yy_subpatterns) + public function yy_r2_7($yy_subpatterns) { if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) { $this->yypopstate(); $this->yypushstate(self::NAKED_STRING_VALUE); + return true; //reprocess in new state } else { $this->token = Smarty_Internal_Configfileparser::TPC_BOOL; $this->yypopstate(); } } - function yy_r2_8($yy_subpatterns) + public function yy_r2_8($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->yypopstate(); } - function yy_r2_9($yy_subpatterns) + public function yy_r2_9($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; @@ -309,9 +299,7 @@ class Smarty_Internal_Configfilelexer $this->yypopstate(); } - - - function yylex3() + public function yylex3() { $tokenMap = array ( 1 => 0, @@ -367,18 +355,15 @@ class Smarty_Internal_Configfilelexer } // end function - const NAKED_STRING_VALUE = 3; - function yy_r3_1($yy_subpatterns) + public function yy_r3_1($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->yypopstate(); } - - - function yylex4() + public function yylex4() { $tokenMap = array ( 1 => 0, @@ -436,28 +421,24 @@ class Smarty_Internal_Configfilelexer } // end function - const COMMENT = 4; - function yy_r4_1($yy_subpatterns) + public function yy_r4_1($yy_subpatterns) { - return false; } - function yy_r4_2($yy_subpatterns) + public function yy_r4_2($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; } - function yy_r4_3($yy_subpatterns) + public function yy_r4_3($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE; $this->yypopstate(); } - - - function yylex5() + public function yylex5() { $tokenMap = array ( 1 => 0, @@ -514,22 +495,20 @@ class Smarty_Internal_Configfilelexer } // end function - const SECTION = 5; - function yy_r5_1($yy_subpatterns) + public function yy_r5_1($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_DOT; } - function yy_r5_2($yy_subpatterns) + public function yy_r5_2($yy_subpatterns) { $this->token = Smarty_Internal_Configfileparser::TPC_SECTION; $this->yypopstate(); } - - function yylex6() + public function yylex6() { $tokenMap = array ( 1 => 0, @@ -586,16 +565,15 @@ class Smarty_Internal_Configfilelexer } // end function - const TRIPPLE = 6; - function yy_r6_1($yy_subpatterns) + public 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) + public function yy_r6_2($yy_subpatterns) { if ($this->mbstring_overload) { @@ -617,6 +595,4 @@ class Smarty_Internal_Configfilelexer $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT; } - } -?> \ No newline at end of file diff --git a/libs/sysplugins/smarty_internal_configfileparser.php b/libs/sysplugins/smarty_internal_configfileparser.php index 784bc684..2b7bf55a 100644 --- a/libs/sysplugins/smarty_internal_configfileparser.php +++ b/libs/sysplugins/smarty_internal_configfileparser.php @@ -14,7 +14,7 @@ class TPC_yyToken implements ArrayAccess public $string = ''; public $metadata = array(); - function __construct($s, $m = array()) + public function __construct($s, $m = array()) { if ($s instanceof TPC_yyToken) { $this->string = $s->string; @@ -29,28 +29,29 @@ class TPC_yyToken implements ArrayAccess } } - function __toString() + public function __toString() { return $this->_string; } - function offsetExists($offset) + public function offsetExists($offset) { return isset($this->metadata[$offset]); } - function offsetGet($offset) + public function offsetGet($offset) { return $this->metadata[$offset]; } - function offsetSet($offset, $value) + public function offsetSet($offset, $value) { if ($offset === null) { if (isset($value[0])) { $x = ($value instanceof TPC_yyToken) ? $value->metadata : $value; $this->metadata = array_merge($this->metadata, $x); + return; } $offset = count($this->metadata); @@ -67,7 +68,7 @@ class TPC_yyToken implements ArrayAccess } } - function offsetUnset($offset) + public function offsetUnset($offset) { unset($this->metadata[$offset]); } @@ -82,7 +83,6 @@ class TPC_yyStackEntry ** is the value of the token */ }; - #line 12 "smarty_internal_configfileparser.y" class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser.php" { @@ -94,7 +94,8 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser private $lex; private $internalError = false; - function __construct($lex, $compiler) { + public function __construct($lex, $compiler) + { // set instance object self::instance($this); $this->lex = $lex; @@ -106,21 +107,25 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser static $instance = null; if (isset($new_instance) && is_object($new_instance)) $instance = $new_instance; + return $instance; } - private function parse_bool($str) { + private function parse_bool($str) + { if (in_array(strtolower($str) ,array('on','yes','true'))) { $res = true; } else { $res = false; } + return $res; } private static $escapes_single = Array('\\' => '\\', '\'' => '\''); - private static function parse_single_quoted_string($qstr) { + private static function parse_single_quoted_string($qstr) + { $escaped_string = substr($qstr, 1, strlen($qstr)-2); //remove outer quotes $ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE); @@ -139,16 +144,20 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser return $str; } - private static function parse_double_quoted_string($qstr) { + private static function parse_double_quoted_string($qstr) + { $inner_str = substr($qstr, 1, strlen($qstr)-2); + return stripcslashes($inner_str); } - private static function parse_tripple_double_quoted_string($qstr) { + private static function parse_tripple_double_quoted_string($qstr) + { return stripcslashes($qstr); } - private function set_var(Array $var, Array &$target_array) { + private function set_var(Array $var, Array &$target_array) + { $key = $var["key"]; $value = $var["value"]; @@ -160,7 +169,8 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser } } - private function add_global_vars(Array $vars) { + private function add_global_vars(Array $vars) + { if (!isset($this->compiler->config_data['vars'])) { $this->compiler->config_data['vars'] = Array(); } @@ -169,7 +179,8 @@ class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser } } - private function add_section_vars($section_name, Array $vars) { + private function add_section_vars($section_name, Array $vars) + { if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) { $this->compiler->config_data['sections'][$section_name]['vars'] = Array(); } @@ -208,7 +219,7 @@ static public $yy_action = array( /* 20 */ 15, 17, 23, 18, 27, 26, 4, 5, 6, 32, /* 30 */ 2, 11, 28, 22, 16, 9, 7, 10, ); - static public $yy_lookahead = array( + public static $yy_lookahead = array( /* 0 */ 7, 8, 9, 10, 11, 12, 5, 27, 15, 16, /* 10 */ 20, 21, 23, 23, 17, 18, 13, 14, 17, 18, /* 20 */ 15, 2, 17, 4, 25, 26, 6, 3, 3, 14, @@ -216,17 +227,17 @@ static public $yy_action = array( ); const YY_SHIFT_USE_DFLT = -8; const YY_SHIFT_MAX = 19; - static public $yy_shift_ofst = array( + public static $yy_shift_ofst = array( /* 0 */ -8, 1, 1, 1, -7, -3, -3, 30, -8, -8, /* 10 */ -8, 19, 5, 3, 15, 16, 24, 25, 32, 20, ); const YY_REDUCE_USE_DFLT = -21; const YY_REDUCE_MAX = 10; - static public $yy_reduce_ofst = array( + public static $yy_reduce_ofst = array( /* 0 */ -10, -1, -1, -1, -20, 10, 12, 8, 14, 7, /* 10 */ -11, ); - static public $yyExpectedTokens = array( + public static $yyExpectedTokens = array( /* 0 */ array(), /* 1 */ array(5, 17, 18, ), /* 2 */ array(5, 17, 18, ), @@ -264,7 +275,7 @@ static public $yy_action = array( /* 34 */ array(), /* 35 */ array(), ); - static public $yy_default = array( + public static $yy_default = array( /* 0 */ 44, 37, 41, 40, 58, 58, 58, 36, 39, 44, /* 10 */ 44, 58, 58, 58, 58, 58, 58, 58, 58, 58, /* 20 */ 55, 54, 57, 56, 50, 45, 43, 42, 38, 46, @@ -277,9 +288,9 @@ static public $yy_action = array( const YYERRORSYMBOL = 19; const YYERRSYMDT = 'yy0'; const YYFALLBACK = 0; - static public $yyFallback = array( + public static $yyFallback = array( ); - static function Trace($TraceFILE, $zTracePrompt) + public static function Trace($TraceFILE, $zTracePrompt) { if (!$TraceFILE) { $zTracePrompt = 0; @@ -290,14 +301,14 @@ static public $yy_action = array( self::$yyTracePrompt = $zTracePrompt; } - static function PrintTrace() + public static function PrintTrace() { self::$yyTraceFILE = fopen('php://output', 'w'); self::$yyTracePrompt = '
'; } - static public $yyTraceFILE; - static public $yyTracePrompt; + public static $yyTraceFILE; + public static $yyTracePrompt; public $yyidx; /* Index of top element in stack */ public $yyerrcnt; /* Shifts left before out of the error */ public $yystack = array(); /* The parser's stack */ @@ -312,7 +323,7 @@ static public $yy_action = array( 'section', 'newline', 'var', 'value', ); - static public $yyRuleName = array( + public static $yyRuleName = array( /* 0 */ "start ::= global_vars sections", /* 1 */ "global_vars ::= var_list", /* 2 */ "sections ::= sections section", @@ -337,7 +348,7 @@ static public $yy_action = array( /* 21 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE", ); - function tokenName($tokenType) + public function tokenName($tokenType) { if ($tokenType === 0) { return 'End of Input'; @@ -349,14 +360,14 @@ static public $yy_action = array( } } - static function yy_destructor($yymajor, $yypminor) + public static function yy_destructor($yymajor, $yypminor) { switch ($yymajor) { default: break; /* If no destructor action specified: do nothing */ } } - function yy_pop_parser_stack() + public function yy_pop_parser_stack() { if (!count($this->yystack)) { return; @@ -370,10 +381,11 @@ static public $yy_action = array( $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); $this->yyidx--; + return $yymajor; } - function __destruct() + public function __destruct() { while ($this->yystack !== Array()) { $this->yy_pop_parser_stack(); @@ -383,7 +395,7 @@ static public $yy_action = array( } } - function yy_get_expected_tokens($token) + public function yy_get_expected_tokens($token) { $state = $this->yystack[$this->yyidx]->stateno; $expected = self::$yyExpectedTokens[$state]; @@ -411,11 +423,12 @@ static public $yy_action = array( $this->yystack[$this->yyidx]->stateno, self::$yyRuleInfo[$yyruleno]['lhs']); if (isset(self::$yyExpectedTokens[$nextstate])) { - $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]); + $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]); if (in_array($token, self::$yyExpectedTokens[$nextstate], true)) { $this->yyidx = $yyidx; $this->yystack = $stack; + return array_unique($expected); } } @@ -446,12 +459,13 @@ static public $yy_action = array( } break; } while (true); - $this->yyidx = $yyidx; - $this->yystack = $stack; + $this->yyidx = $yyidx; + $this->yystack = $stack; + return array_unique($expected); } - function yy_is_expected_token($token) + public function yy_is_expected_token($token) { if ($token === 0) { return true; // 0 is not part of this @@ -484,6 +498,7 @@ static public $yy_action = array( in_array($token, self::$yyExpectedTokens[$nextstate], true)) { $this->yyidx = $yyidx; $this->yystack = $stack; + return true; } if ($nextstate < self::YYNSTATE) { @@ -519,10 +534,11 @@ static public $yy_action = array( } while (true); $this->yyidx = $yyidx; $this->yystack = $stack; + return true; } - function yy_find_shift_action($iLookAhead) + public function yy_find_shift_action($iLookAhead) { $stateno = $this->yystack[$this->yyidx]->stateno; @@ -548,15 +564,17 @@ static public $yy_action = array( $this->yyTokenName[$iLookAhead] . " => " . $this->yyTokenName[$iFallback] . "\n"); } + return $this->yy_find_shift_action($iFallback); } + return self::$yy_default[$stateno]; } else { return self::$yy_action[$i]; } } - function yy_find_reduce_action($stateno, $iLookAhead) + public function yy_find_reduce_action($stateno, $iLookAhead) { /* $stateno = $this->yystack[$this->yyidx]->stateno; */ @@ -579,7 +597,7 @@ static public $yy_action = array( } } - function yy_shift($yyNewState, $yyMajor, $yypMinor) + public function yy_shift($yyNewState, $yyMajor, $yypMinor) { $this->yyidx++; if ($this->yyidx >= self::YYSTACKDEPTH) { @@ -595,6 +613,7 @@ static public $yy_action = array( $this->internalError = true; $this->compiler->trigger_config_file_error("Stack overflow in configfile parser"); #line 593 "smarty_internal_configfileparser.php" + return; } $yytos = new TPC_yyStackEntry; @@ -606,7 +625,7 @@ static public $yy_action = array( fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt, $yyNewState); fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt); - for($i = 1; $i <= $this->yyidx; $i++) { + for ($i = 1; $i <= $this->yyidx; $i++) { fprintf(self::$yyTraceFILE, " %s", $this->yyTokenName[$this->yystack[$i]->major]); } @@ -614,7 +633,7 @@ static public $yy_action = array( } } - static public $yyRuleInfo = array( + public static $yyRuleInfo = array( array( 'lhs' => 20, 'rhs' => 2 ), array( 'lhs' => 21, 'rhs' => 1 ), array( 'lhs' => 22, 'rhs' => 2 ), @@ -639,7 +658,7 @@ static public $yy_action = array( array( 'lhs' => 25, 'rhs' => 3 ), ); - static public $yyReduceMap = array( + public static $yyReduceMap = array( 0 => 0, 2 => 0, 3 => 0, @@ -664,23 +683,27 @@ static public $yy_action = array( 18 => 17, ); #line 131 "smarty_internal_configfileparser.y" - function yy_r0(){ + public function yy_r0() + { $this->_retvalue = null; } #line 666 "smarty_internal_configfileparser.php" #line 136 "smarty_internal_configfileparser.y" - function yy_r1(){ + public function yy_r1() + { $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; } #line 671 "smarty_internal_configfileparser.php" #line 149 "smarty_internal_configfileparser.y" - function yy_r4(){ + public function yy_r4() + { $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null; } #line 677 "smarty_internal_configfileparser.php" #line 154 "smarty_internal_configfileparser.y" - function yy_r5(){ + public 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); } @@ -688,69 +711,81 @@ static public $yy_action = array( } #line 685 "smarty_internal_configfileparser.php" #line 162 "smarty_internal_configfileparser.y" - function yy_r6(){ + public function yy_r6() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; } #line 690 "smarty_internal_configfileparser.php" #line 166 "smarty_internal_configfileparser.y" - function yy_r7(){ + public function yy_r7() + { $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor)); } #line 695 "smarty_internal_configfileparser.php" #line 170 "smarty_internal_configfileparser.y" - function yy_r8(){ + public function yy_r8() + { $this->_retvalue = Array(); } #line 700 "smarty_internal_configfileparser.php" #line 176 "smarty_internal_configfileparser.y" - function yy_r9(){ + public function yy_r9() + { $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor); } #line 705 "smarty_internal_configfileparser.php" #line 181 "smarty_internal_configfileparser.y" - function yy_r10(){ + public function yy_r10() + { $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor; } #line 710 "smarty_internal_configfileparser.php" #line 185 "smarty_internal_configfileparser.y" - function yy_r11(){ + public function yy_r11() + { $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor; } #line 715 "smarty_internal_configfileparser.php" #line 189 "smarty_internal_configfileparser.y" - function yy_r12(){ + public function yy_r12() + { $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor); } #line 720 "smarty_internal_configfileparser.php" #line 193 "smarty_internal_configfileparser.y" - function yy_r13(){ + public function yy_r13() + { $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor); } #line 725 "smarty_internal_configfileparser.php" #line 197 "smarty_internal_configfileparser.y" - function yy_r14(){ + public function yy_r14() + { $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor); } #line 730 "smarty_internal_configfileparser.php" #line 201 "smarty_internal_configfileparser.y" - function yy_r15(){ + public function yy_r15() + { $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor); } #line 735 "smarty_internal_configfileparser.php" #line 205 "smarty_internal_configfileparser.y" - function yy_r16(){ + public function yy_r16() + { $this->_retvalue = ''; } #line 740 "smarty_internal_configfileparser.php" #line 209 "smarty_internal_configfileparser.y" - function yy_r17(){ + public function yy_r17() + { $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } #line 745 "smarty_internal_configfileparser.php" private $_retvalue; - function yy_reduce($yyruleno) + public function yy_reduce($yyruleno) { $yymsp = $this->yystack[$this->yyidx]; if (self::$yyTraceFILE && $yyruleno >= 0 @@ -770,7 +805,7 @@ static public $yy_action = array( $yygoto = self::$yyRuleInfo[$yyruleno]['lhs']; $yysize = self::$yyRuleInfo[$yyruleno]['rhs']; $this->yyidx -= $yysize; - for($i = $yysize; $i; $i--) { + for ($i = $yysize; $i; $i--) { // pop all of the right-hand side parameters array_pop($this->yystack); } @@ -791,7 +826,7 @@ static public $yy_action = array( } } - function yy_parse_failed() + public function yy_parse_failed() { if (self::$yyTraceFILE) { fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt); @@ -801,7 +836,7 @@ static public $yy_action = array( } } - function yy_syntax_error($yymajor, $TOKEN) + public function yy_syntax_error($yymajor, $TOKEN) { #line 118 "smarty_internal_configfileparser.y" @@ -811,12 +846,11 @@ static public $yy_action = array( #line 808 "smarty_internal_configfileparser.php" } - function yy_accept() + public function yy_accept() { if (self::$yyTraceFILE) { fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { + } while ($this->yyidx >= 0) { $stack = $this->yy_pop_parser_stack(); } #line 110 "smarty_internal_configfileparser.y" @@ -828,7 +862,7 @@ static public $yy_action = array( #line 826 "smarty_internal_configfileparser.php" } - function doParse($yymajor, $yytokenvalue) + public function doParse($yymajor, $yytokenvalue) { $yyerrorhit = 0; /* True if yymajor has invoked an error */ @@ -875,7 +909,7 @@ static public $yy_action = array( $this->yy_syntax_error($yymajor, $yytokenvalue); } $yymx = $this->yystack[$this->yyidx]->major; - if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){ + if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) { if (self::$yyTraceFILE) { fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n", self::$yyTracePrompt, $this->yyTokenName[$yymajor]); @@ -918,4 +952,3 @@ static public $yy_action = array( } while ($yymajor != self::YYNOCODE && $this->yyidx >= 0); } } -?> \ No newline at end of file diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index a7d5fa9a..13a12bd3 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -22,59 +22,58 @@ class Smarty_Internal_Templatelexer public $state = 1; private $heredoc_id_stack = Array(); public $smarty_token_names = array ( // Text for parser error messages - 'IDENTITY' => '===', - 'NONEIDENTITY' => '!==', - 'EQUALS' => '==', - 'NOTEQUALS' => '!=', - 'GREATEREQUAL' => '(>=,ge)', - 'LESSEQUAL' => '(<=,le)', - 'GREATERTHAN' => '(>,gt)', - 'LESSTHAN' => '(<,lt)', - 'MOD' => '(%,mod)', - 'NOT' => '(!,not)', - 'LAND' => '(&&,and)', - 'LOR' => '(||,or)', - 'LXOR' => 'xor', - 'OPENP' => '(', - 'CLOSEP' => ')', - 'OPENB' => '[', - 'CLOSEB' => ']', - 'PTR' => '->', - 'APTR' => '=>', - 'EQUAL' => '=', - 'NUMBER' => 'number', - 'UNIMATH' => '+" , "-', - 'MATH' => '*" , "/" , "%', - 'INCDEC' => '++" , "--', - 'SPACE' => ' ', - 'DOLLAR' => '$', - 'SEMICOLON' => ';', - 'COLON' => ':', - 'DOUBLECOLON' => '::', - 'AT' => '@', - 'HATCH' => '#', - 'QUOTE' => '"', - 'BACKTICK' => '`', - 'VERT' => '|', - 'DOT' => '.', - 'COMMA' => '","', - 'ANDSYM' => '"&"', - 'QMARK' => '"?"', - 'ID' => 'identifier', - 'TEXT' => 'text', - 'FAKEPHPSTARTTAG' => 'Fake PHP start tag', - 'PHPSTARTTAG' => 'PHP start tag', - 'PHPENDTAG' => 'PHP end tag', - 'LITERALSTART' => 'Literal start', - 'LITERALEND' => 'Literal end', - 'LDELSLASH' => 'closing tag', - 'COMMENT' => 'comment', - 'AS' => 'as', - 'TO' => 'to', - ); + 'IDENTITY' => '===', + 'NONEIDENTITY' => '!==', + 'EQUALS' => '==', + 'NOTEQUALS' => '!=', + 'GREATEREQUAL' => '(>=,ge)', + 'LESSEQUAL' => '(<=,le)', + 'GREATERTHAN' => '(>,gt)', + 'LESSTHAN' => '(<,lt)', + 'MOD' => '(%,mod)', + 'NOT' => '(!,not)', + 'LAND' => '(&&,and)', + 'LOR' => '(||,or)', + 'LXOR' => 'xor', + 'OPENP' => '(', + 'CLOSEP' => ')', + 'OPENB' => '[', + 'CLOSEB' => ']', + 'PTR' => '->', + 'APTR' => '=>', + 'EQUAL' => '=', + 'NUMBER' => 'number', + 'UNIMATH' => '+" , "-', + 'MATH' => '*" , "/" , "%', + 'INCDEC' => '++" , "--', + 'SPACE' => ' ', + 'DOLLAR' => '$', + 'SEMICOLON' => ';', + 'COLON' => ':', + 'DOUBLECOLON' => '::', + 'AT' => '@', + 'HATCH' => '#', + 'QUOTE' => '"', + 'BACKTICK' => '`', + 'VERT' => '|', + 'DOT' => '.', + 'COMMA' => '","', + 'ANDSYM' => '"&"', + 'QMARK' => '"?"', + 'ID' => 'identifier', + 'TEXT' => 'text', + 'FAKEPHPSTARTTAG' => 'Fake PHP start tag', + 'PHPSTARTTAG' => 'PHP start tag', + 'PHPENDTAG' => 'PHP end tag', + 'LITERALSTART' => 'Literal start', + 'LITERALEND' => 'Literal end', + 'LDELSLASH' => 'closing tag', + 'COMMENT' => 'comment', + 'AS' => 'as', + 'TO' => 'to', + ); - - function __construct($data,$compiler) + public function __construct($data,$compiler) { // $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data); $this->data = $data; @@ -91,34 +90,31 @@ class Smarty_Internal_Templatelexer $this->mbstring_overload = ini_get('mbstring.func_overload') & 2; } - private $_yy_state = 1; private $_yy_stack = array(); - function yylex() + public function yylex() { return $this->{'yylex' . $this->_yy_state}(); } - function yypushstate($state) + public function yypushstate($state) { array_push($this->_yy_stack, $this->_yy_state); $this->_yy_state = $state; } - function yypopstate() + public function yypopstate() { $this->_yy_state = array_pop($this->_yy_stack); } - function yybegin($state) + public function yybegin($state) { $this->_yy_state = $state; } - - - function yylex1() + public function yylex1() { $tokenMap = array ( 1 => 0, @@ -195,29 +191,28 @@ class Smarty_Internal_Templatelexer } // end function - const TEXT = 1; - function yy_r1_1($yy_subpatterns) + public function yy_r1_1($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILD; } - function yy_r1_2($yy_subpatterns) + public function yy_r1_2($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_3($yy_subpatterns) + public function yy_r1_3($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_COMMENT; } - function yy_r1_5($yy_subpatterns) + public function yy_r1_5($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_STRIPON; } - function yy_r1_6($yy_subpatterns) + public function yy_r1_6($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -226,12 +221,12 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_STRIPON; } } - function yy_r1_7($yy_subpatterns) + public function yy_r1_7($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; } - function yy_r1_8($yy_subpatterns) + public function yy_r1_8($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -240,13 +235,13 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF; } } - function yy_r1_9($yy_subpatterns) + public function yy_r1_9($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; $this->yypushstate(self::LITERAL); } - function yy_r1_10($yy_subpatterns) + public function yy_r1_10($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -257,7 +252,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r1_11($yy_subpatterns) + public function yy_r1_11($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -268,7 +263,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r1_13($yy_subpatterns) + public function yy_r1_13($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -279,7 +274,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r1_14($yy_subpatterns) + public function yy_r1_14($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -290,7 +285,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r1_15($yy_subpatterns) + public function yy_r1_15($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -301,7 +296,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r1_16($yy_subpatterns) + public function yy_r1_16($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -312,21 +307,21 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r1_17($yy_subpatterns) + public function yy_r1_17($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->yypushstate(self::SMARTY); $this->taglineno = $this->line; } - function yy_r1_18($yy_subpatterns) + public function yy_r1_18($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yypushstate(self::SMARTY); $this->taglineno = $this->line; } - function yy_r1_19($yy_subpatterns) + public function yy_r1_19($yy_subpatterns) { if (in_array($this->value, Array('value = substr($this->value, 0, 2); } } - function yy_r1_20($yy_subpatterns) + public function yy_r1_20($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG; } - function yy_r1_21($yy_subpatterns) + public function yy_r1_21($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r1_22($yy_subpatterns) + public function yy_r1_22($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG; } - function yy_r1_23($yy_subpatterns) + public function yy_r1_23($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG; } - function yy_r1_24($yy_subpatterns) + public function yy_r1_24($yy_subpatterns) { if ($this->mbstring_overload) { @@ -378,8 +373,7 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - - function yylex2() + public function yylex2() { $tokenMap = array ( 1 => 0, @@ -502,14 +496,13 @@ class Smarty_Internal_Templatelexer } // end function - const SMARTY = 2; - function yy_r2_1($yy_subpatterns) + public function yy_r2_1($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; } - function yy_r2_2($yy_subpatterns) + public function yy_r2_2($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -520,7 +513,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r2_3($yy_subpatterns) + public function yy_r2_3($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -531,7 +524,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r2_5($yy_subpatterns) + public function yy_r2_5($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -542,7 +535,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r2_6($yy_subpatterns) + public function yy_r2_6($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -553,7 +546,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r2_7($yy_subpatterns) + public function yy_r2_7($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -564,300 +557,300 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r2_8($yy_subpatterns) + public function yy_r2_8($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_RDEL; $this->yypopstate(); } - function yy_r2_9($yy_subpatterns) + public function yy_r2_9($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->yypushstate(self::SMARTY); $this->taglineno = $this->line; } - function yy_r2_10($yy_subpatterns) + public function yy_r2_10($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yypushstate(self::SMARTY); $this->taglineno = $this->line; } - function yy_r2_11($yy_subpatterns) + public function yy_r2_11($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_RDEL; $this->yypopstate(); } - function yy_r2_12($yy_subpatterns) + public function yy_r2_12($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISIN; } - function yy_r2_13($yy_subpatterns) + public function yy_r2_13($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_AS; } - function yy_r2_14($yy_subpatterns) + public function yy_r2_14($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_TO; } - function yy_r2_15($yy_subpatterns) + public function yy_r2_15($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_STEP; } - function yy_r2_16($yy_subpatterns) + public function yy_r2_16($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF; } - function yy_r2_17($yy_subpatterns) + public function yy_r2_17($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_IDENTITY; } - function yy_r2_18($yy_subpatterns) + public function yy_r2_18($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY; } - function yy_r2_19($yy_subpatterns) + public function yy_r2_19($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_EQUALS; } - function yy_r2_20($yy_subpatterns) + public function yy_r2_20($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS; } - function yy_r2_22($yy_subpatterns) + public function yy_r2_22($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL; } - function yy_r2_24($yy_subpatterns) + public function yy_r2_24($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL; } - function yy_r2_26($yy_subpatterns) + public function yy_r2_26($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN; } - function yy_r2_27($yy_subpatterns) + public function yy_r2_27($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN; } - function yy_r2_28($yy_subpatterns) + public function yy_r2_28($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_MOD; } - function yy_r2_29($yy_subpatterns) + public function yy_r2_29($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_NOT; } - function yy_r2_30($yy_subpatterns) + public function yy_r2_30($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LAND; } - function yy_r2_31($yy_subpatterns) + public function yy_r2_31($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LOR; } - function yy_r2_32($yy_subpatterns) + public function yy_r2_32($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LXOR; } - function yy_r2_33($yy_subpatterns) + public function yy_r2_33($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISODDBY; } - function yy_r2_34($yy_subpatterns) + public function yy_r2_34($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY; } - function yy_r2_35($yy_subpatterns) + public function yy_r2_35($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISODD; } - function yy_r2_36($yy_subpatterns) + public function yy_r2_36($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD; } - function yy_r2_37($yy_subpatterns) + public function yy_r2_37($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY; } - function yy_r2_38($yy_subpatterns) + public function yy_r2_38($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY; } - function yy_r2_39($yy_subpatterns) + public function yy_r2_39($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISEVEN; } - function yy_r2_40($yy_subpatterns) + public function yy_r2_40($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN; } - function yy_r2_41($yy_subpatterns) + public function yy_r2_41($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY; } - function yy_r2_42($yy_subpatterns) + public function yy_r2_42($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY; } - function yy_r2_43($yy_subpatterns) + public function yy_r2_43($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_TYPECAST; } - function yy_r2_47($yy_subpatterns) + public function yy_r2_47($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_OPENP; } - function yy_r2_48($yy_subpatterns) + public function yy_r2_48($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_CLOSEP; } - function yy_r2_49($yy_subpatterns) + public function yy_r2_49($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_OPENB; } - function yy_r2_50($yy_subpatterns) + public function yy_r2_50($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_CLOSEB; } - function yy_r2_51($yy_subpatterns) + public function yy_r2_51($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_PTR; } - function yy_r2_52($yy_subpatterns) + public function yy_r2_52($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_APTR; } - function yy_r2_53($yy_subpatterns) + public function yy_r2_53($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_EQUAL; } - function yy_r2_54($yy_subpatterns) + public function yy_r2_54($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_INCDEC; } - function yy_r2_55($yy_subpatterns) + public function yy_r2_55($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_UNIMATH; } - function yy_r2_57($yy_subpatterns) + public function yy_r2_57($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_MATH; } - function yy_r2_59($yy_subpatterns) + public function yy_r2_59($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_DOLLAR; } - function yy_r2_60($yy_subpatterns) + public function yy_r2_60($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; } - function yy_r2_61($yy_subpatterns) + public function yy_r2_61($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; } - function yy_r2_62($yy_subpatterns) + public function yy_r2_62($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_COLON; } - function yy_r2_63($yy_subpatterns) + public function yy_r2_63($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_AT; } - function yy_r2_64($yy_subpatterns) + public function yy_r2_64($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_HATCH; } - function yy_r2_65($yy_subpatterns) + public function yy_r2_65($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypushstate(self::DOUBLEQUOTEDSTRING); } - function yy_r2_66($yy_subpatterns) + public function yy_r2_66($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->yypopstate(); } - function yy_r2_67($yy_subpatterns) + public function yy_r2_67($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_VERT; } - function yy_r2_68($yy_subpatterns) + public function yy_r2_68($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_DOT; } - function yy_r2_69($yy_subpatterns) + public function yy_r2_69($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_COMMA; } - function yy_r2_70($yy_subpatterns) + public function yy_r2_70($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ANDSYM; } - function yy_r2_71($yy_subpatterns) + public function yy_r2_71($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_QMARK; } - function yy_r2_72($yy_subpatterns) + public function yy_r2_72($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_HEX; } - function yy_r2_73($yy_subpatterns) + public function yy_r2_73($yy_subpatterns) { // resolve conflicts with shorttag and right_delimiter starting with '=' @@ -869,30 +862,28 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_ATTR; } } - function yy_r2_74($yy_subpatterns) + public function yy_r2_74($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ID; } - function yy_r2_75($yy_subpatterns) + public function yy_r2_75($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_INTEGER; } - function yy_r2_76($yy_subpatterns) + public function yy_r2_76($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_SPACE; } - function yy_r2_77($yy_subpatterns) + public function yy_r2_77($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - - - function yylex3() + public function yylex3() { $tokenMap = array ( 1 => 0, @@ -954,21 +945,20 @@ class Smarty_Internal_Templatelexer } // end function - const LITERAL = 3; - function yy_r3_1($yy_subpatterns) + public function yy_r3_1($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART; $this->yypushstate(self::LITERAL); } - function yy_r3_2($yy_subpatterns) + public function yy_r3_2($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LITERALEND; $this->yypopstate(); } - function yy_r3_3($yy_subpatterns) + public function yy_r3_3($yy_subpatterns) { if (in_array($this->value, Array('value = substr($this->value, 0, 2); } } - function yy_r3_4($yy_subpatterns) + public function yy_r3_4($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG; } - function yy_r3_5($yy_subpatterns) + public function yy_r3_5($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG; } - function yy_r3_6($yy_subpatterns) + public function yy_r3_6($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG; } - function yy_r3_7($yy_subpatterns) + public function yy_r3_7($yy_subpatterns) { if ($this->mbstring_overload) { @@ -1015,8 +1005,7 @@ class Smarty_Internal_Templatelexer $this->token = Smarty_Internal_Templateparser::TP_LITERAL; } - - function yylex4() + public function yylex4() { $tokenMap = array ( 1 => 0, @@ -1084,9 +1073,8 @@ class Smarty_Internal_Templatelexer } // end function - const DOUBLEQUOTEDSTRING = 4; - function yy_r4_1($yy_subpatterns) + public function yy_r4_1($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -1097,7 +1085,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r4_2($yy_subpatterns) + public function yy_r4_2($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -1108,7 +1096,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r4_4($yy_subpatterns) + public function yy_r4_4($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -1119,7 +1107,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r4_5($yy_subpatterns) + public function yy_r4_5($yy_subpatterns) { if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') { @@ -1130,7 +1118,7 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r4_6($yy_subpatterns) + public function yy_r4_6($yy_subpatterns) { if ($this->smarty->auto_literal) { @@ -1141,27 +1129,27 @@ class Smarty_Internal_Templatelexer $this->taglineno = $this->line; } } - function yy_r4_7($yy_subpatterns) + public function yy_r4_7($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH; $this->yypushstate(self::SMARTY); $this->taglineno = $this->line; } - function yy_r4_8($yy_subpatterns) + public function yy_r4_8($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_LDEL; $this->yypushstate(self::SMARTY); $this->taglineno = $this->line; } - function yy_r4_9($yy_subpatterns) + public function yy_r4_9($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->yypopstate(); } - function yy_r4_10($yy_subpatterns) + public function yy_r4_10($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_BACKTICK; @@ -1169,22 +1157,22 @@ class Smarty_Internal_Templatelexer $this->yypushstate(self::SMARTY); $this->taglineno = $this->line; } - function yy_r4_11($yy_subpatterns) + public function yy_r4_11($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_DOLLARID; } - function yy_r4_12($yy_subpatterns) + public function yy_r4_12($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r4_13($yy_subpatterns) + public function yy_r4_13($yy_subpatterns) { $this->token = Smarty_Internal_Templateparser::TP_TEXT; } - function yy_r4_17($yy_subpatterns) + public function yy_r4_17($yy_subpatterns) { if ($this->mbstring_overload) { diff --git a/libs/sysplugins/smarty_internal_templateparser.php b/libs/sysplugins/smarty_internal_templateparser.php index d67be6e6..c322ed53 100644 --- a/libs/sysplugins/smarty_internal_templateparser.php +++ b/libs/sysplugins/smarty_internal_templateparser.php @@ -14,7 +14,7 @@ class TP_yyToken implements ArrayAccess public $string = ''; public $metadata = array(); - function __construct($s, $m = array()) + public function __construct($s, $m = array()) { if ($s instanceof TP_yyToken) { $this->string = $s->string; @@ -29,28 +29,29 @@ class TP_yyToken implements ArrayAccess } } - function __toString() + public function __toString() { return $this->_string; } - function offsetExists($offset) + public function offsetExists($offset) { return isset($this->metadata[$offset]); } - function offsetGet($offset) + public function offsetGet($offset) { return $this->metadata[$offset]; } - function offsetSet($offset, $value) + public function offsetSet($offset, $value) { if ($offset === null) { if (isset($value[0])) { $x = ($value instanceof TP_yyToken) ? $value->metadata : $value; $this->metadata = array_merge($this->metadata, $x); + return; } $offset = count($this->metadata); @@ -67,7 +68,7 @@ class TP_yyToken implements ArrayAccess } } - function offsetUnset($offset) + public function offsetUnset($offset) { unset($this->metadata[$offset]); } @@ -82,11 +83,10 @@ class TP_yyStackEntry ** is the value of the token */ }; - -#line 12 "smarty_internal_templateparser.y" +#line 13 "smarty_internal_templateparser.y" class Smarty_Internal_Templateparser#line 79 "smarty_internal_templateparser.php" { -#line 14 "smarty_internal_templateparser.y" +#line 15 "smarty_internal_templateparser.y" const Err1 = "Security error: Call to private object member not allowed"; const Err2 = "Security error: Call to dynamic object member not allowed"; @@ -98,7 +98,8 @@ class Smarty_Internal_Templateparser#line 79 "smarty_internal_templateparser.php private $internalError = false; private $strip = false; - function __construct($lex, $compiler) { + public function __construct($lex, $compiler) + { $this->lex = $lex; $this->compiler = $compiler; $this->smarty = $this->compiler->smarty; @@ -117,16 +118,20 @@ class Smarty_Internal_Templateparser#line 79 "smarty_internal_templateparser.php $this->current_buffer = $this->root_buffer = new _smarty_template_buffer($this); } - public static function escape_start_tag($tag_text) { + public static function escape_start_tag($tag_text) + { $tag = preg_replace('/\A<\?(.*)\z/', '<?\1', $tag_text, -1 , $count); //Escape tag + return $tag; } - public static function escape_end_tag($tag_text) { + public static function escape_end_tag($tag_text) + { return '?>'; } - public function compileVariable($variable) { + public function compileVariable($variable) + { if (strpos($variable,'(') == 0) { // not a variable variable $var = trim($variable,'\''); @@ -464,7 +469,7 @@ static public $yy_action = array( /* 2370 */ 329, 329, 329, 329, 329, 329, 329, 329, 329, 329, /* 2380 */ 329, 329, 206, ); - static public $yy_lookahead = array( + public static $yy_lookahead = array( /* 0 */ 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* 10 */ 12, 13, 16, 98, 16, 19, 17, 17, 113, 114, /* 20 */ 22, 23, 16, 97, 18, 19, 28, 112, 29, 29, @@ -707,7 +712,7 @@ static public $yy_action = array( ); const YY_SHIFT_USE_DFLT = -5; const YY_SHIFT_MAX = 256; - static public $yy_shift_ofst = array( + public static $yy_shift_ofst = array( /* 0 */ -2, 1271, 1157, 1157, 1271, 1157, 1328, 1328, 1100, 1157, /* 10 */ 1157, 1157, 1157, 1157, 1157, 1157, 1499, 1157, 1157, 1157, /* 20 */ 1157, 1157, 1556, 1157, 1157, 1157, 1157, 1157, 1157, 1157, @@ -737,7 +742,7 @@ static public $yy_action = array( ); const YY_REDUCE_USE_DFLT = -96; const YY_REDUCE_MAX = 208; - static public $yy_reduce_ofst = array( + public static $yy_reduce_ofst = array( /* 0 */ 5, -7, 489, 566, 1630, 856, 70, 1117, 1865, 1854, /* 10 */ 1831, 1812, 1891, 1902, 1977, 1951, 1940, 1921, 1789, 1762, /* 20 */ 1402, 1345, 1288, 1231, 1459, 1516, 1751, 1728, 1709, 1573, @@ -760,7 +765,7 @@ static public $yy_action = array( /* 190 */ 597, 552, 552, 596, 594, 594, 594, 599, -33, 356, /* 200 */ 296, 360, -33, 356, 395, 404, 376, 416, 368, ); - static public $yyExpectedTokens = array( + public static $yyExpectedTokens = array( /* 0 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 22, 23, 28, 32, 33, 34, ), /* 1 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ), /* 2 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ), @@ -1153,7 +1158,7 @@ static public $yy_action = array( /* 389 */ array(), /* 390 */ array(), ); - static public $yy_default = array( + public static $yy_default = array( /* 0 */ 394, 578, 549, 549, 595, 549, 595, 595, 595, 595, /* 10 */ 595, 595, 595, 595, 595, 595, 595, 595, 595, 595, /* 20 */ 595, 595, 595, 595, 595, 595, 595, 595, 595, 595, @@ -1196,15 +1201,15 @@ static public $yy_action = array( /* 390 */ 403, ); const YYNOCODE = 124; - const YYSTACKDEPTH = 100; + const YYSTACKDEPTH = 500; const YYNSTATE = 391; const YYNRULE = 204; const YYERRORSYMBOL = 81; const YYERRSYMDT = 'yy0'; const YYFALLBACK = 0; - static public $yyFallback = array( + public static $yyFallback = array( ); - static function Trace($TraceFILE, $zTracePrompt) + public static function Trace($TraceFILE, $zTracePrompt) { if (!$TraceFILE) { $zTracePrompt = 0; @@ -1215,14 +1220,14 @@ static public $yy_action = array( self::$yyTracePrompt = $zTracePrompt; } - static function PrintTrace() + public static function PrintTrace() { self::$yyTraceFILE = fopen('php://output', 'w'); self::$yyTracePrompt = '
'; } - static public $yyTraceFILE; - static public $yyTracePrompt; + public static $yyTraceFILE; + public static $yyTracePrompt; public $yyidx; /* Index of top element in stack */ public $yyerrcnt; /* Shifts left before out of the error */ public $yystack = array(); /* The parser's stack */ @@ -1261,7 +1266,7 @@ static public $yy_action = array( 'arrayelement', 'doublequoted', 'doublequotedcontent', ); - static public $yyRuleName = array( + public static $yyRuleName = array( /* 0 */ "start ::= template", /* 1 */ "template ::= template_element", /* 2 */ "template ::= template template_element", @@ -1468,7 +1473,7 @@ static public $yy_action = array( /* 203 */ "optspace ::=", ); - function tokenName($tokenType) + public function tokenName($tokenType) { if ($tokenType === 0) { return 'End of Input'; @@ -1480,14 +1485,14 @@ static public $yy_action = array( } } - static function yy_destructor($yymajor, $yypminor) + public static function yy_destructor($yymajor, $yypminor) { switch ($yymajor) { default: break; /* If no destructor action specified: do nothing */ } } - function yy_pop_parser_stack() + public function yy_pop_parser_stack() { if (!count($this->yystack)) { return; @@ -1501,10 +1506,11 @@ static public $yy_action = array( $yymajor = $yytos->major; self::yy_destructor($yymajor, $yytos->minor); $this->yyidx--; + return $yymajor; } - function __destruct() + public function __destruct() { while ($this->yystack !== Array()) { $this->yy_pop_parser_stack(); @@ -1514,7 +1520,7 @@ static public $yy_action = array( } } - function yy_get_expected_tokens($token) + public function yy_get_expected_tokens($token) { $state = $this->yystack[$this->yyidx]->stateno; $expected = self::$yyExpectedTokens[$state]; @@ -1542,11 +1548,12 @@ static public $yy_action = array( $this->yystack[$this->yyidx]->stateno, self::$yyRuleInfo[$yyruleno]['lhs']); if (isset(self::$yyExpectedTokens[$nextstate])) { - $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]); + $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]); if (in_array($token, self::$yyExpectedTokens[$nextstate], true)) { $this->yyidx = $yyidx; $this->yystack = $stack; + return array_unique($expected); } } @@ -1577,12 +1584,13 @@ static public $yy_action = array( } break; } while (true); - $this->yyidx = $yyidx; - $this->yystack = $stack; + $this->yyidx = $yyidx; + $this->yystack = $stack; + return array_unique($expected); } - function yy_is_expected_token($token) + public function yy_is_expected_token($token) { if ($token === 0) { return true; // 0 is not part of this @@ -1615,6 +1623,7 @@ static public $yy_action = array( in_array($token, self::$yyExpectedTokens[$nextstate], true)) { $this->yyidx = $yyidx; $this->yystack = $stack; + return true; } if ($nextstate < self::YYNSTATE) { @@ -1650,10 +1659,11 @@ static public $yy_action = array( } while (true); $this->yyidx = $yyidx; $this->yystack = $stack; + return true; } - function yy_find_shift_action($iLookAhead) + public function yy_find_shift_action($iLookAhead) { $stateno = $this->yystack[$this->yyidx]->stateno; @@ -1679,15 +1689,17 @@ static public $yy_action = array( $this->yyTokenName[$iLookAhead] . " => " . $this->yyTokenName[$iFallback] . "\n"); } + return $this->yy_find_shift_action($iFallback); } + return self::$yy_default[$stateno]; } else { return self::$yy_action[$i]; } } - function yy_find_reduce_action($stateno, $iLookAhead) + public function yy_find_reduce_action($stateno, $iLookAhead) { /* $stateno = $this->yystack[$this->yyidx]->stateno; */ @@ -1710,7 +1722,7 @@ static public $yy_action = array( } } - function yy_shift($yyNewState, $yyMajor, $yypMinor) + public function yy_shift($yyNewState, $yyMajor, $yypMinor) { $this->yyidx++; if ($this->yyidx >= self::YYSTACKDEPTH) { @@ -1721,11 +1733,12 @@ static public $yy_action = array( while ($this->yyidx >= 0) { $this->yy_pop_parser_stack(); } -#line 84 "smarty_internal_templateparser.y" +#line 85 "smarty_internal_templateparser.y" $this->internalError = true; $this->compiler->trigger_template_error("Stack overflow in template parser"); #line 1724 "smarty_internal_templateparser.php" + return; } $yytos = new TP_yyStackEntry; @@ -1737,7 +1750,7 @@ static public $yy_action = array( fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt, $yyNewState); fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt); - for($i = 1; $i <= $this->yyidx; $i++) { + for ($i = 1; $i <= $this->yyidx; $i++) { fprintf(self::$yyTraceFILE, " %s", $this->yyTokenName[$this->yystack[$i]->major]); } @@ -1745,7 +1758,7 @@ static public $yy_action = array( } } - static public $yyRuleInfo = array( + public static $yyRuleInfo = array( array( 'lhs' => 82, 'rhs' => 1 ), array( 'lhs' => 83, 'rhs' => 1 ), array( 'lhs' => 83, 'rhs' => 2 ), @@ -1952,7 +1965,7 @@ static public $yy_action = array( array( 'lhs' => 96, 'rhs' => 0 ), ); - static public $yyReduceMap = array( + public static $yyReduceMap = array( 0 => 0, 1 => 1, 2 => 1, @@ -2157,18 +2170,21 @@ static public $yy_action = array( 200 => 200, 201 => 201, ); -#line 95 "smarty_internal_templateparser.y" - function yy_r0(){ +#line 96 "smarty_internal_templateparser.y" + public function yy_r0() + { $this->_retvalue = $this->root_buffer->to_smarty_php(); } #line 2160 "smarty_internal_templateparser.php" -#line 103 "smarty_internal_templateparser.y" - function yy_r1(){ +#line 104 "smarty_internal_templateparser.y" + public function yy_r1() + { $this->current_buffer->append_subtree($this->yystack[$this->yyidx + 0]->minor); } #line 2165 "smarty_internal_templateparser.php" -#line 119 "smarty_internal_templateparser.y" - function yy_r4(){ +#line 120 "smarty_internal_templateparser.y" + public function yy_r4() + { if ($this->compiler->has_code) { $tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array(); $this->_retvalue = new _smarty_tag($this, $this->compiler->processNocacheCode($tmp.$this->yystack[$this->yyidx + 0]->minor,true)); @@ -2179,18 +2195,21 @@ static public $yy_action = array( $this->block_nesting_level = count($this->compiler->_tag_stack); } #line 2177 "smarty_internal_templateparser.php" -#line 131 "smarty_internal_templateparser.y" - function yy_r5(){ +#line 132 "smarty_internal_templateparser.y" + public function yy_r5() + { $this->_retvalue = new _smarty_tag($this, ''); } #line 2182 "smarty_internal_templateparser.php" -#line 136 "smarty_internal_templateparser.y" - function yy_r6(){ +#line 137 "smarty_internal_templateparser.y" + public function yy_r6() + { $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor); } #line 2187 "smarty_internal_templateparser.php" -#line 141 "smarty_internal_templateparser.y" - function yy_r7(){ +#line 142 "smarty_internal_templateparser.y" + public function yy_r7() + { if ($this->php_handling == Smarty::PHP_PASSTHRU) { $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor)); } elseif ($this->php_handling == Smarty::PHP_QUOTE) { @@ -2205,8 +2224,9 @@ static public $yy_action = array( } } #line 2203 "smarty_internal_templateparser.php" -#line 157 "smarty_internal_templateparser.y" - function yy_r8(){ +#line 158 "smarty_internal_templateparser.y" + public function yy_r8() + { if ($this->is_xml) { $this->compiler->tag_nocache = true; $this->is_xml = false; @@ -2224,8 +2244,9 @@ static public $yy_action = array( } } #line 2222 "smarty_internal_templateparser.php" -#line 176 "smarty_internal_templateparser.y" - function yy_r9(){ +#line 177 "smarty_internal_templateparser.y" + public function yy_r9() + { if ($this->php_handling == Smarty::PHP_PASSTHRU) { $this->_retvalue = new _smarty_text($this, '<%'); } elseif ($this->php_handling == Smarty::PHP_QUOTE) { @@ -2248,8 +2269,9 @@ static public $yy_action = array( } } #line 2246 "smarty_internal_templateparser.php" -#line 200 "smarty_internal_templateparser.y" - function yy_r10(){ +#line 201 "smarty_internal_templateparser.y" + public function yy_r10() + { if ($this->php_handling == Smarty::PHP_PASSTHRU) { $this->_retvalue = new _smarty_text($this, '%>'); } elseif ($this->php_handling == Smarty::PHP_QUOTE) { @@ -2269,8 +2291,9 @@ static public $yy_action = array( } } #line 2267 "smarty_internal_templateparser.php" -#line 220 "smarty_internal_templateparser.y" - function yy_r11(){ +#line 221 "smarty_internal_templateparser.y" + public function yy_r11() + { if ($this->strip) { $this->_retvalue = new _smarty_text($this, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor))); } else { @@ -2278,8 +2301,9 @@ static public $yy_action = array( } } #line 2276 "smarty_internal_templateparser.php" -#line 229 "smarty_internal_templateparser.y" - function yy_r12(){ +#line 230 "smarty_internal_templateparser.y" + public function yy_r12() + { $this->compiler->tag_nocache = true; $this->is_xml = true; $save = $this->template->has_nocache_code; @@ -2287,8 +2311,9 @@ static public $yy_action = array( $this->template->has_nocache_code = $save; } #line 2285 "smarty_internal_templateparser.php" -#line 238 "smarty_internal_templateparser.y" - function yy_r13(){ +#line 239 "smarty_internal_templateparser.y" + public function yy_r13() + { if ($this->strip) { $this->_retvalue = new _smarty_text($this, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $this->yystack[$this->yyidx + 0]->minor)); } else { @@ -2296,236 +2321,281 @@ static public $yy_action = array( } } #line 2294 "smarty_internal_templateparser.php" -#line 247 "smarty_internal_templateparser.y" - function yy_r14(){ +#line 248 "smarty_internal_templateparser.y" + public function yy_r14() + { $this->strip = true; $this->_retvalue = new _smarty_text($this, ''); } #line 2300 "smarty_internal_templateparser.php" -#line 252 "smarty_internal_templateparser.y" - function yy_r15(){ +#line 253 "smarty_internal_templateparser.y" + public function yy_r15() + { $this->strip = false; $this->_retvalue = new _smarty_text($this, ''); } #line 2306 "smarty_internal_templateparser.php" -#line 258 "smarty_internal_templateparser.y" - function yy_r16(){ +#line 259 "smarty_internal_templateparser.y" + public function yy_r16() + { $this->_retvalue = ''; } #line 2311 "smarty_internal_templateparser.php" -#line 262 "smarty_internal_templateparser.y" - function yy_r17(){ +#line 263 "smarty_internal_templateparser.y" + public function yy_r17() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; } #line 2316 "smarty_internal_templateparser.php" -#line 266 "smarty_internal_templateparser.y" - function yy_r18(){ +#line 267 "smarty_internal_templateparser.y" + public function yy_r18() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2321 "smarty_internal_templateparser.php" -#line 274 "smarty_internal_templateparser.y" - function yy_r20(){ +#line 275 "smarty_internal_templateparser.y" + public function yy_r20() + { $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } #line 2326 "smarty_internal_templateparser.php" -#line 282 "smarty_internal_templateparser.y" - function yy_r22(){ +#line 283 "smarty_internal_templateparser.y" + public function yy_r22() + { $this->_retvalue = self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor); } #line 2331 "smarty_internal_templateparser.php" -#line 290 "smarty_internal_templateparser.y" - function yy_r24(){ +#line 291 "smarty_internal_templateparser.y" + public function yy_r24() + { $this->_retvalue = self::escape_end_tag($this->yystack[$this->yyidx + 0]->minor); } #line 2336 "smarty_internal_templateparser.php" -#line 294 "smarty_internal_templateparser.y" - function yy_r25(){ +#line 295 "smarty_internal_templateparser.y" + public function yy_r25() + { $this->_retvalue = '<%'; } #line 2341 "smarty_internal_templateparser.php" -#line 298 "smarty_internal_templateparser.y" - function yy_r26(){ +#line 299 "smarty_internal_templateparser.y" + public function yy_r26() + { $this->_retvalue = '%>'; } #line 2346 "smarty_internal_templateparser.php" -#line 307 "smarty_internal_templateparser.y" - function yy_r27(){ +#line 308 "smarty_internal_templateparser.y" + public function yy_r27() + { $this->_retvalue = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->yystack[$this->yyidx + -1]->minor)); } #line 2351 "smarty_internal_templateparser.php" -#line 311 "smarty_internal_templateparser.y" - function yy_r28(){ +#line 312 "smarty_internal_templateparser.y" + public function yy_r28() + { $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -3]->minor, 'modifierlist'=>$this->yystack[$this->yyidx + -2]->minor)); } #line 2356 "smarty_internal_templateparser.php" -#line 315 "smarty_internal_templateparser.y" - function yy_r29(){ +#line 316 "smarty_internal_templateparser.y" + public function yy_r29() + { $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -2]->minor)); } #line 2361 "smarty_internal_templateparser.php" -#line 319 "smarty_internal_templateparser.y" - function yy_r30(){ +#line 320 "smarty_internal_templateparser.y" + public function yy_r30() + { $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -3]->minor,'modifierlist'=>$this->yystack[$this->yyidx + -2]->minor)); } #line 2366 "smarty_internal_templateparser.php" -#line 332 "smarty_internal_templateparser.y" - function yy_r32(){ +#line 333 "smarty_internal_templateparser.y" + public function yy_r32() + { $this->_retvalue = $this->compiler->compileTag('assign',array(array('value'=>$this->yystack[$this->yyidx + -1]->minor),array('var'=>"'".$this->yystack[$this->yyidx + -3]->minor."'"))); } #line 2371 "smarty_internal_templateparser.php" -#line 340 "smarty_internal_templateparser.y" - function yy_r34(){ +#line 341 "smarty_internal_templateparser.y" + public function yy_r34() + { $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + -2]->minor),array('var'=>"'".$this->yystack[$this->yyidx + -4]->minor."'")),$this->yystack[$this->yyidx + -1]->minor)); } #line 2376 "smarty_internal_templateparser.php" -#line 344 "smarty_internal_templateparser.y" - function yy_r35(){ +#line 345 "smarty_internal_templateparser.y" + public function yy_r35() + { $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + -2]->minor),array('var'=>$this->yystack[$this->yyidx + -4]->minor['var'])),$this->yystack[$this->yyidx + -1]->minor),array('smarty_internal_index'=>$this->yystack[$this->yyidx + -4]->minor['smarty_internal_index'])); } #line 2381 "smarty_internal_templateparser.php" -#line 349 "smarty_internal_templateparser.y" - function yy_r36(){ +#line 350 "smarty_internal_templateparser.y" + public function yy_r36() + { $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor,$this->yystack[$this->yyidx + -1]->minor); } #line 2386 "smarty_internal_templateparser.php" -#line 353 "smarty_internal_templateparser.y" - function yy_r37(){ +#line 354 "smarty_internal_templateparser.y" + public function yy_r37() + { $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor,array()); } #line 2391 "smarty_internal_templateparser.php" -#line 358 "smarty_internal_templateparser.y" - function yy_r38(){ +#line 359 "smarty_internal_templateparser.y" + public function yy_r38() + { $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor,$this->yystack[$this->yyidx + -1]->minor,array('object_methode'=>$this->yystack[$this->yyidx + -2]->minor)); } #line 2396 "smarty_internal_templateparser.php" -#line 363 "smarty_internal_templateparser.y" - function yy_r39(){ +#line 364 "smarty_internal_templateparser.y" + public function yy_r39() + { $this->_retvalue = ''.$this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor,$this->yystack[$this->yyidx + -1]->minor).'_retvalue .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>$this->yystack[$this->yyidx + -2]->minor,'value'=>'ob_get_clean()')).'?>'; } #line 2402 "smarty_internal_templateparser.php" -#line 369 "smarty_internal_templateparser.y" - function yy_r40(){ +#line 370 "smarty_internal_templateparser.y" + public function yy_r40() + { $this->_retvalue = ''.$this->compiler->compileTag($this->yystack[$this->yyidx + -5]->minor,$this->yystack[$this->yyidx + -1]->minor,array('object_methode'=>$this->yystack[$this->yyidx + -3]->minor)).'_retvalue .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>$this->yystack[$this->yyidx + -2]->minor,'value'=>'ob_get_clean()')).'?>'; } #line 2408 "smarty_internal_templateparser.php" -#line 375 "smarty_internal_templateparser.y" - function yy_r41(){ +#line 376 "smarty_internal_templateparser.y" + public function yy_r41() + { $tag = trim(substr($this->yystack[$this->yyidx + -2]->minor,$this->lex->ldel_length)); $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + -1]->minor)); } #line 2414 "smarty_internal_templateparser.php" -#line 380 "smarty_internal_templateparser.y" - function yy_r42(){ +#line 381 "smarty_internal_templateparser.y" + public function yy_r42() + { $tag = trim(substr($this->yystack[$this->yyidx + -3]->minor,$this->lex->ldel_length)); $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,$this->yystack[$this->yyidx + -1]->minor,array('if condition'=>$this->yystack[$this->yyidx + -2]->minor)); } #line 2420 "smarty_internal_templateparser.php" -#line 385 "smarty_internal_templateparser.y" - function yy_r43(){ +#line 386 "smarty_internal_templateparser.y" + public function yy_r43() + { $tag = trim(substr($this->yystack[$this->yyidx + -2]->minor,$this->lex->ldel_length)); $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + -1]->minor)); } #line 2426 "smarty_internal_templateparser.php" -#line 396 "smarty_internal_templateparser.y" - function yy_r45(){ +#line 397 "smarty_internal_templateparser.y" + public function yy_r45() + { $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -10]->minor),array('ifexp'=>$this->yystack[$this->yyidx + -7]->minor),array('var'=>$this->yystack[$this->yyidx + -3]->minor),array('step'=>$this->yystack[$this->yyidx + -2]->minor))),1); } #line 2431 "smarty_internal_templateparser.php" -#line 400 "smarty_internal_templateparser.y" - function yy_r46(){ +#line 401 "smarty_internal_templateparser.y" + public function yy_r46() + { $this->_retvalue = '='.$this->yystack[$this->yyidx + 0]->minor; } #line 2436 "smarty_internal_templateparser.php" -#line 408 "smarty_internal_templateparser.y" - function yy_r48(){ +#line 409 "smarty_internal_templateparser.y" + public function yy_r48() + { $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -4]->minor),array('to'=>$this->yystack[$this->yyidx + -2]->minor))),0); } #line 2441 "smarty_internal_templateparser.php" -#line 412 "smarty_internal_templateparser.y" - function yy_r49(){ +#line 413 "smarty_internal_templateparser.y" + public function yy_r49() + { $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -6]->minor),array('to'=>$this->yystack[$this->yyidx + -4]->minor),array('step'=>$this->yystack[$this->yyidx + -2]->minor))),0); } #line 2446 "smarty_internal_templateparser.php" -#line 417 "smarty_internal_templateparser.y" - function yy_r50(){ +#line 418 "smarty_internal_templateparser.y" + public function yy_r50() + { $this->_retvalue = $this->compiler->compileTag('foreach',$this->yystack[$this->yyidx + -1]->minor); } #line 2451 "smarty_internal_templateparser.php" -#line 422 "smarty_internal_templateparser.y" - function yy_r51(){ +#line 423 "smarty_internal_templateparser.y" + public function yy_r51() + { $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -5]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor)))); } #line 2456 "smarty_internal_templateparser.php" -#line 426 "smarty_internal_templateparser.y" - function yy_r52(){ +#line 427 "smarty_internal_templateparser.y" + public function yy_r52() + { $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -8]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor),array('key'=>$this->yystack[$this->yyidx + -5]->minor)))); } #line 2461 "smarty_internal_templateparser.php" -#line 430 "smarty_internal_templateparser.y" - function yy_r53(){ +#line 431 "smarty_internal_templateparser.y" + public function yy_r53() + { $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -5]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor)))); } #line 2466 "smarty_internal_templateparser.php" -#line 434 "smarty_internal_templateparser.y" - function yy_r54(){ +#line 435 "smarty_internal_templateparser.y" + public function yy_r54() + { $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -8]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor),array('key'=>$this->yystack[$this->yyidx + -5]->minor)))); } #line 2471 "smarty_internal_templateparser.php" -#line 439 "smarty_internal_templateparser.y" - function yy_r55(){ +#line 440 "smarty_internal_templateparser.y" + public function yy_r55() + { $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array($this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -1]->minor)))); } #line 2476 "smarty_internal_templateparser.php" -#line 443 "smarty_internal_templateparser.y" - function yy_r56(){ +#line 444 "smarty_internal_templateparser.y" + public function yy_r56() + { $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array($this->yystack[$this->yyidx + -3]->minor),$this->yystack[$this->yyidx + -2]->minor)),$this->yystack[$this->yyidx + -1]->minor))); } #line 2481 "smarty_internal_templateparser.php" -#line 448 "smarty_internal_templateparser.y" - function yy_r57(){ +#line 449 "smarty_internal_templateparser.y" + public function yy_r57() + { $this->_retvalue = SMARTY_INTERNAL_COMPILE_BLOCK::compileChildBlock($this->compiler); } #line 2486 "smarty_internal_templateparser.php" -#line 454 "smarty_internal_templateparser.y" - function yy_r58(){ +#line 455 "smarty_internal_templateparser.y" + public function yy_r58() + { $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor.'close',array()); } #line 2491 "smarty_internal_templateparser.php" -#line 458 "smarty_internal_templateparser.y" - function yy_r59(){ +#line 459 "smarty_internal_templateparser.y" + public function yy_r59() + { $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor.'close',array(),array('modifier_list'=>$this->yystack[$this->yyidx + -1]->minor)); } #line 2496 "smarty_internal_templateparser.php" -#line 463 "smarty_internal_templateparser.y" - function yy_r60(){ +#line 464 "smarty_internal_templateparser.y" + public function yy_r60() + { $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor.'close',array(),array('object_methode'=>$this->yystack[$this->yyidx + -1]->minor)); } #line 2501 "smarty_internal_templateparser.php" -#line 467 "smarty_internal_templateparser.y" - function yy_r61(){ +#line 468 "smarty_internal_templateparser.y" + public function yy_r61() + { $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor.'close',array(),array('object_methode'=>$this->yystack[$this->yyidx + -2]->minor, 'modifier_list'=>$this->yystack[$this->yyidx + -1]->minor)); } #line 2506 "smarty_internal_templateparser.php" -#line 475 "smarty_internal_templateparser.y" - function yy_r62(){ +#line 476 "smarty_internal_templateparser.y" + public function yy_r62() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor; } #line 2512 "smarty_internal_templateparser.php" -#line 481 "smarty_internal_templateparser.y" - function yy_r63(){ +#line 482 "smarty_internal_templateparser.y" + public function yy_r63() + { $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor); } #line 2517 "smarty_internal_templateparser.php" -#line 486 "smarty_internal_templateparser.y" - function yy_r64(){ +#line 487 "smarty_internal_templateparser.y" + public function yy_r64() + { $this->_retvalue = array(); } #line 2522 "smarty_internal_templateparser.php" -#line 491 "smarty_internal_templateparser.y" - function yy_r65(){ +#line 492 "smarty_internal_templateparser.y" + public function yy_r65() + { if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) { $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'true'); } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) { @@ -2537,131 +2607,156 @@ static public $yy_action = array( } } #line 2535 "smarty_internal_templateparser.php" -#line 503 "smarty_internal_templateparser.y" - function yy_r66(){ +#line 504 "smarty_internal_templateparser.y" + public function yy_r66() + { $this->_retvalue = array(trim($this->yystack[$this->yyidx + -1]->minor," =\n\r\t")=>$this->yystack[$this->yyidx + 0]->minor); } #line 2540 "smarty_internal_templateparser.php" -#line 511 "smarty_internal_templateparser.y" - function yy_r68(){ +#line 512 "smarty_internal_templateparser.y" + public function yy_r68() + { $this->_retvalue = "'".$this->yystack[$this->yyidx + 0]->minor."'"; } #line 2545 "smarty_internal_templateparser.php" -#line 523 "smarty_internal_templateparser.y" - function yy_r71(){ +#line 524 "smarty_internal_templateparser.y" + public function yy_r71() + { $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>$this->yystack[$this->yyidx + 0]->minor); } #line 2550 "smarty_internal_templateparser.php" -#line 536 "smarty_internal_templateparser.y" - function yy_r73(){ +#line 537 "smarty_internal_templateparser.y" + public function yy_r73() + { $this->yystack[$this->yyidx + -2]->minor[]=$this->yystack[$this->yyidx + 0]->minor; $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor; } #line 2556 "smarty_internal_templateparser.php" -#line 541 "smarty_internal_templateparser.y" - function yy_r74(){ +#line 542 "smarty_internal_templateparser.y" + public function yy_r74() + { $this->_retvalue = array('var' => $this->yystack[$this->yyidx + -2]->minor, 'value'=>$this->yystack[$this->yyidx + 0]->minor); } #line 2561 "smarty_internal_templateparser.php" -#line 569 "smarty_internal_templateparser.y" - function yy_r79(){ +#line 570 "smarty_internal_templateparser.y" + public function yy_r79() + { $this->_retvalue = '$_smarty_tpl->getStreamVariable(\''. $this->yystack[$this->yyidx + -2]->minor .'://'. $this->yystack[$this->yyidx + 0]->minor . '\')'; } #line 2566 "smarty_internal_templateparser.php" -#line 574 "smarty_internal_templateparser.y" - function yy_r80(){ +#line 575 "smarty_internal_templateparser.y" + public function yy_r80() + { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor . trim($this->yystack[$this->yyidx + -1]->minor) . $this->yystack[$this->yyidx + 0]->minor; } #line 2571 "smarty_internal_templateparser.php" -#line 593 "smarty_internal_templateparser.y" - function yy_r84(){ +#line 594 "smarty_internal_templateparser.y" + public function yy_r84() + { $this->_retvalue = $this->compiler->compileTag('private_modifier',array(),array('value'=>$this->yystack[$this->yyidx + -1]->minor,'modifierlist'=>$this->yystack[$this->yyidx + 0]->minor)); } #line 2576 "smarty_internal_templateparser.php" -#line 599 "smarty_internal_templateparser.y" - function yy_r85(){ +#line 600 "smarty_internal_templateparser.y" + public function yy_r85() + { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2581 "smarty_internal_templateparser.php" -#line 603 "smarty_internal_templateparser.y" - function yy_r86(){ +#line 604 "smarty_internal_templateparser.y" + public function yy_r86() + { $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2586 "smarty_internal_templateparser.php" -#line 607 "smarty_internal_templateparser.y" - function yy_r87(){ - $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array)'.$this->yystack[$this->yyidx + 0]->minor.')'; +#line 608 "smarty_internal_templateparser.y" + public function yy_r87() + { + $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array) '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2591 "smarty_internal_templateparser.php" -#line 615 "smarty_internal_templateparser.y" - function yy_r89(){ +#line 616 "smarty_internal_templateparser.y" + public function yy_r89() + { $this->_retvalue = '!('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2596 "smarty_internal_templateparser.php" -#line 619 "smarty_internal_templateparser.y" - function yy_r90(){ +#line 620 "smarty_internal_templateparser.y" + public function yy_r90() + { $this->_retvalue = '('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2601 "smarty_internal_templateparser.php" -#line 623 "smarty_internal_templateparser.y" - function yy_r91(){ +#line 624 "smarty_internal_templateparser.y" + public function yy_r91() + { $this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2606 "smarty_internal_templateparser.php" -#line 627 "smarty_internal_templateparser.y" - function yy_r92(){ +#line 628 "smarty_internal_templateparser.y" + public function yy_r92() + { $this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2611 "smarty_internal_templateparser.php" -#line 631 "smarty_internal_templateparser.y" - function yy_r93(){ +#line 632 "smarty_internal_templateparser.y" + public function yy_r93() + { $this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2616 "smarty_internal_templateparser.php" -#line 635 "smarty_internal_templateparser.y" - function yy_r94(){ +#line 636 "smarty_internal_templateparser.y" + public function yy_r94() + { $this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')'; } #line 2621 "smarty_internal_templateparser.php" -#line 659 "smarty_internal_templateparser.y" - function yy_r100(){ +#line 660 "smarty_internal_templateparser.y" + public function yy_r100() + { $this->prefix_number++; $this->compiler->prefix_code[] = 'prefix_number.'='.$this->yystack[$this->yyidx + 0]->minor.';?>'; $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.'$_tmp'.$this->prefix_number; } #line 2628 "smarty_internal_templateparser.php" -#line 668 "smarty_internal_templateparser.y" - function yy_r101(){ +#line 669 "smarty_internal_templateparser.y" + public function yy_r101() + { $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.' ? '. $this->compileVariable("'".$this->yystack[$this->yyidx + -2]->minor."'") . ' : '.$this->yystack[$this->yyidx + 0]->minor; } #line 2633 "smarty_internal_templateparser.php" -#line 672 "smarty_internal_templateparser.y" - function yy_r102(){ +#line 673 "smarty_internal_templateparser.y" + public function yy_r102() + { $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.' ? '.$this->yystack[$this->yyidx + -2]->minor.' : '.$this->yystack[$this->yyidx + 0]->minor; } #line 2638 "smarty_internal_templateparser.php" -#line 687 "smarty_internal_templateparser.y" - function yy_r105(){ +#line 688 "smarty_internal_templateparser.y" + public function yy_r105() + { $this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor; } #line 2643 "smarty_internal_templateparser.php" -#line 708 "smarty_internal_templateparser.y" - function yy_r110(){ +#line 709 "smarty_internal_templateparser.y" + public function yy_r110() + { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor; } #line 2648 "smarty_internal_templateparser.php" -#line 712 "smarty_internal_templateparser.y" - function yy_r111(){ +#line 713 "smarty_internal_templateparser.y" + public function yy_r111() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'; } #line 2653 "smarty_internal_templateparser.php" -#line 716 "smarty_internal_templateparser.y" - function yy_r112(){ +#line 717 "smarty_internal_templateparser.y" + public function yy_r112() + { $this->_retvalue = '.'.$this->yystack[$this->yyidx + 0]->minor; } #line 2658 "smarty_internal_templateparser.php" -#line 721 "smarty_internal_templateparser.y" - function yy_r113(){ +#line 722 "smarty_internal_templateparser.y" + public function yy_r113() + { if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) { $this->_retvalue = 'true'; } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) { @@ -2673,13 +2768,15 @@ static public $yy_action = array( } } #line 2671 "smarty_internal_templateparser.php" -#line 739 "smarty_internal_templateparser.y" - function yy_r115(){ +#line 740 "smarty_internal_templateparser.y" + public function yy_r115() + { $this->_retvalue = "(". $this->yystack[$this->yyidx + -1]->minor .")"; } #line 2676 "smarty_internal_templateparser.php" -#line 754 "smarty_internal_templateparser.y" - function yy_r118(){ +#line 755 "smarty_internal_templateparser.y" + public function yy_r118() + { if (!$this->security || isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor]) || $this->smarty->security_policy->isTrustedStaticClass($this->yystack[$this->yyidx + -2]->minor, $this->compiler)) { if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor])) { $this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor].'::'.$this->yystack[$this->yyidx + 0]->minor; @@ -2691,8 +2788,9 @@ static public $yy_action = array( } } #line 2689 "smarty_internal_templateparser.php" -#line 766 "smarty_internal_templateparser.y" - function yy_r119(){ +#line 767 "smarty_internal_templateparser.y" + public function yy_r119() + { if ($this->yystack[$this->yyidx + -2]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index']).'::'.$this->yystack[$this->yyidx + 0]->minor; } else { @@ -2700,15 +2798,17 @@ static public $yy_action = array( } } #line 2698 "smarty_internal_templateparser.php" -#line 775 "smarty_internal_templateparser.y" - function yy_r120(){ +#line 776 "smarty_internal_templateparser.y" + public function yy_r120() + { $this->prefix_number++; $this->compiler->prefix_code[] = ''.$this->yystack[$this->yyidx + 0]->minor.'prefix_number.'=ob_get_clean();?>'; $this->_retvalue = '$_tmp'.$this->prefix_number; } #line 2705 "smarty_internal_templateparser.php" -#line 790 "smarty_internal_templateparser.y" - function yy_r122(){ +#line 791 "smarty_internal_templateparser.y" + public function yy_r122() + { if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') { $smarty_var = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']); $this->_retvalue = $smarty_var; @@ -2720,98 +2820,117 @@ static public $yy_action = array( } } #line 2718 "smarty_internal_templateparser.php" -#line 803 "smarty_internal_templateparser.y" - function yy_r123(){ +#line 804 "smarty_internal_templateparser.y" + public function yy_r123() + { $this->_retvalue = '$_smarty_tpl->tpl_vars['. $this->yystack[$this->yyidx + -2]->minor .']->'.$this->yystack[$this->yyidx + 0]->minor; } #line 2723 "smarty_internal_templateparser.php" -#line 813 "smarty_internal_templateparser.y" - function yy_r125(){ +#line 814 "smarty_internal_templateparser.y" + public function yy_r125() + { $this->_retvalue = '$_smarty_tpl->getConfigVariable(\''. $this->yystack[$this->yyidx + -1]->minor .'\')'; } #line 2728 "smarty_internal_templateparser.php" -#line 817 "smarty_internal_templateparser.y" - function yy_r126(){ +#line 818 "smarty_internal_templateparser.y" + public function yy_r126() + { $this->_retvalue = '(is_array($tmp = $_smarty_tpl->getConfigVariable(\''. $this->yystack[$this->yyidx + -2]->minor .'\')) ? $tmp'.$this->yystack[$this->yyidx + 0]->minor.' :null)'; } #line 2733 "smarty_internal_templateparser.php" -#line 821 "smarty_internal_templateparser.y" - function yy_r127(){ +#line 822 "smarty_internal_templateparser.y" + public function yy_r127() + { $this->_retvalue = '$_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -1]->minor .')'; } #line 2738 "smarty_internal_templateparser.php" -#line 825 "smarty_internal_templateparser.y" - function yy_r128(){ +#line 826 "smarty_internal_templateparser.y" + public function yy_r128() + { $this->_retvalue = '(is_array($tmp = $_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -2]->minor .')) ? $tmp'.$this->yystack[$this->yyidx + 0]->minor.' : null)'; } #line 2743 "smarty_internal_templateparser.php" -#line 829 "smarty_internal_templateparser.y" - function yy_r129(){ +#line 830 "smarty_internal_templateparser.y" + public function yy_r129() + { $this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor); } #line 2748 "smarty_internal_templateparser.php" -#line 842 "smarty_internal_templateparser.y" - function yy_r131(){ +#line 843 "smarty_internal_templateparser.y" + public function yy_r131() + { return; } #line 2753 "smarty_internal_templateparser.php" -#line 848 "smarty_internal_templateparser.y" - function yy_r132(){ +#line 849 "smarty_internal_templateparser.y" + public function yy_r132() + { $this->_retvalue = '['.$this->compileVariable($this->yystack[$this->yyidx + 0]->minor).']'; } #line 2758 "smarty_internal_templateparser.php" -#line 852 "smarty_internal_templateparser.y" - function yy_r133(){ +#line 853 "smarty_internal_templateparser.y" + public function yy_r133() + { $this->_retvalue = '['.$this->compileVariable($this->yystack[$this->yyidx + -2]->minor).'->'.$this->yystack[$this->yyidx + 0]->minor.']'; } #line 2763 "smarty_internal_templateparser.php" -#line 856 "smarty_internal_templateparser.y" - function yy_r134(){ +#line 857 "smarty_internal_templateparser.y" + public function yy_r134() + { $this->_retvalue = "['". $this->yystack[$this->yyidx + 0]->minor ."']"; } #line 2768 "smarty_internal_templateparser.php" -#line 860 "smarty_internal_templateparser.y" - function yy_r135(){ +#line 861 "smarty_internal_templateparser.y" + public function yy_r135() + { $this->_retvalue = "[". $this->yystack[$this->yyidx + 0]->minor ."]"; } #line 2773 "smarty_internal_templateparser.php" -#line 864 "smarty_internal_templateparser.y" - function yy_r136(){ +#line 865 "smarty_internal_templateparser.y" + public function yy_r136() + { $this->_retvalue = "[". $this->yystack[$this->yyidx + -1]->minor ."]"; } #line 2778 "smarty_internal_templateparser.php" -#line 869 "smarty_internal_templateparser.y" - function yy_r137(){ +#line 870 "smarty_internal_templateparser.y" + public function yy_r137() + { $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\'][\'index\']').']'; } #line 2783 "smarty_internal_templateparser.php" -#line 873 "smarty_internal_templateparser.y" - function yy_r138(){ +#line 874 "smarty_internal_templateparser.y" + public function yy_r138() + { $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.$this->yystack[$this->yyidx + -3]->minor.'\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\']').']'; } #line 2788 "smarty_internal_templateparser.php" -#line 883 "smarty_internal_templateparser.y" - function yy_r140(){ +#line 884 "smarty_internal_templateparser.y" + public function yy_r140() + { $this->_retvalue = '[]'; } #line 2793 "smarty_internal_templateparser.php" -#line 896 "smarty_internal_templateparser.y" - function yy_r142(){ +#line 897 "smarty_internal_templateparser.y" + public function yy_r142() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor; } #line 2798 "smarty_internal_templateparser.php" -#line 901 "smarty_internal_templateparser.y" - function yy_r143(){ +#line 902 "smarty_internal_templateparser.y" + public function yy_r143() + { $this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\''; } #line 2803 "smarty_internal_templateparser.php" -#line 906 "smarty_internal_templateparser.y" - function yy_r144(){ +#line 907 "smarty_internal_templateparser.y" + public function yy_r144() + { $this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 2808 "smarty_internal_templateparser.php" -#line 913 "smarty_internal_templateparser.y" - function yy_r145(){ +#line 914 "smarty_internal_templateparser.y" + public function yy_r145() + { if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index']).$this->yystack[$this->yyidx + 0]->minor; } else { @@ -2819,55 +2938,63 @@ static public $yy_action = array( } } #line 2817 "smarty_internal_templateparser.php" -#line 922 "smarty_internal_templateparser.y" - function yy_r146(){ +#line 923 "smarty_internal_templateparser.y" + public function yy_r146() + { $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; } #line 2822 "smarty_internal_templateparser.php" -#line 927 "smarty_internal_templateparser.y" - function yy_r147(){ +#line 928 "smarty_internal_templateparser.y" + public function yy_r147() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2827 "smarty_internal_templateparser.php" -#line 932 "smarty_internal_templateparser.y" - function yy_r148(){ +#line 933 "smarty_internal_templateparser.y" + public function yy_r148() + { if ($this->security && substr($this->yystack[$this->yyidx + -1]->minor,0,1) == '_') { $this->compiler->trigger_template_error (self::Err1); } $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2835 "smarty_internal_templateparser.php" -#line 939 "smarty_internal_templateparser.y" - function yy_r149(){ +#line 940 "smarty_internal_templateparser.y" + public function yy_r149() + { if ($this->security) { $this->compiler->trigger_template_error (self::Err2); } $this->_retvalue = '->{'.$this->compileVariable($this->yystack[$this->yyidx + -1]->minor).$this->yystack[$this->yyidx + 0]->minor.'}'; } #line 2843 "smarty_internal_templateparser.php" -#line 946 "smarty_internal_templateparser.y" - function yy_r150(){ +#line 947 "smarty_internal_templateparser.y" + public function yy_r150() + { if ($this->security) { $this->compiler->trigger_template_error (self::Err2); } $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; } #line 2851 "smarty_internal_templateparser.php" -#line 953 "smarty_internal_templateparser.y" - function yy_r151(){ +#line 954 "smarty_internal_templateparser.y" + public function yy_r151() + { if ($this->security) { $this->compiler->trigger_template_error (self::Err2); } $this->_retvalue = '->{\''.$this->yystack[$this->yyidx + -4]->minor.'\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}'; } #line 2859 "smarty_internal_templateparser.php" -#line 961 "smarty_internal_templateparser.y" - function yy_r152(){ +#line 962 "smarty_internal_templateparser.y" + public function yy_r152() + { $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor; } #line 2864 "smarty_internal_templateparser.php" -#line 969 "smarty_internal_templateparser.y" - function yy_r153(){ +#line 970 "smarty_internal_templateparser.y" + public function yy_r153() + { if (!$this->security || $this->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) { if (strcasecmp($this->yystack[$this->yyidx + -3]->minor,'isset') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'empty') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'array') === 0 || is_callable($this->yystack[$this->yyidx + -3]->minor)) { $func_name = strtolower($this->yystack[$this->yyidx + -3]->minor); @@ -2884,7 +3011,7 @@ static public $yy_action = array( $isset_par=str_replace("')->value","',null,true,false)->value",$par); } $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $isset_par .")"; - } elseif (in_array($func_name,array('empty','reset','current','end','prev','next'))){ + } elseif (in_array($func_name,array('empty','reset','current','end','prev','next'))) { if (count($this->yystack[$this->yyidx + -1]->minor) != 1) { $this->compiler->trigger_template_error ('Illegal number of paramer in "empty()"'); } @@ -2902,16 +3029,18 @@ static public $yy_action = array( } } #line 2900 "smarty_internal_templateparser.php" -#line 1007 "smarty_internal_templateparser.y" - function yy_r154(){ +#line 1008 "smarty_internal_templateparser.y" + public function yy_r154() + { if ($this->security && substr($this->yystack[$this->yyidx + -3]->minor,0,1) == '_') { $this->compiler->trigger_template_error (self::Err1); } $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". implode(',',$this->yystack[$this->yyidx + -1]->minor) .")"; } #line 2908 "smarty_internal_templateparser.php" -#line 1014 "smarty_internal_templateparser.y" - function yy_r155(){ +#line 1015 "smarty_internal_templateparser.y" + public function yy_r155() + { if ($this->security) { $this->compiler->trigger_template_error (self::Err2); } @@ -2920,171 +3049,203 @@ static public $yy_action = array( $this->_retvalue = '$_tmp'.$this->prefix_number.'('. implode(',',$this->yystack[$this->yyidx + -1]->minor) .')'; } #line 2918 "smarty_internal_templateparser.php" -#line 1025 "smarty_internal_templateparser.y" - function yy_r156(){ +#line 1026 "smarty_internal_templateparser.y" + public function yy_r156() + { $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array($this->yystack[$this->yyidx + 0]->minor)); } #line 2923 "smarty_internal_templateparser.php" -#line 1042 "smarty_internal_templateparser.y" - function yy_r159(){ +#line 1043 "smarty_internal_templateparser.y" + public function yy_r159() + { $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor))); } #line 2928 "smarty_internal_templateparser.php" -#line 1046 "smarty_internal_templateparser.y" - function yy_r160(){ +#line 1047 "smarty_internal_templateparser.y" + public function yy_r160() + { $this->_retvalue = array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor)); } #line 2933 "smarty_internal_templateparser.php" -#line 1054 "smarty_internal_templateparser.y" - function yy_r162(){ +#line 1055 "smarty_internal_templateparser.y" + public function yy_r162() + { $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor); } #line 2938 "smarty_internal_templateparser.php" -#line 1062 "smarty_internal_templateparser.y" - function yy_r163(){ +#line 1063 "smarty_internal_templateparser.y" + public function yy_r163() + { $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor); } #line 2943 "smarty_internal_templateparser.php" -#line 1096 "smarty_internal_templateparser.y" - function yy_r170(){ +#line 1097 "smarty_internal_templateparser.y" + public function yy_r170() + { $this->_retvalue = '$'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2948 "smarty_internal_templateparser.php" -#line 1101 "smarty_internal_templateparser.y" - function yy_r171(){ +#line 1102 "smarty_internal_templateparser.y" + public function yy_r171() + { $this->_retvalue = '$'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; } #line 2953 "smarty_internal_templateparser.php" -#line 1107 "smarty_internal_templateparser.y" - function yy_r172(){ +#line 1108 "smarty_internal_templateparser.y" + public function yy_r172() + { $this->_retvalue = '=='; } #line 2958 "smarty_internal_templateparser.php" -#line 1111 "smarty_internal_templateparser.y" - function yy_r173(){ +#line 1112 "smarty_internal_templateparser.y" + public function yy_r173() + { $this->_retvalue = '!='; } #line 2963 "smarty_internal_templateparser.php" -#line 1115 "smarty_internal_templateparser.y" - function yy_r174(){ +#line 1116 "smarty_internal_templateparser.y" + public function yy_r174() + { $this->_retvalue = '>'; } #line 2968 "smarty_internal_templateparser.php" -#line 1119 "smarty_internal_templateparser.y" - function yy_r175(){ +#line 1120 "smarty_internal_templateparser.y" + public function yy_r175() + { $this->_retvalue = '<'; } #line 2973 "smarty_internal_templateparser.php" -#line 1123 "smarty_internal_templateparser.y" - function yy_r176(){ +#line 1124 "smarty_internal_templateparser.y" + public function yy_r176() + { $this->_retvalue = '>='; } #line 2978 "smarty_internal_templateparser.php" -#line 1127 "smarty_internal_templateparser.y" - function yy_r177(){ +#line 1128 "smarty_internal_templateparser.y" + public function yy_r177() + { $this->_retvalue = '<='; } #line 2983 "smarty_internal_templateparser.php" -#line 1131 "smarty_internal_templateparser.y" - function yy_r178(){ +#line 1132 "smarty_internal_templateparser.y" + public function yy_r178() + { $this->_retvalue = '==='; } #line 2988 "smarty_internal_templateparser.php" -#line 1135 "smarty_internal_templateparser.y" - function yy_r179(){ +#line 1136 "smarty_internal_templateparser.y" + public function yy_r179() + { $this->_retvalue = '!=='; } #line 2993 "smarty_internal_templateparser.php" -#line 1139 "smarty_internal_templateparser.y" - function yy_r180(){ +#line 1140 "smarty_internal_templateparser.y" + public function yy_r180() + { $this->_retvalue = '%'; } #line 2998 "smarty_internal_templateparser.php" -#line 1143 "smarty_internal_templateparser.y" - function yy_r181(){ +#line 1144 "smarty_internal_templateparser.y" + public function yy_r181() + { $this->_retvalue = '&&'; } #line 3003 "smarty_internal_templateparser.php" -#line 1147 "smarty_internal_templateparser.y" - function yy_r182(){ +#line 1148 "smarty_internal_templateparser.y" + public function yy_r182() + { $this->_retvalue = '||'; } #line 3008 "smarty_internal_templateparser.php" -#line 1151 "smarty_internal_templateparser.y" - function yy_r183(){ +#line 1152 "smarty_internal_templateparser.y" + public function yy_r183() + { $this->_retvalue = ' XOR '; } #line 3013 "smarty_internal_templateparser.php" -#line 1158 "smarty_internal_templateparser.y" - function yy_r184(){ +#line 1159 "smarty_internal_templateparser.y" + public function yy_r184() + { $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')'; } #line 3018 "smarty_internal_templateparser.php" -#line 1166 "smarty_internal_templateparser.y" - function yy_r186(){ +#line 1167 "smarty_internal_templateparser.y" + public function yy_r186() + { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor; } #line 3023 "smarty_internal_templateparser.php" -#line 1174 "smarty_internal_templateparser.y" - function yy_r188(){ +#line 1175 "smarty_internal_templateparser.y" + public function yy_r188() + { $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor; } #line 3028 "smarty_internal_templateparser.php" -#line 1178 "smarty_internal_templateparser.y" - function yy_r189(){ +#line 1179 "smarty_internal_templateparser.y" + public function yy_r189() + { $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor; } #line 3033 "smarty_internal_templateparser.php" -#line 1190 "smarty_internal_templateparser.y" - function yy_r191(){ +#line 1191 "smarty_internal_templateparser.y" + public function yy_r191() + { $this->_retvalue = "''"; } #line 3038 "smarty_internal_templateparser.php" -#line 1194 "smarty_internal_templateparser.y" - function yy_r192(){ +#line 1195 "smarty_internal_templateparser.y" + public function yy_r192() + { $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php(); } #line 3043 "smarty_internal_templateparser.php" -#line 1199 "smarty_internal_templateparser.y" - function yy_r193(){ +#line 1200 "smarty_internal_templateparser.y" + public function yy_r193() + { $this->yystack[$this->yyidx + -1]->minor->append_subtree($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor; } #line 3049 "smarty_internal_templateparser.php" -#line 1204 "smarty_internal_templateparser.y" - function yy_r194(){ +#line 1205 "smarty_internal_templateparser.y" + public function yy_r194() + { $this->_retvalue = new _smarty_doublequoted($this, $this->yystack[$this->yyidx + 0]->minor); } #line 3054 "smarty_internal_templateparser.php" -#line 1208 "smarty_internal_templateparser.y" - function yy_r195(){ - $this->_retvalue = new _smarty_code($this, '(string)'.$this->yystack[$this->yyidx + -1]->minor); +#line 1209 "smarty_internal_templateparser.y" + public function yy_r195() + { + $this->_retvalue = new _smarty_code($this, '(string) '.$this->yystack[$this->yyidx + -1]->minor); } #line 3059 "smarty_internal_templateparser.php" -#line 1216 "smarty_internal_templateparser.y" - function yy_r197(){ - $this->_retvalue = new _smarty_code($this, '(string)$_smarty_tpl->tpl_vars[\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\']->value'); +#line 1217 "smarty_internal_templateparser.y" + public function yy_r197() + { + $this->_retvalue = new _smarty_code($this, '(string) $_smarty_tpl->tpl_vars[\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\']->value'); } #line 3064 "smarty_internal_templateparser.php" -#line 1224 "smarty_internal_templateparser.y" - function yy_r199(){ - $this->_retvalue = new _smarty_code($this, '(string)('.$this->yystack[$this->yyidx + -1]->minor.')'); +#line 1225 "smarty_internal_templateparser.y" + public function yy_r199() + { + $this->_retvalue = new _smarty_code($this, '(string) ('.$this->yystack[$this->yyidx + -1]->minor.')'); } #line 3069 "smarty_internal_templateparser.php" -#line 1228 "smarty_internal_templateparser.y" - function yy_r200(){ +#line 1229 "smarty_internal_templateparser.y" + public function yy_r200() + { $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + 0]->minor); } #line 3074 "smarty_internal_templateparser.php" -#line 1232 "smarty_internal_templateparser.y" - function yy_r201(){ +#line 1233 "smarty_internal_templateparser.y" + public function yy_r201() + { $this->_retvalue = new _smarty_dq_content($this, $this->yystack[$this->yyidx + 0]->minor); } #line 3079 "smarty_internal_templateparser.php" private $_retvalue; - function yy_reduce($yyruleno) + public function yy_reduce($yyruleno) { $yymsp = $this->yystack[$this->yyidx]; if (self::$yyTraceFILE && $yyruleno >= 0 @@ -3104,7 +3265,7 @@ static public $yy_action = array( $yygoto = self::$yyRuleInfo[$yyruleno]['lhs']; $yysize = self::$yyRuleInfo[$yyruleno]['rhs']; $this->yyidx -= $yysize; - for($i = $yysize; $i; $i--) { + for ($i = $yysize; $i; $i--) { // pop all of the right-hand side parameters array_pop($this->yystack); } @@ -3125,7 +3286,7 @@ static public $yy_action = array( } } - function yy_parse_failed() + public function yy_parse_failed() { if (self::$yyTraceFILE) { fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt); @@ -3135,9 +3296,9 @@ static public $yy_action = array( } } - function yy_syntax_error($yymajor, $TOKEN) + public function yy_syntax_error($yymajor, $TOKEN) { -#line 77 "smarty_internal_templateparser.y" +#line 78 "smarty_internal_templateparser.y" $this->internalError = true; $this->yymajor = $yymajor; @@ -3145,15 +3306,14 @@ static public $yy_action = array( #line 3142 "smarty_internal_templateparser.php" } - function yy_accept() + public function yy_accept() { if (self::$yyTraceFILE) { fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt); - } - while ($this->yyidx >= 0) { + } while ($this->yyidx >= 0) { $stack = $this->yy_pop_parser_stack(); } -#line 69 "smarty_internal_templateparser.y" +#line 70 "smarty_internal_templateparser.y" $this->successful = !$this->internalError; $this->internalError = false; @@ -3162,7 +3322,7 @@ static public $yy_action = array( #line 3160 "smarty_internal_templateparser.php" } - function doParse($yymajor, $yytokenvalue) + public function doParse($yymajor, $yytokenvalue) { $yyerrorhit = 0; /* True if yymajor has invoked an error */ @@ -3209,7 +3369,7 @@ static public $yy_action = array( $this->yy_syntax_error($yymajor, $yytokenvalue); } $yymx = $this->yystack[$this->yyidx]->major; - if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){ + if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) { if (self::$yyTraceFILE) { fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n", self::$yyTracePrompt, $this->yyTokenName[$yymajor]); From 00ccae885723520147ae79549b95af9ef11ada98 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews@googlemail.com" Date: Sun, 14 Jul 2013 22:15:45 +0000 Subject: [PATCH 06/26] - update for PHP 5.4 compatibility - reformat source to PSR-2 standard --- change_log.txt | 2 + demo/index.php | 9 +- demo/plugins/cacheresource.apc.php | 19 +- demo/plugins/cacheresource.memcache.php | 22 +- demo/plugins/cacheresource.mysql.php | 64 +- demo/plugins/resource.extendsall.php | 26 +- demo/plugins/resource.mysql.php | 22 +- demo/plugins/resource.mysqls.php | 14 +- libs/Smarty.class.php | 197 +- libs/SmartyBC.class.php | 919 +++++----- libs/plugins/block.textformat.php | 11 +- libs/plugins/function.counter.php | 16 +- libs/plugins/function.cycle.php | 19 +- libs/plugins/function.fetch.php | 75 +- libs/plugins/function.html_checkboxes.php | 36 +- libs/plugins/function.html_image.php | 58 +- libs/plugins/function.html_options.php | 40 +- libs/plugins/function.html_radios.php | 56 +- libs/plugins/function.html_select_date.php | 101 +- libs/plugins/function.html_select_time.php | 8 +- libs/plugins/function.html_table.php | 11 +- libs/plugins/function.mailto.php | 10 +- libs/plugins/function.math.php | 13 +- libs/plugins/modifier.capitalize.php | 24 +- libs/plugins/modifier.date_format.php | 23 +- libs/plugins/modifier.debug_print_var.php | 32 +- libs/plugins/modifier.escape.php | 17 +- libs/plugins/modifier.regex_replace.php | 8 +- libs/plugins/modifier.replace.php | 17 +- libs/plugins/modifier.spacify.php | 10 +- libs/plugins/modifier.truncate.php | 25 +- libs/plugins/modifiercompiler.cat.php | 58 +- .../modifiercompiler.count_characters.php | 64 +- .../modifiercompiler.count_paragraphs.php | 54 +- .../modifiercompiler.count_sentences.php | 54 +- libs/plugins/modifiercompiler.count_words.php | 62 +- libs/plugins/modifiercompiler.default.php | 69 +- libs/plugins/modifiercompiler.escape.php | 249 ++- .../plugins/modifiercompiler.from_charset.php | 66 +- libs/plugins/modifiercompiler.indent.php | 63 +- libs/plugins/modifiercompiler.lower.php | 60 +- libs/plugins/modifiercompiler.noprint.php | 48 +- .../modifiercompiler.string_format.php | 50 +- libs/plugins/modifiercompiler.strip.php | 65 +- libs/plugins/modifiercompiler.strip_tags.php | 56 +- libs/plugins/modifiercompiler.to_charset.php | 66 +- libs/plugins/modifiercompiler.unescape.php | 100 +- libs/plugins/modifiercompiler.upper.php | 58 +- libs/plugins/modifiercompiler.wordwrap.php | 91 +- libs/plugins/outputfilter.trimwhitespace.php | 2 - libs/plugins/shared.escape_special_chars.php | 18 +- .../plugins/shared.literal_compiler_param.php | 1 + libs/plugins/shared.make_timestamp.php | 3 +- libs/plugins/shared.mb_str_replace.php | 10 +- libs/plugins/shared.mb_unicode.php | 12 +- libs/plugins/shared.mb_wordwrap.php | 15 +- .../variablefilter.htmlspecialchars.php | 2 - libs/sysplugins/smarty_cacheresource.php | 34 +- .../smarty_cacheresource_custom.php | 102 +- .../smarty_cacheresource_keyvaluestore.php | 139 +- libs/sysplugins/smarty_config_source.php | 25 +- .../smarty_internal_cacheresource_file.php | 24 +- .../smarty_internal_compile_append.php | 12 +- .../smarty_internal_compile_assign.php | 15 +- .../smarty_internal_compile_block.php | 47 +- .../smarty_internal_compile_break.php | 153 +- .../smarty_internal_compile_call.php | 13 +- .../smarty_internal_compile_capture.php | 19 +- .../smarty_internal_compile_config_load.php | 12 +- .../smarty_internal_compile_continue.php | 155 +- .../smarty_internal_compile_debug.php | 11 +- .../smarty_internal_compile_eval.php | 11 +- .../smarty_internal_compile_extends.php | 7 +- .../smarty_internal_compile_for.php | 43 +- .../smarty_internal_compile_foreach.php | 33 +- .../smarty_internal_compile_function.php | 32 +- .../sysplugins/smarty_internal_compile_if.php | 51 +- .../smarty_internal_compile_include.php | 14 +- .../smarty_internal_compile_include_php.php | 12 +- .../smarty_internal_compile_insert.php | 13 +- .../smarty_internal_compile_ldelim.php | 11 +- .../smarty_internal_compile_nocache.php | 20 +- ..._internal_compile_private_block_plugin.php | 17 +- ...ternal_compile_private_function_plugin.php | 17 +- ...arty_internal_compile_private_modifier.php | 280 +-- ..._compile_private_object_block_function.php | 17 +- ...ternal_compile_private_object_function.php | 17 +- ...ernal_compile_private_print_expression.php | 12 +- ...ernal_compile_private_registered_block.php | 225 ++- ...al_compile_private_registered_function.php | 161 +- ...ernal_compile_private_special_variable.php | 15 +- .../smarty_internal_compile_rdelim.php | 11 +- .../smarty_internal_compile_section.php | 41 +- .../smarty_internal_compile_setfilter.php | 144 +- .../smarty_internal_compile_while.php | 28 +- .../smarty_internal_compilebase.php | 32 +- libs/sysplugins/smarty_internal_config.php | 25 +- .../smarty_internal_config_file_compiler.php | 8 +- .../smarty_internal_configfilelexer.php | 2 +- .../smarty_internal_configfileparser.php | 33 +- libs/sysplugins/smarty_internal_data.php | 101 +- libs/sysplugins/smarty_internal_debug.php | 32 +- .../smarty_internal_filter_handler.php | 18 +- .../smarty_internal_function_call_handler.php | 108 +- .../smarty_internal_get_include_path.php | 94 +- .../smarty_internal_nocache_insert.php | 105 +- libs/sysplugins/smarty_internal_parsetree.php | 788 ++++---- .../smarty_internal_resource_eval.php | 186 +- .../smarty_internal_resource_extends.php | 6 +- .../smarty_internal_resource_file.php | 17 +- .../smarty_internal_resource_php.php | 23 +- .../smarty_internal_resource_registered.php | 28 +- .../smarty_internal_resource_stream.php | 7 +- .../smarty_internal_resource_string.php | 30 +- ...smarty_internal_smartytemplatecompiler.php | 10 +- libs/sysplugins/smarty_internal_template.php | 64 +- .../smarty_internal_templatebase.php | 1631 +++++++++-------- .../smarty_internal_templatecompilerbase.php | 1359 +++++++------- .../smarty_internal_templateparser.php | 35 +- libs/sysplugins/smarty_internal_utility.php | 83 +- .../sysplugins/smarty_internal_write_file.php | 21 +- libs/sysplugins/smarty_resource.php | 155 +- libs/sysplugins/smarty_resource_custom.php | 20 +- .../sysplugins/smarty_resource_recompiled.php | 10 +- .../sysplugins/smarty_resource_uncompiled.php | 14 +- libs/sysplugins/smarty_security.php | 80 +- 126 files changed, 5232 insertions(+), 5186 deletions(-) diff --git a/change_log.txt b/change_log.txt index a0c4553d..39b4392c 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,8 @@ ===== trunk ===== 14.7.2013 - bugfix increase of internal maximum parser stacksize to allow more complex tag code {forum topic 24426} +- update for PHP 5.4 compatibility +- reformat source to PSR-2 standard 12.7.2013 - bugfix Do not remove '//' from file path at normalization (Issue 142) diff --git a/demo/index.php b/demo/index.php index 74c8e897..b7d988f5 100644 --- a/demo/index.php +++ b/demo/index.php @@ -5,12 +5,10 @@ * @package Example-application */ -require('../libs/Smarty.class.php'); +require '../libs/Smarty.class.php'; $smarty = new Smarty; - - //$smarty->force_compile = true; $smarty->debugging = true; $smarty->caching = true; @@ -20,14 +18,13 @@ $smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill",true); $smarty->assign("FirstName",array("John","Mary","James","Henry")); $smarty->assign("LastName",array("Doe","Smith","Johnson","Case")); $smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"), - array("I", "J", "K", "L"), array("M", "N", "O", "P"))); + array("I", "J", "K", "L"), array("M", "N", "O", "P"))); $smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"), - array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234"))); + array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234"))); $smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX")); $smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas")); $smarty->assign("option_selected", "NE"); $smarty->display('index.tpl'); -?> diff --git a/demo/plugins/cacheresource.apc.php b/demo/plugins/cacheresource.apc.php index 00ba5981..9854f638 100644 --- a/demo/plugins/cacheresource.apc.php +++ b/demo/plugins/cacheresource.apc.php @@ -9,12 +9,12 @@ * @package CacheResource-examples * @author Uwe Tews */ -class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore { - +class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore +{ public function __construct() { // test if APC is present - if(!function_exists('apc_cache_info')) { + if (!function_exists('apc_cache_info')) { throw new Exception('APC Template Caching Error: APC is not installed'); } } @@ -22,8 +22,8 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore { /** * Read values for a set of keys from cache * - * @param array $keys list of keys to fetch - * @return array list of values with the given keys used as indexes + * @param array $keys list of keys to fetch + * @return array list of values with the given keys used as indexes * @return boolean true on success, false on failure */ protected function read(array $keys) @@ -33,14 +33,15 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore { foreach ($res as $k => $v) { $_res[$k] = $v; } + return $_res; } /** * Save values for a set of keys to cache * - * @param array $keys list of values to save - * @param int $expire expiration time + * @param array $keys list of values to save + * @param int $expire expiration time * @return boolean true on success, false on failure */ protected function write(array $keys, $expire=null) @@ -48,13 +49,14 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore { foreach ($keys as $k => $v) { apc_store($k, $v, $expire); } + return true; } /** * Remove values from cache * - * @param array $keys list of keys to delete + * @param array $keys list of keys to delete * @return boolean true on success, false on failure */ protected function delete(array $keys) @@ -62,6 +64,7 @@ class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore { foreach ($keys as $k) { apc_delete($k); } + return true; } diff --git a/demo/plugins/cacheresource.memcache.php b/demo/plugins/cacheresource.memcache.php index 230607d6..f38b00ac 100644 --- a/demo/plugins/cacheresource.memcache.php +++ b/demo/plugins/cacheresource.memcache.php @@ -12,24 +12,25 @@ * @package CacheResource-examples * @author Rodney Rehm */ -class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore { +class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore +{ /** * memcache instance * @var Memcache */ protected $memcache = null; - + public function __construct() { $this->memcache = new Memcache(); $this->memcache->addServer( '127.0.0.1', 11211 ); } - + /** * Read values for a set of keys from cache * - * @param array $keys list of keys to fetch - * @return array list of values with the given keys used as indexes + * @param array $keys list of keys to fetch + * @return array list of values with the given keys used as indexes * @return boolean true on success, false on failure */ protected function read(array $keys) @@ -45,14 +46,15 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore { foreach ($res as $k => $v) { $_res[$lookup[$k]] = $v; } + return $_res; } - + /** * Save values for a set of keys to cache * - * @param array $keys list of values to save - * @param int $expire expiration time + * @param array $keys list of values to save + * @param int $expire expiration time * @return boolean true on success, false on failure */ protected function write(array $keys, $expire=null) @@ -61,13 +63,14 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore { $k = sha1($k); $this->memcache->set($k, $v, 0, $expire); } + return true; } /** * Remove values from cache * - * @param array $keys list of keys to delete + * @param array $keys list of keys to delete * @return boolean true on success, false on failure */ protected function delete(array $keys) @@ -76,6 +79,7 @@ class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore { $k = sha1($k); $this->memcache->delete($k); } + return true; } diff --git a/demo/plugins/cacheresource.mysql.php b/demo/plugins/cacheresource.mysql.php index ab8c4751..29a24176 100644 --- a/demo/plugins/cacheresource.mysql.php +++ b/demo/plugins/cacheresource.mysql.php @@ -24,14 +24,16 @@ * @package CacheResource-examples * @author Rodney Rehm */ -class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { +class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom +{ // PDO instance protected $db; protected $fetch; protected $fetchTimestamp; protected $save; - - public function __construct() { + + public function __construct() + { try { $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty"); } catch (PDOException $e) { @@ -46,19 +48,19 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { /** * fetch cached content and its modification time from data source * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param string $content cached content - * @param integer $mtime cache modification timestamp (epoch) + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param string $content cached content + * @param integer $mtime cache modification timestamp (epoch) * @return void */ protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime) { $this->fetch->execute(array('id' => $id)); $row = $this->fetch->fetch(); - $this->fetch->closeCursor(); + $this->fetch->closeCursor(); if ($row) { $content = $row['content']; $mtime = strtotime($row['modified']); @@ -67,15 +69,15 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { $mtime = null; } } - + /** * Fetch cached content's modification timestamp from data source * * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content. - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id * @return integer|boolean timestamp (epoch) the template was modified, or false if not found */ protected function fetchTimestamp($id, $name, $cache_id, $compile_id) @@ -83,19 +85,20 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { $this->fetchTimestamp->execute(array('id' => $id)); $mtime = strtotime($this->fetchTimestamp->fetchColumn()); $this->fetchTimestamp->closeCursor(); + return $mtime; } - + /** * Save content to cache * - * @param string $id unique cache content identifier - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration time in seconds or null - * @param string $content content to cache - * @return boolean success + * @param string $id unique cache content identifier + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer|null $exp_time seconds till expiration time in seconds or null + * @param string $content content to cache + * @return boolean success */ protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content) { @@ -106,17 +109,18 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { 'compile_id' => $compile_id, 'content' => $content, )); + return !!$this->save->rowCount(); } - + /** * Delete content from cache * - * @param string $name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer|null $exp_time seconds till expiration or null - * @return integer number of deleted caches + * @param string $name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer|null $exp_time seconds till expiration or null + * @return integer number of deleted caches */ protected function delete($name, $cache_id, $compile_id, $exp_time) { @@ -124,6 +128,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) { // returning the number of deleted caches would require a second query to count them $query = $this->db->query('TRUNCATE TABLE output_cache'); + return -1; } // build the filter @@ -147,6 +152,7 @@ class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom { } // run delete query $query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where)); + return $query->rowCount(); } } diff --git a/demo/plugins/resource.extendsall.php b/demo/plugins/resource.extendsall.php index d8c40b5b..586e6c8c 100644 --- a/demo/plugins/resource.extendsall.php +++ b/demo/plugins/resource.extendsall.php @@ -2,20 +2,20 @@ /** * Extends All Resource - * + * * Resource Implementation modifying the extends-Resource to walk * through the template_dirs and inherit all templates of the same name - * + * * @package Resource-examples * @author Rodney Rehm */ -class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends { - +class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends +{ /** * populate Source Object with meta data from Resource * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object + * @param Smarty_Template_Source $source source object + * @param Smarty_Internal_Template $_template template object * @return void */ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null) @@ -31,20 +31,20 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends { } $sources[$s->uid] = $s; $uid .= $s->filepath; - } - catch (SmartyException $e) {} + } catch (SmartyException $e) {} } - + if (!$sources) { $source->exists = false; $source->template = $_template; + return; } - + $sources = array_reverse($sources, true); reset($sources); $s = current($sources); - + $source->components = $sources; $source->filepath = $s->filepath; $source->uid = sha1($uid); @@ -55,6 +55,4 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends { // need the template at getContent() $source->template = $_template; } -} - -?> \ No newline at end of file +} diff --git a/demo/plugins/resource.mysql.php b/demo/plugins/resource.mysql.php index 312f3fc7..909059b3 100644 --- a/demo/plugins/resource.mysql.php +++ b/demo/plugins/resource.mysql.php @@ -20,7 +20,8 @@ * @package Resource-examples * @author Rodney Rehm */ -class Smarty_Resource_Mysql extends Smarty_Resource_Custom { +class Smarty_Resource_Mysql extends Smarty_Resource_Custom +{ // PDO instance protected $db; // prepared fetch() statement @@ -28,7 +29,8 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom { // prepared fetchTimestamp() statement protected $mtime; - public function __construct() { + public function __construct() + { try { $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty"); } catch (PDOException $e) { @@ -37,13 +39,13 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom { $this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name'); $this->mtime = $this->db->prepare('SELECT modified FROM templates WHERE name = :name'); } - + /** * Fetch a template and its modification time from database * - * @param string $name template name - * @param string $source template source - * @param integer $mtime template modification timestamp (epoch) + * @param string $name template name + * @param string $source template source + * @param integer $mtime template modification timestamp (epoch) * @return void */ protected function fetch($name, &$source, &$mtime) @@ -59,18 +61,20 @@ class Smarty_Resource_Mysql extends Smarty_Resource_Custom { $mtime = null; } } - + /** * Fetch a template's modification time from database * * @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source. - * @param string $name template name + * @param string $name template name * @return integer timestamp (epoch) the template was modified */ - protected function fetchTimestamp($name) { + protected function fetchTimestamp($name) + { $this->mtime->execute(array('name' => $name)); $mtime = $this->mtime->fetchColumn(); $this->mtime->closeCursor(); + return strtotime($mtime); } } diff --git a/demo/plugins/resource.mysqls.php b/demo/plugins/resource.mysqls.php index e22bed0a..a7d5be95 100644 --- a/demo/plugins/resource.mysqls.php +++ b/demo/plugins/resource.mysqls.php @@ -23,13 +23,15 @@ * @package Resource-examples * @author Rodney Rehm */ -class Smarty_Resource_Mysqls extends Smarty_Resource_Custom { +class Smarty_Resource_Mysqls extends Smarty_Resource_Custom +{ // PDO instance protected $db; // prepared fetch() statement protected $fetch; - public function __construct() { + public function __construct() + { try { $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty"); } catch (PDOException $e) { @@ -37,13 +39,13 @@ class Smarty_Resource_Mysqls extends Smarty_Resource_Custom { } $this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name'); } - + /** * Fetch a template and its modification time from database * - * @param string $name template name - * @param string $source template source - * @param integer $mtime template modification timestamp (epoch) + * @param string $name template name + * @param string $source template source + * @param integer $mtime template modification timestamp (epoch) * @return void */ protected function fetch($name, &$source, &$mtime) diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 6c452fde..482c45a3 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -104,8 +104,8 @@ include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_cacheresource_file.php'; * This is the main Smarty class * @package Smarty */ -class Smarty extends Smarty_Internal_TemplateBase { - +class Smarty extends Smarty_Internal_TemplateBase +{ /**#@+ * constant definitions */ @@ -131,7 +131,7 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * define constant for clearing cache files be saved expiration datees */ - const CLEAR_EXPIRED = -1; + const CLEAR_EXPIRED = -1; /** * define compile check modes @@ -167,38 +167,38 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * assigned global tpl vars */ - public static $global_tpl_vars = array(); + static $global_tpl_vars = array(); /** * error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors() */ - public static $_previous_error_handler = null; + static $_previous_error_handler = null; /** * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() */ - public static $_muted_directories = array(); + static $_muted_directories = array(); /** * Flag denoting if Multibyte String functions are available */ - public static $_MBSTRING = SMARTY_MBSTRING; + static $_MBSTRING = SMARTY_MBSTRING; /** * The character set to adhere to (e.g. "UTF-8") */ - public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; + static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; /** * The date format to be used internally * (accepts date() and strftime()) */ - public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; + static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; /** * Flag denoting if PCRE should run in UTF-8 mode */ - public static $_UTF8_MODIFIER = 'u'; + static $_UTF8_MODIFIER = 'u'; /** * Flag denoting if operating system is windows */ - public static $_IS_WINDOWS = false; + static $_IS_WINDOWS = false; /**#@+ * variables @@ -564,7 +564,7 @@ class Smarty extends Smarty_Internal_TemplateBase { * global internal smarty vars * @var array */ - public static $_smarty_vars = array(); + static $_smarty_vars = array(); /** * start time for execution time calculation * @var int @@ -633,7 +633,6 @@ class Smarty extends Smarty_Internal_TemplateBase { } } - /** * Class destructor */ @@ -650,14 +649,13 @@ class Smarty extends Smarty_Internal_TemplateBase { $this->smarty = $this; } - /** * <> Generic getter. * * Calls the appropriate getter function. * Issues an E_USER_NOTICE if no valid getter is found. * - * @param string $name property name + * @param string $name property name * @return mixed */ public function __get($name) @@ -706,7 +704,7 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Check if a template resource exists * - * @param string $resource_name template name + * @param string $resource_name template name * @return boolean status */ public function templateExists($resource_name) @@ -717,14 +715,15 @@ class Smarty extends Smarty_Internal_TemplateBase { // check if it does exists $result = $tpl->source->exists; $this->template_objects = $save; + return $result; } /** * Returns a single or all global variables * - * @param object $smarty - * @param string $varname variable name or null + * @param object $smarty + * @param string $varname variable name or null * @return string variable value or or array of variables */ public function getGlobal($varname = null) @@ -740,6 +739,7 @@ class Smarty extends Smarty_Internal_TemplateBase { foreach (self::$global_tpl_vars AS $key => $var) { $_result[$key] = $var->value; } + return $_result; } } @@ -747,26 +747,27 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Empty cache folder * - * @param integer $exp_time expiration time - * @param string $type resource type + * @param integer $exp_time expiration time + * @param string $type resource type * @return integer number of cache files deleted */ - function clearAllCache($exp_time = null, $type = null) + public function clearAllCache($exp_time = null, $type = null) { // load cache resource and call clearAll $_cache_resource = Smarty_CacheResource::load($this, $type); Smarty_CacheResource::invalidLoadedCache($this); + return $_cache_resource->clearAll($this, $exp_time); } /** * Empty cache for a specific template * - * @param string $template_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time - * @param string $type resource type + * @param string $template_name template name + * @param string $cache_id cache id + * @param string $compile_id compile id + * @param integer $exp_time expiration time + * @param string $type resource type * @return integer number of cache files deleted */ public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) @@ -774,20 +775,22 @@ class Smarty extends Smarty_Internal_TemplateBase { // load cache resource and call clear $_cache_resource = Smarty_CacheResource::load($this, $type); Smarty_CacheResource::invalidLoadedCache($this); + return $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time); } /** * Loads security class and enables security * - * @param string|Smarty_Security $security_class if a string is used, it must be class-name - * @return Smarty current Smarty instance for chaining - * @throws SmartyException when an invalid class name is provided + * @param string|Smarty_Security $security_class if a string is used, it must be class-name + * @return Smarty current Smarty instance for chaining + * @throws SmartyException when an invalid class name is provided */ public function enableSecurity($security_class = null) { if ($security_class instanceof Smarty_Security) { $this->security_policy = $security_class; + return $this; } elseif (is_object($security_class)) { throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security."); @@ -820,8 +823,8 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Set template directory * - * @param string|array $template_dir directory(s) of template sources - * @return Smarty current Smarty instance for chaining + * @param string|array $template_dir directory(s) of template sources + * @return Smarty current Smarty instance for chaining */ public function setTemplateDir($template_dir) { @@ -831,15 +834,16 @@ class Smarty extends Smarty_Internal_TemplateBase { } $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir); + return $this; } /** * Add template directory(s) * - * @param string|array $template_dir directory(s) of template sources - * @param string $key of the array element to assign the template dir to - * @return Smarty current Smarty instance for chaining + * @param string|array $template_dir directory(s) of template sources + * @param string $key of the array element to assign the template dir to + * @return Smarty current Smarty instance for chaining * @throws SmartyException when the given template directory is not valid */ public function addTemplateDir($template_dir, $key=null) @@ -865,6 +869,7 @@ class Smarty extends Smarty_Internal_TemplateBase { $this->template_dir[] = rtrim($template_dir, '/\\') . DS; } $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir); + return $this; } @@ -880,14 +885,14 @@ class Smarty extends Smarty_Internal_TemplateBase { return isset($this->template_dir[$index]) ? $this->template_dir[$index] : null; } - return (array)$this->template_dir; + return (array) $this->template_dir; } /** * Set config directory * - * @param string|array $template_dir directory(s) of configuration sources - * @return Smarty current Smarty instance for chaining + * @param string|array $template_dir directory(s) of configuration sources + * @return Smarty current Smarty instance for chaining */ public function setConfigDir($config_dir) { @@ -897,6 +902,7 @@ class Smarty extends Smarty_Internal_TemplateBase { } $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir); + return $this; } @@ -922,7 +928,7 @@ class Smarty extends Smarty_Internal_TemplateBase { $this->config_dir[$k] = rtrim($v, '/\\') . DS; } } - } elseif( $key !== null ) { + } elseif ($key !== null) { // override directory at specified index $this->config_dir[$key] = rtrim($config_dir, '/\\') . DS; } else { @@ -931,6 +937,7 @@ class Smarty extends Smarty_Internal_TemplateBase { } $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir); + return $this; } @@ -946,19 +953,19 @@ class Smarty extends Smarty_Internal_TemplateBase { return isset($this->config_dir[$index]) ? $this->config_dir[$index] : null; } - return (array)$this->config_dir; + return (array) $this->config_dir; } /** * Set plugins directory * - * @param string|array $plugins_dir directory(s) of plugins - * @return Smarty current Smarty instance for chaining + * @param string|array $plugins_dir directory(s) of plugins + * @return Smarty current Smarty instance for chaining */ public function setPluginsDir($plugins_dir) { $this->plugins_dir = array(); - foreach ((array)$plugins_dir as $k => $v) { + foreach ((array) $plugins_dir as $k => $v) { $this->plugins_dir[$k] = rtrim($v, '/\\') . DS; } @@ -993,6 +1000,7 @@ class Smarty extends Smarty_Internal_TemplateBase { } $this->plugins_dir = array_unique($this->plugins_dir); + return $this; } @@ -1003,13 +1011,13 @@ class Smarty extends Smarty_Internal_TemplateBase { */ public function getPluginsDir() { - return (array)$this->plugins_dir; + return (array) $this->plugins_dir; } /** * Set compile directory * - * @param string $compile_dir directory to store compiled templates in + * @param string $compile_dir directory to store compiled templates in * @return Smarty current Smarty instance for chaining */ public function setCompileDir($compile_dir) @@ -1018,6 +1026,7 @@ class Smarty extends Smarty_Internal_TemplateBase { if (!isset(Smarty::$_muted_directories[$this->compile_dir])) { Smarty::$_muted_directories[$this->compile_dir] = null; } + return $this; } @@ -1034,7 +1043,7 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Set cache directory * - * @param string $cache_dir directory to store cached templates in + * @param string $cache_dir directory to store cached templates in * @return Smarty current Smarty instance for chaining */ public function setCacheDir($cache_dir) @@ -1043,6 +1052,7 @@ class Smarty extends Smarty_Internal_TemplateBase { if (!isset(Smarty::$_muted_directories[$this->cache_dir])) { Smarty::$_muted_directories[$this->cache_dir] = null; } + return $this; } @@ -1059,20 +1069,21 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Set default modifiers * - * @param array|string $modifiers modifier or list of modifiers to set - * @return Smarty current Smarty instance for chaining + * @param array|string $modifiers modifier or list of modifiers to set + * @return Smarty current Smarty instance for chaining */ public function setDefaultModifiers($modifiers) { $this->default_modifiers = (array) $modifiers; + return $this; } /** * Add default modifiers * - * @param array|string $modifiers modifier or list of modifiers to add - * @return Smarty current Smarty instance for chaining + * @param array|string $modifiers modifier or list of modifiers to add + * @return Smarty current Smarty instance for chaining */ public function addDefaultModifiers($modifiers) { @@ -1099,8 +1110,8 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Set autoload filters * - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types + * @param array $filters filters to load automatically + * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types * @return Smarty current Smarty instance for chaining */ public function setAutoloadFilters($filters, $type=null) @@ -1117,8 +1128,8 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Add autoload filters * - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types + * @param array $filters filters to load automatically + * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types * @return Smarty current Smarty instance for chaining */ public function addAutoloadFilters($filters, $type=null) @@ -1145,8 +1156,8 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Get autoload filters * - * @param string $type type of filter to get autoloads for. Defaults to all autoload filters - * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified + * @param string $type type of filter to get autoloads for. Defaults to all autoload filters + * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified */ public function getAutoloadFilters($type=null) { @@ -1170,8 +1181,8 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * set the debug template * - * @param string $tpl_name - * @return Smarty current Smarty instance for chaining + * @param string $tpl_name + * @return Smarty current Smarty instance for chaining * @throws SmartyException if file is not readable */ public function setDebugTemplate($tpl_name) @@ -1187,12 +1198,12 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * creates a template object * - * @param string $template the resource handle of the template file - * @param mixed $cache_id cache id to be used with this template - * @param mixed $compile_id compile id to be used with this template - * @param object $parent next higher level of Smarty variables - * @param boolean $do_clone flag is Smarty object shall be cloned - * @return object template object + * @param string $template the resource handle of the template file + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables + * @param boolean $do_clone flag is Smarty object shall be cloned + * @return object template object */ public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true) { @@ -1247,6 +1258,7 @@ class Smarty extends Smarty_Internal_TemplateBase { $tpl->tpl_vars[$_key] = new Smarty_variable($_val); } } + return $tpl; } @@ -1256,8 +1268,8 @@ class Smarty extends Smarty_Internal_TemplateBase { * class name format: Smarty_PluginType_PluginName * plugin filename format: plugintype.pluginname.php * - * @param string $plugin_name class plugin name to load - * @param bool $check check if already loaded + * @param string $plugin_name class plugin name to load + * @param bool $check check if already loaded * @return string |boolean filepath of loaded file or false */ public function loadPlugin($plugin_name, $check = true) @@ -1272,6 +1284,7 @@ class Smarty extends Smarty_Internal_TemplateBase { // count($_name_parts) < 3 === !isset($_name_parts[2]) if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') { throw new SmartyException("plugin {$plugin_name} is not a valid name format"); + return false; } // if type is "internal", get plugin from sysplugins @@ -1279,6 +1292,7 @@ class Smarty extends Smarty_Internal_TemplateBase { $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php'; if (file_exists($file)) { require_once($file); + return $file; } else { return false; @@ -1290,7 +1304,7 @@ class Smarty extends Smarty_Internal_TemplateBase { $_stream_resolve_include_path = function_exists('stream_resolve_include_path'); // loop through plugin dirs and find the plugin - foreach($this->getPluginsDir() as $_plugin_dir) { + foreach ($this->getPluginsDir() as $_plugin_dir) { $names = array( $_plugin_dir . $_plugin_filename, $_plugin_dir . strtolower($_plugin_filename), @@ -1298,6 +1312,7 @@ class Smarty extends Smarty_Internal_TemplateBase { foreach ($names as $file) { if (file_exists($file)) { require_once($file); + return $file; } if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) { @@ -1310,6 +1325,7 @@ class Smarty extends Smarty_Internal_TemplateBase { if ($file !== false) { require_once($file); + return $file; } } @@ -1322,10 +1338,10 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Compile all template files * - * @param string $extension file extension - * @param bool $force_compile force all to recompile - * @param int $time_limit - * @param int $max_errors + * @param string $extension file extension + * @param bool $force_compile force all to recompile + * @param int $time_limit + * @param int $max_errors * @return integer number of template files recompiled */ public function compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null) @@ -1336,10 +1352,10 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Compile all config files * - * @param string $extension file extension - * @param bool $force_compile force all to recompile - * @param int $time_limit - * @param int $max_errors + * @param string $extension file extension + * @param bool $force_compile force all to recompile + * @param int $time_limit + * @param int $max_errors * @return integer number of template files recompiled */ public function compileAllConfig($extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null) @@ -1350,9 +1366,9 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Delete compiled template file * - * @param string $resource_name template name - * @param string $compile_id compile id - * @param integer $exp_time expiration time + * @param string $resource_name template name + * @param string $compile_id compile id + * @param integer $exp_time expiration time * @return integer number of template files deleted */ public function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null) @@ -1364,8 +1380,8 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Return array of tag/attributes of all tags used by an template * - * @param object $templae template object - * @return array of tag/attributes + * @param object $templae template object + * @return array of tag/attributes */ public function getTags(Smarty_Internal_Template $template) { @@ -1375,7 +1391,7 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * Run installation test * - * @param array $errors Array to write errors into, rather than outputting them + * @param array $errors Array to write errors into, rather than outputting them * @return boolean true if setup is fine, false if something is wrong */ public function testInstall(&$errors=null) @@ -1387,10 +1403,10 @@ class Smarty extends Smarty_Internal_TemplateBase { * Error Handler to mute expected messages * * @link http://php.net/set_error_handler - * @param integer $errno Error level + * @param integer $errno Error level * @return boolean */ - public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) + static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext) { $_is_muted_directory = false; @@ -1442,7 +1458,7 @@ class Smarty extends Smarty_Internal_TemplateBase { * * @return void */ - public static function muteExpectedErrors() + static function muteExpectedErrors() { /* error muting is done because some people implemented custom error_handlers using @@ -1474,7 +1490,7 @@ class Smarty extends Smarty_Internal_TemplateBase { * * @return void */ - public static function unmuteExpectedErrors() + static function unmuteExpectedErrors() { restore_error_handler(); } @@ -1492,9 +1508,11 @@ if (Smarty::$_CHARSET !== 'UTF-8') { * Smarty exception class * @package Smarty */ -class SmartyException extends Exception { - public static $escape = true; - public function __construct($message) { +class SmartyException extends Exception +{ + static $escape = true; + public function __construct($message) + { $this->message = self::$escape ? htmlentities($message) : $message; } } @@ -1503,7 +1521,8 @@ class SmartyException extends Exception { * Smarty compiler exception class * @package Smarty */ -class SmartyCompilerException extends SmartyException { +class SmartyCompilerException extends SmartyException +{ } /** @@ -1529,5 +1548,3 @@ function smartyAutoload($class) include SMARTY_SYSPLUGINS_DIR . $_class . '.php'; } } - -?> \ No newline at end of file diff --git a/libs/SmartyBC.class.php b/libs/SmartyBC.class.php index f8f0a138..32f22289 100644 --- a/libs/SmartyBC.class.php +++ b/libs/SmartyBC.class.php @@ -1,460 +1,459 @@ - - * @author Uwe Tews - * @author Rodney Rehm - * @package Smarty - */ -/** - * @ignore - */ -require(dirname(__FILE__) . '/Smarty.class.php'); - -/** - * Smarty Backward Compatability Wrapper Class - * - * @package Smarty - */ -class SmartyBC extends Smarty { - - /** - * Smarty 2 BC - * @var string - */ - public $_version = self::SMARTY_VERSION; - - /** - * Initialize new SmartyBC object - * - * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false ) - */ - public function __construct(array $options=array()) - { - parent::__construct($options); - // register {php} tag - $this->registerPlugin('block', 'php', 'smarty_php_tag'); - } - - /** - * wrapper for assign_by_ref - * - * @param string $tpl_var the template variable name - * @param mixed &$value the referenced value to assign - */ - public function assign_by_ref($tpl_var, &$value) - { - $this->assignByRef($tpl_var, $value); - } - - /** - * wrapper for append_by_ref - * - * @param string $tpl_var the template variable name - * @param mixed &$value the referenced value to append - * @param boolean $merge flag if array elements shall be merged - */ - public function append_by_ref($tpl_var, &$value, $merge = false) - { - $this->appendByRef($tpl_var, $value, $merge); - } - - /** - * clear the given assigned template variable. - * - * @param string $tpl_var the template variable to clear - */ - public function clear_assign($tpl_var) - { - $this->clearAssign($tpl_var); - } - - /** - * Registers custom function to be used in templates - * - * @param string $function the name of the template function - * @param string $function_impl the name of the PHP function to register - * @param bool $cacheable - * @param mixed $cache_attrs - */ - public function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null) - { - $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs); - } - - /** - * Unregisters custom function - * - * @param string $function name of template function - */ - public function unregister_function($function) - { - $this->unregisterPlugin('function', $function); - } - - /** - * Registers object to be used in templates - * - * @param string $object name of template object - * @param object $object_impl the referenced PHP object to register - * @param array $allowed list of allowed methods (empty = all) - * @param boolean $smarty_args smarty argument format, else traditional - * @param array $block_functs list of methods that are block format - */ - public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) - { - settype($allowed, 'array'); - settype($smarty_args, 'boolean'); - $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); - } - - /** - * Unregisters object - * - * @param string $object name of template object - */ - public function unregister_object($object) - { - $this->unregisterObject($object); - } - - /** - * Registers block function to be used in templates - * - * @param string $block name of template block - * @param string $block_impl PHP function to register - * @param bool $cacheable - * @param mixed $cache_attrs - */ - public function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null) - { - $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs); - } - - /** - * Unregisters block function - * - * @param string $block name of template function - */ - public function unregister_block($block) - { - $this->unregisterPlugin('block', $block); - } - - /** - * Registers compiler function - * - * @param string $function name of template function - * @param string $function_impl name of PHP function to register - * @param bool $cacheable - */ - public function register_compiler_function($function, $function_impl, $cacheable=true) - { - $this->registerPlugin('compiler', $function, $function_impl, $cacheable); - } - - /** - * Unregisters compiler function - * - * @param string $function name of template function - */ - public function unregister_compiler_function($function) - { - $this->unregisterPlugin('compiler', $function); - } - - /** - * Registers modifier to be used in templates - * - * @param string $modifier name of template modifier - * @param string $modifier_impl name of PHP function to register - */ - public function register_modifier($modifier, $modifier_impl) - { - $this->registerPlugin('modifier', $modifier, $modifier_impl); - } - - /** - * Unregisters modifier - * - * @param string $modifier name of template modifier - */ - public function unregister_modifier($modifier) - { - $this->unregisterPlugin('modifier', $modifier); - } - - /** - * Registers a resource to fetch a template - * - * @param string $type name of resource - * @param array $functions array of functions to handle resource - */ - public function register_resource($type, $functions) - { - $this->registerResource($type, $functions); - } - - /** - * Unregisters a resource - * - * @param string $type name of resource - */ - public function unregister_resource($type) - { - $this->unregisterResource($type); - } - - /** - * Registers a prefilter function to apply - * to a template before compiling - * - * @param callable $function - */ - public function register_prefilter($function) - { - $this->registerFilter('pre', $function); - } - - /** - * Unregisters a prefilter function - * - * @param callable $function - */ - public function unregister_prefilter($function) - { - $this->unregisterFilter('pre', $function); - } - - /** - * Registers a postfilter function to apply - * to a compiled template after compilation - * - * @param callable $function - */ - public function register_postfilter($function) - { - $this->registerFilter('post', $function); - } - - /** - * Unregisters a postfilter function - * - * @param callable $function - */ - public function unregister_postfilter($function) - { - $this->unregisterFilter('post', $function); - } - - /** - * Registers an output filter function to apply - * to a template output - * - * @param callable $function - */ - public function register_outputfilter($function) - { - $this->registerFilter('output', $function); - } - - /** - * Unregisters an outputfilter function - * - * @param callable $function - */ - public function unregister_outputfilter($function) - { - $this->unregisterFilter('output', $function); - } - - /** - * load a filter of specified type and name - * - * @param string $type filter type - * @param string $name filter name - */ - public function load_filter($type, $name) - { - $this->loadFilter($type, $name); - } - - /** - * clear cached content for the given template and cache id - * - * @param string $tpl_file name of template file - * @param string $cache_id name of cache_id - * @param string $compile_id name of compile_id - * @param string $exp_time expiration time - * @return boolean - */ - public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) - { - return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time); - } - - /** - * clear the entire contents of cache (all templates) - * - * @param string $exp_time expire time - * @return boolean - */ - public function clear_all_cache($exp_time = null) - { - return $this->clearCache(null, null, null, $exp_time); - } - - /** - * test to see if valid cache exists for this template - * - * @param string $tpl_file name of template file - * @param string $cache_id - * @param string $compile_id - * @return boolean - */ - public function is_cached($tpl_file, $cache_id = null, $compile_id = null) - { - return $this->isCached($tpl_file, $cache_id, $compile_id); - } - - /** - * clear all the assigned template variables. - */ - public function clear_all_assign() - { - $this->clearAllAssign(); - } - - /** - * clears compiled version of specified template resource, - * or all compiled template files if one is not specified. - * This function is for advanced use only, not normally needed. - * - * @param string $tpl_file - * @param string $compile_id - * @param string $exp_time - * @return boolean results of {@link smarty_core_rm_auto()} - */ - public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) - { - return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time); - } - - /** - * Checks whether requested template exists. - * - * @param string $tpl_file - * @return boolean - */ - public function template_exists($tpl_file) - { - return $this->templateExists($tpl_file); - } - - /** - * Returns an array containing template variables - * - * @param string $name - * @return array - */ - public function get_template_vars($name=null) - { - return $this->getTemplateVars($name); - } - - /** - * Returns an array containing config variables - * - * @param string $name - * @return array - */ - public function get_config_vars($name=null) - { - return $this->getConfigVars($name); - } - - /** - * load configuration values - * - * @param string $file - * @param string $section - * @param string $scope - */ - public function config_load($file, $section = null, $scope = 'global') - { - $this->ConfigLoad($file, $section, $scope); - } - - /** - * return a reference to a registered object - * - * @param string $name - * @return object - */ - public function get_registered_object($name) - { - return $this->getRegisteredObject($name); - } - - /** - * clear configuration values - * - * @param string $var - */ - public function clear_config($var = null) - { - $this->clearConfig($var); - } - - /** - * trigger Smarty error - * - * @param string $error_msg - * @param integer $error_type - */ - public function trigger_error($error_msg, $error_type = E_USER_WARNING) - { - trigger_error("Smarty error: $error_msg", $error_type); - } - -} - -/** - * Smarty {php}{/php} block function - * - * @param array $params parameter list - * @param string $content contents of the block - * @param object $template template object - * @param boolean &$repeat repeat flag - * @return string content re-formatted - */ -function smarty_php_tag($params, $content, $template, &$repeat) -{ - eval($content); - return ''; -} - -?> \ No newline at end of file + + * @author Uwe Tews + * @author Rodney Rehm + * @package Smarty + */ +/** + * @ignore + */ +require(dirname(__FILE__) . '/Smarty.class.php'); + +/** + * Smarty Backward Compatability Wrapper Class + * + * @package Smarty + */ +class SmartyBC extends Smarty +{ + /** + * Smarty 2 BC + * @var string + */ + public $_version = self::SMARTY_VERSION; + + /** + * Initialize new SmartyBC object + * + * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false ) + */ + public function __construct(array $options=array()) + { + parent::__construct($options); + // register {php} tag + $this->registerPlugin('block', 'php', 'smarty_php_tag'); + } + + /** + * wrapper for assign_by_ref + * + * @param string $tpl_var the template variable name + * @param mixed &$value the referenced value to assign + */ + public function assign_by_ref($tpl_var, &$value) + { + $this->assignByRef($tpl_var, $value); + } + + /** + * wrapper for append_by_ref + * + * @param string $tpl_var the template variable name + * @param mixed &$value the referenced value to append + * @param boolean $merge flag if array elements shall be merged + */ + public function append_by_ref($tpl_var, &$value, $merge = false) + { + $this->appendByRef($tpl_var, $value, $merge); + } + + /** + * clear the given assigned template variable. + * + * @param string $tpl_var the template variable to clear + */ + public function clear_assign($tpl_var) + { + $this->clearAssign($tpl_var); + } + + /** + * Registers custom function to be used in templates + * + * @param string $function the name of the template function + * @param string $function_impl the name of the PHP function to register + * @param bool $cacheable + * @param mixed $cache_attrs + */ + public function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null) + { + $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs); + } + + /** + * Unregisters custom function + * + * @param string $function name of template function + */ + public function unregister_function($function) + { + $this->unregisterPlugin('function', $function); + } + + /** + * Registers object to be used in templates + * + * @param string $object name of template object + * @param object $object_impl the referenced PHP object to register + * @param array $allowed list of allowed methods (empty = all) + * @param boolean $smarty_args smarty argument format, else traditional + * @param array $block_functs list of methods that are block format + */ + public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) + { + settype($allowed, 'array'); + settype($smarty_args, 'boolean'); + $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods); + } + + /** + * Unregisters object + * + * @param string $object name of template object + */ + public function unregister_object($object) + { + $this->unregisterObject($object); + } + + /** + * Registers block function to be used in templates + * + * @param string $block name of template block + * @param string $block_impl PHP function to register + * @param bool $cacheable + * @param mixed $cache_attrs + */ + public function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null) + { + $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs); + } + + /** + * Unregisters block function + * + * @param string $block name of template function + */ + public function unregister_block($block) + { + $this->unregisterPlugin('block', $block); + } + + /** + * Registers compiler function + * + * @param string $function name of template function + * @param string $function_impl name of PHP function to register + * @param bool $cacheable + */ + public function register_compiler_function($function, $function_impl, $cacheable=true) + { + $this->registerPlugin('compiler', $function, $function_impl, $cacheable); + } + + /** + * Unregisters compiler function + * + * @param string $function name of template function + */ + public function unregister_compiler_function($function) + { + $this->unregisterPlugin('compiler', $function); + } + + /** + * Registers modifier to be used in templates + * + * @param string $modifier name of template modifier + * @param string $modifier_impl name of PHP function to register + */ + public function register_modifier($modifier, $modifier_impl) + { + $this->registerPlugin('modifier', $modifier, $modifier_impl); + } + + /** + * Unregisters modifier + * + * @param string $modifier name of template modifier + */ + public function unregister_modifier($modifier) + { + $this->unregisterPlugin('modifier', $modifier); + } + + /** + * Registers a resource to fetch a template + * + * @param string $type name of resource + * @param array $functions array of functions to handle resource + */ + public function register_resource($type, $functions) + { + $this->registerResource($type, $functions); + } + + /** + * Unregisters a resource + * + * @param string $type name of resource + */ + public function unregister_resource($type) + { + $this->unregisterResource($type); + } + + /** + * Registers a prefilter function to apply + * to a template before compiling + * + * @param callable $function + */ + public function register_prefilter($function) + { + $this->registerFilter('pre', $function); + } + + /** + * Unregisters a prefilter function + * + * @param callable $function + */ + public function unregister_prefilter($function) + { + $this->unregisterFilter('pre', $function); + } + + /** + * Registers a postfilter function to apply + * to a compiled template after compilation + * + * @param callable $function + */ + public function register_postfilter($function) + { + $this->registerFilter('post', $function); + } + + /** + * Unregisters a postfilter function + * + * @param callable $function + */ + public function unregister_postfilter($function) + { + $this->unregisterFilter('post', $function); + } + + /** + * Registers an output filter function to apply + * to a template output + * + * @param callable $function + */ + public function register_outputfilter($function) + { + $this->registerFilter('output', $function); + } + + /** + * Unregisters an outputfilter function + * + * @param callable $function + */ + public function unregister_outputfilter($function) + { + $this->unregisterFilter('output', $function); + } + + /** + * load a filter of specified type and name + * + * @param string $type filter type + * @param string $name filter name + */ + public function load_filter($type, $name) + { + $this->loadFilter($type, $name); + } + + /** + * clear cached content for the given template and cache id + * + * @param string $tpl_file name of template file + * @param string $cache_id name of cache_id + * @param string $compile_id name of compile_id + * @param string $exp_time expiration time + * @return boolean + */ + public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) + { + return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time); + } + + /** + * clear the entire contents of cache (all templates) + * + * @param string $exp_time expire time + * @return boolean + */ + public function clear_all_cache($exp_time = null) + { + return $this->clearCache(null, null, null, $exp_time); + } + + /** + * test to see if valid cache exists for this template + * + * @param string $tpl_file name of template file + * @param string $cache_id + * @param string $compile_id + * @return boolean + */ + public function is_cached($tpl_file, $cache_id = null, $compile_id = null) + { + return $this->isCached($tpl_file, $cache_id, $compile_id); + } + + /** + * clear all the assigned template variables. + */ + public function clear_all_assign() + { + $this->clearAllAssign(); + } + + /** + * clears compiled version of specified template resource, + * or all compiled template files if one is not specified. + * This function is for advanced use only, not normally needed. + * + * @param string $tpl_file + * @param string $compile_id + * @param string $exp_time + * @return boolean results of {@link smarty_core_rm_auto()} + */ + public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) + { + return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time); + } + + /** + * Checks whether requested template exists. + * + * @param string $tpl_file + * @return boolean + */ + public function template_exists($tpl_file) + { + return $this->templateExists($tpl_file); + } + + /** + * Returns an array containing template variables + * + * @param string $name + * @return array + */ + public function get_template_vars($name=null) + { + return $this->getTemplateVars($name); + } + + /** + * Returns an array containing config variables + * + * @param string $name + * @return array + */ + public function get_config_vars($name=null) + { + return $this->getConfigVars($name); + } + + /** + * load configuration values + * + * @param string $file + * @param string $section + * @param string $scope + */ + public function config_load($file, $section = null, $scope = 'global') + { + $this->ConfigLoad($file, $section, $scope); + } + + /** + * return a reference to a registered object + * + * @param string $name + * @return object + */ + public function get_registered_object($name) + { + return $this->getRegisteredObject($name); + } + + /** + * clear configuration values + * + * @param string $var + */ + public function clear_config($var = null) + { + $this->clearConfig($var); + } + + /** + * trigger Smarty error + * + * @param string $error_msg + * @param integer $error_type + */ + public function trigger_error($error_msg, $error_type = E_USER_WARNING) + { + trigger_error("Smarty error: $error_msg", $error_type); + } + +} + +/** + * Smarty {php}{/php} block function + * + * @param array $params parameter list + * @param string $content contents of the block + * @param object $template template object + * @param boolean &$repeat repeat flag + * @return string content re-formatted + */ +function smarty_php_tag($params, $content, $template, &$repeat) +{ + eval($content); + + return ''; +} diff --git a/libs/plugins/block.textformat.php b/libs/plugins/block.textformat.php index b22b104a..b62a4f8e 100644 --- a/libs/plugins/block.textformat.php +++ b/libs/plugins/block.textformat.php @@ -53,17 +53,17 @@ function smarty_block_textformat($params, $content, $template, &$repeat) case 'indent_char': case 'wrap_char': case 'assign': - $$_key = (string)$_val; + $$_key = (string) $_val; break; case 'indent': case 'indent_first': case 'wrap': - $$_key = (int)$_val; + $$_key = (int) $_val; break; case 'wrap_cut': - $$_key = (bool)$_val; + $$_key = (bool) $_val; break; default: @@ -78,7 +78,6 @@ function smarty_block_textformat($params, $content, $template, &$repeat) $_paragraphs = preg_split('![\r\n]{2}!', $content); $_output = ''; - foreach ($_paragraphs as &$_paragraph) { if (!$_paragraph) { continue; @@ -102,12 +101,10 @@ function smarty_block_textformat($params, $content, $template, &$repeat) } } $_output = implode($wrap_char . $wrap_char, $_paragraphs); - + if ($assign) { $template->assign($assign, $_output); } else { return $_output; } } - -?> \ No newline at end of file diff --git a/libs/plugins/function.counter.php b/libs/plugins/function.counter.php index 3906badf..cd147634 100644 --- a/libs/plugins/function.counter.php +++ b/libs/plugins/function.counter.php @@ -35,7 +35,7 @@ function smarty_function_counter($params, $template) $counter =& $counters[$name]; if (isset($params['start'])) { - $counter['start'] = $counter['count'] = (int)$params['start']; + $counter['start'] = $counter['count'] = (int) $params['start']; } if (!empty($params['assign'])) { @@ -45,9 +45,9 @@ function smarty_function_counter($params, $template) if (isset($counter['assign'])) { $template->assign($counter['assign'], $counter['count']); } - + if (isset($params['print'])) { - $print = (bool)$params['print']; + $print = (bool) $params['print']; } else { $print = empty($counter['assign']); } @@ -61,7 +61,7 @@ function smarty_function_counter($params, $template) if (isset($params['skip'])) { $counter['skip'] = $params['skip']; } - + if (isset($params['direction'])) { $counter['direction'] = $params['direction']; } @@ -70,9 +70,7 @@ function smarty_function_counter($params, $template) $counter['count'] -= $counter['skip']; else $counter['count'] += $counter['skip']; - - return $retval; - -} -?> \ No newline at end of file + return $retval; + +} diff --git a/libs/plugins/function.cycle.php b/libs/plugins/function.cycle.php index 1778ffb5..9bf26f8c 100644 --- a/libs/plugins/function.cycle.php +++ b/libs/plugins/function.cycle.php @@ -48,13 +48,14 @@ function smarty_function_cycle($params, $template) static $cycle_vars; $name = (empty($params['name'])) ? 'default' : $params['name']; - $print = (isset($params['print'])) ? (bool)$params['print'] : true; - $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true; - $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false; + $print = (isset($params['print'])) ? (bool) $params['print'] : true; + $advance = (isset($params['advance'])) ? (bool) $params['advance'] : true; + $reset = (isset($params['reset'])) ? (bool) $params['reset'] : false; if (!isset($params['values'])) { - if(!isset($cycle_vars[$name]['values'])) { + if (!isset($cycle_vars[$name]['values'])) { trigger_error("cycle: missing 'values' parameter"); + return; } } else { @@ -71,13 +72,13 @@ function smarty_function_cycle($params, $template) $cycle_vars[$name]['delimiter'] = ','; } - if(is_array($cycle_vars[$name]['values'])) { + if (is_array($cycle_vars[$name]['values'])) { $cycle_array = $cycle_vars[$name]['values']; } else { $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); } - if(!isset($cycle_vars[$name]['index']) || $reset ) { + if (!isset($cycle_vars[$name]['index']) || $reset ) { $cycle_vars[$name]['index'] = 0; } @@ -86,13 +87,13 @@ function smarty_function_cycle($params, $template) $template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]); } - if($print) { + if ($print) { $retval = $cycle_array[$cycle_vars[$name]['index']]; } else { $retval = null; } - if($advance) { + if ($advance) { if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { $cycle_vars[$name]['index'] = 0; } else { @@ -102,5 +103,3 @@ function smarty_function_cycle($params, $template) return $retval; } - -?> \ No newline at end of file diff --git a/libs/plugins/function.fetch.php b/libs/plugins/function.fetch.php index eca1182d..a4eaef37 100644 --- a/libs/plugins/function.fetch.php +++ b/libs/plugins/function.fetch.php @@ -24,28 +24,29 @@ function smarty_function_fetch($params, $template) { if (empty($params['file'])) { trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE); + return; } - + // strip file protocol if (stripos($params['file'], 'file://') === 0) { $params['file'] = substr($params['file'], 7); } - + $protocol = strpos($params['file'], '://'); if ($protocol !== false) { $protocol = strtolower(substr($params['file'], 0, $protocol)); } - + if (isset($template->smarty->security_policy)) { if ($protocol) { // remote resource (or php stream, …) - if(!$template->smarty->security_policy->isTrustedUri($params['file'])) { + if (!$template->smarty->security_policy->isTrustedUri($params['file'])) { return; } } else { // local file - if(!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) { + if (!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) { return; } } @@ -54,7 +55,7 @@ function smarty_function_fetch($params, $template) $content = ''; if ($protocol == 'http') { // http fetch - if($uri_parts = parse_url($params['file'])) { + if ($uri_parts = parse_url($params['file'])) { // set defaults $host = $server_name = $uri_parts['host']; $timeout = 30; @@ -64,43 +65,44 @@ function smarty_function_fetch($params, $template) $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; $_is_proxy = false; - if(empty($uri_parts['port'])) { + if (empty($uri_parts['port'])) { $port = 80; } else { $port = $uri_parts['port']; } - if(!empty($uri_parts['user'])) { + if (!empty($uri_parts['user'])) { $user = $uri_parts['user']; } - if(!empty($uri_parts['pass'])) { + if (!empty($uri_parts['pass'])) { $pass = $uri_parts['pass']; } // loop through parameters, setup headers - foreach($params as $param_key => $param_value) { - switch($param_key) { + foreach ($params as $param_key => $param_value) { + switch ($param_key) { case "file": case "assign": case "assign_headers": break; case "user": - if(!empty($param_value)) { + if (!empty($param_value)) { $user = $param_value; } break; case "pass": - if(!empty($param_value)) { + if (!empty($param_value)) { $pass = $param_value; } break; case "accept": - if(!empty($param_value)) { + if (!empty($param_value)) { $accept = $param_value; } break; case "header": - if(!empty($param_value)) { - if(!preg_match('![\w\d-]+: .+!',$param_value)) { + if (!empty($param_value)) { + if (!preg_match('![\w\d-]+: .+!',$param_value)) { trigger_error("[plugin] invalid header format '".$param_value."'",E_USER_NOTICE); + return; } else { $extra_headers[] = $param_value; @@ -108,80 +110,84 @@ function smarty_function_fetch($params, $template) } break; case "proxy_host": - if(!empty($param_value)) { + if (!empty($param_value)) { $proxy_host = $param_value; } break; case "proxy_port": - if(!preg_match('!\D!', $param_value)) { + if (!preg_match('!\D!', $param_value)) { $proxy_port = (int) $param_value; } else { trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE); + return; } break; case "agent": - if(!empty($param_value)) { + if (!empty($param_value)) { $agent = $param_value; } break; case "referer": - if(!empty($param_value)) { + if (!empty($param_value)) { $referer = $param_value; } break; case "timeout": - if(!preg_match('!\D!', $param_value)) { + if (!preg_match('!\D!', $param_value)) { $timeout = (int) $param_value; } else { trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE); + return; } break; default: trigger_error("[plugin] unrecognized attribute '".$param_key."'",E_USER_NOTICE); + return; } } - if(!empty($proxy_host) && !empty($proxy_port)) { + if (!empty($proxy_host) && !empty($proxy_port)) { $_is_proxy = true; $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout); } else { $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout); } - if(!$fp) { + if (!$fp) { trigger_error("[plugin] unable to fetch: $errstr ($errno)",E_USER_NOTICE); + return; } else { - if($_is_proxy) { + if ($_is_proxy) { fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n"); } else { fputs($fp, "GET $uri HTTP/1.0\r\n"); } - if(!empty($host)) { + if (!empty($host)) { fputs($fp, "Host: $host\r\n"); } - if(!empty($accept)) { + if (!empty($accept)) { fputs($fp, "Accept: $accept\r\n"); } - if(!empty($agent)) { + if (!empty($agent)) { fputs($fp, "User-Agent: $agent\r\n"); } - if(!empty($referer)) { + if (!empty($referer)) { fputs($fp, "Referer: $referer\r\n"); } - if(isset($extra_headers) && is_array($extra_headers)) { - foreach($extra_headers as $curr_header) { + if (isset($extra_headers) && is_array($extra_headers)) { + foreach ($extra_headers as $curr_header) { fputs($fp, $curr_header."\r\n"); } } - if(!empty($user) && !empty($pass)) { + if (!empty($user) && !empty($pass)) { fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); } fputs($fp, "\r\n"); - while(!feof($fp)) { + while (!feof($fp)) { $content .= fgets($fp,4096); } fclose($fp); @@ -189,12 +195,13 @@ function smarty_function_fetch($params, $template) $content = $csplit[1]; - if(!empty($params['assign_headers'])) { + if (!empty($params['assign_headers'])) { $template->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0])); } } } else { trigger_error("[plugin fetch] unable to parse URL, check syntax",E_USER_NOTICE); + return; } } else { @@ -210,5 +217,3 @@ function smarty_function_fetch($params, $template) return $content; } } - -?> \ No newline at end of file diff --git a/libs/plugins/function.html_checkboxes.php b/libs/plugins/function.html_checkboxes.php index 1866bc2f..ad0e9cd4 100644 --- a/libs/plugins/function.html_checkboxes.php +++ b/libs/plugins/function.html_checkboxes.php @@ -58,8 +58,8 @@ function smarty_function_html_checkboxes($params, $template) $extra = ''; - foreach($params as $_key => $_val) { - switch($_key) { + foreach ($params as $_key => $_val) { + switch ($_key) { case 'name': case 'separator': $$_key = (string) $_val; @@ -134,7 +134,7 @@ function smarty_function_html_checkboxes($params, $template) // omit break; to fall through! default: - if(!is_array($_val)) { + if (!is_array($_val)) { $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; } else { trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); @@ -159,7 +159,7 @@ function smarty_function_html_checkboxes($params, $template) } } - if(!empty($params['assign'])) { + if (!empty($params['assign'])) { $template->assign($params['assign'], $_html_result); } else { return implode("\n", $_html_result); @@ -167,52 +167,55 @@ function smarty_function_html_checkboxes($params, $template) } -function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true) { +function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true) +{ $_output = ''; - + if (is_object($value)) { if (method_exists($value, "__toString")) { $value = (string) $value->__toString(); } else { trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE); + return ''; } } else { $value = (string) $value; } - + if (is_object($output)) { if (method_exists($output, "__toString")) { $output = (string) $output->__toString(); } else { trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE); + return ''; } } else { $output = (string) $output; } - + if ($labels) { if ($label_ids) { $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value)); $_output .= '