Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: functions_search.php 4384 2009-06-19 11:49:42Z Tomm $
| * $Id: functions_search.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
/**
| */
/**
|
Zeile 154 | Zeile 154 |
---|
} } $unsearchable = $unsearchableforums;
|
} } $unsearchable = $unsearchableforums;
|
| // Get our unsearchable password protected forums $pass_protected_forums = get_password_protected_forums(); if($unsearchable && $pass_protected_forums) { $unsearchable .= ","; } if($pass_protected_forums) { $unsearchable .= implode(",", $pass_protected_forums); }
|
return $unsearchable;
|
return $unsearchable;
|
| }
/** * Build a array list of the forums this user cannot search due to password protection * * @param int the fids to check (leave null to check all forums) * @return return a array list of password protected forums the user cannot search */ function get_password_protected_forums($fids=array()) { global $forum_cache, $mybb; if(!is_array($fids)) { return false; } if(!is_array($forum_cache)) { $forum_cache = cache_forums(); if(!$forum_cache) { return false; } } if(empty($fids)) { $fids = array_keys($forum_cache); }
$pass_fids = array(); foreach($fids as $fid) { if(empty($forum_cache[$fid]['password'])) { continue; } if(md5($mybb->user['uid'].$forum_cache[$fid]['password']) != $mybb->cookies['forumpass'][$fid]) { $pass_fids[] = $fid; $child_list = get_child_list($fid); } if(is_array($child_list)) { $pass_fids = array_merge($pass_fids, $child_list); } } return array_unique($pass_fids);
|
}
/** * Clean search keywords and make them safe for querying
|
}
/** * Clean search keywords and make them safe for querying
|
*
| *
|
* @param string The keywords to be cleaned * @return string The cleaned keywords */ function clean_keywords($keywords)
|
* @param string The keywords to be cleaned * @return string The cleaned keywords */ function clean_keywords($keywords)
|
{ $keywords = my_strtolower($keywords);
| { $keywords = my_strtolower($keywords);
|
$keywords = str_replace("%", "\\%", $keywords); $keywords = preg_replace("#\*{2,}#s", "*", $keywords); $keywords = str_replace("*", "%", $keywords); $keywords = preg_replace("#([\[\]\|\.\,:'])#s", " ", $keywords);
|
$keywords = str_replace("%", "\\%", $keywords); $keywords = preg_replace("#\*{2,}#s", "*", $keywords); $keywords = str_replace("*", "%", $keywords); $keywords = preg_replace("#([\[\]\|\.\,:'])#s", " ", $keywords);
|
$keywords = preg_replace("#\s+#s", " ", $keywords);
| $keywords = preg_replace("#\s+#s", " ", $keywords);
|
// Search for "and" or "or" and remove if it's at the beginning
|
// Search for "and" or "or" and remove if it's at the beginning
|
| $keywords = trim($keywords);
|
if(my_strpos($keywords, "or") !== false && my_strpos($keywords, "or") == 0) { $keywords = substr_replace($keywords, "", 0, 2);
|
if(my_strpos($keywords, "or") !== false && my_strpos($keywords, "or") == 0) { $keywords = substr_replace($keywords, "", 0, 2);
|
} if(my_strpos($keywords, "and") !== false && my_strpos($keywords, "and") == 0)
| } if(my_strpos($keywords, "and") !== false && my_strpos($keywords, "and") == 0)
|
{ $keywords = substr_replace($keywords, "", 0, 3); }
|
{ $keywords = substr_replace($keywords, "", 0, 3); }
|
return trim($keywords);
| return $keywords;
|
}
/**
| }
/**
|
Zeile 202 | Zeile 268 |
---|
$keywords = preg_replace("#\*{2,}#s", "*", $keywords); $keywords = preg_replace("#([\[\]\|\.\,:])#s", " ", $keywords); $keywords = preg_replace("#\s+#s", " ", $keywords);
|
$keywords = preg_replace("#\*{2,}#s", "*", $keywords); $keywords = preg_replace("#([\[\]\|\.\,:])#s", " ", $keywords); $keywords = preg_replace("#\s+#s", " ", $keywords);
|
| $words = array();
|
if(my_strpos($keywords, "\"") !== false) { $inquote = false;
| if(my_strpos($keywords, "\"") !== false) { $inquote = false;
|