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 5458 2011-05-01 21:12:31Z jammerx2 $
|
*/
/**
| */
/**
|
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; } // 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 428 | Zeile 447 |
---|
} // Add terms to search query if($search['subject'] == 1)
|
} // Add terms to search query if($search['subject'] == 1)
|
{
| {
|
$subject_lookin .= " $boolean LOWER(subject) LIKE '%{$word}%'"; } if($search['message'] == 1)
| $subject_lookin .= " $boolean LOWER(subject) LIKE '%{$word}%'"; } if($search['message'] == 1)
|
Zeile 443 | Zeile 462 |
---|
{ $phrase = str_replace(array("+", "-", "*"), '', trim($phrase)); if(my_strlen($phrase) < $mybb->settings['minsearchword'])
|
{ $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 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 521 | Zeile 566 |
---|
} if(!is_array($search['folder']))
|
} if(!is_array($search['folder']))
|
{
| {
|
$search['folder'] = array($search['folder']); }
| $search['folder'] = array($search['folder']); }
|
Zeile 540 | Zeile 585 |
---|
}
if($search['status'])
|
}
if($search['status'])
|
{
| {
|
$searchsql .= " AND ("; if($search['status']['new']) {
| $searchsql .= " AND ("; if($search['status']['new']) {
|
Zeile 553 | Zeile 598 |
---|
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') ";
|
Zeile 565 | Zeile 610 |
---|
} $statussql = implode("OR", $statussql); $searchsql .= $statussql.")";
|
} $statussql = implode("OR", $statussql); $searchsql .= $statussql.")";
|
}
| }
|
// Run the search $pms = array(); $query = $db->simple_select("privatemessages", "pmid", $searchsql); while($pm = $db->fetch_array($query)) { $pms[$pm['pmid']] = $pm['pmid'];
|
// Run the search $pms = array(); $query = $db->simple_select("privatemessages", "pmid", $searchsql); while($pm = $db->fetch_array($query)) { $pms[$pm['pmid']] = $pm['pmid'];
|
}
| }
|
if(count($pms) < 1) { error($lang->error_nosearchresults);
| if(count($pms) < 1) { error($lang->error_nosearchresults);
|
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 .= ")"; $message_lookin .= ")";
|
$inquote = !$inquote; } $subject_lookin .= ")"; $message_lookin .= ")";
|
} else {
| } else {
|
$keywords = str_replace("\"", '', trim($keywords)); if(my_strlen($keywords) < $mybb->settings['minsearchword']) {
| $keywords = str_replace("\"", '', trim($keywords)); if(my_strlen($keywords) < $mybb->settings['minsearchword']) {
|
Zeile 702 | Zeile 760 |
---|
{ $userids = array(); if($search['matchusername'])
|
{ $userids = array(); if($search['matchusername'])
|
{
| {
|
$query = $db->simple_select("users", "uid", "username='".$db->escape_string($search['author'])."'"); } else { $search['author'] = my_strtolower($search['author']); $query = $db->simple_select("users", "uid", "LOWER(username) LIKE '%".$db->escape_string_like($db->escape_string($search['author']))."%'");
|
$query = $db->simple_select("users", "uid", "username='".$db->escape_string($search['author'])."'"); } else { $search['author'] = my_strtolower($search['author']); $query = $db->simple_select("users", "uid", "LOWER(username) LIKE '%".$db->escape_string_like($db->escape_string($search['author']))."%'");
|
}
| }
|
while($user = $db->fetch_array($query)) { $userids[] = $user['uid'];
| while($user = $db->fetch_array($query)) { $userids[] = $user['uid'];
|
Zeile 729 | Zeile 787 |
---|
if($search['postdate']) { if($search['pddir'] == 0)
|
if($search['postdate']) { if($search['pddir'] == 0)
|
{
| {
|
$datecut = "<="; } else { $datecut = ">=";
|
$datecut = "<="; } else { $datecut = ">=";
|
}
| }
|
$now = TIME_NOW; $datelimit = $now-(86400 * $search['postdate']); $datecut .= "'$datelimit'";
| $now = TIME_NOW; $datelimit = $now-(86400 * $search['postdate']); $datecut .= "'$datelimit'";
|
Zeile 841 | Zeile 899 |
---|
$onlyusfids = array(); // Check group permissions if we can't view threads not started by us
|
$onlyusfids = array(); // Check group permissions if we can't view threads not started by us
|
$group_permissions = forum_permissions(); foreach($group_permissions as $fid => $forum_permissions)
| if($group_permissions = forum_permissions())
|
{
|
{
|
if($forum_permissions['canonlyviewownthreads'] == 1)
| foreach($group_permissions as $fid => $forum_permissions)
|
{
|
{
|
$onlyusfids[] = $fid;
| if($forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid; }
|
} } if(!empty($onlyusfids))
| } } if(!empty($onlyusfids))
|