Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: functions_search.php 5132 2010-07-28 08:18:14Z RyanGordon $
| * $Id: functions_search.php 5448 2011-04-16 16:42:29Z Tomm $
|
*/
/**
| */
/**
|
Zeile 414 | Zeile 414 |
---|
// If this word is a search operator set the boolean if($i % 2 && ($word == "and" || $word == "or")) {
|
// If this word is a search operator set the boolean if($i % 2 && ($word == "and" || $word == "or")) {
|
| if($i <= 1) { if($search['subject'] && $search['message'] && $subject_lookin == " AND (") { // We're looking for anything, check for a subject lookin continue; } elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (") { // Just in a subject? continue; } elseif(!$search['subject'] && $search['message'] && $message_lookin == " {$string} (") { // Just in a message? continue; } }
|
$boolean = $word;
|
$boolean = $word;
|
}
| }
|
// Otherwise check the length of the word as it is a normal search term else { $word = trim($word); // Word is too short - show error message if(my_strlen($word) < $mybb->settings['minsearchword'])
|
// Otherwise check the length of the word as it is a normal search term else { $word = trim($word); // Word is too short - show error message if(my_strlen($word) < $mybb->settings['minsearchword'])
|
{
| {
|
$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength);
|
$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength);
|
}
| }
|
// Add terms to search query if($search['subject'] == 1) { $subject_lookin .= " $boolean LOWER(subject) LIKE '%{$word}%'";
|
// Add terms to search query if($search['subject'] == 1) { $subject_lookin .= " $boolean LOWER(subject) LIKE '%{$word}%'";
|
} if($search['message'] == 1) { $message_lookin .= " $boolean LOWER(message) LIKE '%{$word}%'"; } } } } // In the middle of a quote (phrase) else { $phrase = str_replace(array("+", "-", "*"), '', trim($phrase)); if(my_strlen($phrase) < $mybb->settings['minsearchword']) { $lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); }
| } if($search['message'] == 1) { $message_lookin .= " $boolean LOWER(message) LIKE '%{$word}%'"; } } } } // In the middle of a quote (phrase) else { $phrase = str_replace(array("+", "-", "*"), '', trim($phrase)); if(my_strlen($phrase) < $mybb->settings['minsearchword']) { $lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); }
|
// Add phrase to search query $subject_lookin .= " $boolean LOWER(subject) LIKE '%{$phrase}%'"; if($search['message'] == 1)
| // Add phrase to search query $subject_lookin .= " $boolean LOWER(subject) LIKE '%{$phrase}%'"; if($search['message'] == 1)
|
Zeile 454 | Zeile 473 |
---|
$message_lookin .= " $boolean LOWER(message) LIKE '%{$phrase}%'"; } }
|
$message_lookin .= " $boolean LOWER(message) LIKE '%{$phrase}%'"; } }
|
| // Check to see if we have any search terms and not a malformed SQL string $error = false; if($search['subject'] && $search['message'] && $subject_lookin == " AND (") { // We're looking for anything, check for a subject lookin $error = true; } elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (") { // Just in a subject? $error = true; } elseif(!$search['subject'] && $search['message'] && $message_lookin == " {$string} (") { // Just in a message? $error = true; }
if($error == true) { // There are no search keywords to look for $lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); }
|
$inquote = !$inquote; }
| $inquote = !$inquote; }
|
Zeile 512 | Zeile 557 |
---|
if(count($userids) < 1) { error($lang->error_nosearchresults);
|
if(count($userids) < 1) { error($lang->error_nosearchresults);
|
}
| }
|
else { $userids = implode(',', $userids);
| else { $userids = implode(',', $userids);
|
Zeile 639 | Zeile 684 |
---|
// If this word is a search operator set the boolean if($i % 2 && ($word == "and" || $word == "or")) {
|
// If this word is a search operator set the boolean if($i % 2 && ($word == "and" || $word == "or")) {
|
| if($i <= 1 && $subject_lookin == " AND (") { continue; }
|
$boolean = $word; } // Otherwise check the length of the word as it is a normal search term
| $boolean = $word; } // Otherwise check the length of the word as it is a normal search term
|
Zeile 676 | Zeile 726 |
---|
$message_lookin .= " $boolean LOWER(p.message) LIKE '%{$phrase}%'"; } }
|
$message_lookin .= " $boolean LOWER(p.message) LIKE '%{$phrase}%'"; } }
|
| if($subject_lookin == " AND (") { // There are no search keywords to look for $lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); }
|
$inquote = !$inquote; } $subject_lookin .= ")";
| $inquote = !$inquote; } $subject_lookin .= ")";
|