Fix default AND for word concaten..blah blah

git-svn-id: file:///svn/phpbb/trunk@2326 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-03-18 22:59:39 +00:00
parent 315f0e4d3a
commit 0fb594ca58

View file

@ -68,11 +68,11 @@ else
$search_id = ( isset($HTTP_GET_VARS['search_id']) ) ? $HTTP_GET_VARS['search_id'] : "";
$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : "posts";
$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : 'posts';
if( isset($HTTP_POST_VARS['search_terms']) )
{
$search_terms = ( $HTTP_POST_VARS['search_terms'] == "all" ) ? 1 : 0;
$search_terms = ( $HTTP_POST_VARS['search_terms'] == 'all' ) ? 1 : 0;
}
else
{
@ -81,7 +81,7 @@ else
if( isset($HTTP_POST_VARS['search_fields']) )
{
$search_fields = ( $HTTP_POST_VARS['search_fields'] == "all" ) ? 1 : 0;
$search_fields = ( $HTTP_POST_VARS['search_fields'] == 'all' ) ? 1 : 0;
}
else
{
@ -97,11 +97,11 @@ $sort_by = ( isset($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_
if( isset($HTTP_POST_VARS['sort_dir']) )
{
$sort_dir = ( $HTTP_POST_VARS['sort_dir'] == "DESC" ) ? "DESC" : "ASC";
$sort_dir = ( $HTTP_POST_VARS['sort_dir'] == 'DESC' ) ? 'DESC' : 'ASC';
}
else
{
$sort_dir = "DESC";
$sort_dir = 'DESC';
}
if(!empty($HTTP_POST_VARS['search_time']) )
@ -119,7 +119,7 @@ $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) :
// Define some globally used data
//
$sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['Sort_Topic_Title'], $lang['Sort_Author'], $lang['Sort_Forum']);
$sort_by_sql = array("p.post_time", "pt.post_subject", "t.topic_title", "u.username", "f.forum_id");
$sort_by_sql = array('p.post_time', 'pt.post_subject', 't.topic_title', 'u.username', 'f.forum_id');
//
// Begin core code
@ -139,7 +139,7 @@ if( $mode == 'searchuser' )
}
else
{
username_search("", false);
username_search('', false);
}
exit;
@ -169,9 +169,9 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
exit;
}
$show_results = "topics";
$show_results = 'topics';
$sort_by = 0;
$sort_dir = "DESC";
$sort_dir = 'DESC';
}
else if ( $search_id == 'egosearch' )
{
@ -187,13 +187,13 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
exit;
}
$show_results = "topics";
$show_results = 'topics';
$sort_by = 0;
$sort_dir = "DESC";
$sort_dir = 'DESC';
}
else
{
$search_author = str_replace("*", "%", trim($search_author));
$search_author = str_replace('*', '%', trim($search_author));
$sql = "SELECT user_id
FROM " . USERS_TABLE . "
@ -224,7 +224,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain matched posts list", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);
}
$search_ids = array();
@ -239,17 +239,17 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
}
else if ( $search_keywords != '' )
{
$stopword_array = @file($phpbb_root_path . "language/lang_" . $board_config['default_lang'] . "/search_stopwords.txt");
$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');
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
$split_search = array();
$cleaned_search = clean_words("search", stripslashes($search_keywords), $stopword_array, $synonym_array);
$split_search = split_words($cleaned_search, "search");
$cleaned_search = clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array);
$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" : '';
$word_count = 0;
$current_match_type = 'and';
$current_match_type = 'or';
$word_match = array();
$result_list = array();
@ -273,10 +273,10 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
default:
if( !empty($search_terms) )
{
$current_match_type = "and";
$current_match_type = 'and';
}
$match_word = str_replace("*", "%", $split_search[$i]);
$match_word = str_replace('*', '%', $split_search[$i]);
$sql = "SELECT m.post_id
FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m
@ -286,7 +286,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$search_msg_only";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain matched posts list", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);
}
$row = array();
@ -298,17 +298,17 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
{
$result_list[$temp_row['post_id']] = 1;
}
else if ( $current_match_type == "or" )
else if ( $current_match_type == 'or' )
{
$result_list[$temp_row['post_id']] = 1;
}
else if ( $current_match_type == "not" )
else if ( $current_match_type == 'not' )
{
$result_list[$temp_row['post_id']] = 0;
}
}
if ( $current_match_type == "and" && $word_count )
if ( $current_match_type == 'and' && $word_count )
{
@reset($result_list);
while( list($post_id, $match_count) = @each($result_list) )
@ -347,7 +347,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
//
// If not logged in we explicitly prevent searching of private forums
//
$auth_sql = "";
$auth_sql = '';
if ( $search_forum != -1 )
{
$is_auth = auth(AUTH_READ, $search_forum, $userdata);
@ -368,41 +368,41 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$auth_sql = "f.cat_id = $search_cat";
}
$ignore_forum_sql = "";
$ignore_forum_sql = '';
while( list($key, $value) = each($is_auth_ary) )
{
if ( !$value['auth_read'] )
{
$ignore_forum_sql .= ( ( $ignore_forum_sql != "" ) ? ", " : "" ) . $key;
$ignore_forum_sql .= ( ( $ignore_forum_sql != '' ) ? ', ' : '' ) . $key;
}
}
if ( $ignore_forum_sql != "" )
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) ";
$auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id NOT IN ($ignore_forum_sql) " : "f.forum_id NOT IN ($ignore_forum_sql) ";
}
}
//
// Author name search
//
if ( $search_author != "" )
if ( $search_author != '' )
{
$search_author = str_replace("*", "%", trim(str_replace("\'", "''", $search_author)));
$search_author = str_replace('*', '%', trim(str_replace("\'", "''", $search_author)));
}
if ( $total_match_count )
{
if ( $show_results == "topics" )
if ( $show_results == 'topics' )
{
$where_sql = "";
$where_sql = '';
if ( $search_time )
{
$where_sql .= ( $search_author == "" && $auth_sql == "" ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time ";
$where_sql .= ( $search_author == '' && $auth_sql == '' ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time ";
}
if ( $search_author == "" && $auth_sql == "" )
if ( $search_author == '' && $auth_sql == '' )
{
$sql = "SELECT topic_id
FROM " . POSTS_TABLE . "
@ -435,7 +435,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain topic ids", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
}
$search_ids = array();
@ -450,12 +450,12 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
}
else if ( $search_author != '' || $search_time || $auth_sql != '' )
{
$where_sql = ( $search_author == "" && $auth_sql == "" ) ? "post_id IN (" . implode(", ", $search_ids) . ")" : "p.post_id IN (" . implode(", ", $search_ids) . ")";
$from_sql = ( $search_author == "" && $auth_sql == "" ) ? POSTS_TABLE : POSTS_TABLE . " p";
$where_sql = ( $search_author == '' && $auth_sql == '' ) ? "post_id IN (" . implode(', ', $search_ids) . ")" : "p.post_id IN (" . implode(", ", $search_ids) . ")";
$from_sql = ( $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . " p";
if ( $search_time )
{
$where_sql .= ( $search_author == "" && $auth_sql == "" ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time";
$where_sql .= ( $search_author == '' && $auth_sql == '' ) ? " AND post_time >= $search_time " : " AND p.post_time >= $search_time";
}
if ( $auth_sql != '' )
@ -475,7 +475,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
WHERE $where_sql";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain post ids", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
}
$search_ids = array();
@ -491,7 +491,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
}
else if ( $search_id == 'unanswered' )
{
if ( $auth_sql != "" )
if ( $auth_sql != '' )
{
$sql = "SELECT t.topic_id, f.forum_id
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
@ -510,7 +510,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain post ids", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain post ids', '', __LINE__, __FILE__, $sql);
}
$search_ids = array();
@ -525,9 +525,9 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
//
// Basic requirements
//
$show_results = "topics";
$show_results = 'topics';
$sort_by = 0;
$sort_dir = "DESC";
$sort_dir = 'DESC';
}
else
{
@ -554,7 +554,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
WHERE session_id NOT IN (" . implode(", ", $delete_search_ids) . ")";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't delete old search id sessions", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not delete old search id sessions', '', __LINE__, __FILE__, $sql);
}
}
}
@ -562,8 +562,8 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
//
// Store new result data
//
$search_results = implode(", ", $search_ids);
$per_page = ( $show_results == "posts" ) ? $board_config['posts_per_page'] : $board_config['topics_per_page'];
$search_results = implode(', ', $search_ids);
$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)
@ -590,7 +590,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
VALUES($search_id, '" . $userdata['session_id'] . "', '" . str_replace("\'", "''", $result_array) . "')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't insert search results", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not insert search results', '', __LINE__, __FILE__, $sql);
}
}
}
@ -602,7 +602,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
AND session_id = '". $userdata['session_id'] . "'";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain search results", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql);
}
if( $row = $db->sql_fetchrow($result) )
@ -618,9 +618,9 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
//
// Look up data ...
//
if ( $search_results != "" )
if ( $search_results != '' )
{
if ( $show_results == "posts" )
if ( $show_results == 'posts' )
{
$sql = "SELECT pt.post_text, pt.bbcode_uid, pt.post_subject, p.*, f.forum_id, f.forum_name, t.*, u.username, u.user_id, u.user_sig, u.user_sig_bbcode_uid
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " pt
@ -641,13 +641,13 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
AND p.poster_id = u2.user_id";
}
$per_page = ( $show_results == "posts" ) ? $board_config['posts_per_page'] : $board_config['topics_per_page'];
$per_page = ( $show_results == 'posts' ) ? $board_config['posts_per_page'] : $board_config['topics_per_page'];
$sql .= " ORDER BY " . $sort_by_sql[$sort_by] . " $sort_dir LIMIT $start, " . $per_page;
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't obtain search results", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain search results', '', __LINE__, __FILE__, $sql);
}
$searchset = array();
@ -671,37 +671,37 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$page_title = $lang['Search'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if ( $show_results == "posts" )
if ( $show_results == 'posts' )
{
$template->set_filenames(array(
"body" => "search_results_posts.tpl",
"jumpbox" => "jumpbox.tpl")
'body' => 'search_results_posts.tpl',
'jumpbox' => 'jumpbox.tpl')
);
}
else
{
$template->set_filenames(array(
"body" => "search_results_topics.tpl",
"jumpbox" => "jumpbox.tpl")
'body' => 'search_results_topics.tpl',
'jumpbox' => 'jumpbox.tpl')
);
}
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"L_GO" => $lang['Go'],
"L_JUMP_TO" => $lang['Jump_to'],
"L_SELECT_FORUM" => $lang['Select_forum'],
'L_GO' => $lang['Go'],
'L_JUMP_TO' => $lang['Jump_to'],
'L_SELECT_FORUM' => $lang['Select_forum'],
"S_JUMPBOX_LIST" => $jumpbox,
"S_JUMPBOX_ACTION" => append_sid("viewforum.$phpEx"))
'S_JUMPBOX_LIST' => $jumpbox,
'S_JUMPBOX_ACTION' => append_sid("viewforum.$phpEx"))
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_var_from_handle('JUMPBOX', 'jumpbox');
$l_search_matches = ( $total_match_count == 1 ) ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count);
$template->assign_vars(array(
"L_SEARCH_MATCHES" => $l_search_matches,
"L_TOPIC" => $lang['Topic'])
'L_SEARCH_MATCHES' => $l_search_matches,
'L_TOPIC' => $lang['Topic'])
);
$highlight_active = "";
@ -711,23 +711,23 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
{
$split_word = $split_search[$j];
if( $split_word != "and" && $split_word != "or" && $split_word != "not" )
if( $split_word != 'and' && $split_word != 'or' && $split_word != 'not' )
{
$highlight_active .= " " . $split_word;
$search_string[] = "#\b(" . str_replace("\*", ".*?", phpbb_preg_quote($split_word, "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])(?!.*?<\/span>)\b#i";
$replace_string[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\\1</b></span>';
$search_string[] = '#\b(' . str_replace("\*", ".*?", phpbb_preg_quote($split_word, '#')) . ')(?!.*?<\/a>)(?!.*?\[/url\])(?!.*?<\/span>)\b#i';
$replace_string[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\1</b></span>';
for ($k = 0; $k < count($synonym_array); $k++)
{
list($replace_synonym, $match_synonym) = split(" ", trim(strtolower($synonym_array[$k])));
list($replace_synonym, $match_synonym) = split(' ', trim(strtolower($synonym_array[$k])));
if( $replace_synonym == $split_word )
{
$search_string[] = "#\b(" . str_replace("\*", ".*?", phpbb_preg_quote($replace_synonym, "#")) . ")(?!.*?<\/a>)(?!.*?\[/url\])(?!.*?<\/span>)\b#i";
$replace_string[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\\1</b></span>';
$search_string[] = '#\b(' . str_replace('\*', '.*?', phpbb_preg_quote($replace_synonym, '#')) . ')(?!.*?<\/a>)(?!.*?\[/url\])(?!.*?<\/span>)\b#i';
$replace_string[] = '<span style="color:#' . $theme['fontcolor3'] . '"><b>\1</b></span>';
$highlight_active .= " " . $match_synonym;
$highlight_active .= ' ' . $match_synonym;
}
}
}
@ -735,8 +735,8 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$highlight_active = urlencode(trim($highlight_active));
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array();
$tracking_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();
for($i = 0; $i < count($searchset); $i++)
{
@ -752,7 +752,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$forum_id = $searchset[$i]['forum_id'];
$topic_id = $searchset[$i]['topic_id'];
if( $show_results == "posts" )
if( $show_results == 'posts' )
{
if( isset($return_chars) )
{
@ -764,16 +764,16 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
//
if( $return_chars != -1 )
{
$message = (strlen($message) > $return_chars) ? substr($message, 0, $return_chars) . " ..." : $message;
$message = (strlen($message) > $return_chars) ? substr($message, 0, $return_chars) . ' ...' : $message;
$message = strip_tags($message);
$message = preg_replace("/\[.*?:$bbcode_uid:?.*?\]/si", "", $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);
$message = preg_replace('/\[url\]|\[\/url\]/si', '', $message);
}
else
@ -782,13 +782,13 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
{
if( $postrow[$i]['enable_html'] )
{
$message = preg_replace("#(<)([\/]?.*?)(>)#is", "&lt;\\2&gt;", $message);
$message = preg_replace('#(<)([\/]?.*?)(>)#is', '&lt;\\2&gt;', $message);
}
}
if( $bbcode_uid != "" )
if( $bbcode_uid != '' )
{
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace("/\:[0-9a-z\:]+\]/si", "]", $message);
$message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message);
}
$message = make_clickable($message);
@ -809,7 +809,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
}
else
{
$post_subject = ( $searchset[$i]['post_subject'] != "" ) ? $searchset[$i]['post_subject'] : $topic_title;
$post_subject = ( $searchset[$i]['post_subject'] != '' ) ? $searchset[$i]['post_subject'] : $topic_title;
}
if($board_config['allow_smilies'] && $searchset[$i]['enable_smilies'])
@ -817,13 +817,13 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$message = smilies_pass($message);
}
$message = str_replace("\n", "<br />", $message);
$message = str_replace("\n", '<br />', $message);
}
$poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . "\">" : "";
$poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . '">' : '';
$poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
$poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? "</a>" : "";
$poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';
if( $userdata['session_logged_in'] && $searchset[$i]['post_time'] > $userdata['user_lastvisit'] )
{
@ -851,20 +851,20 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
}
$template->assign_block_vars("searchresults", array(
"TOPIC_TITLE" => $topic_title,
"FORUM_NAME" => $searchset[$i]['forum_name'],
"POST_SUBJECT" => $post_subject,
"POST_DATE" => $post_date,
"POSTER_NAME" => $poster,
"TOPIC_REPLIES" => $searchset[$i]['topic_replies'],
"TOPIC_VIEWS" => $searchset[$i]['topic_views'],
"MESSAGE" => $message,
'TOPIC_TITLE' => $topic_title,
'FORUM_NAME' => $searchset[$i]['forum_name'],
'POST_SUBJECT' => $post_subject,
'POST_DATE' => $post_date,
'POSTER_NAME' => $poster,
'TOPIC_REPLIES' => $searchset[$i]['topic_replies'],
'TOPIC_VIEWS' => $searchset[$i]['topic_views'],
'MESSAGE' => $message,
"MINI_POST_IMG" => $mini_post_img,
'MINI_POST_IMG' => $mini_post_img,
"U_POST" => $post_url,
"U_TOPIC" => $topic_url,
"U_FORUM" => $forum_url)
'U_POST' => $post_url,
'U_TOPIC' => $topic_url,
'U_FORUM' => $forum_url)
);
}
else
@ -880,11 +880,11 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
if($topic_type == POST_ANNOUNCE)
{
$topic_type = $lang['Topic_Announcement'] . " ";
$topic_type = $lang['Topic_Announcement'] . ' ';
}
else if($topic_type == POST_STICKY)
{
$topic_type = $lang['Topic_Sticky'] . " ";
$topic_type = $lang['Topic_Sticky'] . ' ';
}
else
{
@ -893,7 +893,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
if( $searchset[$i]['topic_vote'] )
{
$topic_type .= $lang['Topic_Poll'] . " ";
$topic_type .= $lang['Topic_Poll'] . ' ';
}
$views = $searchset[$i]['topic_views'];
@ -919,7 +919,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
{
if( $times != 1 )
{
$goto_page .= ", ";
$goto_page .= ', ';
}
$goto_page .= '<a href="' . $base_url . '">' . $times . '</a>';
@ -936,11 +936,11 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
if( $searchset[$i]['topic_status'] == TOPIC_MOVED )
{
$topic_type = $lang['Topic_Moved'] . " ";
$topic_type = $lang['Topic_Moved'] . ' ';
$topic_id = $searchset[$i]['topic_moved_id'];
$folder_image = "<img src=\"" . $images['folder'] . "\" alt=\"" . $lang['No_new_posts'] . "\" />";
$newest_post_img = "";
$folder_image = '<img src="' . $images['folder'] . '" alt="' . $lang['No_new_posts'] . '" />';
$newest_post_img = '';
}
else
{
@ -982,7 +982,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$unread_topics = true;
if( !empty($tracking_topics['' . $topic_id . '']) )
if( !empty($tracking_topics[$topic_id]) )
{
if( $tracking_topics[$topic_id] > $searchset[$i]['post_time'] )
{
@ -998,9 +998,9 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
}
}
if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_all"]) )
if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
{
if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f_all"] > $searchset[$i]['post_time'] )
if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $searchset[$i]['post_time'] )
{
$unread_topics = false;
}
@ -1008,7 +1008,7 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
if( $unread_topics )
{
$folder_image = "<img src=\"$folder_new\" alt=\"" . $lang['New_posts'] . "\" title=\"" . $lang['New_posts'] . "\" />";
$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&amp;view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_post'] . "\" title=\"" . $lang['View_newest_post'] . "\" border=\"0\" /></a> ";
}
@ -1017,13 +1017,13 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$folder_alt = ( $searchset[$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 = "";
$newest_post_img = '';
}
}
else if( $searchset[$i]['post_time'] > $userdata['user_lastvisit'] )
{
$folder_image = "<img src=\"$folder_new\" alt=\"" . $lang['New_posts'] . "\" title=\"" . $lang['New_posts'] . "\" />";
$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&amp;view=newest\"><img src=\"" . $images['icon_newest_reply'] . "\" alt=\"" . $lang['View_newest_post'] . "\" title=\"" . $lang['View_newest_post'] . "\" border=\"0\" /></a> ";
}
@ -1049,35 +1049,35 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
}
}
$topic_poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . "\">" : "";
$topic_poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
$topic_poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? "</a>" : "";
$topic_poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . '">' : '';
$topic_poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? $searchset[$i]['username'] : ( ( $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $lang['Guest'] );
$topic_poster .= ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : '';
$last_post_time = create_date($board_config['default_dateformat'], $searchset[$i]['post_time'], $board_config['board_timezone']);
$last_post_user = ( $searchset[$i]['id2'] == ANONYMOUS && $searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] : $searchset[$i]['user2'];
$last_post = $last_post_time . "<br />";
$last_post .= ( $searchset[$i]['id2'] == ANONYMOUS ) ? ( ($searchset[$i]['post_username'] != "" ) ? $searchset[$i]['post_username'] . " " : $lang['Guest'] . " " ) : "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['id2']) . "\">" . $searchset[$i]['user2'] . "</a> ";
$last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $searchset[$i]['topic_last_post_id']) . "#" . $searchset[$i]['topic_last_post_id'] . "\"><img src=\"" . $images['icon_latest_reply'] . "\" alt=\"" . $lang['View_latest_post'] . "\" title=\"" . $lang['View_latest_post'] . "\" border=\"0\" /></a>";
$last_post = $last_post_time . '<br />';
$last_post .= ( $searchset[$i]['id2'] == ANONYMOUS ) ? ( ($searchset[$i]['post_username'] != '' ) ? $searchset[$i]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['id2']) . '">' . $searchset[$i]['user2'] . '</a> ';
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $searchset[$i]['topic_last_post_id']) . '#' . $searchset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';
$template->assign_block_vars("searchresults", array(
"FORUM_NAME" => $searchset[$i]['forum_name'],
"FORUM_ID" => $forum_id,
"TOPIC_ID" => $topic_id,
"FOLDER" => $folder_image,
"NEWEST_POST_IMG" => $newest_post_img,
"TOPIC_POSTER" => $topic_poster,
"GOTO_PAGE" => $goto_page,
"REPLIES" => $replies,
"TOPIC_TITLE" => $topic_title,
"TOPIC_TYPE" => $topic_type,
"VIEWS" => $views,
"LAST_POST" => $last_post,
$template->assign_block_vars('searchresults', array(
'FORUM_NAME' => $searchset[$i]['forum_name'],
'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id,
'FOLDER' => $folder_image,
'NEWEST_POST_IMG' => $newest_post_img,
'TOPIC_POSTER' => $topic_poster,
'GOTO_PAGE' => $goto_page,
'REPLIES' => $replies,
'TOPIC_TITLE' => $topic_title,
'TOPIC_TYPE' => $topic_type,
'VIEWS' => $views,
'LAST_POST' => $last_post,
"U_VIEW_FORUM" => $forum_url,
"U_VIEW_TOPIC" => $topic_url,
"U_TOPIC_POSTER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']))
'U_VIEW_FORUM' => $forum_url,
'U_VIEW_TOPIC' => $topic_url,
'U_TOPIC_POSTER_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $searchset[$i]['user_id']))
);
}
}
@ -1085,13 +1085,13 @@ else if( $search_keywords != '' || $search_author != '' || $search_id )
$base_url = "search.$phpEx?search_id=$search_id";
$template->assign_vars(array(
"PAGINATION" => generate_pagination($base_url, $total_match_count, $per_page, $start),
"PAGE_NUMBER" => sprintf($lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_match_count / $per_page )),
'PAGINATION' => generate_pagination($base_url, $total_match_count, $per_page, $start),
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $per_page ) + 1 ), ceil( $total_match_count / $per_page )),
"L_GOTO_PAGE" => $lang['Goto_page'])
'L_GOTO_PAGE' => $lang['Goto_page'])
);
$template->pparse("body");
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
@ -1107,17 +1107,17 @@ $sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id
$result = $db->sql_query($sql);
if( !$result )
{
message_die(GENERAL_ERROR, "Couldn't obtain forum_name/forum_id", "", __LINE__, __FILE__, $sql);
message_die(GENERAL_ERROR, 'Could not obtain forum_name/forum_id', '', __LINE__, __FILE__, $sql);
}
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$s_forums = "";
$s_forums = '';
while( $row = $db->sql_fetchrow($result) )
{
if( $is_auth_ary[$row['forum_id']]['auth_read'] )
{
$s_forums .= "<option value=\"" . $row['forum_id'] . "\">" . $row['forum_name'] . "</option>";
$s_forums .= '<option value="' . $row['forum_id'] . '">' . $row['forum_name'] . '</option>';
if( empty($list_cat[$row['cat_id']]) )
{
$list_cat[$row['cat_id']] = $row['cat_title'];
@ -1125,17 +1125,17 @@ while( $row = $db->sql_fetchrow($result) )
}
}
if( $s_forums != "" )
if( $s_forums != '' )
{
$s_forums = "<option value=\"-1\">" . $lang['All_available'] . "</option>" . $s_forums;
$s_forums = '<option value="-1">' . $lang['All_available'] . '</option>' . $s_forums;
//
// Category to search
//
$s_categories = "<option value=\"-1\">" . $lang['All_available'] . "</option>";
$s_categories = '<option value="-1">' . $lang['All_available'] . '</option>';
while( list($cat_id, $cat_title) = @each($list_cat))
{
$s_categories .= "<option value=\"$cat_id\">$cat_title</option>";
$s_categories .= '<option value="' . $cat_id . '">' . $cat_title . '</option>';
}
}
else
@ -1172,11 +1172,11 @@ for($i = 0; $i < count($sort_by_types); $i++)
$previous_days = array(0, 1, 7, 14, 30, 90, 180, 364);
$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']);
$s_time = "";
$s_time = '';
for($i = 0; $i < count($previous_days); $i++)
{
$selected = ( $topic_days == $previous_days[$i] ) ? " selected=\"selected\"" : "";
$s_time .= "<option value=\"" . $previous_days[$i] . "\"$selected>" . $previous_days_text[$i] . "</option>";
$selected = ( $topic_days == $previous_days[$i] ) ? ' selected="selected"' : '';
$s_time .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>';
}
//
@ -1186,51 +1186,51 @@ $page_title = $lang['Search'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "search_body.tpl",
"jumpbox" => "jumpbox.tpl")
'body' => 'search_body.tpl',
'jumpbox' => 'jumpbox.tpl')
);
$jumpbox = make_jumpbox();
$template->assign_vars(array(
"L_GO" => $lang['Go'],
"L_JUMP_TO" => $lang['Jump_to'],
"L_SELECT_FORUM" => $lang['Select_forum'],
'L_GO' => $lang['Go'],
'L_JUMP_TO' => $lang['Jump_to'],
'L_SELECT_FORUM' => $lang['Select_forum'],
"S_JUMPBOX_LIST" => $jumpbox,
"S_JUMPBOX_ACTION" => append_sid("viewforum.$phpEx"))
'S_JUMPBOX_LIST' => $jumpbox,
'S_JUMPBOX_ACTION' => append_sid("viewforum.$phpEx"))
);
$template->assign_var_from_handle("JUMPBOX", "jumpbox");
$template->assign_var_from_handle('JUMPBOX', 'jumpbox');
$template->assign_vars(array(
"L_SEARCH_QUERY" => $lang['Search_query'],
"L_SEARCH_OPTIONS" => $lang['Search_options'],
"L_SEARCH_KEYWORDS" => $lang['Search_keywords'],
"L_SEARCH_KEYWORDS_EXPLAIN" => $lang['Search_keywords_explain'],
"L_SEARCH_AUTHOR" => $lang['Search_author'],
"L_SEARCH_AUTHOR_EXPLAIN" => $lang['Search_author_explain'],
"L_SEARCH_ANY_TERMS" => $lang['Search_for_any'],
"L_SEARCH_ALL_TERMS" => $lang['Search_for_all'],
"L_SEARCH_MESSAGE_ONLY" => $lang['Search_msg_only'],
"L_SEARCH_MESSAGE_TITLE" => $lang['Search_title_msg'],
"L_CATEGORY" => $lang['Category'],
"L_RETURN_FIRST" => $lang['Return_first'],
"L_CHARACTERS" => $lang['characters_posts'],
"L_SORT_BY" => $lang['Sort_by'],
"L_SORT_ASCENDING" => $lang['Sort_Ascending'],
"L_SORT_DESCENDING" => $lang['Sort_Descending'],
"L_SEARCH_PREVIOUS" => $lang['Search_previous'],
"L_DISPLAY_RESULTS" => $lang['Display_results'],
'L_SEARCH_QUERY' => $lang['Search_query'],
'L_SEARCH_OPTIONS' => $lang['Search_options'],
'L_SEARCH_KEYWORDS' => $lang['Search_keywords'],
'L_SEARCH_KEYWORDS_EXPLAIN' => $lang['Search_keywords_explain'],
'L_SEARCH_AUTHOR' => $lang['Search_author'],
'L_SEARCH_AUTHOR_EXPLAIN' => $lang['Search_author_explain'],
'L_SEARCH_ANY_TERMS' => $lang['Search_for_any'],
'L_SEARCH_ALL_TERMS' => $lang['Search_for_all'],
'L_SEARCH_MESSAGE_ONLY' => $lang['Search_msg_only'],
'L_SEARCH_MESSAGE_TITLE' => $lang['Search_title_msg'],
'L_CATEGORY' => $lang['Category'],
'L_RETURN_FIRST' => $lang['Return_first'],
'L_CHARACTERS' => $lang['characters_posts'],
'L_SORT_BY' => $lang['Sort_by'],
'L_SORT_ASCENDING' => $lang['Sort_Ascending'],
'L_SORT_DESCENDING' => $lang['Sort_Descending'],
'L_SEARCH_PREVIOUS' => $lang['Search_previous'],
'L_DISPLAY_RESULTS' => $lang['Display_results'],
"S_SEARCH_ACTION" => append_sid("search.$phpEx?mode=results"),
"S_CHARACTER_OPTIONS" => $s_characters,
"S_FORUM_OPTIONS" => $s_forums,
"S_CATEGORY_OPTIONS" => $s_categories,
"S_TIME_OPTIONS" => $s_time,
"S_SORT_OPTIONS" => $s_sort_by,
"S_HIDDEN_FIELDS" => $s_hidden_fields)
'S_SEARCH_ACTION' => append_sid("search.$phpEx?mode=results"),
'S_CHARACTER_OPTIONS' => $s_characters,
'S_FORUM_OPTIONS' => $s_forums,
'S_CATEGORY_OPTIONS' => $s_categories,
'S_TIME_OPTIONS' => $s_time,
'S_SORT_OPTIONS' => $s_sort_by,
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
$template->pparse("body");
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);