Vergleich inc/functions_search.php - 1.8.24 - 1.8.33

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 83Zeile 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 279Zeile 274
 */
function clean_keywords($keywords)
{

 */
function clean_keywords($keywords)
{

	global $db;

	global $db, $lang;


$keywords = my_strtolower($keywords);
$keywords = $db->escape_string_like($keywords);


$keywords = my_strtolower($keywords);
$keywords = $db->escape_string_like($keywords);

Zeile 293Zeile 288
	if(my_strpos($keywords, "or") === 0)
{
$keywords = substr_replace($keywords, "", 0, 2);

	if(my_strpos($keywords, "or") === 0)
{
$keywords = substr_replace($keywords, "", 0, 2);

 
		$keywords = " ".$keywords;

	}

if(my_strpos($keywords, "and") === 0)
{
$keywords = substr_replace($keywords, "", 0, 3);

	}

if(my_strpos($keywords, "and") === 0)
{
$keywords = substr_replace($keywords, "", 0, 3);

 
		$keywords = " ".$keywords;
}

if(!$keywords)
{
error($lang->error_nosearchterms);

	}

return $keywords;

	}

return $keywords;

Zeile 389Zeile 391
				{
$word = trim($word);
if($word == "or")

				{
$word = trim($word);
if($word == "or")

					{

					{

						$boolean[$depth] = '';
// Remove "and" operator from previous element
$last = array_pop($words[$depth]);

						$boolean[$depth] = '';
// Remove "and" operator from previous element
$last = array_pop($words[$depth]);

Zeile 485Zeile 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)
{
$mybb->settings['minsearchword'] = 3;

{
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;

	}

$subject_lookin = "";

	}

$subject_lookin = "";

Zeile 522Zeile 524
		}

if(preg_match("#\s(and|or)\s#", $keywords))

		}

if(preg_match("#\s(and|or)\s#", $keywords))

		{

		{

			$string = "AND";
if($search['subject'] == 1)
{

			$string = "AND";
if($search['subject'] == 1)
{

Zeile 692Zeile 694
	}

if($search['sender'])

	}

if($search['sender'])

	{
$userids = array();
$search['sender'] = my_strtolower($search['sender']);

switch($db->type)
{

	{
$userids = array();
$search['sender'] = my_strtolower($search['sender']);

switch($db->type)
{

			case 'mysql':
case 'mysqli':
$field = 'username';

			case 'mysql':
case 'mysqli':
$field = 'username';

Zeile 739Zeile 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 816Zeile 818
	{
$mybb->settings['minsearchword'] = 3;
}

	{
$mybb->settings['minsearchword'] = 3;
}





	$name_lookin = "";
$document_lookin = "";
$searchsql = "enabled='1'";

	$name_lookin = "";
$document_lookin = "";
$searchsql = "enabled='1'";

Zeile 892Zeile 894
									// 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
{

							}

$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 = trim($word);
// Word is too short - show error message
if(my_strlen($word) < $mybb->settings['minsearchword'])

Zeile 974Zeile 976
			}

$searchsql .= "{$name_lookin} {$document_lookin}";

			}

$searchsql .= "{$name_lookin} {$document_lookin}";

		}

		}

		else
{
$keywords = str_replace("\"", '', trim($keywords));

		else
{
$keywords = str_replace("\"", '', trim($keywords));

Zeile 1100Zeile 1102
							$word = trim($word);
// Word is too short - show error message
if(my_strlen($word) < $mybb->settings['minsearchword'])

							$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);
}

								$lang->error_minsearchlength = $lang->sprintf($lang->error_minsearchlength, $mybb->settings['minsearchword']);
error($lang->error_minsearchlength);
}

Zeile 1148Zeile 1150
		{
$keywords = str_replace("\"", '', trim($keywords));
if(my_strlen($keywords) < $mybb->settings['minsearchword'])

		{
$keywords = str_replace("\"", '', trim($keywords));
if(my_strlen($keywords) < $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 1169Zeile 1171
		{
$user = get_user_by_username($search['author']);
if($user)

		{
$user = get_user_by_username($search['author']);
if($user)

			{
$userids[] = $user['uid'];
}
}
else

			{
$userids[] = $user['uid'];
}
}
else

		{
switch($db->type)

		{
switch($db->type)

			{

			{

				case 'mysql':
case 'mysqli':
$field = 'username';

				case 'mysql':
case 'mysqli':
$field = 'username';

Zeile 1195Zeile 1197
		if(count($userids) < 1)
{
error($lang->error_nosearchresults);

		if(count($userids) < 1)
{
error($lang->error_nosearchresults);

		}
else
{

		}
else
{

			$userids = implode(',', $userids);
$post_usersql = " AND p.uid IN (".$userids.")";
$thread_usersql = " AND t.uid IN (".$userids.")";

			$userids = implode(',', $userids);
$post_usersql = " AND p.uid IN (".$userids.")";
$thread_usersql = " AND t.uid IN (".$userids.")";

Zeile 1295Zeile 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)."))";
}

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


$unsearchforums = get_unsearchable_forums();
if($unsearchforums)

Zeile 1470Zeile 1472
		$mybb->settings['minsearchword'] = 4;
}


		$mybb->settings['minsearchword'] = 4;
}


 
	$message_lookin = $subject_lookin = '';

	if($keywords)
{
$keywords_exp = explode("\"", $keywords);

	if($keywords)
{
$keywords_exp = explode("\"", $keywords);

Zeile 1556Zeile 1559
			$thread_usersql = " AND t.uid IN (".$userids.")";
}
}

			$thread_usersql = " AND t.uid IN (".$userids.")";
}
}

	$datecut = '';

	$datecut = $thread_datecut = $post_datecut = '';

	if($search['postdate'])
{
if($search['pddir'] == 0)

	if($search['postdate'])
{
if($search['pddir'] == 0)

Zeile 1705Zeile 1708
	$unapproved_where_p = get_visible_where('p');

// Searching a specific thread?

	$unapproved_where_p = get_visible_where('p');

// Searching a specific thread?

 
	$tidsql = '';

	if($search['tid'])
{
$tidsql = " AND t.tid='".(int)$search['tid']."'";

	if($search['tid'])
{
$tidsql = " AND t.tid='".(int)$search['tid']."'";