Vergleich inc/functions_search.php - 1.4.9 - 1.4.16

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 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 154Zeile 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);

}

/**

}

/**

Zeile 173Zeile 238
	$keywords = preg_replace("#\s+#s", " ", $keywords);

// Search for "and" or "or" and remove if it's at the beginning

	$keywords = preg_replace("#\s+#s", " ", $keywords);

// 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)

	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)
{
$keywords = substr_replace($keywords, "", 0, 3);

		$keywords = substr_replace($keywords, "", 0, 2);
}
if(my_strpos($keywords, "and") !== false && my_strpos($keywords, "and") == 0)
{
$keywords = substr_replace($keywords, "", 0, 3);

	}

	}





	return trim($keywords);

	return $keywords;

}

/**

}

/**

Zeile 202Zeile 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;
$keywords = explode("\"", $keywords);
foreach($keywords as $phrase)

	if(my_strpos($keywords, "\"") !== false)
{
$inquote = false;
$keywords = explode("\"", $keywords);
foreach($keywords as $phrase)

		{

		{

			if($phrase != '')
{
if($inquote)
{
$words[] = "\"".trim($phrase)."\"";

			if($phrase != '')
{
if($inquote)
{
$words[] = "\"".trim($phrase)."\"";

				}

				}

				else
{
$split_words = preg_split("#\s{1,}#", $phrase, -1);

				else
{
$split_words = preg_split("#\s{1,}#", $phrase, -1);

Zeile 233Zeile 301
				}
}
$inquote = !$inquote;

				}
}
$inquote = !$inquote;

		}
}

		}
}

	else
{
$split_words = preg_split("#\s{1,}#", $keywords, -1);

	else
{
$split_words = preg_split("#\s{1,}#", $keywords, -1);

Zeile 288Zeile 356
function perform_search_mysql($search)
{
global $mybb, $db, $lang;

function perform_search_mysql($search)
{
global $mybb, $db, $lang;





	$keywords = clean_keywords($search['keywords']);
if(!$keywords && !$search['author'])
{

	$keywords = clean_keywords($search['keywords']);
if(!$keywords && !$search['author'])
{

Zeile 369Zeile 437
						$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 .= ")";