PK BJs libs/Autoloader.phpnu W+A 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',);
/**
* Registers Smarty_Autoloader backward compatible to older installations.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function registerBC($prepend = false)
{
/**
* register the class autoloader
*/
if (!defined('SMARTY_SPL_AUTOLOAD')) {
define('SMARTY_SPL_AUTOLOAD', 0);
}
if (SMARTY_SPL_AUTOLOAD &&
set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
) {
$registeredAutoLoadFunctions = spl_autoload_functions();
if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
spl_autoload_register();
}
} else {
self::register($prepend);
}
}
/**
* Registers Smarty_Autoloader as an SPL autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not.
*/
public static function register($prepend = false)
{
self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR;
self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR :
self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR;
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
} else {
spl_autoload_register(array(__CLASS__, 'autoload'));
}
}
/**
* Handles auto loading of classes.
*
* @param string $class A class name.
*/
public static function autoload($class)
{
if ($class[ 0 ] !== 'S' && strpos($class, 'Smarty') !== 0) {
return;
}
$_class = strtolower($class);
if (isset(self::$rootClasses[ $_class ])) {
$file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
if (is_file($file)) {
include $file;
}
} else {
$file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
if (is_file($file)) {
include $file;
}
}
return;
}
}
PK BJh>JI > libs/sysplugins/smarty_internal_method_getdefaultmodifiers.phpnu W+A _getSmartyObj();
return $smarty->default_modifiers;
}
}PK BJ3B7R 6 libs/sysplugins/smarty_internal_parsetree_template.phpnu W+A subtrees)) {
$this->subtrees = array_merge($this->subtrees, $subtree->subtrees);
} else {
if ($subtree->data !== '') {
$this->subtrees[] = $subtree;
}
}
}
/**
* Append array to subtree
*
* @param \Smarty_Internal_Templateparser $parser
* @param \Smarty_Internal_ParseTree[] $array
*/
public function append_array(Smarty_Internal_Templateparser $parser, $array = array())
{
if (!empty($array)) {
$this->subtrees = array_merge($this->subtrees, (array) $array);
}
}
/**
* Prepend array to subtree
*
* @param \Smarty_Internal_Templateparser $parser
* @param \Smarty_Internal_ParseTree[] $array
*/
public function prepend_array(Smarty_Internal_Templateparser $parser, $array = array())
{
if (!empty($array)) {
$this->subtrees = array_merge((array) $array, $this->subtrees);
}
}
/**
* Sanitize and merge subtree buffers together
*
* @param \Smarty_Internal_Templateparser $parser
*
* @return string template code content
*/
public function to_smarty_php(Smarty_Internal_Templateparser $parser)
{
$code = '';
for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key ++) {
if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
$subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Text ||
$this->subtrees[ $key + 1 ]->data == '')) {
$key ++;
if ($this->subtrees[ $key ]->data == '') {
continue;
}
$subtree .= $this->subtrees[ $key ]->to_smarty_php($parser);
}
if ($subtree == '') {
continue;
}
$code .= preg_replace('/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', "\n",
$subtree);
continue;
}
if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
$subtree = $this->subtrees[ $key ]->to_smarty_php($parser);
while ($key + 1 < $cnt && ($this->subtrees[ $key + 1 ] instanceof Smarty_Internal_ParseTree_Tag ||
$this->subtrees[ $key + 1 ]->data == '')) {
$key ++;
if ($this->subtrees[ $key ]->data == '') {
continue;
}
$subtree = $parser->compiler->appendCode($subtree, $this->subtrees[ $key ]->to_smarty_php($parser));
}
if ($subtree == '') {
continue;
}
$code .= $subtree;
continue;
}
$code .= $this->subtrees[ $key ]->to_smarty_php($parser);
}
return $code;
}
}
PK BJV,\< < = libs/sysplugins/smarty_internal_method_addautoloadfilters.phpnu W+A _getSmartyObj();
if ($type !== null) {
$this->_checkFilterType($type);
if (!empty($smarty->autoload_filters[ $type ])) {
$smarty->autoload_filters[ $type ] = array_merge($smarty->autoload_filters[ $type ], (array) $filters);
} else {
$smarty->autoload_filters[ $type ] = (array) $filters;
}
} else {
foreach ((array) $filters as $type => $value) {
$this->_checkFilterType($type);
if (!empty($smarty->autoload_filters[ $type ])) {
$smarty->autoload_filters[ $type ] =
array_merge($smarty->autoload_filters[ $type ], (array) $value);
} else {
$smarty->autoload_filters[ $type ] = (array) $value;
}
}
}
return $obj;
}
}PK BJȠ
1 libs/sysplugins/smarty_internal_compile_while.phpnu W+A loopNesting ++;
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$this->openTag($compiler, 'while', $compiler->nocache);
if (!array_key_exists("if condition", $parameter)) {
$compiler->trigger_template_error("missing while condition", null, true);
}
// maybe nocache because of nocache variables
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
if (is_array($parameter[ 'if condition' ])) {
if ($compiler->nocache) {
// create nocache var to make it know for further compiling
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
$var = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
} else {
$var = $parameter[ 'if condition' ][ 'var' ];
}
$compiler->setNocacheInVariable($var);
}
$prefixVar = $compiler->getNewPrefixVariable();
$assignCompiler = new Smarty_Internal_Compile_Assign();
$assignAttr = array();
$assignAttr[][ 'value' ] = "{$prefixVar}";
if (is_array($parameter[ 'if condition' ][ 'var' ])) {
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ][ 'var' ];
$_output = "";
$_output .= $assignCompiler->compile($assignAttr, $compiler,
array('smarty_internal_index' => $parameter[ 'if condition' ][ 'var' ][ 'smarty_internal_index' ]));
} else {
$assignAttr[][ 'var' ] = $parameter[ 'if condition' ][ 'var' ];
$_output = "";
$_output .= $assignCompiler->compile($assignAttr, $compiler, array());
}
return $_output;
} else {
return "";
}
}
}
/**
* Smarty Internal Plugin Compile Whileclose Class
*
* @package Smarty
* @subpackage Compiler
*/
class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase
{
/**
* Compiles code for the {/while} tag
*
* @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
*
* @return string compiled code
*/
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
$compiler->loopNesting --;
// must endblock be nocache?
if ($compiler->nocache) {
$compiler->tag_nocache = true;
}
$compiler->nocache = $this->closeTag($compiler, array('while'));
return "\n";
}
}
PK BJc * libs/sysplugins/smarty_resource_custom.phpnu W+A filepath = $source->type . ':' . substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25);
$source->uid = sha1($source->type . ':' . $source->name);
$mtime = $this->fetchTimestamp($source->name);
if ($mtime !== null) {
$source->timestamp = $mtime;
} else {
$this->fetch($source->name, $content, $timestamp);
$source->timestamp = isset($timestamp) ? $timestamp : false;
if (isset($content)) {
$source->content = $content;
}
}
$source->exists = !!$source->timestamp;
}
/**
* Load template's source into current template object
*
* @param Smarty_Template_Source $source source object
*
* @return string template source
* @throws SmartyException if source cannot be loaded
*/
public function getContent(Smarty_Template_Source $source)
{
$this->fetch($source->name, $content, $timestamp);
if (isset($content)) {
return $content;
}
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
/**
* Determine basename for compiled filename
*
* @param Smarty_Template_Source $source source object
*
* @return string resource's basename
*/
public function getBasename(Smarty_Template_Source $source)
{
return basename(substr(preg_replace('/[^A-Za-z0-9.]/','',$source->name),0,25));
}
}
PK BJ 5 libs/sysplugins/smarty_internal_method_loadfilter.phpnu W+A true, 'post' => true, 'output' => true, 'variable' => true);
/**
* load a filter of specified type and name
*
* @api Smarty::loadFilter()
*
* @link http://www.smarty.net/docs/en/api.load.filter.tpl
*
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type filter type
* @param string $name filter name
*
* @return bool
* @throws SmartyException if filter could not be loaded
*/
public function loadFilter(Smarty_Internal_TemplateBase $obj, $type, $name)
{
$smarty = $obj->_getSmartyObj();
$this->_checkFilterType($type);
$_plugin = "smarty_{$type}filter_{$name}";
$_filter_name = $_plugin;
if (is_callable($_plugin)) {
$smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin;
return true;
}
if ($smarty->loadPlugin($_plugin)) {
if (class_exists($_plugin, false)) {
$_plugin = array($_plugin, 'execute');
}
if (is_callable($_plugin)) {
$smarty->registered_filters[ $type ][ $_filter_name ] = $_plugin;
return true;
}
}
throw new SmartyException("{$type}filter \"{$name}\" not found or callable");
}
/**
* Check if filter type is valid
*
* @param string $type
*
* @throws \SmartyException
*/
public function _checkFilterType($type)
{
if (!isset($this->filterTypes[ $type ])) {
throw new SmartyException("Illegal filter type \"{$type}\"");
}
}
}PK BJ ; libs/sysplugins/smarty_internal_method_unregisterfilter.phpnu W+A _getSmartyObj();
$this->_checkFilterType($type);
if (isset($smarty->registered_filters[ $type ])) {
$name = is_string($callback) ? $callback : $this->_getFilterName($callback);
if (isset($smarty->registered_filters[ $type ][ $name ])) {
unset($smarty->registered_filters[ $type ][ $name ]);
if (empty($smarty->registered_filters[ $type ])) {
unset($smarty->registered_filters[ $type ]);
}
}
}
return $obj;
}
}PK BJÙ libs/sysplugins/smarty_data.phpnu W+A dataObjectName = 'Data_object ' . (isset($name) ? "'{$name}'" : self::$count);
$this->smarty = $smarty;
if (is_object($_parent)) {
// when object set up back pointer
$this->parent = $_parent;
} elseif (is_array($_parent)) {
// set up variable values
foreach ($_parent as $_key => $_val) {
$this->tpl_vars[ $_key ] = new Smarty_Variable($_val);
}
} elseif ($_parent != null) {
throw new SmartyException("Wrong type for template variables");
}
}
}
PK BJk 5 libs/sysplugins/smarty_internal_method_clearcache.phpnu W+A _clearTemplateCache();
// load cache resource and call clear
$_cache_resource = Smarty_CacheResource::load($smarty, $type);
return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
}
}PK BJ0#> D libs/sysplugins/smarty_internal_compile_private_registered_block.phpnu W+A smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) {
$tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
$callback = $tag_info[ 0 ];
if (is_array($callback)) {
if (is_object($callback[ 0 ])) {
$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
$callback =
array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
} else {
$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
$callback =
array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
}
} else {
$callable = "\$_block_plugin{$this->nesting}";
$callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", '');
}
} else {
$tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
$callback = $tag_info[ 0 ];
if (is_array($callback)) {
$callable = "array('{$callback[0]}', '{$callback[1]}')";
$callback = "{$callback[1]}::{$callback[1]}";
} else {
$callable = null;
}
}
$compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache;
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
$_value = str_replace("'", "^#^", $_value);
$_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
} else {
$_paramsArray[] = "'$_key'=>$_value";
}
}
return array($callback, $_paramsArray, $callable);
}
}
PK BJpf 2 libs/sysplugins/smarty_internal_nocache_insert.phpnu W+A assign('{$_assign}' , {$_function} (" . var_export($_attr, true) .
",\$_smarty_tpl), true);?>";
} else {
$_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
}
$_tpl = $_template;
while ($_tpl->_isSubTpl()) {
$_tpl = $_tpl->parent;
}
return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output .
"/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";
}
}
PK BJ#Y\ > libs/sysplugins/smarty_internal_method_compilealltemplates.phpnu W+A compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
}
/**
* Compile all template or config files
*
* @param \Smarty $smarty
* @param string $extension template file name extension
* @param bool $force_compile force all to recompile
* @param int $time_limit set maximum execution time
* @param int $max_errors set maximum allowed errors
* @param bool $isConfig flag true if called for config files
*
* @return int number of template files compiled
*/
protected function compileAll(Smarty $smarty, $extension, $force_compile, $time_limit, $max_errors,
$isConfig = false)
{
// switch off time limit
if (function_exists('set_time_limit')) {
@set_time_limit($time_limit);
}
$_count = 0;
$_error_count = 0;
$sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
// loop over array of source directories
foreach ($sourceDir as $_dir) {
$_dir_1 = new RecursiveDirectoryIterator($_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ?
FilesystemIterator::FOLLOW_SYMLINKS : 0);
$_dir_2 = new RecursiveIteratorIterator($_dir_1);
foreach ($_dir_2 as $_fileinfo) {
$_file = $_fileinfo->getFilename();
if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
continue;
}
if (!substr_compare($_file, $extension, - strlen($extension)) == 0) {
continue;
}
if ($_fileinfo->getPath() !== substr($_dir, 0, - 1)) {
$_file = substr($_fileinfo->getPath(), strlen($_dir)) . $smarty->ds . $_file;
}
echo "\n
", $_dir, '---', $_file;
flush();
$_start_time = microtime(true);
$_smarty = clone $smarty;
//
$_smarty->_cache = array();
$_smarty->ext = new Smarty_Internal_Extension_Handler();
$_smarty->ext->objType = $_smarty->_objType;
$_smarty->force_compile = $force_compile;
try {
/* @var Smarty_Internal_Template $_tpl */
$_tpl = new $smarty->template_class($_file, $_smarty);
$_tpl->caching = Smarty::CACHING_OFF;
$_tpl->source =
$isConfig ? Smarty_Template_Config::load($_tpl) : Smarty_Template_Source::load($_tpl);
if ($_tpl->mustCompile()) {
$_tpl->compileTemplateSource();
$_count ++;
echo ' compiled in ', microtime(true) - $_start_time, ' seconds';
flush();
} else {
echo ' is up to date';
flush();
}
}
catch (Exception $e) {
echo "\n
------>Error: ", $e->getMessage(), "
\n";
$_error_count ++;
}
// free memory
unset($_tpl);
$_smarty->_clearTemplateCache();
if ($max_errors !== null && $_error_count == $max_errors) {
echo "\n
too many errors\n";
exit();
}
}
}
echo "\n
";
return $_count;
}
}PK BJޡ\ \ 1 libs/sysplugins/smarty_internal_templatelexer.phpnu W+A
*/
class Smarty_Internal_Templatelexer
{
/**
* Source
*
* @var string
*/
public $data;
/**
* Source length
*
* @var int
*/
public $dataLength = null;
/**
* byte counter
*
* @var int
*/
public $counter;
/**
* token number
*
* @var int
*/
public $token;
/**
* token value
*
* @var string
*/
public $value;
/**
* current line
*
* @var int
*/
public $line;
/**
* tag start line
*
* @var
*/
public $taglineno;
/**
* php code type
*
* @var string
*/
public $phpType = '';
/**
* escaped left delimiter
*
* @var string
*/
public $ldel = '';
/**
* escaped left delimiter length
*
* @var int
*/
public $ldel_length = 0;
/**
* escaped right delimiter
*
* @var string
*/
public $rdel = '';
/**
* escaped right delimiter length
*
* @var int
*/
public $rdel_length = 0;
/**
* state number
*
* @var int
*/
public $state = 1;
/**
* Smarty object
*
* @var Smarty
*/
public $smarty = null;
/**
* compiler object
*
* @var Smarty_Internal_TemplateCompilerBase
*/
public $compiler = null;
/**
* literal tag nesting level
*
* @var int
*/
private $literal_cnt = 0;
/**
* PHP start tag string
*
* @var string
*/
/**
* trace file
*
* @var resource
*/
public $yyTraceFILE;
/**
* trace prompt
*
* @var string
*/
public $yyTracePrompt;
/**
* XML flag true while processing xml
*
* @var bool
*/
public $is_xml = false;
/**
* state names
*
* @var array
*/
public $state_name = array(1 => 'TEXT', 2 => 'TAG', 3 => 'TAGBODY', 4 => 'LITERAL', 5 => 'DOUBLEQUOTEDSTRING',);
/**
* storage for assembled token patterns
*
* @var string
*/
private $yy_global_pattern1 = null;
private $yy_global_pattern2 = null;
private $yy_global_pattern3 = null;
private $yy_global_pattern4 = null;
private $yy_global_pattern5 = null;
/**
* token names
*
* @var array
*/
public $smarty_token_names = array( // Text for parser error messages
'NOT' => '(!,not)',
'OPENP' => '(',
'CLOSEP' => ')',
'OPENB' => '[',
'CLOSEB' => ']',
'PTR' => '->',
'APTR' => '=>',
'EQUAL' => '=',
'NUMBER' => 'number',
'UNIMATH' => '+" , "-',
'MATH' => '*" , "/" , "%',
'INCDEC' => '++" , "--',
'SPACE' => ' ',
'DOLLAR' => '$',
'SEMICOLON' => ';',
'COLON' => ':',
'DOUBLECOLON' => '::',
'AT' => '@',
'HATCH' => '#',
'QUOTE' => '"',
'BACKTICK' => '`',
'VERT' => '"|" modifier',
'DOT' => '.',
'COMMA' => '","',
'QMARK' => '"?"',
'ID' => 'id, name',
'TEXT' => 'text',
'LDELSLASH' => '{/..} closing tag',
'LDEL' => '{...} Smarty tag',
'COMMENT' => 'comment',
'AS' => 'as',
'TO' => 'to',
'PHP' => '" '"<", "==" ... logical operator',
'TLOGOP' => '"lt", "eq" ... logical operator; "is div by" ... if condition',
'SCOND' => '"is even" ... if condition',
);
/**
* constructor
*
* @param string $data template source
* @param Smarty_Internal_TemplateCompilerBase $compiler
*/
function __construct($data, Smarty_Internal_TemplateCompilerBase $compiler)
{
$this->data = $data;
$this->dataLength = strlen($data);
$this->counter = 0;
if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
$this->counter += strlen($match[0]);
}
$this->line = 1;
$this->smarty = $compiler->smarty;
$this->compiler = $compiler;
$this->ldel = preg_quote($this->smarty->left_delimiter, '/');
$this->ldel_length = strlen($this->smarty->left_delimiter);
$this->rdel = preg_quote($this->smarty->right_delimiter, '/');
$this->rdel_length = strlen($this->smarty->right_delimiter);
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
}
public function PrintTrace()
{
$this->yyTraceFILE = fopen('php://output', 'w');
$this->yyTracePrompt = '
';
}
/*
* Check if this tag is autoliteral
*/
public function isAutoLiteral()
{
return $this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false;
}
private $_yy_state = 1;
private $_yy_stack = array();
public function yylex()
{
return $this->{'yylex' . $this->_yy_state}();
}
public function yypushstate($state)
{
if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
}
array_push($this->_yy_stack, $this->_yy_state);
$this->_yy_state = $state;
if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
}
}
public function yypopstate()
{
if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
}
$this->_yy_state = array_pop($this->_yy_stack);
if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
}
}
public function yybegin($state)
{
$this->_yy_state = $state;
if ($this->yyTraceFILE) {
fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
}
}
public function yylex1()
{
if (!isset($this->yy_global_pattern1)) {
$this->yy_global_pattern1 = "/\G([{][}])|\G(" . $this->ldel . "[*])|\G((" . $this->ldel . "\\s*php([ ].*?)?" . $this->rdel . ")|(" . $this->ldel . "\\s*[\/]php" . $this->rdel . "))|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*)|\G(\\s*" . $this->rdel . ")|\G((<[?]((php\\s+|=)|\\s+))|(<[%])|(<[?]xml\\s+)|(]*>)|(]*>)|(
]*>.*?]*>)#is', $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { foreach ($matches as $match) { $store[] = $match[ 0 ][ 0 ]; $_length = strlen($match[ 0 ][ 0 ]); $replace = '@!@SMARTY:' . $_store . ':SMARTY@!@'; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] - $_offset, $_length); $_offset += $_length - strlen($replace); ++ $_store; } } $expressions = array(// replace multiple spaces between tags by a single space '#(:SMARTY@!@|>)[\040\011]+(?=@!@SMARTY:|<)#s' => '\1 \2', // remove newline between tags '#(:SMARTY@!@|>)[\040\011]*[\n]\s*(?=@!@SMARTY:|<)#s' => '\1\2', // remove multiple spaces between attributes (but not in attribute values!) '#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5', '#>[\040\011]+$#Ss' => '> ', '#>[\040\011]*[\n]\s*$#Ss' => '>', $this->stripRegEx => '',); $text = preg_replace(array_keys($expressions), array_values($expressions), $text); $_offset = 0; if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $text, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { foreach ($matches as $match) { $_length = strlen($match[ 0 ][ 0 ]); $replace = $store[ $match[ 1 ][ 0 ] ]; $text = substr_replace($text, $replace, $match[ 0 ][ 1 ] + $_offset, $_length); $_offset += strlen($replace) - $_length; ++ $_store; } } } else { $text = preg_replace($this->stripRegEx, '', $text); } } return new Smarty_Internal_ParseTree_Text($text); } return null; } /** * lazy loads internal compile plugin for tag and calls the compile method * compile objects cached for reuse. * class name format: Smarty_Internal_Compile_TagName * plugin filename format: Smarty_Internal_TagName.php * * @param string $tag tag name * @param array $args list of tag attributes * @param mixed $param1 optional parameter * @param mixed $param2 optional parameter * @param mixed $param3 optional parameter * * @return string|bool compiled code or false */ public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null) { /* @var Smarty_Internal_CompileBase $tagCompiler */ $tagCompiler = $this->getTagCompiler($tag); // compile this tag return $tagCompiler === false ? false : $tagCompiler->compile($args, $this, $param1, $param2, $param3); } /** * lazy loads internal compile plugin for tag compile objects cached for reuse. * * class name format: Smarty_Internal_Compile_TagName * plugin filename format: Smarty_Internal_TagName.php * * @param string $tag tag name * * @return Smarty_Internal_CompileBase|bool tag compiler object or false if not found */ public function getTagCompiler($tag) { // re-use object if already exists if (!isset(self::$_tag_objects[ $tag ])) { // lazy load internal compiler plugin $_tag = explode('_', $tag); $_tag = array_map('ucfirst', $_tag); $class_name = 'Smarty_Internal_Compile_' . implode('_', $_tag); if (class_exists($class_name) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) ) { self::$_tag_objects[ $tag ] = new $class_name; } else { self::$_tag_objects[ $tag ] = false; } } return self::$_tag_objects[ $tag ]; } /** * Check for plugins and return function name * * @param $plugin_name * @param string $plugin_type type of plugin * * @return string call name of function */ public function getPlugin($plugin_name, $plugin_type) { $function = null; if ($this->template->caching && ($this->nocache || $this->tag_nocache)) { if (isset($this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { $function = $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } elseif (isset($this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ] = $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ]; $function = $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } } else { if (isset($this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ])) { $function = $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } elseif (isset($this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ])) { $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ] = $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ]; $function = $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ]; } } if (isset($function)) { if ($plugin_type === 'modifier') { $this->modifier_plugins[ $plugin_name ] = true; } return $function; } // loop through plugin dirs and find the plugin $function = 'smarty_' . $plugin_type . '_' . $plugin_name; $file = $this->smarty->loadPlugin($function, false); if (is_string($file)) { if ($this->template->caching && ($this->nocache || $this->tag_nocache)) { $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'file' ] = $file; $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ $plugin_type ][ 'function' ] = $function; } else { $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'file' ] = $file; $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ $plugin_type ][ 'function' ] = $function; } if ($plugin_type === 'modifier') { $this->modifier_plugins[ $plugin_name ] = true; } return $function; } if (is_callable($function)) { // plugin function is defined in the script return $function; } return false; } /** * Check for plugins by default plugin handler * * @param string $tag name of tag * @param string $plugin_type type of plugin * * @return boolean true if found */ public function getPluginFromDefaultHandler($tag, $plugin_type) { $callback = null; $script = null; $cacheable = true; $result = call_user_func_array($this->smarty->default_plugin_handler_func, array($tag, $plugin_type, $this->template, &$callback, &$script, &$cacheable,)); if ($result) { $this->tag_nocache = $this->tag_nocache || !$cacheable; if ($script !== null) { if (is_file($script)) { if ($this->template->caching && ($this->nocache || $this->tag_nocache)) { $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'file' ] = $script; $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } else { $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'file' ] = $script; $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $tag ][ $plugin_type ][ 'function' ] = $callback; } require_once $script; } else { $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found"); } } if (is_callable($callback)) { $this->default_handler_plugins[ $plugin_type ][ $tag ] = array($callback, true, array()); return true; } else { $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable"); } } return false; } /** * Append code segments and remove unneeded ?> \s*$/', $left) && preg_match('/^\s*<\?php\s+/', $right)) { $left = preg_replace('/\s*\?>\s*$/', "\n", $left); $left .= preg_replace('/^\s*<\?php\s+/', '', $right); } else { $left .= $right; } return $left; } /** * Inject inline code for nocache template sections * This method gets the content of each template element from the parser. * If the content is compiled code and it should be not cached the code is injected * into the rendered output. * * @param string $content content of template element * @param boolean $is_code true if content is compiled code * * @return string content */ public function processNocacheCode($content, $is_code) { // If the template is not evaluated and we have a nocache section and or a nocache tag if ($is_code && !empty($content)) { // generate replacement code if ((!($this->template->source->handler->recompiled) || $this->forceNocache) && $this->template->caching && !$this->suppressNocacheProcessing && ($this->nocache || $this->tag_nocache) ) { $this->template->compiled->has_nocache_code = true; $_output = addcslashes($content, '\'\\'); $_output = str_replace("^#^", "'", $_output); $_output = "nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n"; // make sure we include modifier plugins for nocache code foreach ($this->modifier_plugins as $plugin_name => $dummy) { if (isset($this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ])) { $this->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $plugin_name ][ 'modifier' ] = $this->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin_name ][ 'modifier' ]; } } } else { $_output = $content; } } else { $_output = $content; } $this->modifier_plugins = array(); $this->suppressNocacheProcessing = false; $this->tag_nocache = false; return $_output; } /** * Get Id * * @param string $input * * @return bool|string */ public function getId($input) { if (preg_match('~^([\'"]*)([0-9]*[a-zA-Z_]\w*)\1$~', $input, $match)) { return $match[ 2 ]; } return false; } /** * Get variable name from string * * @param string $input * * @return bool|string */ public function getVariableName($input) { if (preg_match('~^[$]_smarty_tpl->tpl_vars\[[\'"]*([0-9]*[a-zA-Z_]\w*)[\'"]*\]->value$~', $input, $match)) { return $match[ 1 ]; } return false; } /** * Set nocache flag in variable or create new variable * * @param string $varName */ public function setNocacheInVariable($varName) { // create nocache var to make it know for further compiling if ($_var = $this->getId($varName)) { if (isset($this->template->tpl_vars[ $_var ])) { $this->template->tpl_vars[ $_var ] = clone $this->template->tpl_vars[ $_var ]; $this->template->tpl_vars[ $_var ]->nocache = true; } else { $this->template->tpl_vars[ $_var ] = new Smarty_Variable(null, true); } } } /** * @param array $_attr tag attributes * @param array $validScopes * * @return int|string * @throws \SmartyCompilerException */ public function convertScope($_attr, $validScopes) { $_scope = 0; if (isset($_attr[ 'scope' ])) { $_scopeName = trim($_attr[ 'scope' ], "'\""); if (is_numeric($_scopeName) && in_array($_scopeName, $validScopes)) { $_scope = $_scopeName; } elseif (is_string($_scopeName)) { $_scopeName = trim($_scopeName, "'\""); $_scope = isset($validScopes[ $_scopeName ]) ? $validScopes[ $_scopeName ] : false; } else { $_scope = false; } if ($_scope === false) { $err = var_export($_scopeName, true); $this->trigger_template_error("illegal value '{$err}' for \"scope\" attribute", null, true); } } return $_scope; } /** * Generate nocache code string * * @param string $code PHP code * * @return string */ public function makeNocacheCode($code) { return "echo '/*%%SmartyNocache:{$this->nocache_hash}%%*//*/%%SmartyNocache:{$this->nocache_hash}%%*/';\n"; } /** * display compiler error messages without dying * If parameter $args is empty it is a parser detected syntax error. * In this case the parser is called to obtain information about expected tokens. * If parameter $args contains a string this is used as error message * * @param string $args individual error message or null * @param string $line line-number * @param null|bool $tagline if true the line number of last tag * * @throws \SmartyCompilerException when an unexpected token is found */ public function trigger_template_error($args = null, $line = null, $tagline = null) { $lex = $this->parser->lex; if ($tagline === true) { // get line number of Tag $line = $lex->taglineno; } elseif (!isset($line)) { // get template source line which has error $line = $lex->line; } else { $line = (int) $line; } if (in_array($this->template->source->type, array('eval', 'string'))) { $templateName = $this->template->source->type . ':' . trim(preg_replace('![\t\r\n]+!', ' ', strlen($lex->data) > 40 ? substr($lex->data, 0, 40) . '...' : $lex->data)); } else { $templateName = $this->template->source->type . ':' . $this->template->source->filepath; } // $line += $this->trace_line_offset; $match = preg_split("/\n/", $lex->data); $error_text = 'Syntax error in template "' . (empty($this->trace_filepath) ? $templateName : $this->trace_filepath) . '" on line ' . ($line + $this->trace_line_offset) . ' "' . trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ])) . '" '; if (isset($args)) { // individual error message $error_text .= $args; } else { $expect = array(); // expected token from parser $error_text .= ' - Unexpected "' . $lex->value . '"'; if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4) { foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) { $exp_token = $this->parser->yyTokenName[ $token ]; if (isset($lex->smarty_token_names[ $exp_token ])) { // token type from lexer $expect[] = '"' . $lex->smarty_token_names[ $exp_token ] . '"'; } else { // otherwise internal token name $expect[] = $this->parser->yyTokenName[ $token ]; } } $error_text .= ', expected one of: ' . implode(' , ', $expect); } } $e = new SmartyCompilerException($error_text); $e->line = $line; $e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[ $line - 1 ])); $e->desc = $args; $e->template = $this->template->source->filepath; throw $e; } /** * Return var_export() value with all white spaces removed * * @param mixed $value * * @return string */ public function getVarExport($value) { return preg_replace('/\s/', '', var_export($value, true)); } /** * Check if $value contains variable elements * * @param mixed $value * * @return bool|int */ public function isVariable($value) { if (is_string($value)) { return preg_match('/[$(]/', $value); } if (is_bool($value) || is_numeric($value)) { return false; } if (is_array($value)) { foreach ($value as $k => $v) { if ($this->isVariable($k) || $this->isVariable($v)) { return true; } } return false; } return false; } /** * Get new prefix variable name * * @return string */ public function getNewPrefixVariable() { ++ self::$prefixVariableNumber; return $this->getPrefixVariable(); } /** * Get current prefix variable name * * @return string */ public function getPrefixVariable() { return '$_prefixVariable' . self::$prefixVariableNumber; } /** * append code to prefix buffer * * @param string $code */ public function appendPrefixCode($code) { $this->prefix_code[] = $code; } /** * get prefix code string * * @return string */ public function getPrefixCode() { $code = ''; $prefixArray = array_merge($this->prefix_code, array_pop($this->prefixCodeStack)); $this->prefixCodeStack[] = array(); foreach ($prefixArray as $c) { $code = $this->appendCode($code, $c); } $this->prefix_code = array(); return $code; } } PK BJs# s# ( libs/sysplugins/smarty_internal_data.phpnu W+A ext = new Smarty_Internal_Extension_Handler(); $this->ext->objType = $this->_objType; } /** * assigns a Smarty variable * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to assign * @param boolean $nocache if true any output of this variable will be not cached * * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for * chaining */ public function assign($tpl_var, $value = null, $nocache = false) { if (is_array($tpl_var)) { foreach ($tpl_var as $_key => $_val) { $this->assign($_key, $_val, $nocache); } } else { if ($tpl_var != '') { if ($this->_objType === 2) { /** @var Smarty_Internal_Template $this */ $this->_assignInScope($tpl_var, $value, $nocache); } else { $this->tpl_vars[ $tpl_var ] = new Smarty_Variable($value, $nocache); } } } return $this; } /** * appends values to template variables * * @api Smarty::append() * @link http://www.smarty.net/docs/en/api.append.tpl * * @param array|string $tpl_var the template variable name(s) * @param mixed $value the value to append * @param bool $merge flag if array elements shall be merged * @param bool $nocache if true any output of this variable will * be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function append($tpl_var, $value = null, $merge = false, $nocache = false) { return $this->ext->append->append($this, $tpl_var, $value, $merge, $nocache); } /** * assigns a global Smarty variable * * @param string $varName the global variable name * @param mixed $value the value to assign * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function assignGlobal($varName, $value = null, $nocache = false) { return $this->ext->assignGlobal->assignGlobal($this, $varName, $value, $nocache); } /** * appends values to template variables by reference * * @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 * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function appendByRef($tpl_var, &$value, $merge = false) { return $this->ext->appendByRef->appendByRef($this, $tpl_var, $value, $merge); } /** * assigns values to template variables by reference * * @param string $tpl_var the template variable name * @param $value * @param boolean $nocache if true any output of this variable will be not cached * * @return \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty */ public function assignByRef($tpl_var, &$value, $nocache = false) { return $this->ext->assignByRef->assignByRef($this, $tpl_var, $value, $nocache); } /** * Returns a single or all template variables * * @api Smarty::getTemplateVars() * @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * * @param string $varName variable name or null * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object * @param bool $searchParents include parent templates? * * @return mixed variable value or or array of variables */ public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) { return $this->ext->getTemplateVars->getTemplateVars($this, $varName, $_ptr, $searchParents); } /** * gets the object of a Smarty variable * * @param string $variable the name of the Smarty variable * @param Smarty_Internal_Data $_ptr optional pointer to data object * @param boolean $searchParents search also in parent data * @param bool $error_enable * * @return Smarty_Variable|Smarty_Undefined_Variable the object of the variable * @deprecated since 3.1.28 please use Smarty_Internal_Data::getTemplateVars() instead. */ public function getVariable($variable = null, Smarty_Internal_Data $_ptr = null, $searchParents = true, $error_enable = true) { return $this->ext->getTemplateVars->_getVariable($this, $variable, $_ptr, $searchParents, $error_enable); } /** * Follow the parent chain an merge template and config variables * * @param \Smarty_Internal_Data|null $data */ public function _mergeVars(Smarty_Internal_Data $data = null) { if (isset($data)) { if (!empty($this->tpl_vars)) { $data->tpl_vars = array_merge($this->tpl_vars, $data->tpl_vars); } if (!empty($this->config_vars)) { $data->config_vars = array_merge($this->config_vars, $data->config_vars); } } else { $data = $this; } if (isset($this->parent)) { $this->parent->_mergeVars($data); } } /** * Return true if this instance is a Data obj * * @return bool */ public function _isDataObj() { return $this->_objType === 4; } /** * Return true if this instance is a template obj * * @return bool */ public function _isTplObj() { return $this->_objType === 2; } /** * Return true if this instance is a Smarty obj * * @return bool */ public function _isSmartyObj() { return $this->_objType === 1; } /** * Get Smarty object * * @return Smarty */ public function _getSmartyObj() { return $this->smarty; } /** * Handle unknown class methods * * @param string $name unknown method-name * @param array $args argument array * * @return mixed * @throws SmartyException */ public function __call($name, $args) { return $this->ext->_callExternalMethod($this, $name, $args); } } PK BJMU." ." 1 libs/sysplugins/smarty_internal_compile_block.phpnu W+A */ class Smarty_Internal_Compile_Block extends Smarty_Internal_Compile_Shared_Inheritance { /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $required_attributes = array('name'); /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $shorttag_order = array('name'); /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $option_flags = array('hide', 'nocache'); /** * Attribute definition: Overwrites base class. * * @var array * @see Smarty_Internal_CompileBase */ public $optional_attributes = array('assign'); /** * Saved compiler object * * @var Smarty_Internal_TemplateCompilerBase */ public $compiler = null; /** * Compiles code for the {block} tag * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param array $parameter array with compilation parameter * * @return bool true */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { if (!isset($compiler->_cache[ 'blockNesting' ])) { $compiler->_cache[ 'blockNesting' ] = 0; } if ($compiler->_cache[ 'blockNesting' ] == 0) { // make sure that inheritance gets initialized in template code $this->registerInit($compiler); $this->option_flags = array('hide', 'nocache', 'append', 'prepend'); } else { $this->option_flags = array('hide', 'nocache'); } // check and get attributes $_attr = $this->getAttributes($compiler, $args); $compiler->_cache[ 'blockNesting' ] ++; $_className = 'Block_' . preg_replace('![^\w]+!', '_', uniqid(rand(), true)); $compiler->_cache[ 'blockName' ][ $compiler->_cache[ 'blockNesting' ] ] = $_attr[ 'name' ]; $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ] = $_className; $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ] = array(); $compiler->_cache[ 'blockParams' ][ 1 ][ 'subBlocks' ][ trim($_attr[ 'name' ], '"\'') ][] = $_className; $this->openTag($compiler, 'block', array($_attr, $compiler->nocache, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code, $compiler->template->caching)); // must whole block be nocache ? if ($compiler->tag_nocache) { $i = 0; } $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; // $compiler->suppressNocacheProcessing = true; if ($_attr[ 'nocache' ] === true) { //$compiler->trigger_template_error('nocache option not allowed', $compiler->parser->lex->taglineno); } $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $compiler->template->compiled->has_nocache_code = false; $compiler->suppressNocacheProcessing = true; } } /** * Smarty Internal Plugin Compile BlockClose Class * */ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_Compile_Shared_Inheritance { /** * Compiles code for the {/block} tag * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param array $parameter array with compilation parameter * * @return bool true */ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { list($_attr, $_nocache, $_buffer, $_has_nocache_code, $_caching) = $this->closeTag($compiler, array('block')); // init block parameter $_block = $compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]; unset($compiler->_cache[ 'blockParams' ][ $compiler->_cache[ 'blockNesting' ] ]); $_name = $_attr[ 'name' ]; $_assign = isset($_attr[ 'assign' ]) ? $_attr[ 'assign' ] : null; unset($_attr[ 'assign' ], $_attr[ 'name' ]); foreach ($_attr as $name => $stat) { if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat != 'false')) { $_block[ $name ] = 'true'; } } $_className = $compiler->_cache[ 'blockClass' ][ $compiler->_cache[ 'blockNesting' ] ]; // get compiled block code $_functionCode = $compiler->parser->current_buffer; // setup buffer for template function code $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); $output = " $value) { $output .= "public \${$property} = " . var_export($value,true) .";\n"; } $output .= "public function callBlock(Smarty_Internal_Template \$_smarty_tpl) {\n"; //$output .= "/*/%%SmartyNocache:{$compiler->template->compiled->nocache_hash}%%*/\n"; if ($compiler->template->compiled->has_nocache_code) { $output .= "\$_smarty_tpl->cached->hashes['{$compiler->template->compiled->nocache_hash}'] = true;\n"; } if (isset($_assign)) { $output .= "ob_start();\n"; } $output .= "?>\n"; $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); $compiler->parser->current_buffer->append_subtree($compiler->parser, $_functionCode); $output = "assign({$_assign}, ob_get_clean());\n"; } $output .= "}\n"; $output .= "}\n"; $output .= "/* {/block {$_name}} */\n\n"; $output .= "?>\n"; $compiler->parser->current_buffer->append_subtree($compiler->parser, new Smarty_Internal_ParseTree_Tag($compiler->parser, $output)); $compiler->blockOrFunctionCode .= $f = $compiler->parser->current_buffer->to_smarty_php($compiler->parser); $compiler->parser->current_buffer = new Smarty_Internal_ParseTree_Template(); // nocache plugins must be copied if (!empty($compiler->template->compiled->required_plugins[ 'nocache' ])) { foreach ($compiler->template->compiled->required_plugins[ 'nocache' ] as $plugin => $tmp) { foreach ($tmp as $type => $data) { $compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $plugin ][ $type ] = $data; } } } // restore old status $compiler->template->compiled->has_nocache_code = $_has_nocache_code; $compiler->tag_nocache = $compiler->nocache; $compiler->nocache = $_nocache; $compiler->parser->current_buffer = $_buffer; $output = "_cache[ 'blockNesting' ] == 1) { $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name);\n"; } else { $output .= "\$_smarty_tpl->inheritance->instanceBlock(\$_smarty_tpl, '$_className', $_name, \$this->tplIndex);\n"; } $output .= "?>\n"; $compiler->_cache[ 'blockNesting' ] --; if ($compiler->_cache[ 'blockNesting' ] == 0) { unset($compiler->_cache[ 'blockNesting' ]); } $compiler->has_code = true; $compiler->suppressNocacheProcessing = true; return $output; } } PK BJ 6 libs/sysplugins/smarty_internal_method_mustcompile.phpnu W+A source->exists) { if ($_template->_isSubTpl()) { $parent_resource = " in '$_template->parent->template_resource}'"; } else { $parent_resource = ''; } throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}"); } if ($_template->mustCompile === null) { $_template->mustCompile = (!$_template->source->handler->uncompiled && ($_template->smarty->force_compile || $_template->source->handler->recompiled || !$_template->compiled->exists || ($_template->smarty->compile_check && $_template->compiled->getTimeStamp() < $_template->source->getTimeStamp()))); } return $_template->mustCompile; } }PK BJt t 2 libs/sysplugins/smarty_internal_compile_ldelim.phpnu W+A getAttributes($compiler, $args); if ($_attr[ 'nocache' ] === true) { $compiler->trigger_template_error('nocache option not allowed', null, true); } // this tag does not return compiled code $compiler->has_code = true; return $compiler->smarty->left_delimiter; } } PK BJW B libs/sysplugins/smarty_internal_compile_private_foreachsection.phpnu W+A propertyPreg = '~('; $this->startOffset = 0; $this->resultOffsets = array(); $this->matchResults = array('named' => array(), 'item' => array()); if ($this->isNamed) { $this->buildPropertyPreg(true, $attributes); } if (isset($this->itemProperties)) { if ($this->isNamed) { $this->propertyPreg .= '|'; } $this->buildPropertyPreg(false, $attributes); } $this->propertyPreg .= ')\W~i'; // Template source $this->matchTemplateSource($compiler); // Parent template source $this->matchParentTemplateSource($compiler); // {block} source $this->matchBlockSource($compiler); } /** * Build property preg string * * @param bool $named * @param array $attributes */ public function buildPropertyPreg($named, $attributes) { if ($named) { $this->resultOffsets[ 'named' ] = $this->startOffset + 3; $this->propertyPreg .= "([\$]smarty[.]{$this->tagName}[.]{$attributes['name']}[.]("; $properties = $this->nameProperties; } else { $this->resultOffsets[ 'item' ] = $this->startOffset + 3; $this->propertyPreg .= "([\$]{$attributes['item']}[@]("; $properties = $this->itemProperties; } $this->startOffset += count($properties) + 2; $propName = reset($properties); while ($propName) { $this->propertyPreg .= "({$propName})"; $propName = next($properties); if ($propName) { $this->propertyPreg .= '|'; } } $this->propertyPreg .= '))'; } /** * Find matches in source string * * @param string $source */ public function matchProperty($source) { preg_match_all($this->propertyPreg, $source, $match, PREG_SET_ORDER); foreach ($this->resultOffsets as $key => $offset) { foreach ($match as $m) { if (isset($m[ $offset ]) && !empty($m[ $offset ])) { $this->matchResults[ $key ][ strtolower($m[ $offset ]) ] = true; } } } } /** * Find matches in template source * * @param \Smarty_Internal_TemplateCompilerBase $compiler */ public function matchTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler) { $this->matchProperty($compiler->parser->lex->data); } /** * Find matches in all parent template source * * @param \Smarty_Internal_TemplateCompilerBase $compiler */ public function matchParentTemplateSource(Smarty_Internal_TemplateCompilerBase $compiler) { // search parent compiler template source $nextCompiler = $compiler; while ($nextCompiler !== $nextCompiler->parent_compiler) { $nextCompiler = $nextCompiler->parent_compiler; if ($compiler !== $nextCompiler) { // get template source $_content = $nextCompiler->template->source->getContent(); if ($_content != '') { // run pre filter if required if ((isset($nextCompiler->smarty->autoload_filters[ 'pre' ]) || isset($nextCompiler->smarty->registered_filters[ 'pre' ])) ) { $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content, $nextCompiler->template); } $this->matchProperty($_content); } } } } /** * Find matches in {block} tag source * * @param \Smarty_Internal_TemplateCompilerBase $compiler */ public function matchBlockSource(Smarty_Internal_TemplateCompilerBase $compiler) { } /** * Compiles code for the {$smarty.foreach.xxx} or {$smarty.section.xxx}tag * * @param array $args array with attributes from parser * @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object * @param array $parameter array with compilation parameter * * @return string compiled code * @throws \SmartyCompilerException */ public function compileSpecialVariable($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter) { $tag = strtolower(trim($parameter[ 0 ], '"\'')); $name = isset($parameter[ 1 ]) ? $compiler->getId($parameter[ 1 ]) : false; if (!$name) { $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); } $property = isset($parameter[ 2 ]) ? strtolower($compiler->getId($parameter[ 2 ])) : false; if (!$property || !in_array($property, $this->nameProperties)) { $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} property attribute", null, true); } $tagVar = "'__smarty_{$tag}_{$name}'"; return "(isset(\$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}']) ? \$_smarty_tpl->tpl_vars[{$tagVar}]->value['{$property}'] : null)"; } }PK BJzs 6 libs/sysplugins/smarty_internal_method_clearconfig.phpnu W+A config_vars[ $name ]); } else { $data->config_vars = array(); } return $data; } }PK BJxaS # libs/sysplugins/smarty_variable.phpnu W+A value = $value; $this->nocache = $nocache; } /** * <