aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-01-28 17:25:58 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-01-28 17:25:58 +0000
commite46d624c6bf84b8669196e081dff5c434fd0e25a (patch)
tree57de42ac1df87cdcf1514316c915f4df307a1f90 /phpBB/includes/template.php
parent4c87b7480ec92755ccf30aaa39a2132b95693e9b (diff)
downloadforums-e46d624c6bf84b8669196e081dff5c434fd0e25a.tar
forums-e46d624c6bf84b8669196e081dff5c434fd0e25a.tar.gz
forums-e46d624c6bf84b8669196e081dff5c434fd0e25a.tar.bz2
forums-e46d624c6bf84b8669196e081dff5c434fd0e25a.tar.xz
forums-e46d624c6bf84b8669196e081dff5c434fd0e25a.zip
Fix various var not set warnings ... many thanks go to The Horta for pointing out and offering fixes for many of these
git-svn-id: file:///svn/phpbb/trunk@1997 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
-rw-r--r--phpBB/includes/template.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 8396b7b4a0..d183ecb85a 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -144,6 +144,7 @@ class Template {
}
// Compile it, with the "no echo statements" option on.
+ $_str = "";
$code = $this->compile($this->uncompiled_code[$handle], true, '_str');
// evaluate the variable assignment.
@@ -303,7 +304,7 @@ class Template {
}
// This will handle the remaining root-level varrefs
- $code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . $this->_tpldata[\'.\'][0][\'\1\'] . \'', $code);
+ $code = preg_replace('#\{([a-z0-9\-_]*?)\}#is', '\' . ( ( isset($this->_tpldata[\'.\'][0][\'\1\']) ) ? $this->_tpldata[\'.\'][0][\'\1\'] : \'\' ) . \'', $code);
// Break it up into lines.
$code_lines = explode("\n", $code);
@@ -323,14 +324,14 @@ class Template {
$n[1] = $m[1];
// Added: dougk_ff7-Keeps templates from bombing if begin is on the same line as end.. I think. :)
- if (preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n))
+ if ( preg_match('#<!-- END (.*?) -->#', $code_lines[$i], $n) )
{
$block_nesting_level++;
$block_names[$block_nesting_level] = $m[1];
if ($block_nesting_level < 2)
{
// Block is not nested.
- $code_lines[$i] = '$_' . $a[1] . '_count = sizeof($this->_tpldata[\'' . $n[1] . '.\']);';
+ $code_lines[$i] = '$_' . $a[1] . '_count = ( isset($this->_tpldata[\'' . $n[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $n[1] . '.\']) : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
@@ -346,7 +347,7 @@ class Template {
// current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block.
- $code_lines[$i] = '$_' . $a[1] . '_count = sizeof(' . $varref . ');';
+ $code_lines[$i] = '$_' . $a[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
@@ -366,7 +367,7 @@ class Template {
if ($block_nesting_level < 2)
{
// Block is not nested.
- $code_lines[$i] = '$_' . $m[1] . '_count = sizeof($this->_tpldata[\'' . $m[1] . '.\']);';
+ $code_lines[$i] = '$_' . $m[1] . '_count = ( isset($this->_tpldata[\'' . $m[1] . '.\']) ) ? sizeof($this->_tpldata[\'' . $m[1] . '.\']) : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
@@ -382,7 +383,7 @@ class Template {
// current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block.
- $code_lines[$i] = '$_' . $m[1] . '_count = sizeof(' . $varref . ');';
+ $code_lines[$i] = '$_' . $m[1] . '_count = ( isset(' . $varref . ') ) ? sizeof(' . $varref . ') : 0;';
$code_lines[$i] .= "\n" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{';
}
@@ -472,4 +473,4 @@ class Template {
}
-?>
+?> \ No newline at end of file