phpBB-Title-Search-Update UDiff
von Imhotep- SNIPPET_TEXT:
-
- --- search.php.old 2005-05-13 23:04:02.000000000 +0200
- +++ search.php 2005-06-21 00:31:51.000000000 +0200
- @@ -81,13 +81,10 @@
- $search_terms = 0;
- }
- -if ( isset($HTTP_POST_VARS['search_fields']) )
- -{
- - $search_fields = ( $HTTP_POST_VARS['search_fields'] == 'all' ) ? 1 : 0;
- -}
- -else
- -{
- - $search_fields = 0;
- +switch($HTTP_POST_VARS['search_fields']){
- + case 'all': $search_fields = 'a'; break;
- + case 'msgonly': $search_fields = 'm'; break;
- + case 'titleonly': $search_fields = 't'; break;
- }
- $return_chars = ( isset($HTTP_POST_VARS['return_chars']) ) ? intval($HTTP_POST_VARS['return_chars']) : 200;
- @@ -259,7 +256,11 @@
- $split_search = array();
- $split_search = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('search', stripslashes($search_keywords), $stopword_array, $synonym_array), 'search') : split(' ', $search_keywords);
- - $search_msg_only = ( !$search_fields ) ? "AND m.title_match = 0" : ( ( strstr($multibyte_charset, $lang['ENCODING']) ) ? '' : '' );
- + switch($search_fields){
- + case 'a': $search_msg_only = ''; break;
- + case 'm': $search_msg_only = 'AND m.title_match = 0'; break;
- + case 't': $search_msg_only = 'AND m.title_match = 1'; break;
- + }
- $word_count = 0;
- $current_match_type = 'or';
- @@ -308,7 +309,7 @@
- else
- {
- $match_word = addslashes('%' . str_replace('*', '', $split_search[$i]) . '%');
- - $search_msg_only = ( $search_fields ) ? "OR post_subject LIKE '$match_word'" : '';
- + $search_msg_only = ( $search_fields != 'm' ) ? "OR post_subject LIKE '$match_word'" : '';
- $sql = "SELECT post_id
- FROM " . POSTS_TEXT_TABLE . "
- WHERE post_text LIKE '$match_word'
- @@ -1398,6 +1399,7 @@
- '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_TITLE' => $lang['Search_title_only'],
- 'L_SEARCH_MESSAGE_TITLE' => $lang['Search_title_msg'],
- 'L_CATEGORY' => $lang['Category'],
- 'L_RETURN_FIRST' => $lang['Return_first'],
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN