More fixes and updates

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@2572 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-05-13 01:30:59 +00:00
parent 6ca24b8a9f
commit 9fe7c358a1
7 changed files with 74 additions and 78 deletions

View file

@ -100,15 +100,13 @@ if( isset($HTTP_POST_VARS['submit']) )
if(!empty($forum_id)) if(!empty($forum_id))
{ {
$sql = "UPDATE " . FORUMS_TABLE . " SET ";
if(isset($HTTP_POST_VARS['simpleauth'])) if(isset($HTTP_POST_VARS['simpleauth']))
{ {
$simple_ary = $simple_auth_ary[$HTTP_POST_VARS['simpleauth']]; $simple_ary = $simple_auth_ary[$HTTP_POST_VARS['simpleauth']];
for($i = 0; $i < count($simple_ary); $i++) for($i = 0; $i < count($simple_ary); $i++)
{ {
$sql .= ( ( $i < count($simple_ary) - 1 ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i]; $sql .= ( ( $sql != '' ) ? ', ' : '' ) . $forum_auth_fields[$i] . ' = ' . $simple_ary[$i];
} }
$sql .= " WHERE forum_id = $forum_id"; $sql .= " WHERE forum_id = $forum_id";
@ -127,22 +125,21 @@ if( isset($HTTP_POST_VARS['submit']) )
} }
} }
$sql .= ( ( $i < count($forum_auth_fields) - 1 ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value; $sql .= ( ( $sql != '' ) ? ', ' : '' ) .$forum_auth_fields[$i] . ' = ' . $value;
} }
$sql .= " WHERE forum_id = $forum_id"; $sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
} }
if ( $sql != '' ) if ( $sql != '' )
{ {
if ( !$db->sql_query($sql) ) if ( !$db->sql_query($sql) )
{ {
message_die(GENERAL_ERROR, "Couldn't update auth table!", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not update auth table', '', __LINE__, __FILE__, $sql);
} }
} }
$forum_sql = ""; $forum_sql = '';
$adv = 0; $adv = 0;
} }

View file

@ -157,19 +157,19 @@ function auth($type, $forum_id, $userdata, $f_access = '')
} }
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{
do
{ {
if ( $forum_id != AUTH_LIST_ALL) if ( $forum_id != AUTH_LIST_ALL)
{ {
$u_access[] = $row; $u_access[] = $row;
} }
else else
{
do
{ {
$u_access[$row['forum_id']][] = $row; $u_access[$row['forum_id']][] = $row;
} }
while( $row = $db->sql_fetchrow($result) );
} }
while( $row = $db->sql_fetchrow($result) );
} }
} }

View file

@ -606,7 +606,7 @@ function make_clickable($text)
// matches an "xxxx://yyyy" URL at the start of a line, or after a space. // matches an "xxxx://yyyy" URL at the start of a line, or after a space.
// xxxx can only be alpha characters. // xxxx can only be alpha characters.
// yyyy is anything up to the first space, newline, or comma. // yyyy is anything up to the first space, newline, or comma.
$ret = preg_replace("#([\n ])([a-z]+?)://([^,\t <\n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret); $ret = preg_replace("#([\n ])([a-z]+?)://([^\t <\n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
// Must contain at least 2 dots. xxxx contains either alphanum, or "-" // Must contain at least 2 dots. xxxx contains either alphanum, or "-"
@ -614,7 +614,7 @@ function make_clickable($text)
// zzzz is optional.. will contain everything up to the first space, newline, or comma. // zzzz is optional.. will contain everything up to the first space, newline, or comma.
// This is slightly restrictive - it's not going to match stuff like "forums.foo.com" // This is slightly restrictive - it's not going to match stuff like "forums.foo.com"
// This is to keep it from getting annoying and matching stuff that's not meant to be a link. // This is to keep it from getting annoying and matching stuff that's not meant to be a link.
$ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^,\t <\n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret); $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^\t <\n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret);
// matches an email@domain type address at the start of a line, or after a space. // matches an email@domain type address at the start of a line, or after a space.
// Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".

View file

@ -397,7 +397,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
$topic_update_sql .= "topic_replies = topic_replies - 1"; $topic_update_sql .= "topic_replies = topic_replies - 1";
$sql = "SELECT MAX(post_id) AS post_id $sql = "SELECT MAX(post_id) AS last_post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if ( !($db->sql_query($sql)) ) if ( !($db->sql_query($sql)) )
@ -407,13 +407,13 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
$topic_update_sql .= ', topic_last_post_id = ' . $row['post_id']; $topic_update_sql .= ', topic_last_post_id = ' . $row['last_post_id'];
} }
} }
if ( $post_data['last_topic'] ) if ( $post_data['last_topic'] )
{ {
$sql = "SELECT MAX(post_id) AS post_id $sql = "SELECT MAX(post_id) AS last_post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE forum_id = $forum_id"; WHERE forum_id = $forum_id";
if ( !($db->sql_query($sql)) ) if ( !($db->sql_query($sql)) )
@ -423,13 +423,13 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
$forum_update_sql .= ( $row['post_id'] ) ? ', forum_last_post_id = ' . $row['post_id'] : ', forum_last_post_id = 0'; $forum_update_sql .= ( $row['last_post_id'] ) ? ', forum_last_post_id = ' . $row['last_post_id'] : ', forum_last_post_id = 0';
} }
} }
} }
else if ( $post_data['first_post'] ) else if ( $post_data['first_post'] )
{ {
$sql = "SELECT MIN(post_id) AS post_id $sql = "SELECT MIN(post_id) AS first_post_id
FROM " . POSTS_TABLE . " FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id"; WHERE topic_id = $topic_id";
if ( !($db->sql_query($sql)) ) if ( !($db->sql_query($sql)) )
@ -439,7 +439,7 @@ function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_i
if ( $row = $db->sql_fetchrow($result) ) if ( $row = $db->sql_fetchrow($result) )
{ {
$topic_update_sql .= 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['post_id']; $topic_update_sql .= 'topic_replies = topic_replies - 1, topic_first_post_id = ' . $row['first_post_id'];
} }
} }
else else
@ -517,13 +517,6 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
} }
$sql = "DELETE FROM " . SEARCH_MATCH_TABLE . "
WHERE post_id = $post_id";
if ( !($db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in deleting post', '', __LINE__, __FILE__, $sql);
}
$topic_update_sql .= 'topic_replies = topic_replies - 1'; $topic_update_sql .= 'topic_replies = topic_replies - 1';
if ( $post_data['last_post'] ) if ( $post_data['last_post'] )
{ {
@ -546,12 +539,14 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
} }
} }
} }
remove_search_post($post_id);
} }
if( $mode == 'poll_delete' || ( $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] ) && $post_data['has_poll'] && $post_data['edit_poll'] ) if( $mode == 'poll_delete' || ( $mode == 'delete' && $post_data['first_post'] && $post_data['last_post'] ) && $post_data['has_poll'] && $post_data['edit_poll'] )
{ {
$sql = "DELETE FROM " . VOTE_DESC_TABLE . " $sql = "DELETE FROM " . VOTE_DESC_TABLE . "
WHERE vote_id = $poll_id"; WHERE topic_id = $topic_id";
if ( !($db->sql_query($sql)) ) if ( !($db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Error in deleting poll', '', __LINE__, __FILE__, $sql);
@ -572,7 +567,6 @@ function delete_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
} }
} }
remove_search_post($post_id);
// //
// Ok we set variables above that were intended to update the topics table // Ok we set variables above that were intended to update the topics table
// so let's go ahead and use it already :) // so let's go ahead and use it already :)

View file

@ -21,7 +21,6 @@
function clean_words($mode, &$entry, &$stopword_list, &$synonym_list) function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
{ {
// Weird, $init_match doesn't work with static when double quotes (") are used...
static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!'); static $drop_char_match = array('^', '$', '&', '(', ')', '<', '>', '`', '\'', '"', '|', ',', '@', '_', '?', '%', '-', '~', '+', '.', '[', ']', '{', '}', ':', '\\', '/', '=', '#', '\'', ';', '!');
static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' '); static $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' , ' ', ' ', ' ', ' ', ' ', ' ');
@ -42,13 +41,10 @@ function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
} }
else if ( $mode == 'search' ) else if ( $mode == 'search' )
{ {
$entry = str_replace('+', ' and ', $entry); $entry = str_replace(' +', ' and ', $entry);
$entry = str_replace('-', ' not ', $entry); $entry = str_replace(' -', ' not ', $entry);
} }
// Replace numbers on their own
$entry = preg_replace('/\b[0-9]+\b/', ' ', $entry);
// //
// Filter out strange characters like ^, $, &, change "it's" to "its" // Filter out strange characters like ^, $, &, change "it's" to "its"
// //
@ -61,8 +57,8 @@ function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
{ {
$entry = str_replace('*', ' ', $entry); $entry = str_replace('*', ' ', $entry);
// 'words' that consist of <=3 or >=25 characters are removed. // 'words' that consist of <=3 or >=20 characters are removed.
$entry = preg_replace('/\b([a-z0-9]{1,3}|[a-z0-9]{20,})\b/',' ', $entry); $entry = preg_replace('/\b([a-z0-9]{1,3}|[a-z0-9]{21,})\b/',' ', $entry);
} }
if ( !empty($stopword_list) ) if ( !empty($stopword_list) )
@ -95,14 +91,8 @@ function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
function split_words(&$entry, $mode = 'post') function split_words(&$entry, $mode = 'post')
{ {
if ( $mode == 'post' ) $rex = ( $mode == 'post' ) ? "/\b(\w[\w']*\w+|\w+?)\b/" : '/(\*?[à-ÿa-z0-9]+\*?)|\b([à-ÿa-z0-9]+)\b/';
{ preg_match_all($rex, $entry, $split_entries);
preg_match_all("/\b(\w[\w']*\w+|\w+?)\b/", $entry, $split_entries);
}
else
{
preg_match_all('/(\*?[à-ÿa-z0-9]+\*?)|\b([à-ÿa-z0-9]+)\b/', $entry, $split_entries);
}
return $split_entries[1]; return $split_entries[1];
} }

View file

@ -117,6 +117,11 @@ $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) :
$sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['Sort_Topic_Title'], $lang['Sort_Author'], $lang['Sort_Forum']); $sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['Sort_Topic_Title'], $lang['Sort_Author'], $lang['Sort_Forum']);
//
// encoding match for workaround
//
$multibyte_charset = 'utf-8, big5, shift_jis, euc-kr, gb2312';
// //
// Begin core code // Begin core code
// //
@ -235,10 +240,9 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt'); $synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
$split_search = array(); $split_search = array();
$cleaned_search = clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array); $split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);
$split_search = split_words($cleaned_search, 'search');
$search_msg_only = ( !$search_fields ) ? "AND m.title_match = 0" : ''; $search_msg_only = ( !$search_fields ) ? "AND m.title_match = 0" : ( ( strstr($multibyte_charset, $lang['ENCODING']) ) ? '' : '' );
$word_count = 0; $word_count = 0;
$current_match_type = 'or'; $current_match_type = 'or';
@ -268,14 +272,25 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
$current_match_type = 'and'; $current_match_type = 'and';
} }
if ( !strstr($multibyte_charset, $lang['ENCODING']) )
{
$match_word = str_replace('*', '%', $split_search[$i]); $match_word = str_replace('*', '%', $split_search[$i]);
$sql = "SELECT m.post_id $sql = "SELECT m.post_id
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
WHERE w.word_text LIKE '$match_word' WHERE w.word_text LIKE '$match_word'
AND m.word_id = w.word_id AND m.word_id = w.word_id
AND w.word_common <> 1 AND w.word_common <> 1
$search_msg_only"; $search_msg_only";
}
else
{
$match_word = addslashes('%' . str_replace('*', '', $split_search[$i]) . '%');
$search_msg_only = ( $search_fields ) ? "OR post_subject LIKE '$match_word'" : '';
$sql = "SELECT post_id
FROM " . POSTS_TEXT_TABLE . "
WHERE post_text LIKE '$match_word'
$search_msg_only";
}
if ( !($result = $db->sql_query($sql)) ) if ( !($result = $db->sql_query($sql)) )
{ {
message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);

View file

@ -140,9 +140,9 @@ $join_sql_table = ( !isset($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POST
$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"; $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"; $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"; $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, t.topic_last_post_id, 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 . " $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, 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 . " FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql WHERE $join_sql
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
@ -152,12 +152,12 @@ if ( !($result = $db->sql_query($sql)) )
message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql);
} }
if ( !($forum_row = $db->sql_fetchrow($result)) ) if ( !($forum_topic_data = $db->sql_fetchrow($result)) )
{ {
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
} }
$forum_id = $forum_row['forum_id']; $forum_id = $forum_topic_data['forum_id'];
// //
// Start session management // Start session management
@ -172,7 +172,7 @@ init_userprefs($userdata);
// Start auth check // Start auth check
// //
$is_auth = array(); $is_auth = array();
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_row); $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);
if( !$is_auth['auth_view'] || !$is_auth['auth_read'] ) if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
{ {
@ -192,14 +192,14 @@ if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
// End auth check // End auth check
// //
$forum_name = $forum_row['forum_name']; $forum_name = $forum_topic_data['forum_name'];
$topic_title = $forum_row['topic_title']; $topic_title = $forum_topic_data['topic_title'];
$topic_id = $forum_row['topic_id']; $topic_id = $forum_topic_data['topic_id'];
$topic_time = $forum_row['topic_time']; $topic_time = $forum_topic_data['topic_time'];
if ( !empty($post_id) ) if ( !empty($post_id) )
{ {
$start = floor(($forum_row['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page']; $start = floor(($forum_topic_data['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page'];
} }
// //
@ -342,7 +342,7 @@ if( !empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']) )
} }
else else
{ {
$total_replies = $forum_row['topic_replies'] + 1; $total_replies = $forum_topic_data['topic_replies'] + 1;
$limit_posts_time = ''; $limit_posts_time = '';
$post_days = 0; $post_days = 0;
@ -499,10 +499,10 @@ $nav_links['up'] = array(
'title' => $forum_name 'title' => $forum_name
); );
$reply_img = ( $forum_row['forum_status'] == FORUM_LOCKED || $forum_row['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new']; $reply_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new'];
$reply_alt = ( $forum_row['forum_status'] == FORUM_LOCKED || $forum_row['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Reply_to_topic']; $reply_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Reply_to_topic'];
$post_img = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new']; $post_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'];
$post_alt = ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic']; $post_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'];
// //
// Set a cookie for this topic // Set a cookie for this topic
@ -567,7 +567,7 @@ if ( $is_auth['auth_mod'] )
$topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=move"). '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a>&nbsp;'; $topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=move"). '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a>&nbsp;';
$topic_mod .= ( $forum_row['topic_status'] == TOPIC_UNLOCKED ) ? '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=lock") . '"><img src="' . $images['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a>&nbsp;' : '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=unlock") . '"><img src="' . $images['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a>&nbsp;'; $topic_mod .= ( $forum_topic_data['topic_status'] == TOPIC_UNLOCKED ) ? '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=lock") . '"><img src="' . $images['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a>&nbsp;' : '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=unlock") . '"><img src="' . $images['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a>&nbsp;';
$topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=split") . '"><img src="' . $images['topic_mod_split'] . '" alt="' . $lang['Split_topic'] . '" title="' . $lang['Split_topic'] . '" border="0" /></a>&nbsp;'; $topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;mode=split") . '"><img src="' . $images['topic_mod_split'] . '" alt="' . $lang['Split_topic'] . '" title="' . $lang['Split_topic'] . '" border="0" /></a>&nbsp;';
} }
@ -646,7 +646,7 @@ $template->assign_vars(array(
// //
// Does this topic contain a poll? // Does this topic contain a poll?
// //
if ( !empty($forum_row['topic_vote']) ) if ( !empty($forum_topic_data['topic_vote']) )
{ {
$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result $sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result
FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
@ -689,7 +689,7 @@ if ( !empty($forum_row['topic_vote']) )
$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0; $poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;
if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_row['topic_status'] == TOPIC_LOCKED ) if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_topic_data['topic_status'] == TOPIC_LOCKED )
{ {
$template->set_filenames(array( $template->set_filenames(array(
'pollbox' => 'viewtopic_poll_result.tpl') 'pollbox' => 'viewtopic_poll_result.tpl')
@ -987,7 +987,7 @@ for($i = 0; $i < $total_posts; $i++)
$ip_img = ''; $ip_img = '';
$ip = ''; $ip = '';
if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $i == $total_replies - 1 ) if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] )
{ {
$temp_url = append_sid("posting.$phpEx?mode=delete&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']); $temp_url = append_sid("posting.$phpEx?mode=delete&amp;" . POST_POST_URL . "=" . $postrow[$i]['post_id']);
$delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>'; $delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>';