Skip to content

Commit

Permalink
- reformating for PSR-2 coding standards #483
Browse files Browse the repository at this point in the history
  • Loading branch information
uwetews committed Aug 31, 2018
1 parent 4f7cd8f commit 7b64226
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lexer/smarty_internal_templateparser.y
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class Smarty_Internal_Templateparser
}
%include_class
{
const Err1 = 'Security error: Call to private object member not allowed';
const Err2 = 'Security error: Call to dynamic object member not allowed';
const Err3 = 'PHP in template not allowed. Use SmartyBC to enable it';
const ERR1 = 'Security error: Call to private object member not allowed';
const ERR2 = 'Security error: Call to dynamic object member not allowed';
const ERR3 = 'PHP in template not allowed. Use SmartyBC to enable it';

/**
* result status
Expand Down Expand Up @@ -329,10 +329,10 @@ smartytag(A) ::= SMARTYBLOCKCHILDPARENT(i). {
$j = strrpos(i,'.');
if (i[$j+1] == 'c') {
// {$smarty.block.child}
A = $this->compiler->compileTag('child',array(),array(i));;
A = $this->compiler->compileTag('child',array(),array(i));
} else {
// {$smarty.block.parent}
A = $this->compiler->compileTag('parent',array(),array(i));;
A = $this->compiler->compileTag('parent',array(),array(i));
}
}

Expand Down Expand Up @@ -922,7 +922,7 @@ indexdef(res) ::= OPENB INTEGER(n) CLOSEB. {
res = '['.n.']';
}
indexdef(res) ::= OPENB DOLLARID(i) CLOSEB. {
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';;
res = '['.$this->compiler->compileVariable('\''.substr(i,1).'\'').']';
}
indexdef(res) ::= OPENB variable(v) CLOSEB. {
res = '['.v.']';
Expand Down Expand Up @@ -998,28 +998,28 @@ objectchain(res) ::= objectchain(oc) objectelement(oe). {
// variable
objectelement(res)::= PTR ID(i) arrayindex(a). {
if ($this->security && substr(i,0,1) === '_') {
$this->compiler->trigger_template_error (self::Err1);
$this->compiler->trigger_template_error (self::ERR1);
}
res = '->'.i.a;
}

objectelement(res)::= PTR varvar(v) arrayindex(a). {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
res = '->{'.$this->compiler->compileVariable(v).a.'}';
}

objectelement(res)::= PTR LDEL expr(e) RDEL arrayindex(a). {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
res = '->{'.e.a.'}';
}

objectelement(res)::= PTR ID(ii) LDEL expr(e) RDEL arrayindex(a). {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
res = '->{\''.ii.'\'.'.e.a.'}';
}
Expand All @@ -1043,14 +1043,14 @@ function(res) ::= ns1(f) OPENP params(p) CLOSEP. {
//
method(res) ::= ID(f) OPENP params(p) CLOSEP. {
if ($this->security && substr(f,0,1) === '_') {
$this->compiler->trigger_template_error (self::Err1);
$this->compiler->trigger_template_error (self::ERR1);
}
res = f . '('. implode(',',p) .')';
}

method(res) ::= DOLLARID(f) OPENP params(p) CLOSEP. {
if ($this->security) {
$this->compiler->trigger_template_error (self::Err2);
$this->compiler->trigger_template_error (self::ERR2);
}
$prefixVar = $this->compiler->getNewPrefixVariable();
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ".$this->compiler->compileVariable('\''.substr(f,1).'\'').';?>');
Expand Down

0 comments on commit 7b64226

Please sign in to comment.