Zeile 125 | Zeile 125 |
---|
$pwverified = 1; if($forum['password'] != '') {
|
$pwverified = 1; if($forum['password'] != '') {
|
if($mybb->cookies['forumpass'][$forum['fid']] !== md5($mybb->user['uid'].$forum['password']))
| if(!isset($mybb->cookies['forumpass'][$forum['fid']]) || !my_hash_equals($mybb->cookies['forumpass'][$forum['fid']], md5($mybb->user['uid'].$forum['password'])))
|
{ $pwverified = 0; }
| { $pwverified = 0; }
|
Zeile 272 | Zeile 272 |
---|
// Separate braces for further processing $keywords = preg_replace("#((\+|-|<|>|~)?\(|\))#s", " $1 ", $keywords); $keywords = preg_replace("#\s+#s", " ", $keywords);
|
// Separate braces for further processing $keywords = preg_replace("#((\+|-|<|>|~)?\(|\))#s", " $1 ", $keywords); $keywords = preg_replace("#\s+#s", " ", $keywords);
|
| global $mybb; $min_word_length = (int) $mybb->settings['minsearchword']; if($min_word_length <= 0) { $min_word_length = 3; } $min_word_length -= 1; // Replaces less than 3 characters $keywords = preg_replace("/(\b.{1,{$min_word_length}})(\s)|(\b.{1,{$min_word_length}}$)/", '$2', $keywords); // Collapse multiple spaces $keywords = preg_replace('/(\s)+/', '$1', $keywords); $keywords = trim($keywords);
|
$words = array(array());
| $words = array(array());
|
Zeile 288 | Zeile 303 |
---|
if($phrase != '') { if($inquote)
|
if($phrase != '') { if($inquote)
|
{
| {
|
if($phrase_operator)
|
if($phrase_operator)
|
{
| {
|
$boolean[$depth] = $phrase_operator; } // Phrases do not need further processing
| $boolean[$depth] = $phrase_operator; } // Phrases do not need further processing
|
Zeile 304 | Zeile 319 |
---|
if(!is_array($split_words)) { continue;
|
if(!is_array($split_words)) { continue;
|
}
| }
|
if(!$inquote) { // Save possible operator in front of phrase
| if(!$inquote) { // Save possible operator in front of phrase
|
Zeile 353 | Zeile 368 |
---|
elseif($word == '+(' || $word == '-(' || $word == '<(' || $word == '>(' || $word == '~(' || $word == '(') { if(strlen($word) == 2)
|
elseif($word == '+(' || $word == '-(' || $word == '<(' || $word == '>(' || $word == '~(' || $word == '(') { if(strlen($word) == 2)
|
{
| {
|
$boolean[$depth] = substr($word, 0, 1); } $words[++$depth] = array();
| $boolean[$depth] = substr($word, 0, 1); } $words[++$depth] = array();
|
Zeile 403 | Zeile 418 |
---|
$keywords = implode(' ', $words[0]); return $keywords;
|
$keywords = implode(' ', $words[0]); return $keywords;
|
}
/* Database engine specific search functions */
/** * Perform a thread and post search under MySQL or MySQLi
| }
/* Database engine specific search functions */
/** * Perform a thread and post search under MySQL or MySQLi
|
* * @param array $search Array of search data * @return array Array of search data with results mixed in
| * * @param array $search Array of search data * @return array Array of search data with results mixed in
|
Zeile 443 | Zeile 458 |
---|
case 'mysqli': $sfield = 'subject'; $mfield = 'message';
|
case 'mysqli': $sfield = 'subject'; $mfield = 'message';
|
break;
| break;
|
default: $sfield = 'LOWER(subject)'; $mfield = 'LOWER(message)';
| default: $sfield = 'LOWER(subject)'; $mfield = 'LOWER(message)';
|
Zeile 496 | Zeile 511 |
---|
continue; } elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (")
|
continue; } elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (")
|
{
| {
|
// Just in a subject? continue; }
| // Just in a subject? continue; }
|
Zeile 531 | Zeile 546 |
---|
} $boolean = 'AND'; }
|
} $boolean = 'AND'; }
|
}
| }
|
} // In the middle of a quote (phrase) else { $phrase = str_replace(array("+", "-", "*"), '', trim($phrase)); if(my_strlen($phrase) < $mybb->settings['minsearchword'])
|
} // 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); }
| $lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); }
|
Zeile 547 | Zeile 562 |
---|
if($search['message'] == 1) { $message_lookin .= " $boolean {$mfield} LIKE '%{$phrase}%'";
|
if($search['message'] == 1) { $message_lookin .= " $boolean {$mfield} LIKE '%{$phrase}%'";
|
} $boolean = 'AND';
| } $boolean = 'AND';
|
}
// 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 (")
|
}
// 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
|
// We're looking for anything, check for a subject lookin
|
$error = true;
| $error = true;
|
} elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (") {
| } elseif($search['subject'] && !$search['message'] && $subject_lookin == " AND (") {
|
Zeile 564 | Zeile 579 |
---|
$error = true; } elseif(!$search['subject'] && $search['message'] && $message_lookin == " {$string} (")
|
$error = true; } elseif(!$search['subject'] && $search['message'] && $message_lookin == " {$string} (")
|
{
| {
|
// Just in a message? $error = true; }
| // Just in a message? $error = true; }
|
Zeile 598 | Zeile 613 |
---|
{ $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);
|
}
| }
|
// If we're looking in both, then find matches in either the subject or the message if($search['subject'] == 1 && $search['message'] == 1)
| // If we're looking in both, then find matches in either the subject or the message if($search['subject'] == 1 && $search['message'] == 1)
|
Zeile 649 | Zeile 664 |
---|
{ $userids = implode(',', $userids); $searchsql .= " AND fromid IN (".$userids.")";
|
{ $userids = implode(',', $userids); $searchsql .= " AND fromid IN (".$userids.")";
|
} }
| } }
|
if(!is_array($search['folder'])) {
| if(!is_array($search['folder'])) {
|
Zeile 685 | Zeile 700 |
---|
if($search['status']['forwarded']) { $statussql[] = " status='4' ";
|
if($search['status']['forwarded']) { $statussql[] = " status='4' ";
|
} if($search['status']['read']) { $statussql[] = " (status != '0' AND readtime > '0') ";
| } if($search['status']['read']) { $statussql[] = " (status != '0' AND readtime > '0') ";
|
} // Sent Folder if(in_array(2, $search['folder']))
| } // Sent Folder if(in_array(2, $search['folder']))
|
Zeile 719 | Zeile 734 |
---|
error($lang->error_nosearchresults); } $pms = implode(',', $pms);
|
error($lang->error_nosearchresults); } $pms = implode(',', $pms);
|
|
|
return array( "querycache" => $pms );
| return array( "querycache" => $pms );
|
Zeile 753 | Zeile 768 |
---|
if($keywords) { switch($db->type)
|
if($keywords) { switch($db->type)
|
{
| {
|
case 'mysql': case 'mysqli': $nfield = 'name';
| case 'mysql': case 'mysqli': $nfield = 'name';
|
Zeile 821 | Zeile 836 |
---|
// Just in a document? continue; }
|
// Just in a document? continue; }
|
}
$boolean = $word; } // Otherwise check the length of the word as it is a normal search term else { $word = trim($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'])
|
// 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); } // Add terms to search query if($search['name'] == 1)
|
$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); } // Add terms to search query if($search['name'] == 1)
|
{
| {
|
$name_lookin .= " $boolean {$nfield} LIKE '%{$word}%'"; } if($search['document'] == 1)
| $name_lookin .= " $boolean {$nfield} LIKE '%{$word}%'"; } if($search['document'] == 1)
|
Zeile 845 | Zeile 860 |
---|
$document_lookin .= " $boolean {$dfield} LIKE '%{$word}%'"; } }
|
$document_lookin .= " $boolean {$dfield} LIKE '%{$word}%'"; } }
|
} }
| } }
|
// In the middle of a quote (phrase) else {
| // In the middle of a quote (phrase) else {
|
Zeile 855 | Zeile 870 |
---|
{ $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 phrase to search query $name_lookin .= " $boolean {$nfield} LIKE '%{$phrase}%'"; if($search['document'] == 1) { $document_lookin .= " $boolean {$dfield} LIKE '%{$phrase}%'"; }
|
// Add phrase to search query $name_lookin .= " $boolean {$nfield} LIKE '%{$phrase}%'"; if($search['document'] == 1) { $document_lookin .= " $boolean {$dfield} LIKE '%{$phrase}%'"; }
|
}
| }
|
// Check to see if we have any search terms and not a malformed SQL string $error = false; if($search['name'] && $search['document'] && $name_lookin == " AND (") { // We're looking for anything, check for a name lookin
|
// Check to see if we have any search terms and not a malformed SQL string $error = false; if($search['name'] && $search['document'] && $name_lookin == " AND (") { // We're looking for anything, check for a name lookin
|
$error = true; }
| $error = true; }
|
elseif($search['name'] && !$search['document'] && $name_lookin == " AND (") { // Just in a name?
|
elseif($search['name'] && !$search['document'] && $name_lookin == " AND (") { // Just in a name?
|
$error = true; }
| $error = true; }
|
elseif(!$search['name'] && $search['document'] && $document_lookin == " {$string} (") { // Just in a document? $error = true;
|
elseif(!$search['name'] && $search['document'] && $document_lookin == " {$string} (") { // Just in a document? $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); }
|
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;
|
}
| }
|
if($search['name'] == 1) {
| if($search['name'] == 1) {
|
Zeile 898 | Zeile 913 |
---|
}
if($search['document'] == 1)
|
}
if($search['document'] == 1)
|
{
| {
|
$document_lookin .= ")"; }
| $document_lookin .= ")"; }
|
Zeile 951 | Zeile 966 |
---|
"querycache" => $helpdocs ); }
|
"querycache" => $helpdocs ); }
|
|
|
/** * Perform a thread and post search under MySQL or MySQLi *
| /** * Perform a thread and post search under MySQL or MySQLi *
|
Zeile 963 | Zeile 978 |
---|
global $mybb, $db, $lang, $cache;
$keywords = clean_keywords($search['keywords']);
|
global $mybb, $db, $lang, $cache;
$keywords = clean_keywords($search['keywords']);
|
if(!$keywords && !$search['author']) { error($lang->error_nosearchterms); }
| |
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
if($mybb->settings['minsearchword'] < 1) { $mybb->settings['minsearchword'] = 3;
|
}
| }
|
$subject_lookin = $message_lookin = ''; if($keywords) {
| $subject_lookin = $message_lookin = ''; if($keywords) {
|
Zeile 1393 | Zeile 1404 |
---|
global $mybb, $db, $lang;
$keywords = clean_keywords_ft($search['keywords']);
|
global $mybb, $db, $lang;
$keywords = clean_keywords_ft($search['keywords']);
|
if(!$keywords && !$search['author']) { error($lang->error_nosearchterms); }
|
|
// Attempt to determine minimum word length from MySQL for fulltext searches $query = $db->query("SHOW VARIABLES LIKE 'ft_min_word_len';"); $min_length = $db->fetch_field($query, 'Value');
| // Attempt to determine minimum word length from MySQL for fulltext searches $query = $db->query("SHOW VARIABLES LIKE 'ft_min_word_len';"); $min_length = $db->fetch_field($query, 'Value');
|