aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--phpBB/db/db2.php3
-rw-r--r--phpBB/db/msaccess.php12
-rw-r--r--phpBB/db/mssql-odbc.php10
-rw-r--r--phpBB/db/mssql.php3
-rw-r--r--phpBB/db/mysql.php3
-rw-r--r--phpBB/db/mysql4.php206
-rw-r--r--phpBB/db/oracle.php3
-rw-r--r--phpBB/db/postgres7.php3
-rw-r--r--phpBB/includes/sessions.php6
-rw-r--r--phpBB/includes/template.php15
-rw-r--r--phpBB/index.php5
-rw-r--r--phpBB/viewforum.php14
-rw-r--r--phpBB/viewtopic.php57
13 files changed, 152 insertions, 188 deletions
diff --git a/phpBB/db/db2.php b/phpBB/db/db2.php
index 704ae53f12..da471841c1 100644
--- a/phpBB/db/db2.php
+++ b/phpBB/db/db2.php
@@ -32,7 +32,8 @@ class sql_db
var $query_resultset;
var $query_numrows;
var $next_id;
- var $row;
+ var $row = array();
+ var $rowset = array();
var $row_index;
var $num_queries = 0;
diff --git a/phpBB/db/msaccess.php b/phpBB/db/msaccess.php
index 49e9a50e5a..a2ae1a32a5 100644
--- a/phpBB/db/msaccess.php
+++ b/phpBB/db/msaccess.php
@@ -28,16 +28,16 @@ class sql_db
{
var $db_connect_id;
- var $result_ids;
+ var $result_ids = array();
var $result;
var $next_id;
- var $num_rows;
- var $current_row;
- var $field_names;
- var $field_types;
- var $result_rowset;
+ var $num_rows = array();
+ var $current_row = array();
+ var $field_names = array();
+ var $field_types = array();
+ var $result_rowset = array();
var $num_queries = 0;
diff --git a/phpBB/db/mssql-odbc.php b/phpBB/db/mssql-odbc.php
index ab9f887f55..f71f95bafc 100644
--- a/phpBB/db/mssql-odbc.php
+++ b/phpBB/db/mssql-odbc.php
@@ -32,11 +32,11 @@ class sql_db
var $next_id;
- var $num_rows;
- var $current_row;
- var $field_names;
- var $field_types;
- var $result_rowset;
+ var $num_rows = array();
+ var $current_row = array();
+ var $field_names = array();
+ var $field_types = array();
+ var $result_rowset = array();
var $num_queries = 0;
diff --git a/phpBB/db/mssql.php b/phpBB/db/mssql.php
index 52ae9c8a84..4754d8c422 100644
--- a/phpBB/db/mssql.php
+++ b/phpBB/db/mssql.php
@@ -33,7 +33,8 @@ class sql_db
var $next_id;
var $in_transaction = 0;
- var $row;
+ var $row = array();
+ var $rowset = array();
var $limit_offset;
var $query_limit_success;
diff --git a/phpBB/db/mysql.php b/phpBB/db/mysql.php
index 9922bc0615..ded3ae27c6 100644
--- a/phpBB/db/mysql.php
+++ b/phpBB/db/mysql.php
@@ -29,7 +29,8 @@ class sql_db
var $db_connect_id;
var $query_result;
- var $row;
+ var $row = array();
+ var $rowset = array();
var $num_queries = 0;
//
diff --git a/phpBB/db/mysql4.php b/phpBB/db/mysql4.php
index bb812f9b9a..b40497b40e 100644
--- a/phpBB/db/mysql4.php
+++ b/phpBB/db/mysql4.php
@@ -4,7 +4,7 @@
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
- * email : support@phpbb.com
+ * email : supportphpbb.com
*
* $Id$
*
@@ -29,7 +29,8 @@ class sql_db
var $db_connect_id;
var $query_result;
- var $row;
+ var $row = array();
+ var $rowset = array();
var $num_queries = 0;
var $in_transaction = 0;
@@ -38,33 +39,28 @@ class sql_db
//
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
-
$this->persistency = $persistency;
$this->user = $sqluser;
$this->password = $sqlpassword;
$this->server = $sqlserver;
$this->dbname = $database;
- if($this->persistency)
- {
- $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)
+ $this->db_connect_id = ($this->persistency) ? mysql_pconnect($this->server, $this->user, $this->password) : mysql_connect($this->server, $this->user, $this->password);
+
+ if( $this->db_connect_id )
{
- if($database != "")
+ if( $database != "" )
{
$this->dbname = $database;
- $dbselect = @mysql_select_db($this->dbname);
- if(!$dbselect)
+ $dbselect = mysql_select_db($this->dbname);
+
+ if( !$dbselect )
{
- @mysql_close($this->db_connect_id);
+ mysql_close($this->db_connect_id);
$this->db_connect_id = $dbselect;
}
}
+
return $this->db_connect_id;
}
else
@@ -78,17 +74,17 @@ class sql_db
//
function sql_close()
{
- if($this->db_connect_id)
+ if( $this->db_connect_id )
{
//
// Commit any remaining transactions
//
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
{
@@ -108,10 +104,10 @@ class sql_db
if( $query != "" )
{
-// $this->num_queries++;
+ $this->num_queries++;
if( $transaction == BEGIN_TRANSACTION )
{
- $result = @mysql_query("BEGIN", $this->db_connect_id);
+ $result = mysql_query("BEGIN", $this->db_connect_id);
if(!$result)
{
return false;
@@ -119,7 +115,7 @@ class sql_db
$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 )
@@ -129,16 +125,16 @@ class sql_db
if( $transaction == END_TRANSACTION )
{
- $result = @mysql_query("COMMIT", $this->db_connect_id);
+ $result = mysql_query("COMMIT", $this->db_connect_id);
}
return $this->query_result;
}
else
{
- 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;
}
return false;
@@ -150,89 +146,59 @@ class sql_db
//
function sql_numrows($query_id = 0)
{
- if(!$query_id)
+ if( !$query_id )
{
$query_id = $this->query_result;
}
- if($query_id)
- {
- $result = @mysql_num_rows($query_id);
- return $result;
- }
- else
- {
- return false;
- }
+
+ return ( $query_id ) ? mysql_num_rows($query_id) : false;
}
+
function sql_affectedrows()
{
- if($this->db_connect_id)
- {
- $result = @mysql_affected_rows($this->db_connect_id);
- return $result;
- }
- else
- {
- return false;
- }
+ return ( $this->db_connect_id ) ? mysql_affected_rows($this->db_connect_id) : false;
}
+
function sql_numfields($query_id = 0)
{
- if(!$query_id)
+ if( !$query_id )
{
$query_id = $this->query_result;
}
- if($query_id)
- {
- $result = @mysql_num_fields($query_id);
- return $result;
- }
- else
- {
- return false;
- }
+
+ return ( $query_id ) ? mysql_num_fields($query_id) : false;
}
+
function sql_fieldname($offset, $query_id = 0)
{
- if(!$query_id)
+ if( !$query_id )
{
$query_id = $this->query_result;
}
- if($query_id)
- {
- $result = @mysql_field_name($query_id, $offset);
- return $result;
- }
- else
- {
- return false;
- }
+
+ return ( $query_id ) ? mysql_field_name($query_id, $offset) : false;
}
+
function sql_fieldtype($offset, $query_id = 0)
{
- if(!$query_id)
+ if( !$query_id )
{
$query_id = $this->query_result;
}
- if($query_id)
- {
- $result = @mysql_field_type($query_id, $offset);
- return $result;
- }
- else
- {
- return false;
- }
+
+ return ( $query_id ) ? mysql_field_type($query_id, $offset) : false;
}
+
function sql_fetchrow($query_id = 0)
{
- if(!$query_id)
+ if( !$query_id )
{
$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];
}
else
@@ -240,20 +206,24 @@ class sql_db
return false;
}
}
+
function sql_fetchrowset($query_id = 0)
{
- if(!$query_id)
+ if( !$query_id )
{
$query_id = $this->query_result;
}
- if($query_id)
+
+ if( $query_id )
{
unset($this->rowset[$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];
}
+
return $result;
}
else
@@ -261,39 +231,42 @@ class sql_db
return false;
}
}
+
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
- if(!$query_id)
+ if( !$query_id )
{
$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
{
- if(empty($this->row[$query_id]) && empty($this->rowset[$query_id]))
+ if( empty($this->row[$query_id]) && empty($this->rowset[$query_id]) )
{
- if($this->sql_fetchrow())
+ if( $this->sql_fetchrow() )
{
$result = $this->row[$query_id][$field];
}
}
else
{
- if($this->rowset[$query_id])
+ if( $this->rowset[$query_id] )
{
$result = $this->rowset[$query_id][$field];
}
- else if($this->row[$query_id])
+ else if( $this->row[$query_id] )
{
$result = $this->row[$query_id][$field];
}
}
}
+
return $result;
}
else
@@ -301,51 +274,36 @@ class sql_db
return false;
}
}
- function sql_rowseek($rownum, $query_id = 0){
- if(!$query_id)
+
+ function sql_rowseek($rownum, $query_id = 0)
+ {
+ if( !$query_id )
{
$query_id = $this->query_result;
}
- if($query_id)
- {
- $result = @mysql_data_seek($query_id, $rownum);
- return $result;
- }
- else
- {
- return false;
- }
+
+ return ( $query_id ) ? mysql_data_seek($query_id, $rownum) : false;
}
- function sql_nextid(){
- if($this->db_connect_id)
- {
- $result = @mysql_insert_id($this->db_connect_id);
- return $result;
- }
- else
- {
- return false;
- }
+
+ function sql_nextid()
+ {
+ return ( $this->db_connect_id ) ? mysql_insert_id($this->db_connect_id) : false;
}
- function sql_freeresult($query_id = 0){
- if(!$query_id)
+
+ function sql_freeresult($query_id = 0)
+ {
+ if( !$query_id )
{
$query_id = $this->query_result;
}
- if($query_id)
- {
- $result = @mysql_free_result($query_id);
- return $result;
- }
- else
- {
- return false;
- }
+
+ return ( $query_id ) ? mysql_free_result($query_id) : false;
}
- function sql_error($query_id = 0)
+
+ function sql_error()
{
- $result["message"] = @mysql_error($this->db_connect_id);
- $result["code"] = @mysql_errno($this->db_connect_id);
+ $result['message'] = mysql_error($this->db_connect_id);
+ $result['code'] = mysql_errno($this->db_connect_id);
return $result;
}
diff --git a/phpBB/db/oracle.php b/phpBB/db/oracle.php
index 560343bfe4..3319bca4ec 100644
--- a/phpBB/db/oracle.php
+++ b/phpBB/db/oracle.php
@@ -30,7 +30,8 @@ class sql_db
var $db_connect_id;
var $query_result;
var $in_transaction = 0;
- var $row;
+ var $row = array();
+ var $rowset = array();
var $num_queries = 0;
var $last_query_text = "";
diff --git a/phpBB/db/postgres7.php b/phpBB/db/postgres7.php
index f0f1821d1f..a9ae5926e5 100644
--- a/phpBB/db/postgres7.php
+++ b/phpBB/db/postgres7.php
@@ -30,7 +30,8 @@ class sql_db
var $db_connect_id;
var $query_result;
var $in_transaction = 0;
- var $row;
+ var $row = array();
+ var $rowset = array();
var $rownum = array();
var $num_queries = 0;
diff --git a/phpBB/includes/sessions.php b/phpBB/includes/sessions.php
index e09e3dc9df..de9b00af05 100644
--- a/phpBB/includes/sessions.php
+++ b/phpBB/includes/sessions.php
@@ -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;
}
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
diff --git a/phpBB/index.php b/phpBB/index.php
index ffc8e46f00..ef53a5b5bc 100644
--- a/phpBB/index.php
+++ b/phpBB/index.php
@@ -27,7 +27,7 @@ include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
-$userdata = session_pagestart($user_ip, PAGE_INDEX, $board_config['session_length']);
+$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// 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);
}
+ $new_topic_data = array();
while( $topic_data = $db->sql_fetchrow($result) )
{
$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;
if( $userdata['session_logged_in'] )
{
- if( count($new_topic_data[$forum_id]) )
+ if( !empty($new_topic_data[$forum_id]) )
{
$forum_last_post_time = 0;
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index b4f97ff314..2f85c86054 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -86,7 +86,7 @@ $forum_row = $db->sql_fetchrow($result);
//
// Start session management
//
-$userdata = session_pagestart($user_ip, $forum_id, $board_config['session_length']);
+$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// 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>';
}
+$l_moderators = ( count($moderators) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$forum_moderators = ( count($moderators) ) ? implode(", ", $moderators) : $lang['None'];
unset($moderators);
@@ -386,18 +387,11 @@ $template->assign_vars(array(
"FOLDER_ANNOUNCE_IMG" => $images['folder_announce'],
"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_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"),
-
- "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)
+ "U_MARK_READ" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&amp;mark=topics"))
);
//
// End header
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index d9e592e818..c61414df34 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -176,7 +176,7 @@ $forum_id = $forum_row['forum_id'];
//
// Start session management
//
-$userdata = session_pagestart($user_ip, $forum_id, $board_config['session_length']);
+$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
@@ -377,6 +377,7 @@ if(!empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']))
}
else
{
+ $post_order = "asc";
$post_time_order = "ASC";
}
@@ -417,11 +418,11 @@ $db->sql_freeresult($result);
$sql = "SELECT *
FROM " . RANKS_TABLE . "
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);
}
-$ranksrow = $db->sql_fetchrowset($ranksresult);
+$ranksrow = $db->sql_fetchrowset($result);
//
// Define censored word matches
@@ -506,31 +507,34 @@ $post_alt = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked
//
// Set a cookie for this topic
//
-$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();
-
-if( !empty($tracking_topics['' . $topic_id . '']) && !empty($tracking_forums['' . $forum_id . '']) )
-{
- $topic_last_read = ( $tracking_topics['' . $topic_id . ''] > $tracking_forums['' . $forum_id . ''] ) ? $tracking_topics['' . $topic_id . ''] : $tracking_forums['' . $forum_id . ''];
-}
-else if( !empty($tracking_topics['' . $topic_id . '']) || !empty($tracking_forums['' . $forum_id . '']) )
-{
- $topic_last_read = ( !empty($tracking_topics['' . $topic_id . '']) ) ? $tracking_topics['' . $topic_id . ''] : $tracking_forums['' . $forum_id . ''];
-}
-else
+if( $userdata['session_logged_in'] )
{
- $topic_last_read = $userdata['session_last_visit'];
-}
+ $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();
-if( count($tracking_topics) == 150 && empty($tracking_topics['' . $topic_id . '']) )
-{
- asort($tracking_topics);
- unset($tracking_topics[key($tracking_topics)]);
-}
+ if( !empty($tracking_topics['' . $topic_id . '']) && !empty($tracking_forums['' . $forum_id . '']) )
+ {
+ $topic_last_read = ( $tracking_topics['' . $topic_id . ''] > $tracking_forums['' . $forum_id . ''] ) ? $tracking_topics['' . $topic_id . ''] : $tracking_forums['' . $forum_id . ''];
+ }
+ else if( !empty($tracking_topics['' . $topic_id . '']) || !empty($tracking_forums['' . $forum_id . '']) )
+ {
+ $topic_last_read = ( !empty($tracking_topics['' . $topic_id . '']) ) ? $tracking_topics['' . $topic_id . ''] : $tracking_forums['' . $forum_id . ''];
+ }
+ else
+ {
+ $topic_last_read = $userdata['user_lastvisit'];
+ }
-$tracking_topics['' . $topic_id . ''] = time();
+ if( count($tracking_topics) == 150 && empty($tracking_topics['' . $topic_id . '']) )
+ {
+ asort($tracking_topics);
+ unset($tracking_topics[key($tracking_topics)]);
+ }
-setcookie($board_config['cookie_name'] . "_t", serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
+ $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']);
+}
//
// Dump out the page header and load viewtopic body template
@@ -595,12 +599,12 @@ if( $can_watch_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_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
{
$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,
"QUOTE_IMG" => $quote_img,
- "PMSG_IMG" => $pmsg_img,
"IP_IMG" => $ip_img,
"DELETE_IMG" => $delpost_img,