Zeile 83 | Zeile 83 |
---|
*/ function get_unsearchable_forums($pid=0, $first=1) {
|
*/ function get_unsearchable_forums($pid=0, $first=1) {
|
global $db, $forum_cache, $permissioncache, $mybb, $unsearchableforums, $unsearchable, $templates, $forumpass;
| global $forum_cache, $permissioncache, $mybb, $unsearchableforums, $unsearchable, $templates, $forumpass;
|
$pid = (int)$pid;
if(!is_array($forum_cache)) {
|
$pid = (int)$pid;
if(!is_array($forum_cache)) {
|
// Get Forums $query = $db->simple_select("forums", "fid,parentlist,password,active", '', array('order_by' => 'pid, disporder')); while($forum = $db->fetch_array($query)) { $forum_cache[$forum['fid']] = $forum; }
| cache_forums();
|
} if(!is_array($permissioncache)) {
| } if(!is_array($permissioncache)) {
|
Zeile 105 | Zeile 100 |
---|
if($permissioncache[$forum['fid']]) { $perms = $permissioncache[$forum['fid']];
|
if($permissioncache[$forum['fid']]) { $perms = $permissioncache[$forum['fid']];
|
}
| }
|
else { $perms = $mybb->usergroup;
| else { $perms = $mybb->usergroup;
|
Zeile 119 | Zeile 114 |
---|
if($forum_cache[$parent]['active'] == 0) { $forum['active'] = 0;
|
if($forum_cache[$parent]['active'] == 0) { $forum['active'] = 0;
|
} }
| } }
|
}
if($perms['canview'] != 1 || $perms['cansearch'] != 1 || !forum_password_validated($forum, true) || $forum['active'] == 0)
| }
if($perms['canview'] != 1 || $perms['cansearch'] != 1 || !forum_password_validated($forum, true) || $forum['active'] == 0)
|
Zeile 133 | Zeile 128 |
---|
} } $unsearchable = $unsearchableforums;
|
} } $unsearchable = $unsearchableforums;
|
|
|
// Get our unsearchable password protected forums $pass_protected_forums = get_password_protected_forums();
|
// Get our unsearchable password protected forums $pass_protected_forums = get_password_protected_forums();
|
|
|
if($unsearchable && $pass_protected_forums) { $unsearchable .= ",";
| if($unsearchable && $pass_protected_forums) { $unsearchable .= ",";
|
Zeile 145 | Zeile 140 |
---|
if($pass_protected_forums) { $unsearchable .= implode(",", $pass_protected_forums);
|
if($pass_protected_forums) { $unsearchable .= implode(",", $pass_protected_forums);
|
}
| }
|
return $unsearchable; }
| return $unsearchable; }
|
Zeile 219 | Zeile 214 |
---|
$unapproved_where .= ')'; return $unapproved_where;
|
$unapproved_where .= ')'; return $unapproved_where;
|
} }
| } }
|
// Normal users if($mybb->user['uid'] > 0 && $mybb->settings['showownunapproved'] == 1) {
| // Normal users if($mybb->user['uid'] > 0 && $mybb->settings['showownunapproved'] == 1) {
|
Zeile 246 | Zeile 241 |
---|
}
if(!is_array($forum_cache))
|
}
if(!is_array($forum_cache))
|
{
| {
|
$forum_cache = cache_forums(); if(!$forum_cache) {
| $forum_cache = cache_forums(); if(!$forum_cache) {
|
Zeile 297 | Zeile 292 |
---|
}
if(my_strpos($keywords, "and") === 0)
|
}
if(my_strpos($keywords, "and") === 0)
|
{
| {
|
$keywords = substr_replace($keywords, "", 0, 3); $keywords = " ".$keywords; }
|
$keywords = substr_replace($keywords, "", 0, 3); $keywords = " ".$keywords; }
|
if(!$keywords) { error($lang->error_nosearchterms); }
| if(!$keywords) { error($lang->error_nosearchterms); }
|
return $keywords; }
| return $keywords; }
|
Zeile 321 | Zeile 316 |
---|
if(!$keywords) { return false;
|
if(!$keywords) { return false;
|
}
| }
|
$keywords = my_strtolower($keywords); $keywords = str_replace("%", "\\%", $keywords); $keywords = preg_replace("#\*{2,}#s", "*", $keywords);
| $keywords = my_strtolower($keywords); $keywords = str_replace("%", "\\%", $keywords); $keywords = preg_replace("#\*{2,}#s", "*", $keywords);
|
Zeile 370 | Zeile 365 |
---|
if($phrase_operator) { $boolean[$depth] = $phrase_operator;
|
if($phrase_operator) { $boolean[$depth] = $phrase_operator;
|
}
| }
|
// Phrases do not need further processing $words[$depth][] = "{$boolean[$depth]}\"{$phrase}\""; $boolean[$depth] = $phrase_operator = '+';
| // Phrases do not need further processing $words[$depth][] = "{$boolean[$depth]}\"{$phrase}\""; $boolean[$depth] = $phrase_operator = '+';
|
Zeile 492 | Zeile 487 |
---|
* @return array Array of search data with results mixed in */ function privatemessage_perform_search_mysql($search)
|
* @return array Array of search data with results mixed in */ function privatemessage_perform_search_mysql($search)
|
{ global $mybb, $db, $lang;
$keywords = clean_keywords($search['keywords']); if(!$keywords && !$search['sender']) { error($lang->error_nosearchterms); }
if($mybb->settings['minsearchword'] < 1) {
| { global $mybb, $db, $lang;
$keywords = clean_keywords($search['keywords']); if(!$keywords && !$search['sender']) { error($lang->error_nosearchterms); }
if($mybb->settings['minsearchword'] < 1) {
|
$mybb->settings['minsearchword'] = 3; }
| $mybb->settings['minsearchword'] = 3; }
|
Zeile 655 | Zeile 650 |
---|
}
$inquote = !$inquote;
|
}
$inquote = !$inquote;
|
}
| }
|
if($search['subject'] == 1) {
| if($search['subject'] == 1) {
|
Zeile 699 | Zeile 694 |
---|
}
if($search['sender'])
|
}
if($search['sender'])
|
{ $userids = array(); $search['sender'] = my_strtolower($search['sender']);
switch($db->type) { case 'mysql': case 'mysqli':
| { $userids = array(); $search['sender'] = my_strtolower($search['sender']);
switch($db->type) { case 'mysql': case 'mysqli':
|
$field = 'username'; break; default:
| $field = 'username'; break; default:
|
Zeile 746 | Zeile 741 |
---|
if($folderids) { $searchsql .= " AND folder IN (".$folderids.")";
|
if($folderids) { $searchsql .= " AND folder IN (".$folderids.")";
|
} }
| } }
|
if($search['status']) { $searchsql .= " AND (";
| if($search['status']) { $searchsql .= " AND (";
|
Zeile 823 | Zeile 818 |
---|
{ $mybb->settings['minsearchword'] = 3; }
|
{ $mybb->settings['minsearchword'] = 3; }
|
|
|
$name_lookin = ""; $document_lookin = ""; $searchsql = "enabled='1'";
| $name_lookin = ""; $document_lookin = ""; $searchsql = "enabled='1'";
|
Zeile 900 | Zeile 895 |
---|
continue; } }
|
continue; } }
|
$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']) { $lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); }
| $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']) { $lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']); error($lang->error_minsearchlength); }
|
// Add terms to search query if($search['name'] == 1) {
| // Add terms to search query if($search['name'] == 1) {
|
Zeile 1302 | Zeile 1297 |
---|
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid;
|
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1) { $onlyusfids[] = $fid;
|
} } } if(!empty($onlyusfids)) { $permsql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))"; }
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $permsql .= " AND t.fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $permsql .= " AND t.fid NOT IN ($inactiveforums)"; }
| } } } if(!empty($onlyusfids)) { $permsql .= "AND ((t.fid IN(".implode(',', $onlyusfids).") AND t.uid='{$mybb->user['uid']}') OR t.fid NOT IN(".implode(',', $onlyusfids)."))"; }
$unsearchforums = get_unsearchable_forums(); if($unsearchforums) { $permsql .= " AND t.fid NOT IN ($unsearchforums)"; } $inactiveforums = get_inactive_forums(); if($inactiveforums) { $permsql .= " AND t.fid NOT IN ($inactiveforums)"; }
|
$visiblesql = $post_visiblesql = $plain_post_visiblesql = $unapproved_where_t = $unapproved_where_p = ""; if(isset($search['visible'])) {
| $visiblesql = $post_visiblesql = $plain_post_visiblesql = $unapproved_where_t = $unapproved_where_p = ""; if(isset($search['visible'])) {
|
Zeile 1371 | Zeile 1366 |
---|
if((int)$mybb->settings['searchhardlimit'] > 0) { $limitsql = "LIMIT ".(int)$mybb->settings['searchhardlimit'];
|
if((int)$mybb->settings['searchhardlimit'] > 0) { $limitsql = "LIMIT ".(int)$mybb->settings['searchhardlimit'];
|
}
| }
|
// Searching both posts and thread titles $threads = array(); $posts = array();
| // Searching both posts and thread titles $threads = array(); $posts = array();
|
Zeile 1394 | Zeile 1389 |
---|
if($thread['firstpost']) { $posts[$thread['tid']] = $thread['firstpost'];
|
if($thread['firstpost']) { $posts[$thread['tid']] = $thread['firstpost'];
|
} } }
| } } }
|
$query = $db->query(" SELECT p.pid, p.tid FROM ".TABLE_PREFIX."posts p
| $query = $db->query(" SELECT p.pid, p.tid FROM ".TABLE_PREFIX."posts p
|
Zeile 1449 | Zeile 1444 |
---|
while($post = $db->fetch_array($query)) { $posts[$post['pid']] = $post['pid'];
|
while($post = $db->fetch_array($query)) { $posts[$post['pid']] = $post['pid'];
|
}
| }
|
$posts = implode(',', $posts); } }
| $posts = implode(',', $posts); } }
|
Zeile 1525 | Zeile 1520 |
---|
{ $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);
|
}
| }
|
$message_lookin = "AND MATCH(message) AGAINST('".$db->escape_string($keywords)."' IN BOOLEAN MODE)"; $subject_lookin = "AND MATCH(subject) AGAINST('".$db->escape_string($keywords)."' IN BOOLEAN MODE)"; }
| $message_lookin = "AND MATCH(message) AGAINST('".$db->escape_string($keywords)."' IN BOOLEAN MODE)"; $subject_lookin = "AND MATCH(subject) AGAINST('".$db->escape_string($keywords)."' IN BOOLEAN MODE)"; }
|
Zeile 1539 | Zeile 1534 |
---|
{ $user = get_user_by_username($search['author']); if($user)
|
{ $user = get_user_by_username($search['author']); if($user)
|
{ $userids[] = $user['uid'];
| { $userids[] = $user['uid'];
|
} } else
| } } else
|
Zeile 1550 | Zeile 1545 |
---|
while($user = $db->fetch_array($query)) { $userids[] = $user['uid'];
|
while($user = $db->fetch_array($query)) { $userids[] = $user['uid'];
|
} }
| } }
|
if(count($userids) < 1) {
| if(count($userids) < 1) {
|
Zeile 1627 | Zeile 1622 |
---|
$search['forums'] = array((int)$search['forums']); } foreach($search['forums'] as $forum)
|
$search['forums'] = array((int)$search['forums']); } foreach($search['forums'] as $forum)
|
{
| {
|
$forum = (int)$forum; if($forum > 0) {
| $forum = (int)$forum; if($forum > 0) {
|
Zeile 1652 | Zeile 1647 |
---|
$group_permissions = forum_permissions(); foreach($group_permissions as $fid => $forum_permissions) {
|
$group_permissions = forum_permissions(); foreach($group_permissions as $fid => $forum_permissions) {
|
if($forum_permissions['canonlyviewownthreads'] == 1)
| if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)
|
{ $onlyusfids[] = $fid; }
| { $onlyusfids[] = $fid; }
|
Zeile 1679 | Zeile 1674 |
---|
if($search['visible'] == 1) { $visiblesql = " AND t.visible = '1'";
|
if($search['visible'] == 1) { $visiblesql = " AND t.visible = '1'";
|
|
|
if($search['postthread'] == 1) { $post_visiblesql = " AND p.visible = '1'";
| if($search['postthread'] == 1) { $post_visiblesql = " AND p.visible = '1'";
|
Zeile 1714 | Zeile 1709 |
---|
// Searching a specific thread? $tidsql = '';
|
// Searching a specific thread? $tidsql = '';
|
if($search['tid'])
| if(!empty($search['tid']))
|
{ $tidsql = " AND t.tid='".(int)$search['tid']."'";
|
{ $tidsql = " AND t.tid='".(int)$search['tid']."'";
|
}
| }
|
$limitsql = ''; if((int)$mybb->settings['searchhardlimit'] > 0)
|
$limitsql = ''; if((int)$mybb->settings['searchhardlimit'] > 0)
|
{
| {
|
$limitsql = "LIMIT ".(int)$mybb->settings['searchhardlimit']; }
| $limitsql = "LIMIT ".(int)$mybb->settings['searchhardlimit']; }
|
Zeile 1732 | Zeile 1727 |
---|
if($search['postthread'] == 1) { // No need to search subjects when looking for results within a specific thread
|
if($search['postthread'] == 1) { // No need to search subjects when looking for results within a specific thread
|
if(!$search['tid'])
| if(empty($search['tid']))
|
{ $query = $db->query(" SELECT t.tid, t.firstpost
| { $query = $db->query(" SELECT t.tid, t.firstpost
|