diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2005-11-08 19:29:20 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2005-11-08 19:29:20 +0000 |
| commit | a484161be2733c5b2f51df681cd4f7e2a77c1176 (patch) | |
| tree | 7b4e603905111dea4a29b59b88e0b5b6c12b2c1b /phpBB/includes/template.php | |
| parent | 8a965db7aa17af5db4ea6ab7c970cb2a5d21bc86 (diff) | |
| download | forums-a484161be2733c5b2f51df681cd4f7e2a77c1176.tar forums-a484161be2733c5b2f51df681cd4f7e2a77c1176.tar.gz forums-a484161be2733c5b2f51df681cd4f7e2a77c1176.tar.bz2 forums-a484161be2733c5b2f51df681cd4f7e2a77c1176.tar.xz forums-a484161be2733c5b2f51df681cd4f7e2a77c1176.zip | |
- tiny bugfixes. ;)
git-svn-id: file:///svn/phpbb/trunk@5296 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
| -rw-r--r-- | phpBB/includes/template.php | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index 986c5641d3..1e230dd311 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -275,10 +275,10 @@ class template $str = &$str[sizeof($str) - 1]; } - $vararray['S_ROW_COUNT'] = sizeof($str[$blocks[$blockcount]]); + $vararray['S_ROW_COUNT'] = isset($str[$blocks[$blockcount]]) ? sizeof($str[$blocks[$blockcount]]) : 0; // Assign S_FIRST_ROW - if (sizeof($str[$blocks[$blockcount]]) == 0) + if (!isset($str[$blocks[$blockcount]]) || sizeof($str[$blocks[$blockcount]]) == 0) { $vararray['S_FIRST_ROW'] = true; } @@ -286,7 +286,7 @@ class template // Now the tricky part, we always assign S_LAST_ROW and remove the entry before // This is much more clever than going through the complete template data on display (phew) $vararray['S_LAST_ROW'] = true; - if (sizeof($str[$blocks[$blockcount]]) > 0) + if (isset($str[$blocks[$blockcount]]) && sizeof($str[$blocks[$blockcount]]) > 0) { unset($str[$blocks[$blockcount]][sizeof($str[$blocks[$blockcount]]) - 1]['S_LAST_ROW']); } @@ -299,17 +299,17 @@ class template else { // Top-level block. - $vararray['S_ROW_COUNT'] = sizeof($this->_tpldata[$blockname]); + $vararray['S_ROW_COUNT'] = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; // Assign S_FIRST_ROW - if (sizeof($this->_tpldata[$blockname]) == 0) + if (!isset($this->_tpldata[$blockname]) || sizeof($this->_tpldata[$blockname]) == 0) { $vararray['S_FIRST_ROW'] = true; } // We always assign S_LAST_ROW and remove the entry before $vararray['S_LAST_ROW'] = true; - if (sizeof($this->_tpldata[$blockname]) > 0) + if (isset($this->_tpldata[$blockname]) && sizeof($this->_tpldata[$blockname]) > 0) { unset($this->_tpldata[$blockname][sizeof($this->_tpldata[$blockname]) - 1]['S_LAST_ROW']); } @@ -635,8 +635,8 @@ class template $text_blocks = preg_replace('#\{L_([A-Z0-9\-_]*?)\}#e', "'<?php echo ((isset(\$this->_tpldata[\'.\'][0][\'L_\\1\'])) ? \$this->_tpldata[\'.\'][0][\'L_\\1\'] : \'' . ((isset(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '') . '\'); ?>'" , $text_blocks); } - $text_blocks = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "<?php echo \$this->_tpldata['.'][0]['\\1']; ?>", $text_blocks); - $text_blocks = preg_replace('#\{\$([a-z0-9\-_]*?)\}#is', "<?php echo \$this->_tpldata['DEFINE']['.']['\\1']; ?>", $text_blocks); + $text_blocks = preg_replace('#\{([a-z0-9\-_]*?)\}#is', "<?php echo (isset(\$this->_tpldata['.'][0]['\\1'])) ? \$this->_tpldata['.'][0]['\\1'] : ''; ?>", $text_blocks); + $text_blocks = preg_replace('#\{\$([a-z0-9\-_]*?)\}#is', "<?php echo (isset(\$this->_tpldata['DEFINE']['.']['\\1'])) ? \$this->_tpldata['DEFINE']['.']['\\1'] : ''; ?>", $text_blocks); return; } @@ -709,13 +709,13 @@ class template return $tag_template_php; } - // - // Compile IF tags - much of this is from Smarty with - // some adaptions for our block level methods - // + /** + * Compile IF tags - much of this is from Smarty with + * some adaptions for our block level methods + */ function compile_tag_if($tag_args, $elseif) { - /* Tokenize args for 'if' tag. */ + // Tokenize args for 'if' tag. preg_match_all('/(?: "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | @@ -823,7 +823,8 @@ class template } else if (preg_match('#^\.((([a-z0-9\-_]+)?\.?)+?)$#s', $token, $varrefs)) { - $token = 'sizeof(' . $this->generate_block_data_ref($varrefs[1], false) . ')'; + $_tok = $this->generate_block_data_ref($varrefs[1], false); + $token = "(isset($_tok) && sizeof($_tok))"; } break; |
