1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-07 01:06:48 +02:00

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
This commit is contained in:
Paul S. Owen
2002-01-28 17:25:58 +00:00
parent 4c87b7480e
commit e46d624c6b
13 changed files with 162 additions and 198 deletions

View File

@@ -38,14 +38,15 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $auto_crea
if( isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) || isset($HTTP_COOKIE_VARS[$cookiename . '_data']) )
{
$sessiondata = isset($HTTP_COOKIE_VARS[$cookiename . '_data']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : "";
$session_id = isset($HTTP_COOKIE_VARS[$cookiename . '_sid']) ? stripslashes($HTTP_COOKIE_VARS[$cookiename . '_sid']) : "";
$sessiondata = isset($HTTP_COOKIE_VARS[$cookiename . '_data']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data'])) : "";
$sessionmethod = SESSION_METHOD_COOKIE;
}
else
{
$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : "";
$sessiondata = array();
$sessionmethod = SESSION_METHOD_GET;
}
@@ -201,7 +202,7 @@ function session_begin($user_id, $user_ip, $page_id, $session_length, $auto_crea
// Checks for a given user session, tidies session
// table and updates user sessions at each page refresh
//
function session_pagestart($user_ip, $thispage_id, $session_length)
function session_pagestart($user_ip, $thispage_id)
{
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
@@ -224,6 +225,7 @@ function session_pagestart($user_ip, $thispage_id, $session_length)
else
{
$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : "";
$session_data = array();
$sessionmethod = SESSION_METHOD_GET;
}

View File

@@ -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 {
}
?>
?>