|
From: Paul S. O. <ps...@us...> - 2001-12-05 00:21:00
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv16782
Modified Files:
search.php login.php common.php viewtopic.php viewforum.php
index.php
Log Message:
New session code, probably still dodgy, fix for login failed message, search updates, highlighting URI messup fixes, max limit for ranks
Index: search.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/search.php,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** search.php 2001/11/29 13:05:03 1.40
--- search.php 2001/12/05 00:20:51 1.41
***************
*** 257,290 ****
{
! if( $query_keywords != "" || $query_author != "" || $search_id == "newposts" || $search_id == "egosearch" || $search_id == "unanswered")
! {
! $synonym_array = @file($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/search_synonyms.txt");
! $stopword_array = @file($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/search_stopwords.txt");
if( $search_id == "newposts" )
{
! $show_results = "topics";
! $search_time = $userdata['session_last_visit'];
! $sortby = 0;
! $sortby_dir = "DESC";
}
!
! if( $search_id == "egosearch" )
{
! $query_author = $userdata['username'];
! $show_results = "topics";
! $search_time = 0;
! $sortby = 0;
! $sortby_dir = "DESC";
}
!
! if( $search_id == "unanswered" )
{
! $show_results = "topics";
! $search_time = 0;
! $sortby = 0;
! $sortby_dir = "DESC";
}
!
$cleaned_search = clean_words_search($query_keywords);
$cleaned_search = remove_stop_words($cleaned_search, $stopword_array);
--- 257,361 ----
{
! $search_sql = "";
+ //
+ // Cycle through options ...
+ //
+ if( $search_id == "newposts" || $search_id == "egosearch" || ( $query_author != "" && $query_keywords == "" ) )
+ {
if( $search_id == "newposts" )
{
! $sql = "SELECT post_id
! FROM " . POSTS_TABLE . "
! WHERE post_time >= " . $userdata['session_last_visit'] . "
! ORDER BY post_time DESC";
! }
! else if( $search_id == "egosearch" )
! {
! $sql = "SELECT post_id
! FROM " . POSTS_TABLE . "
! WHERE poster_id = " . $userdata['user_id'] . "
! ORDER BY post_time DESC";
}
! else
{
! $query_author = str_replace("*", "%", trim($query_author));
!
! $sql = "SELECT p.post_id
! FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
! WHERE u.username LIKE '$query_author'
! AND p.poster_id = u.user_id
! ORDER BY p.post_time DESC";
}
! $result = $db->sql_query($sql);
! if( !$result )
{
! message_die(GENERAL_ERROR, "Couldn't obtain matched posts list", "", __LINE__, __FILE__, $sql);
}
!
! $sql_post_id_in = "";
! while( $row = $db->sql_fetchrow($result) )
! {
! if( $sql_post_id_in != "" )
! {
! $sql_post_id_in .= ", ";
! }
! $sql_post_id_in .= $row['post_id'];
!
! $total_posts++;
! }
!
! if( $sql_post_id_in != "" )
! {
! $sql = "SELECT topic_id
! FROM " . POSTS_TABLE . "
! WHERE post_id IN ($sql_post_id_in)
! GROUP BY topic_id";
! $result = $db->sql_query($sql);
! if( !$result )
! {
! message_die(GENERAL_ERROR, "Couldn't matched posts", "", __LINE__, __FILE__, $sql);
! }
!
! $sql_post_id_in = "";
! while( $row = $db->sql_fetchrow($result) )
! {
! if( $sql_post_id_in != "" )
! {
! $sql_post_id_in .= ", ";
! }
! $sql_post_id_in .= $row['topic_id'];
! }
!
! $search_sql .= "t.topic_id IN ($sql_post_id_in) ";
! }
! else
! {
! message_die(GENERAL_MESSAGE, $lang['No_search_match']);
! }
!
! $show_results = "topics";
! $sortby = 0;
! $sortby_dir = "DESC";
!
! }
! else if( $search_id == "unanswered" )
! {
!
! $search_sql = "t.topic_replies = 0 ";
!
! //
! // Basic requirements
! //
! $show_results = "topics";
! $sortby = 0;
! $sortby_dir = "DESC";
! }
! else if( $query_keywords != "" || $query_author != "" )
! {
!
! $synonym_array = @file($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/search_synonyms.txt");
! $stopword_array = @file($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/search_stopwords.txt");
!
$cleaned_search = clean_words_search($query_keywords);
$cleaned_search = remove_stop_words($cleaned_search, $stopword_array);
***************
*** 384,396 ****
}
}
-
-
- $sql_fields = ( $show_results == "posts") ? "pt.post_text, pt.post_subject, p.post_id, p.post_time, p.post_username, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid" : "f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username" ;
-
- $sql_from = ( $show_results == "posts") ? FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt" : FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2";
-
- $sql_where = ( $show_results == "posts") ? "pt.post_id = p.post_id AND f.forum_id = p.forum_id AND p.topic_id = t.topic_id AND p.poster_id = u.user_id" : "f.forum_id = t.forum_id AND u.user_id = t.topic_poster AND p.post_id = t.topic_last_post_id AND u2.user_id = p.poster_id";
! $search_sql = "";
//
--- 455,466 ----
}
}
! //
! // Author name search
! //
! if( $query_author != "" )
! {
! $query_author = str_replace("*", "%", trim($query_author));
! }
//
***************
*** 401,627 ****
if( $show_results == "posts" )
{
! $search_sql .= "p.post_id IN ($sql_post_id_in) ";
}
else
{
! switch(SQL_LAYER)
{
! case 'mysql':
! case 'mysql4':
! $sql = "SELECT topic_id
! FROM " . POSTS_TABLE . "
! WHERE post_id IN ($sql_post_id_in)
! GROUP BY topic_id";
! $result = $db->sql_query($sql);
! if( !$result )
{
! message_die(GENERAL_ERROR, "Couldn't matched posts", "", __LINE__, __FILE__, $sql);
}
!
! $sql_post_id_in = "";
! while( $row = $db->sql_fetchrow($result) )
{
! if( $sql_post_id_in != "" )
! {
! $sql_post_id_in .= ", ";
! }
! $sql_post_id_in .= $row['topic_id'];
}
- $search_sql .= "t.topic_id IN ($sql_post_id_in) ";
-
- break;
-
- default:
- $search_sql .= "t.topic_id IN (
- SELECT topic_id
- FROM " . POSTS_TABLE . "
- WHERE post_id IN ($sql_post_id_in)
- GROUP BY topic_id )";
- break;
- }
}
}
! //
! // Author name search
! //
! if( $query_author != "" )
{
! $query_author = str_replace("*", "%", trim($query_author));
!
! if( $show_results == "posts" )
! {
! $search_sql .= ( $search_sql == "" ) ? "u.username LIKE '$query_author' " : " AND u.username LIKE '$query_author' ";
! }
! else
! {
! $search_sql .= ( $search_sql == "" ) ? "us.username LIKE '$query_author' AND us.user_id = p.poster_id " : " AND us.username LIKE '$query_author' AND us.user_id = p.poster_id ";
! $sql_from .= ", " . USERS_TABLE . " us ";
! }
}
! //
! // Unanswered Posts
! //
! if( $search_id == "unanswered" )
{
! $search_sql .= ( $search_sql == "" ) ? "t.topic_replies = 0 " : "AND t.topic_replies = 0 ";
}
!
! //
! // If user is logged in then we'll check to see which (if any) private
! // forums they are allowed to view and include them in the search.
! //
! // If not logged in we explicitly prevent searching of private forums
! //
! if( $search_sql != "" || $search_id == "newposts" || $search_id == "egosearch" || $search_id == "unanswered" )
{
! $sql = "SELECT $sql_fields
! FROM $sql_from ";
! $sql .= ( $search_id == "newposts" ) ? "WHERE $sql_where" : "WHERE $search_sql AND $sql_where";
! if( $search_forum != "all" )
{
! $is_auth = auth(AUTH_READ, $search_forum, $userdata);
!
! if( !$is_auth['auth_read'] )
! {
! message_die(GENERAL_MESSAGE, $lang['No_search_match']);
! }
! else
{
! $sql .= " AND f.forum_id = $search_forum";
}
}
! else
! {
! $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
!
! if( $search_cat != "all" )
! {
! $sql .= " AND f.cat_id = $search_cat";
! }
! $ignore_forum_sql = "";
! while( list($key, $value) = each($is_auth_ary) )
! {
! if( !$value['auth_read'] )
! {
! if( $ignore_forum_sql != "" )
! {
! $ignore_forum_sql .= ", ";
! }
! $ignore_forum_sql .= $key;
! }
! }
! if( $ignore_forum_sql != "" )
! {
! $sql .= " AND f.forum_id NOT IN ($ignore_forum_sql) ";
! }
! }
! if( $search_time )
! {
! $sql .= " AND p.post_time >= $search_time ";
! }
! $sql .= " ORDER BY " . $sortby_sql[$sortby] . " $sortby_dir";
!
! if( !$result = $db->sql_query($sql) )
! {
! message_die(GENERAL_ERROR, "Couldn't obtain search results", "", __LINE__, __FILE__, $sql);
! }
! $total_match_count = $db->sql_numrows($result);
! $searchset = $db->sql_fetchrowset($result);
! //
! // Clean up search results table
! //
! $sql = "SELECT session_id
! FROM " . SESSIONS_TABLE;
! if( $result = $db->sql_query($sql) )
{
! $delete_search_id_sql = "";
! while( $row = $db->sql_fetchrow($result) )
{
! if( $delete_search_id_sql != "" )
! {
! $delete_search_id_sql .= ", ";
! }
! $delete_search_id_sql .= "'" . $row['session_id'] . "'";
}
! if( $delete_search_id_sql != "" )
{
! $sql = "DELETE FROM " . SEARCH_TABLE . "
! WHERE session_id NOT IN ($delete_search_id_sql)";
! if( !$result = $db->sql_query($sql) )
! {
! message_die(GENERAL_ERROR, "Couldn't delete old search id sessions", "", __LINE__, __FILE__, $sql);
! }
}
}
! //
! // Store new result data
! //
! if( $total_match_count )
{
! $search_results = "";
! for($i = 0; $i < count($searchset); $i++)
{
! if( $show_results == "posts")
! {
! $search_results .= ($search_results != "") ? ", " . $searchset[$i]['post_id'] : $searchset[$i]['post_id'];
! }
! else
! {
! $search_results .= ($search_results != "") ? ", " . $searchset[$i]['topic_id'] : $searchset[$i]['topic_id'];
! }
}
!
! $per_page = ( $show_results == "posts" ) ? $board_config['posts_per_page'] : $board_config['topics_per_page'];
!
! //
! // Combine both results and search data (apart from original query)
! // so we can serialize it and place it in the DB
! //
! $store_search_data = array();
! $store_search_data['results'] = $search_results;
! $store_search_data['word_array'] = $split_search;
! $store_search_data['match_count'] = $total_match_count;
!
! $result_array = serialize($store_search_data);
! unset($store_search_data);
! unset($search_results);
! mt_srand ((double) microtime() * 1000000);
! $search_id = mt_rand();
! $sql = "UPDATE " . SEARCH_TABLE . "
! SET search_id = $search_id, search_array = '$result_array'
! WHERE session_id = '" . $userdata['session_id'] . "'";
! $result = $db->sql_query($sql);
! if( !$result || !$db->sql_affectedrows() )
{
! $sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_array)
! VALUES($search_id, '" . $userdata['session_id'] . "', '$result_array')";
! if( !$result = $db->sql_query($sql) )
! {
! message_die(GENERAL_ERROR, "Couldn't insert search results", "", __LINE__, __FILE__, $sql);
! }
}
-
- $db->sql_freeresult($result);
-
- }
- else
- {
- message_die(GENERAL_MESSAGE, $lang['No_search_match']);
}
}
else
--- 471,723 ----
if( $show_results == "posts" )
{
! $search_sql .= ( $query_author == "" ) ? "p.post_id IN ($sql_post_id_in)" : "p.post_id IN ($sql_post_id_in) AND u.username LIKE '$query_author' ";
!
! if( $search_time )
! {
! $search_sql .= " AND p.post_time >= $search_time ";
! }
}
else
{
!
! $search_time_sql = "";
! if( $search_time )
! {
! $search_time_sql = ( $query_author == "" ) ? "AND post_time >= $search_time " : "AND p.post_time >= $search_time ";
! }
!
! if( $query_author == "" )
! {
! $sql = "SELECT topic_id
! FROM " . POSTS_TABLE . "
! WHERE post_id IN ($sql_post_id_in)
! $search_time_sql
! GROUP BY topic_id";
! }
! else
! {
! $sql = "SELECT p.topic_id
! FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
! WHERE p.post_id IN ($sql_post_id_in)
! AND u.username LIKE '$query_author'
! AND p.poster_id = u.user_id
! $search_time_sql
! GROUP BY p.topic_id";
! }
! $result = $db->sql_query($sql);
! if( !$result )
! {
! message_die(GENERAL_ERROR, "Couldn't matched posts", "", __LINE__, __FILE__, $sql);
! }
!
! $sql_post_id_in = "";
! while( $row = $db->sql_fetchrow($result) )
{
! if( $sql_post_id_in != "" )
! {
! $sql_post_id_in .= ", ";
! }
! $sql_post_id_in .= $row['topic_id'];
! }
!
! $search_sql .= "t.topic_id IN ($sql_post_id_in) ";
! /*
! if( $query_author == "" )
{
! $search_sql .= "t.topic_id IN (
! SELECT topic_id
! FROM " . POSTS_TABLE . "
! WHERE post_id IN ($sql_post_id_in)
! $search_time_sql
! GROUP BY topic_id )";
}
! else
{
! $search_sql .= "t.topic_id IN (
! SELECT p.topic_id
! FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u
! WHERE p.post_id IN ($sql_post_id_in)
! AND u.username LIKE '$query_author'
! AND p.poster_id = u.user_id
! $search_time_sql
! GROUP BY p.topic_id )";
}
+ */
}
}
! else
{
! message_die(GENERAL_MESSAGE, $lang['No_search_match']);
}
+ }
! //
! // Define common SQL
! //
! $sql_fields = ( $show_results == "posts") ? "pt.post_text, pt.post_subject, p.post_id, p.post_time, p.post_username, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid" : "f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_time, t.topic_views, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username" ;
!
! $sql_from = ( $show_results == "posts") ? FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt" : FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2";
!
! $sql_where = ( $show_results == "posts") ? "pt.post_id = p.post_id AND f.forum_id = p.forum_id AND p.topic_id = t.topic_id AND p.poster_id = u.user_id" : "f.forum_id = t.forum_id AND u.user_id = t.topic_poster AND p.post_id = t.topic_last_post_id AND u2.user_id = p.poster_id";
!
! //
! // Build query ...
! //
! $sql = "SELECT $sql_fields
! FROM $sql_from ";
!
! $sql .= "WHERE $search_sql AND $sql_where ";
!
! //
! // If user is logged in then we'll check to see which (if any) private
! // forums they are allowed to view and include them in the search.
! //
! // If not logged in we explicitly prevent searching of private forums
! //
! $auth_sql = "";
! if( $search_forum != "all" )
! {
! $is_auth = auth(AUTH_READ, $search_forum, $userdata);
!
! if( !$is_auth['auth_read'] )
{
! message_die(GENERAL_MESSAGE, $lang['No_searchable_forums']);
}
! else
{
! $auth_sql = "f.forum_id = $search_forum";
! }
! }
! else
! {
! $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
! if( $search_cat != "all" )
! {
! $auth_sql = "f.cat_id = $search_cat";
! }
! $ignore_forum_sql = "";
! while( list($key, $value) = each($is_auth_ary) )
! {
! if( !$value['auth_read'] )
{
! if( $ignore_forum_sql != "" )
{
! $ignore_forum_sql .= ", ";
}
+ $ignore_forum_sql .= $key;
}
! }
! if( $ignore_forum_sql != "" )
! {
! $auth_sql .= ( $auth_sql != "" ) ? " AND f.forum_id NOT IN ($ignore_forum_sql) " : "f.forum_id NOT IN ($ignore_forum_sql) ";
! }
! }
! //
! // Finish building query (for all combinations)
! // and run it ...
! //
! if( $search_sql != "" || $search_id == "newposts" || $search_id == "egosearch" || $search_id == "unanswered" )
! {
! if( $auth_sql != "" )
! {
! $sql .= " AND " . $auth_sql;
! }
! $sql .= " ORDER BY " . $sortby_sql[$sortby] . " $sortby_dir";
! if( !$result = $db->sql_query($sql) )
! {
! message_die(GENERAL_ERROR, "Couldn't obtain search results", "", __LINE__, __FILE__, $sql);
! }
! $total_match_count = $db->sql_numrows($result);
! $searchset = $db->sql_fetchrowset($result);
! //
! // Clean up search results table
! //
! $sql = "SELECT session_id
! FROM " . SESSIONS_TABLE;
! if( $result = $db->sql_query($sql) )
! {
! $delete_search_id_sql = "";
! while( $row = $db->sql_fetchrow($result) )
{
! if( $delete_search_id_sql != "" )
{
! $delete_search_id_sql .= ", ";
}
+ $delete_search_id_sql .= "'" . $row['session_id'] . "'";
+ }
! if( $delete_search_id_sql != "" )
! {
! $sql = "DELETE FROM " . SEARCH_TABLE . "
! WHERE session_id NOT IN ($delete_search_id_sql)";
! if( !$result = $db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, "Couldn't delete old search id sessions", "", __LINE__, __FILE__, $sql);
}
}
+ }
! //
! // Store new result data
! //
! if( $total_match_count )
! {
! $search_results = "";
! for($i = 0; $i < count($searchset); $i++)
{
! if( $show_results == "posts")
{
! $search_results .= ($search_results != "") ? ", " . $searchset[$i]['post_id'] : $searchset[$i]['post_id'];
}
! else
! {
! $search_results .= ($search_results != "") ? ", " . $searchset[$i]['topic_id'] : $searchset[$i]['topic_id'];
! }
! }
! $per_page = ( $show_results == "posts" ) ? $board_config['posts_per_page'] : $board_config['topics_per_page'];
! //
! // Combine both results and search data (apart from original query)
! // so we can serialize it and place it in the DB
! //
! $store_search_data = array();
! $store_search_data['results'] = $search_results;
! $store_search_data['word_array'] = $split_search;
! $store_search_data['match_count'] = $total_match_count;
!
! $result_array = serialize($store_search_data);
! unset($store_search_data);
! unset($search_results);
!
! mt_srand ((double) microtime() * 1000000);
! $search_id = mt_rand();
!
! $sql = "UPDATE " . SEARCH_TABLE . "
! SET search_id = $search_id, search_array = '$result_array'
! WHERE session_id = '" . $userdata['session_id'] . "'";
! $result = $db->sql_query($sql);
! if( !$result || !$db->sql_affectedrows() )
! {
! $sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_array)
! VALUES($search_id, '" . $userdata['session_id'] . "', '$result_array')";
! if( !$result = $db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, "Couldn't insert search results", "", __LINE__, __FILE__, $sql);
}
}
+
+ $db->sql_freeresult($result);
+
}
else
***************
*** 743,746 ****
--- 839,844 ----
$highlight_active = "";
+ $search_string = array();
+ $replace_string = array();
for($j = 0; $j < count($split_search); $j++ )
{
***************
*** 751,755 ****
$highlight_active .= " " . $split_word;
! $search_string[] = "#\b(" . preg_quote(str_replace("*", ".*?", $split_word), "#") . ")\b#i";
$replace_string[] = "<font color=\"#" . $theme['fontcolor3'] . "\"><b>\\1</b></font>";
--- 849,853 ----
$highlight_active .= " " . $split_word;
! $search_string[] = "#\b(" . str_replace("\*", ".*?", preg_quote($split_word, "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])\b#i";
$replace_string[] = "<font color=\"#" . $theme['fontcolor3'] . "\"><b>\\1</b></font>";
***************
*** 760,764 ****
if( $replace_synonym == $split_word )
{
! $search_string[] = "#\b(" . preg_quote($match_synonym, "#") . ")\b#i";
$replace_string[] = "<font color=\"#" . $theme['fontcolor3'] . "\"><b>\\1</b></font>";
--- 858,862 ----
if( $replace_synonym == $split_word )
{
! $search_string[] = "#\b(" . str_replace("\*", ".*?", preg_quote($replace_synonym, "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])\b#i";
$replace_string[] = "<font color=\"#" . $theme['fontcolor3'] . "\"><b>\\1</b></font>";
***************
*** 798,802 ****
--- 896,907 ----
$message = strip_tags($message);
$message = preg_replace("/\[.*?:$bbcode_uid:?.*?\]/si", "", $message);
+
+ if( count($search_string) )
+ {
+ $message = preg_replace($search_string, $replace_string, $message);
+ }
+
$message = preg_replace("/\[url\]|\[\/url\]/si", "", $message);
+
}
else
***************
*** 805,808 ****
--- 910,920 ----
$user_sig_bbcode_uid = $searchset[$i]['user_sig_bbcode_uid'];
+ $message = make_clickable($message);
+
+ if( count($search_string) )
+ {
+ $message = preg_replace($search_string, $replace_string, $message);
+ }
+
if( !$board_config['allow_html'] )
{
***************
*** 828,833 ****
}
- $message = make_clickable($message);
-
if( $searchset[$i]['enable_sig'] )
{
--- 940,943 ----
***************
*** 855,863 ****
$message = str_replace("\n", "<br />", $message);
- if( count($search_string) )
- {
- $message = preg_replace($search_string, $replace_string, $message);
- }
}
$template->assign_block_vars("searchresults", array(
"TOPIC_TITLE" => $topic_title,
--- 965,970 ----
$message = str_replace("\n", "<br />", $message);
}
+
$template->assign_block_vars("searchresults", array(
"TOPIC_TITLE" => $topic_title,
***************
*** 984,1016 ****
}
! if( empty($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) && $searchset[$i]['post_time'] > $userdata['session_last_visit'] )
{
- $folder_image = "<img src=\"$folder_new\" alt=\"" . $lang['New_posts'] . "\" />";
! $newest_post_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_posts'] . "\" border=\"0\" /></a> ";
! }
! else
! {
! if( isset($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) )
{
! if( $HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id] < $searchset[$i]['post_time'] && $searchset[$i]['post_time'] > $userdata['session_last_visit'] )
{
! $folder_image = "<img src=\"$folder_new\" alt=\"" . $lang['New_posts'] . "\" />";
! $newest_post_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_posts'] . "\" border=\"0\" /></a> ";
}
! else
{
! $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
! $folder_image = "<img src=\"$folder\" alt=\"$folder_alt\" />";
! $newest_post_img = "";
}
}
else
{
! $folder_alt = ( $searchset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
! $folder_image = "<img src=\"$folder\" alt=\"$folder_alt\" />";
$newest_post_img = "";
}
}
}
--- 1091,1151 ----
}
! if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"]) ||
! isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"]) ||
! isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_all"]) )
{
! $unread_topics = true;
!
! if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"]) )
{
! if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"] > $topic_rowset[$i]['post_time'] )
{
! $unread_topics = false;
! }
! }
! if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"]) )
! {
! if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"] > $topic_rowset[$i]['post_time'] )
! {
! $unread_topics = false;
}
! }
!
! if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_all"]) )
! {
! if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_all"] > $topic_rowset[$i]['post_time'] )
{
! $unread_topics = false;
}
}
+
+ if( $unread_topics )
+ {
+ $folder_image = "<img src=\"$folder_new\" alt=\"" . $lang['New_posts'] . "\" title=\"" . $lang['New_posts'] . "\" />";
+
+ $newest_post_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_post'] . "\" title=\"" . $lang['View_newest_post'] . "\" border=\"0\" /></a> ";
+ }
else
{
! $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
!
! $folder_image = "<img src=\"$folder\" alt=\"$folder_alt\" title=\"$folder_alt\" border=\"0\" />";
$newest_post_img = "";
}
+
+ }
+ else if( $topic_rowset[$i]['post_time'] > $userdata['session_last_visit'] )
+ {
+ $folder_image = "<img src=\"$folder_new\" alt=\"" . $lang['New_posts'] . "\" title=\"" . $lang['New_posts'] . "\" />";
+
+ $newest_post_img = "<a href=\"viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_post'] . "\" title=\"" . $lang['View_newest_post'] . "\" border=\"0\" /></a> ";
+ }
+ else
+ {
+ $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
+ $folder_image = "<img src=\"$folder\" alt=\"$folder_alt\" title=\"$folder_alt\" border=\"0\" />";
+ $newest_post_img = "";
}
}
Index: login.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/login.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** login.php 2001/12/02 01:04:25 1.35
--- login.php 2001/12/05 00:20:52 1.36
***************
*** 25,29 ****
// board is shut down
//
! define("IN_ADMIN", true);
$phpbb_root_path = "./";
--- 25,29 ----
// board is shut down
//
! define("IN_LOGIN", true);
$phpbb_root_path = "./";
***************
*** 31,34 ****
--- 31,35 ----
include($phpbb_root_path . 'common.'.$phpEx);
+
//
// Set page ID for session management
***************
*** 70,74 ****
$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;
! $session_id = session_begin($rowresult['user_id'], $user_ip, PAGE_INDEX, $session_length, TRUE, $autologin);
if( $session_id )
--- 71,75 ----
$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;
! $session_id = session_begin($rowresult['user_id'], $user_ip, PAGE_INDEX, $session_length, FALSE, $autologin);
if( $session_id )
***************
*** 97,101 ****
$message = $lang['Error_login'] . "<br /><br />" . sprintf($lang['Click_return_login'], "<a href=\"" . append_sid("login.$phpEx?$redirect") . "\">", "</a> ") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a> ");
!
message_die(GENERAL_MESSAGE, $message);
}
--- 98,102 ----
$message = $lang['Error_login'] . "<br /><br />" . sprintf($lang['Click_return_login'], "<a href=\"" . append_sid("login.$phpEx?$redirect") . "\">", "</a> ") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a> ");
!
message_die(GENERAL_MESSAGE, $message);
}
***************
*** 111,115 ****
$message = $lang['Error_login'] . "<br /><br />" . sprintf($lang['Click_return_login'], "<a href=\"" . append_sid("login.$phpEx?$redirect") . "\">", "</a> ") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a> ");
!
message_die(GENERAL_MESSAGE, $message);
}
--- 112,116 ----
$message = $lang['Error_login'] . "<br /><br />" . sprintf($lang['Click_return_login'], "<a href=\"" . append_sid("login.$phpEx?$redirect") . "\">", "</a> ") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a> ");
!
message_die(GENERAL_MESSAGE, $message);
}
Index: common.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/common.php,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -r1.65 -r1.66
*** common.php 2001/11/26 12:09:37 1.65
--- common.php 2001/12/05 00:20:52 1.66
***************
*** 180,184 ****
}
! if( $board_config['board_disable'] && !defined("IN_ADMIN") )
{
message_die(GENERAL_MESSAGE, 'Board_disable', 'Information');
--- 180,184 ----
}
! if( $board_config['board_disable'] && !defined("IN_ADMIN") && !defined("IN_LOGIN") )
{
message_die(GENERAL_MESSAGE, 'Board_disable', 'Information');
Index: viewtopic.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/viewtopic.php,v
retrieving revision 1.144
retrieving revision 1.145
diff -C2 -r1.144 -r1.145
*** viewtopic.php 2001/11/27 00:30:59 1.144
--- viewtopic.php 2001/12/05 00:20:52 1.145
***************
*** 57,85 ****
if( $HTTP_GET_VARS["view"] == "newest" )
{
! if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name']]) )
{
! $sessiondata = unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name']]));
! $newest_time = $sessiondata['lastvisit'];
!
! $sql = "SELECT post_id
! FROM " . POSTS_TABLE . "
! WHERE topic_id = $topic_id
! AND post_time >= $newest_time
! ORDER BY post_time ASC
! LIMIT 1";
! if( !$result = $db->sql_query($sql) )
{
! message_die(GENERAL_ERROR, "Couldn't obtain newer/older topic information", "", __LINE__, __FILE__, $sql);
! }
! if( !($row = $db->sql_fetchrow($result)) )
! {
! message_die(GENERAL_MESSAGE, $lang['No_new_posts_last_visit']);
}
else
{
! $post_id = $row['post_id'];
! header("Location: " . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true));
}
}
--- 57,91 ----
if( $HTTP_GET_VARS["view"] == "newest" )
{
! if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_sid"]) )
{
! $session_id = $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_sid"];
! if( $session_id )
{
! $sql = "SELECT p.post_id
! FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s
! WHERE topic_id = $topic_id
! AND s.session_id = '$session_id'
! AND p.post_time >= s.session_last_visit
! ORDER BY p.post_time ASC
! LIMIT 1";
! if( !$result = $db->sql_query($sql) )
! {
! message_die(GENERAL_ERROR, "Couldn't obtain newer/older topic information", "", __LINE__, __FILE__, $sql);
! }
! if( !($row = $db->sql_fetchrow($result)) )
! {
! message_die(GENERAL_MESSAGE, $lang['No_new_posts_last_visit']);
! }
! else
! {
! $post_id = $row['post_id'];
! header("Location: " . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true));
! }
}
else
{
! header("Location: " . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
}
}
***************
*** 138,159 ****
// page the post is on and the correct display of viewtopic)
//
! $join_sql_table = (!isset($post_id)) ? "" : "" . POSTS_TABLE . " p, " . POSTS_TABLE . " p2,";
! $join_sql = (!isset($post_id)) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id";
! $count_sql = (!isset($post_id)) ? "" : ", COUNT(p2.post_id) AS prev_posts";
! $order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
! FROM $join_sql_table " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
!
! if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql);
}
! if(!$total_rows = $db->sql_numrows($result))
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', "", __LINE__, __FILE__, $sql);
--- 144,164 ----
// page the post is on and the correct display of viewtopic)
//
! $join_sql_table = ( !isset($post_id) ) ? "" : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 ";
! $join_sql = ( !isset($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id";
! $count_sql = ( !isset($post_id) ) ? "" : ", COUNT(p2.post_id) AS prev_posts";
! $order_sql = ( !isset($post_id) ) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
! FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
! if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql);
}
! if( !$total_rows = $db->sql_numrows($result) )
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', "", __LINE__, __FILE__, $sql);
***************
*** 207,211 ****
// solution being practically as fast and certainly simpler!
//
! if($userdata['user_id'] != ANONYMOUS)
{
$can_watch_topic = TRUE;
--- 212,216 ----
// solution being practically as fast and certainly simpler!
//
! if( $userdata['user_id'] != ANONYMOUS )
{
$can_watch_topic = TRUE;
***************
*** 318,324 ****
$previous_days_text = array($lang['All_Posts'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']);
! if(!empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']))
{
! $post_days = (!empty($HTTP_POST_VARS['postdays'])) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays'];
$min_post_time = time() - ($post_days * 86400);
--- 323,329 ----
$previous_days_text = array($lang['All_Posts'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']);
! if( !empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']) )
{
! $post_days = ( !empty($HTTP_POST_VARS['postdays']) ) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays'];
$min_post_time = time() - ($post_days * 86400);
***************
*** 455,463 ****
// Dump out the page header and load viewtopic body template
//
! $topic_last_read = ( isset($HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id]) ) ? $HTTP_COOKIE_VARS['phpbb2_' . $forum_id . '_' . $topic_id] : 0;
!
! setcookie('phpbb2_' . $forum_id . '_' . $topic_id, time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
$template->set_filenames(array(
"body" => "viewtopic_body.tpl",
--- 460,485 ----
// Dump out the page header and load viewtopic body template
//
! if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"]) && isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"]) )
! {
! $topic_last_read = ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"] > $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"] ) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"] : $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"];
! }
! else if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"]) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"]) )
! {
! $topic_last_read = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"]) ) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t_$topic_id"] : $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_$forum_id"];
! }
! else
! {
! $topic_last_read = $userdata['session_last_visit'];
! }
+ //
+ // Set a cookie for this topic
+ //
+ setcookie($board_config['cookie_name'] . "_t_$topic_id", time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
+ //session_send_cookie("_t_$topic_id", time(), 0);
+ //
+ // Load templates
+ //
$template->set_filenames(array(
"body" => "viewtopic_body.tpl",
***************
*** 515,518 ****
--- 537,543 ----
if( isset($HTTP_GET_VARS['highlight']) )
{
+ $highlight_match = array();
+ $highlight_replace = array();
+
//
// Split words and phrases
***************
*** 524,529 ****
if( trim($words[$i]) != "" )
{
! $highlight_match[] = "#\b(" . str_replace("\*", ".*?", preg_quote($words[$i], "#")) . ")\b#i";
! $highlight_replace[] = "<font color=\"#FF0000\"><b>\\1</b></font>";
}
}
--- 549,554 ----
if( trim($words[$i]) != "" )
{
! $highlight_match[] = "#\b(" . str_replace("\*", ".*?", preg_quote($words[$i], "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])\b#i";
! $highlight_replace[] = "<font color=\"#" . $theme['fontcolor3'] . "\"><b>\\1</b></font>";
}
}
***************
*** 727,737 ****
{
case USER_AVATAR_UPLOAD:
! $poster_avatar = ( $board_config['avatar_upload_db'] ) ? "<img src=\"avatar.$phpEx?p=" . $postrow[$i]['post_id'] . "\" alt=\"\" />" : "<img src=\"" . $board_config['avatar_path'] . "/" . $postrow[$i]['user_avatar'] . "\" alt=\"\" />";
break;
case USER_AVATAR_REMOTE:
! $poster_avatar = "<img src=\"" . $postrow[$i]['user_avatar'] . "\" alt=\"\" />";
break;
case USER_AVATAR_GALLERY:
! $poster_avatar = "<img src=\"" . $board_config['avatar_gallery_path'] . "/" . $postrow[$i]['user_avatar'] . "\" alt=\"\" />";
break;
}
--- 752,762 ----
{
case USER_AVATAR_UPLOAD:
! $poster_avatar = ( $board_config['avatar_upload_db'] ) ? "<img src=\"avatar.$phpEx?p=" . $postrow[$i]['post_id'] . "\" alt=\"\" />" : "<img src=\"" . $board_config['avatar_path'] . "/" . $postrow[$i]['user_avatar'] . "\" alt=\"\" border=\"\" />";
break;
case USER_AVATAR_REMOTE:
! $poster_avatar = "<img src=\"" . $postrow[$i]['user_avatar'] . "\" alt=\"\" border=\"\" />";
break;
case USER_AVATAR_GALLERY:
! $poster_avatar = "<img src=\"" . $board_config['avatar_gallery_path'] . "/" . $postrow[$i]['user_avatar'] . "\" alt=\"\" border=\"\" />";
break;
}
***************
*** 747,755 ****
if( $postrow[$i]['post_time'] > $userdata['session_last_visit'] && $postrow[$i]['post_time'] > $topic_last_read )
{
! $mini_post_img = '<img src="' . $images['icon_minipost_new'] . '" alt="' . $lang['New_post'] . '" />';
}
else
{
! $mini_post_img = '<img src="' . $images['icon_minipost'] . '" alt="' . $lang['Post'] . '" />';
}
--- 772,780 ----
if( $postrow[$i]['post_time'] > $userdata['session_last_visit'] && $postrow[$i]['post_time'] > $topic_last_read )
{
! $mini_post_img = '<img src="' . $images['icon_minipost_new'] . '" alt="' . $lang['New_post'] . '" title="' . $lang['New_post'] . '" border="0" />';
}
else
{
! $mini_post_img = '<img src="' . $images['icon_minipost'] . '" alt="' . $lang['Post'] . '" title="' . $lang['Post'] . '" border="0" />';
}
***************
*** 776,783 ****
for($j = 0; $j < count($ranksrow); $j++)
{
! if($postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'])
{
$poster_rank = $ranksrow[$j]['rank_title'];
! $rank_image = ($ranksrow[$j]['rank_image']) ? "<img src=\"" . $ranksrow[$j]['rank_image'] . "\"><br />" : "";
}
}
--- 801,808 ----
for($j = 0; $j < count($ranksrow); $j++)
{
! if( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
{
$poster_rank = $ranksrow[$j]['rank_title'];
! $rank_image = ($ranksrow[$j]['rank_image']) ? "<img src=\"" . $ranksrow[$j]['rank_image'] . "\" alt=\"\" border=\"0\" /><br />" : "";
}
}
***************
*** 787,794 ****
for($j = 0; $j < count($ranksrow); $j++)
{
! if($postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && $postrow[$i]['user_posts'] < $ranksrow[$j]['rank_max'] && !$ranksrow[$j]['rank_special'])
{
$poster_rank = $ranksrow[$j]['rank_title'];
! $rank_image = ($ranksrow[$j]['rank_image']) ? "<img src=\"" . $ranksrow[$j]['rank_image'] . "\"><br />" : "";
}
}
--- 812,819 ----
for($j = 0; $j < count($ranksrow); $j++)
{
! if( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )
{
$poster_rank = $ranksrow[$j]['rank_title'];
! $rank_image = ($ranksrow[$j]['rank_image']) ? "<img src=\"" . $ranksrow[$j]['rank_image'] . "\" alt=\"\" border=\"0\" /><br />" : "";
}
}
***************
*** 806,812 ****
if($poster_id != ANONYMOUS)
{
! $profile_img = "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id") . "\"><img src=\"" . $images['icon_profile'] . "\" alt=\"" . $lang['Read_profile'] . "\" border=\"0\" /></a>";
! $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$poster_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Send_private_message'] . "\" border=\"0\" /></a>";
if( !empty($postrow[$i]['user_viewemail']) )
--- 831,837 ----
if($poster_id != ANONYMOUS)
{
! $profile_img = "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id") . "\"><img src=\"" . $images['icon_profile'] . "\" alt=\"" . $lang['Read_profile'] . "\" title=\"" . $lang['Read_profile'] . "\" border=\"0\" /></a>";
! $pm_img = "<a href=\"" . append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$poster_id") . "\"><img src=\"". $images['icon_pm'] . "\" alt=\"" . $lang['Send_private_message'] . "\" title=\"" . $lang['Send_private_message'] . "\" border=\"0\" /></a>";
if( !empty($postrow[$i]['user_viewemail']) )
***************
*** 814,818 ****
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL ."=" . $poster_id) : "mailto:" . $postrow[$i]['user_email'];
! $email_img = "<a href=\"$email_uri\"><img src=\"" . $images['icon_email'] . "\" alt=\"" . $lang['Send_email'] . "\" border=\"0\" /></a>";
}
else
--- 839,843 ----
$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL ."=" . $poster_id) : "mailto:" . $postrow[$i]['user_email'];
! $email_img = "<a href=\"$email_uri\"><img src=\"" . $images['icon_email'] . "\" alt=\"" . $lang['Send_email'] . "\" title=\"" . $lang['Send_email'] . "\" border=\"0\" /></a>";
}
else
***************
*** 821,825 ****
}
! $www_img = ($postrow[$i]['user_website']) ? "<a href=\"" . $postrow[$i]['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : "";
if( !empty($postrow[$i]['user_icq']) )
--- 846,850 ----
}
! $www_img = ($postrow[$i]['user_website']) ? "<a href=\"" . $postrow[$i]['user_website'] . "\" target=\"_userwww\"><img src=\"" . $images['icon_www'] . "\" alt=\"" . $lang['Visit_website'] . "\" title=\"" . $lang['Visit_website'] . "\" border=\"0\" /></a>" : "";
if( !empty($postrow[$i]['user_icq']) )
***************
*** 834,843 ****
if( $theme['template_name'] == "subSilver" )
{
! $icq_add_img = '<table width="59" border="0" cellspacing="0" cellpadding="0"><tr><td nowrap="nowrap" class="icqback"><img src="images/spacer.gif" width="3" height="18" alt = "">' . $icq_status_img . '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '"><img src="images/spacer.gif" width="35" height="18" border="0" alt="' . $lang['ICQ'] . '" /></a></td></tr></table>';
$icq_status_img = "";
}
else
{
! $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $postrow[$i]['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>";
}
}
--- 859,868 ----
if( $theme['template_name'] == "subSilver" )
{
! $icq_add_img = '<table width="59" border="0" cellspacing="0" cellpadding="0"><tr><td nowrap="nowrap" class="icqback"><img src="images/spacer.gif" width="3" height="18" alt = "" />' . $icq_status_img . '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '"><img src="images/spacer.gif" width="35" height="18" border="0" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" /></a></td></tr></table>';
$icq_status_img = "";
}
else
{
! $icq_add_img = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $postrow[$i]['user_icq'] . "\"><img src=\"" . $images['icon_icq'] . "\" alt=\"" . $lang['ICQ'] . "\" title=\"" . $lang['ICQ'] . "\" border=\"0\" /></a>";
}
}
***************
*** 848,856 ****
}
! $aim_img = ($postrow[$i]['user_aim']) ? "<a href=\"aim:goim?screenname=" . $postrow[$i]['user_aim'] . "&message=Hello+Are+you+there?\"><img src=\"" . $images['icon_aim'] . "\" border=\"0\" alt=\"" . $lang['AIM'] . "\" /></a>" : "";
! $msn_img = ($postrow[$i]['user_msnm']) ? "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id") . "\"><img src=\"" . $images['icon_msnm'] . "\" border=\"0\" alt=\"" . $lang['MSNM'] . "\" /></a>" : "";
! $yim_img = ($postrow[$i]['user_yim']) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=" . $postrow[$i]['user_yim'] . "&.src=pg\"><img src=\"" . $images['icon_yim'] . "\" border=\"0\" alt=\"" . $lang['YIM'] . "\" /></a>" : "";
}
else
--- 873,881 ----
}
! $aim_img = ($postrow[$i]['user_aim']) ? "<a href=\"aim:goim?screenname=" . $postrow[$i]['user_aim'] . "&message=Hello+Are+you+there?\"><img src=\"" . $images['icon_aim'] . "\" alt=\"" . $lang['AIM'] . "\" title=\"" . $lang['AIM'] . "\" border=\"0\" /></a>" : "";
! $msn_img = ($postrow[$i]['user_msnm']) ? "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id") . "\"><img src=\"" . $images['icon_msnm'] . "\" alt=\"" . $lang['MSNM'] . "\" title=\"" . $lang['MSNM'] . "\" border=\"0\" /></a>" : "";
! $yim_img = ($postrow[$i]['user_yim']) ? "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=" . $postrow[$i]['user_yim'] . "&.src=pg\"><img src=\"" . $images['icon_yim'] . "\" alt=\"" . $lang['YIM'] . "\" title=\"" . $lang['YIM'] . "\" border=\"0\" /></a>" : "";
}
else
***************
*** 867,871 ****
}
! $quote_img = "<a href=\"" . append_sid("posting.$phpEx?mode=quote&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_quote'] . "\" alt=\"" . $lang['Reply_with_quote'] ."\" border=\"0\" /></a>";
$search_img = "<a href=\"" . append_sid("search.$phpEx?search_author=" . urlencode($poster)) . "\"><img src=\"" . $images['icon_search'] . "\" border=\"0\" /></a>";
--- 892,896 ----
}
! $quote_img = "<a href=\"" . append_sid("posting.$phpEx?mode=quote&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_quote'] . "\" alt=\"" . $lang['Reply_with_quote'] ."\" title=\"" . $lang['Reply_with_quote'] ."\" border=\"0\" /></a>";
$search_img = "<a href=\"" . append_sid("search.$phpEx?search_author=" . urlencode($poster)) . "\"><img src=\"" . $images['icon_search'] . "\" border=\"0\" /></a>";
***************
*** 873,877 ****
if( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] )
{
! $edit_img = "<a href=\"" . append_sid("posting.$phpEx?mode=editpost&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_edit'] . "\" alt=\"" . $lang['Edit_delete_post'] . "\" border=\"0\" /></a>";
}
else
--- 898,902 ----
if( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] )
{
! $edit_img = "<a href=\"" . append_sid("posting.$phpEx?mode=editpost&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_edit'] . "\" alt=\"" . $lang['Edit_delete_post'] . "\" title=\"" . $lang['Edit_delete_post'] . "\" border=\"0\" /></a>";
}
else
***************
*** 882,888 ****
if( $is_auth['auth_mod'] )
{
! $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>";
! $delpost_img = "<a href=\"" . append_sid("posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>";
}
else
--- 907,913 ----
if( $is_auth['auth_mod'] )
{
! $ip_img = "<a href=\"" . append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id) . "\"><img src=\"" . $images['icon_ip'] . "\" alt=\"" . $lang['View_IP'] . "\" title=\"" . $lang['View_IP'] . "\" border=\"0\" /></a>";
! $delpost_img = "<a href=\"" . append_sid("posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" title=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>";
}
else
***************
*** 892,896 ****
if( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $i == $total_replies - 1 )
{
! $delpost_img = "<a href=\"" . append_sid("posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>";
}
else
--- 917,921 ----
if( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $i == $total_replies - 1 )
{
! $delpost_img = "<a href=\"" . append_sid("posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id']) . "\"><img src=\"" . $images['icon_delpost'] . "\" alt=\"" . $lang['Delete_post'] . "\" title=\"" . $lang['Delete_post'] . "\" border=\"0\" /></a>";
}
else
***************
*** 909,912 ****
--- 934,952 ----
//
+ // Note! The order used for parsing the message _is_
+ // important, moving things around could break any
+ // output
+ //
+ $message = make_clickable($message);
+
+ //
+ // Highlight active words (primarily for search)
+ //
+ if( $highlight_active )
+ {
+ $message = preg_replace($highlight_match, $highlight_replace, $message);
+ }
+
+ //
// If the board has HTML off but the post has HTML
// on then we process it, else leave it alone
***************
*** 925,928 ****
--- 965,971 ----
}
+ //
+ // Parse signature for BBCode if reqd.
+ //
if( $user_sig != "" && $postrow[$i]['enable_sig'] && $user_sig_bbcode_uid != "" )
{
***************
*** 930,933 ****
--- 973,979 ----
}
+ //
+ // Parse message for BBCode if reqd
+ //
if( $bbcode_uid != "" )
{
***************
*** 935,945 ****
}
! if( $highlight_active )
! {
! $message = preg_replace($highlight_match, $highlight_replace, $message);
! }
!
! $message = make_clickable($message);
!
if( $postrow[$i]['enable_sig'] && $user_sig != "" )
{
--- 981,987 ----
}
! //
! // Append signature
! //
if( $postrow[$i]['enable_sig'] && $user_sig != "" )
{
***************
*** 947,950 ****
--- 989,995 ----
}
+ //
+ // Replace naughty words
+ //
if( count($orig_word) )
{
***************
*** 953,956 ****
--- 998,1004 ----
}
+ //
+ // Parse smilies
+ //
if( $board_config['allow_smilies'] && $postrow[$i]['enable_smilies'] )
{
***************
*** 958,961 ****
--- 1006,1013 ----
}
+ //
+ // Replace newlines (we use this rather than nl2br because
+ // till recently it wasn't XHTML compliant)
+ //
$message = str_replace("\n", "<br />", $message);
***************
*** 1033,1049 ****
$s_auth_can .= sprintf($lang['Rules_moderate'], "<a href=\"" . append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id") . "\">", "</a>");
! $topic_mod = "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=delete") . "\"><img src=\"" . $images['topic_mod_delete'] . "\" alt = \"" . $lang['Delete_topic'] . "\" border=\"0\" /></a> ";
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move"). "\"><img src=\"" . $images['topic_mod_move'] . "\" alt = \"" . $lang['Move_topic'] . "\" border=\"0\" /></a> ";
if($forum_row['topic_status'] == TOPIC_UNLOCKED)
{
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock") . "\"><img src=\"" . $images['topic_mod_lock'] . "\" alt = \"" . $lang['Lock_topic'] . "\" border=\"0\" /></a> ";
}
else
{
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unlock") . "\"><img src=\"" . $images['topic_mod_unlock'] . "\" alt = \"" . $lang['Unlock_topic'] . "\" border=\"0\" /></a> ";
}
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=split") . "\"><img src=\"" . $images['topic_mod_split'] . "\" alt = \"" . $lang['Split_topic'] . "\" border=\"0\" /></a> ";
}
--- 1085,1101 ----
$s_auth_can .= sprintf($lang['Rules_moderate'], "<a href=\"" . append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id") . "\">", "</a>");
! $topic_mod = "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=delete") . "\"><img src=\"" . $images['topic_mod_delete'] . "\" alt=\"" . $lang['Delete_topic'] . "\" title=\"" . $lang['Delete_topic'] . "\" border=\"0\" /></a> ";
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move"). "\"><img src=\"" . $images['topic_mod_move'] . "\" alt=\"" . $lang['Move_topic'] . "\" title=\"" . $lang['Move_topic'] . "\" border=\"0\" /></a> ";
if($forum_row['topic_status'] == TOPIC_UNLOCKED)
{
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock") . "\"><img src=\"" . $images['topic_mod_lock'] . "\" alt=\"" . $lang['Lock_topic'] . "\" title=\"" . $lang['Lock_topic'] . "\" border=\"0\" /></a> ";
}
else
{
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unlock") . "\"><img src=\"" . $images['topic_mod_unlock'] . "\" alt=\"" . $lang['Unlock_topic'] . "\" title=\"" . $lang['Unlock_topic'] . "\" border=\"0\" /></a> ";
}
! $topic_mod .= "<a href=\"" . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=split") . "\"><img src=\"" . $images['topic_mod_split'] . "\" alt=\"" . $lang['Split_topic'] . "\" title=\"" . $lang['Split_topic'] . "\" border=\"0\" /></a> ";
}
***************
*** 1056,1065 ****
{
$s_watching_topic = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start") . "\">" . $lang['Stop_watching_topic'] . "</a>";
! $s_watching_topic_img = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start") . "\"><img src=\"" . $images['Topic_un_watch'] . "\" alt=\"" . $lang['Stop_watching_topic'] . "\" border=\"0\"></a>";
}
else
{
$s_watching_topic = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start") . "\">" . $lang['Start_watching_topic'] . "</a>";
! $s_watching_topic_img = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start") . "\"><img src=\"" . $images['Topic_watch'] . "\" alt=\"" . $lang['Start_watching_topic'] . "\" border=\"0\"></a>";
}
}
--- 1108,1117 ----
{
$s_watching_topic = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start") . "\">" . $lang['Stop_watching_topic'] . "</a>";
! $s_watching_topic_img = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&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&watch=topic&start=$start") . "\">" . $lang['Start_watching_topic'] . "</a>";
! $s_watching_topic_img = "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start") . "\"><img src=\"" . $images['Topic_watch'] . "\" alt=\"" . $lang['Start_watching_topic'] . "\" title=\"" . $lang['Start_watching_topic'] . "\" border=\"0\"></a>";
}
}
Index: viewforum.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/viewforum.php,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -r1.106 -r1.107
*** viewforum.php 2001/11/26 12:09:37 1.106
--- viewforum.php 2001/12/05 00:20:52 1.107
***************
*** 113,159 ****
if( $mark_read == "topics" )
{
! if( $userdata['session_last_visit'] )
{
! $sql = "SELECT t.topic_id, p.post_time
! FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
! WHERE t.forum_id = $forum_id
! AND p.post_id = t.topic_last_post_id
! AND p.post_time > " . $userdata['sessi...
[truncated message content] |