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

@ -32,7 +32,8 @@ class sql_db
var $query_resultset; var $query_resultset;
var $query_numrows; var $query_numrows;
var $next_id; var $next_id;
var $row; var $row = array();
var $rowset = array();
var $row_index; var $row_index;
var $num_queries = 0; var $num_queries = 0;

View file

@ -28,16 +28,16 @@ class sql_db
{ {
var $db_connect_id; var $db_connect_id;
var $result_ids; var $result_ids = array();
var $result; var $result;
var $next_id; var $next_id;
var $num_rows; var $num_rows = array();
var $current_row; var $current_row = array();
var $field_names; var $field_names = array();
var $field_types; var $field_types = array();
var $result_rowset; var $result_rowset = array();
var $num_queries = 0; var $num_queries = 0;

View file

@ -32,11 +32,11 @@ class sql_db
var $next_id; var $next_id;
var $num_rows; var $num_rows = array();
var $current_row; var $current_row = array();
var $field_names; var $field_names = array();
var $field_types; var $field_types = array();
var $result_rowset; var $result_rowset = array();
var $num_queries = 0; var $num_queries = 0;

View file

@ -33,7 +33,8 @@ class sql_db
var $next_id; var $next_id;
var $in_transaction = 0; var $in_transaction = 0;
var $row; var $row = array();
var $rowset = array();
var $limit_offset; var $limit_offset;
var $query_limit_success; var $query_limit_success;

View file

@ -29,7 +29,8 @@ class sql_db
var $db_connect_id; var $db_connect_id;
var $query_result; var $query_result;
var $row; var $row = array();
var $rowset = array();
var $num_queries = 0; var $num_queries = 0;
// //

View file

@ -4,7 +4,7 @@
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * email : supportphpbb.com
* *
* $Id$ * $Id$
* *
@ -29,7 +29,8 @@ class sql_db
var $db_connect_id; var $db_connect_id;
var $query_result; var $query_result;
var $row; var $row = array();
var $rowset = array();
var $num_queries = 0; var $num_queries = 0;
var $in_transaction = 0; var $in_transaction = 0;
@ -38,33 +39,28 @@ class sql_db
// //
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true) function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{ {
$this->persistency = $persistency; $this->persistency = $persistency;
$this->user = $sqluser; $this->user = $sqluser;
$this->password = $sqlpassword; $this->password = $sqlpassword;
$this->server = $sqlserver; $this->server = $sqlserver;
$this->dbname = $database; $this->dbname = $database;
if($this->persistency) $this->db_connect_id = ($this->persistency) ? mysql_pconnect($this->server, $this->user, $this->password) : mysql_connect($this->server, $this->user, $this->password);
{
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
}
else
{
$this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);
}
if( $this->db_connect_id ) if( $this->db_connect_id )
{ {
if( $database != "" ) if( $database != "" )
{ {
$this->dbname = $database; $this->dbname = $database;
$dbselect = @mysql_select_db($this->dbname); $dbselect = mysql_select_db($this->dbname);
if( !$dbselect ) if( !$dbselect )
{ {
@mysql_close($this->db_connect_id); mysql_close($this->db_connect_id);
$this->db_connect_id = $dbselect; $this->db_connect_id = $dbselect;
} }
} }
return $this->db_connect_id; return $this->db_connect_id;
} }
else else
@ -85,10 +81,10 @@ class sql_db
// //
if( $this->in_transaction ) if( $this->in_transaction )
{ {
@mysql_query("COMMIT", $this->db_connect_id); mysql_query("COMMIT", $this->db_connect_id);
} }
$result = @mysql_close($this->db_connect_id);
return $result; return mysql_close($this->db_connect_id);
} }
else else
{ {
@ -108,10 +104,10 @@ class sql_db
if( $query != "" ) if( $query != "" )
{ {
// $this->num_queries++; $this->num_queries++;
if( $transaction == BEGIN_TRANSACTION ) if( $transaction == BEGIN_TRANSACTION )
{ {
$result = @mysql_query("BEGIN", $this->db_connect_id); $result = mysql_query("BEGIN", $this->db_connect_id);
if(!$result) if(!$result)
{ {
return false; return false;
@ -119,7 +115,7 @@ class sql_db
$this->in_transaction = TRUE; $this->in_transaction = TRUE;
} }
$this->query_result = @mysql_query($query, $this->db_connect_id); $this->query_result = mysql_query($query, $this->db_connect_id);
} }
if( $this->query_result ) if( $this->query_result )
@ -129,7 +125,7 @@ class sql_db
if( $transaction == END_TRANSACTION ) if( $transaction == END_TRANSACTION )
{ {
$result = @mysql_query("COMMIT", $this->db_connect_id); $result = mysql_query("COMMIT", $this->db_connect_id);
} }
return $this->query_result; return $this->query_result;
@ -138,7 +134,7 @@ class sql_db
{ {
if( $this->in_transaction ) if( $this->in_transaction )
{ {
@mysql_query("ROLLBACK", $this->db_connect_id); mysql_query("ROLLBACK", $this->db_connect_id);
$this->in_transaction = FALSE; $this->in_transaction = FALSE;
} }
return false; return false;
@ -154,85 +150,55 @@ class sql_db
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if($query_id)
{ return ( $query_id ) ? mysql_num_rows($query_id) : false;
$result = @mysql_num_rows($query_id);
return $result;
}
else
{
return false;
}
} }
function sql_affectedrows() function sql_affectedrows()
{ {
if($this->db_connect_id) return ( $this->db_connect_id ) ? mysql_affected_rows($this->db_connect_id) : false;
{
$result = @mysql_affected_rows($this->db_connect_id);
return $result;
}
else
{
return false;
}
} }
function sql_numfields($query_id = 0) function sql_numfields($query_id = 0)
{ {
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if($query_id)
{ return ( $query_id ) ? mysql_num_fields($query_id) : false;
$result = @mysql_num_fields($query_id);
return $result;
}
else
{
return false;
}
} }
function sql_fieldname($offset, $query_id = 0) function sql_fieldname($offset, $query_id = 0)
{ {
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if($query_id)
{ return ( $query_id ) ? mysql_field_name($query_id, $offset) : false;
$result = @mysql_field_name($query_id, $offset);
return $result;
}
else
{
return false;
}
} }
function sql_fieldtype($offset, $query_id = 0) function sql_fieldtype($offset, $query_id = 0)
{ {
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if($query_id)
{ return ( $query_id ) ? mysql_field_type($query_id, $offset) : false;
$result = @mysql_field_type($query_id, $offset);
return $result;
}
else
{
return false;
}
} }
function sql_fetchrow($query_id = 0) function sql_fetchrow($query_id = 0)
{ {
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if( $query_id ) if( $query_id )
{ {
$this->row[$query_id] = @mysql_fetch_array($query_id, MYSQL_ASSOC); $this->row[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC);
return $this->row[$query_id]; return $this->row[$query_id];
} }
else else
@ -240,20 +206,24 @@ class sql_db
return false; return false;
} }
} }
function sql_fetchrowset($query_id = 0) function sql_fetchrowset($query_id = 0)
{ {
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if( $query_id ) if( $query_id )
{ {
unset($this->rowset[$query_id]); unset($this->rowset[$query_id]);
unset($this->row[$query_id]); unset($this->row[$query_id]);
while($this->rowset[$query_id] = @mysql_fetch_array($query_id, MYSQL_ASSOC))
while($this->rowset[$query_id] = mysql_fetch_array($query_id, MYSQL_ASSOC))
{ {
$result[] = $this->rowset[$query_id]; $result[] = $this->rowset[$query_id];
} }
return $result; return $result;
} }
else else
@ -261,17 +231,19 @@ class sql_db
return false; return false;
} }
} }
function sql_fetchfield($field, $rownum = -1, $query_id = 0) function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{ {
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if( $query_id ) if( $query_id )
{ {
if( $rownum > -1 ) if( $rownum > -1 )
{ {
$result = @mysql_result($query_id, $rownum, $field); $result = mysql_result($query_id, $rownum, $field);
} }
else else
{ {
@ -294,6 +266,7 @@ class sql_db
} }
} }
} }
return $result; return $result;
} }
else else
@ -301,51 +274,36 @@ class sql_db
return false; return false;
} }
} }
function sql_rowseek($rownum, $query_id = 0){
function sql_rowseek($rownum, $query_id = 0)
{
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if($query_id)
return ( $query_id ) ? mysql_data_seek($query_id, $rownum) : false;
}
function sql_nextid()
{ {
$result = @mysql_data_seek($query_id, $rownum); return ( $this->db_connect_id ) ? mysql_insert_id($this->db_connect_id) : false;
return $result;
} }
else
function sql_freeresult($query_id = 0)
{ {
return false;
}
}
function sql_nextid(){
if($this->db_connect_id)
{
$result = @mysql_insert_id($this->db_connect_id);
return $result;
}
else
{
return false;
}
}
function sql_freeresult($query_id = 0){
if( !$query_id ) if( !$query_id )
{ {
$query_id = $this->query_result; $query_id = $this->query_result;
} }
if($query_id)
{ return ( $query_id ) ? mysql_free_result($query_id) : false;
$result = @mysql_free_result($query_id);
return $result;
} }
else
function sql_error()
{ {
return false; $result['message'] = mysql_error($this->db_connect_id);
} $result['code'] = mysql_errno($this->db_connect_id);
}
function sql_error($query_id = 0)
{
$result["message"] = @mysql_error($this->db_connect_id);
$result["code"] = @mysql_errno($this->db_connect_id);
return $result; return $result;
} }

View file

@ -30,7 +30,8 @@ class sql_db
var $db_connect_id; var $db_connect_id;
var $query_result; var $query_result;
var $in_transaction = 0; var $in_transaction = 0;
var $row; var $row = array();
var $rowset = array();
var $num_queries = 0; var $num_queries = 0;
var $last_query_text = ""; var $last_query_text = "";

View file

@ -30,7 +30,8 @@ class sql_db
var $db_connect_id; var $db_connect_id;
var $query_result; var $query_result;
var $in_transaction = 0; var $in_transaction = 0;
var $row; var $row = array();
var $rowset = array();
var $rownum = array(); var $rownum = array();
var $num_queries = 0; var $num_queries = 0;

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']) ) 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']) : ""; $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; $sessionmethod = SESSION_METHOD_COOKIE;
} }
else else
{ {
$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : ""; $session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : "";
$sessiondata = array();
$sessionmethod = SESSION_METHOD_GET; $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 // Checks for a given user session, tidies session
// table and updates user sessions at each page refresh // 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 $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID; global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
@ -224,6 +225,7 @@ function session_pagestart($user_ip, $thispage_id, $session_length)
else else
{ {
$session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : ""; $session_id = ( isset($HTTP_GET_VARS['sid']) ) ? $HTTP_GET_VARS['sid'] : "";
$session_data = array();
$sessionmethod = SESSION_METHOD_GET; $sessionmethod = SESSION_METHOD_GET;
} }

View file

@ -144,6 +144,7 @@ class Template {
} }
// Compile it, with the "no echo statements" option on. // Compile it, with the "no echo statements" option on.
$_str = "";
$code = $this->compile($this->uncompiled_code[$handle], true, '_str'); $code = $this->compile($this->uncompiled_code[$handle], true, '_str');
// evaluate the variable assignment. // evaluate the variable assignment.
@ -303,7 +304,7 @@ class Template {
} }
// This will handle the remaining root-level varrefs // 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. // Break it up into lines.
$code_lines = explode("\n", $code); $code_lines = explode("\n", $code);
@ -330,7 +331,7 @@ class Template {
if ($block_nesting_level < 2) if ($block_nesting_level < 2)
{ {
// Block is not nested. // 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" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{'; $code_lines[$i] .= "\n" . '{';
} }
@ -346,7 +347,7 @@ class Template {
// current indices of all parent blocks. // current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false); $varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block. // 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" . 'for ($_' . $n[1] . '_i = 0; $_' . $n[1] . '_i < $_' . $n[1] . '_count; $_' . $n[1] . '_i++)';
$code_lines[$i] .= "\n" . '{'; $code_lines[$i] .= "\n" . '{';
} }
@ -366,7 +367,7 @@ class Template {
if ($block_nesting_level < 2) if ($block_nesting_level < 2)
{ {
// Block is not nested. // 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" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{'; $code_lines[$i] .= "\n" . '{';
} }
@ -382,7 +383,7 @@ class Template {
// current indices of all parent blocks. // current indices of all parent blocks.
$varref = $this->generate_block_data_ref($namespace, false); $varref = $this->generate_block_data_ref($namespace, false);
// Create the for loop code to iterate over this block. // 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" . 'for ($_' . $m[1] . '_i = 0; $_' . $m[1] . '_i < $_' . $m[1] . '_count; $_' . $m[1] . '_i++)';
$code_lines[$i] .= "\n" . '{'; $code_lines[$i] .= "\n" . '{';
} }

View file

@ -27,7 +27,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
// //
// Start session management // Start session management
// //
$userdata = session_pagestart($user_ip, PAGE_INDEX, $board_config['session_length']); $userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata); init_userprefs($userdata);
// //
// End session management // End session management
@ -194,6 +194,7 @@ if( ( $total_categories = count($category_rows) ) )
message_die(GENERAL_ERROR, "Could not query new topic information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not query new topic information", "", __LINE__, __FILE__, $sql);
} }
$new_topic_data = array();
while( $topic_data = $db->sql_fetchrow($result) ) while( $topic_data = $db->sql_fetchrow($result) )
{ {
$new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time']; $new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
@ -324,7 +325,7 @@ if( ( $total_categories = count($category_rows) ) )
$unread_topics = false; $unread_topics = false;
if( $userdata['session_logged_in'] ) if( $userdata['session_logged_in'] )
{ {
if( count($new_topic_data[$forum_id]) ) if( !empty($new_topic_data[$forum_id]) )
{ {
$forum_last_post_time = 0; $forum_last_post_time = 0;

View file

@ -86,7 +86,7 @@ $forum_row = $db->sql_fetchrow($result);
// //
// Start session management // Start session management
// //
$userdata = session_pagestart($user_ip, $forum_id, $board_config['session_length']); $userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata); init_userprefs($userdata);
// //
// End session management // End session management
@ -221,6 +221,7 @@ while( $row = $db->sql_fetchrow($result) )
$moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>'; $moderators[] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
} }
$l_moderators = ( count($moderators) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$forum_moderators = ( count($moderators) ) ? implode(", ", $moderators) : $lang['None']; $forum_moderators = ( count($moderators) ) ? implode(", ", $moderators) : $lang['None'];
unset($moderators); unset($moderators);
@ -386,18 +387,11 @@ $template->assign_vars(array(
"FOLDER_ANNOUNCE_IMG" => $images['folder_announce'], "FOLDER_ANNOUNCE_IMG" => $images['folder_announce'],
"FOLDER_ANNOUNCE_NEW_IMG" => $images['folder_announce_new'], "FOLDER_ANNOUNCE_NEW_IMG" => $images['folder_announce_new'],
"L_MODERATOR" => ( $total_mods == 1 ) ? $lang['Moderator'] : $lang['Moderators'], "L_MODERATOR" => $l_moderators,
"L_MARK_TOPICS_READ" => $lang['Mark_all_topics'], "L_MARK_TOPICS_READ" => $lang['Mark_all_topics'],
"L_POST_NEW_TOPIC" => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'], "L_POST_NEW_TOPIC" => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'],
"U_MARK_READ" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"), "U_MARK_READ" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"))
"S_AUTH_LIST" => $s_auth_can,
"S_AUTH_READ_IMG" => $s_auth_read_img,
"S_AUTH_POST_IMG" => $s_auth_post_img,
"S_AUTH_REPLY_IMG" => $s_auth_reply_img,
"S_AUTH_EDIT_IMG" => $s_auth_edit_img,
"S_AUTH_MOD_IMG" => $s_auth_mod_img)
); );
// //
// End header // End header

View file

@ -176,7 +176,7 @@ $forum_id = $forum_row['forum_id'];
// //
// Start session management // Start session management
// //
$userdata = session_pagestart($user_ip, $forum_id, $board_config['session_length']); $userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata); init_userprefs($userdata);
// //
// End session management // End session management
@ -377,6 +377,7 @@ if(!empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']))
} }
else else
{ {
$post_order = "asc";
$post_time_order = "ASC"; $post_time_order = "ASC";
} }
@ -417,11 +418,11 @@ $db->sql_freeresult($result);
$sql = "SELECT * $sql = "SELECT *
FROM " . RANKS_TABLE . " FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min"; ORDER BY rank_special, rank_min";
if(!$ranks_result = $db->sql_query($sql)) if( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, "Couldn't obtain ranks information.", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain ranks information.", "", __LINE__, __FILE__, $sql);
} }
$ranksrow = $db->sql_fetchrowset($ranksresult); $ranksrow = $db->sql_fetchrowset($result);
// //
// Define censored word matches // Define censored word matches
@ -506,6 +507,8 @@ $post_alt = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked
// //
// Set a cookie for this topic // Set a cookie for this topic
// //
if( $userdata['session_logged_in'] )
{
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array(); $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array(); $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();
@ -519,7 +522,7 @@ else if( !empty($tracking_topics['' . $topic_id . '']) || !empty($tracking_forum
} }
else else
{ {
$topic_last_read = $userdata['session_last_visit']; $topic_last_read = $userdata['user_lastvisit'];
} }
if( count($tracking_topics) == 150 && empty($tracking_topics['' . $topic_id . '']) ) if( count($tracking_topics) == 150 && empty($tracking_topics['' . $topic_id . '']) )
@ -531,6 +534,7 @@ if( count($tracking_topics) == 150 && empty($tracking_topics['' . $topic_id . ''
$tracking_topics['' . $topic_id . ''] = time(); $tracking_topics['' . $topic_id . ''] = time();
setcookie($board_config['cookie_name'] . "_t", serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); setcookie($board_config['cookie_name'] . "_t", serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
}
// //
// Dump out the page header and load viewtopic body template // Dump out the page header and load viewtopic body template
@ -595,12 +599,12 @@ if( $can_watch_topic )
if( $is_watching_topic ) if( $is_watching_topic )
{ {
$s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start") . '">' . $lang['Stop_watching_topic'] . '</a>'; $s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start") . '">' . $lang['Stop_watching_topic'] . '</a>';
$s_watching_topic_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start") . '"><img src="' . $images['Topic_un_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Stop_watching_topic'] . '" border="0"></a>'; $s_watching_topic_img = ( isset($images['Topic_un_watch']) ) ? '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;unwatch=topic&amp;start=$start") . '"><img src="' . $images['Topic_un_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Stop_watching_topic'] . '" border="0"></a>' : '';
} }
else else
{ {
$s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start") . '">' . $lang['Start_watching_topic'] . '</a>'; $s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start") . '">' . $lang['Start_watching_topic'] . '</a>';
$s_watching_topic_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start") . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>'; $s_watching_topic_img = ( isset($images['Topic_watch']) ) ? '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;watch=topic&amp;start=$start") . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>' : '';
} }
} }
@ -1136,7 +1140,6 @@ for($i = 0; $i < $total_posts; $i++)
"EDIT_IMG" => $edit_img, "EDIT_IMG" => $edit_img,
"QUOTE_IMG" => $quote_img, "QUOTE_IMG" => $quote_img,
"PMSG_IMG" => $pmsg_img,
"IP_IMG" => $ip_img, "IP_IMG" => $ip_img,
"DELETE_IMG" => $delpost_img, "DELETE_IMG" => $delpost_img,