Vergleich inc/functions_search.php - 1.2.7 - 1.2.13

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * $Id: functions_search.php 3065 2007-05-16 00:36:39Z Tikitiki $

 * $Id: functions_search.php 3508 2007-11-23 16:10:16Z Tikitiki $

 */

/**

 */

/**

Zeile 309Zeile 309
					$matches = preg_split("#\s{1,}(and|or)\s{1,}#", $phrase, -1, PREG_SPLIT_DELIM_CAPTURE);
$count_matches = count($matches);


					$matches = preg_split("#\s{1,}(and|or)\s{1,}#", $phrase, -1, PREG_SPLIT_DELIM_CAPTURE);
$count_matches = count($matches);


					for($i=0;$i<$count_matches;$i++)

					for($i=0; $i < $count_matches; $i++)

					{
$word = trim($matches[$i]);
if(empty($word))

					{
$word = trim($matches[$i]);
if(empty($word))

Zeile 438Zeile 438

$forumin = "";
$fidlist = array();


$forumin = "";
$fidlist = array();

 
	$searchin = array();

	if($search['forums'] != "all")
{
if(!is_array($search['forums']))

	if($search['forums'] != "all")
{
if(!is_array($search['forums']))

Zeile 449Zeile 450
			if(!$searchin[$forum])
{
$forum = intval($forum);

			if(!$searchin[$forum])
{
$forum = intval($forum);

				$query = $db->query("SELECT f.fid FROM ".TABLE_PREFIX."forums f LEFT JOIN ".TABLE_PREFIX."forumpermissions p ON (f.fid=p.fid AND p.gid='".$mybb->user[usergroup]."') WHERE INSTR(CONCAT(',',parentlist,','),',$forum,') > 0 AND active!='no' AND (ISNULL(p.fid) OR p.cansearch='yes')");
if($db->num_rows($query) == 1)

				$query = $db->query("SELECT DISTINCT f.fid FROM ".TABLE_PREFIX."forums f LEFT JOIN ".TABLE_PREFIX."forumpermissions p ON (f.fid=p.fid AND p.gid='".$mybb->user[usergroup]."') WHERE INSTR(CONCAT(',',parentlist,','),',$forum,') > 0 AND active!='no' AND (ISNULL(p.fid) OR p.cansearch='yes')");
while($sforum = $db->fetch_array($query))

				{

				{

					$forumin .= " AND t.fid='$forum' ";
$searchin[$fid] = 1;
}
else
{
while($sforum = $db->fetch_array($query))
{
$fidlist[] = $sforum['fid'];
}
if(count($fidlist) > 1)
{
$forumin = " AND t.fid IN (".implode(",", $fidlist).")";
}

					$fidlist[] = $sforum['fid'];













				}
}
}

				}
}
}

	}













		if(count($fidlist) == 1)
{
$forumin .= " AND t.fid='$forum' ";
$searchin[$fid] = 1;
}
else
{
if(count($fidlist) > 1)
{
$forumin = " AND t.fid IN (".implode(",", $fidlist).")";
}
}
}

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

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

Zeile 476Zeile 477
	}
$inactiveforums = get_inactive_forums();
if($inactiveforums)

	}
$inactiveforums = get_inactive_forums();
if($inactiveforums)

	{

	{

		$permsql .= " AND t.fid NOT IN ($inactiveforums)";

		$permsql .= " AND t.fid NOT IN ($inactiveforums)";

 
	}

$limitsql = "";
if(intval($mybb->settings['searchhardlimit']) > 0)
{
$limitsql = "LIMIT ".intval($mybb->settings['searchhardlimit']);

	}

// Searching both posts and thread titles

	}

// Searching both posts and thread titles

Zeile 491Zeile 498
			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin

			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin

		");
while($thread = $db->fetch_array($query))
{
$threads[$thread['tid']] = $thread['tid'];


			{$limitsql}
");
while($thread = $db->fetch_array($query))
{
$threads[$thread['tid']] = $thread['tid'];

			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
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE 1=1 $post_datecut $thread_replycut $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

		$query = $db->query("
SELECT p.pid, p.tid
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE 1=1 $post_datecut $thread_replycut $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

 
			{$limitsql}

		");
while($post = $db->fetch_array($query))
{

		");
while($post = $db->fetch_array($query))
{

Zeile 527Zeile 536
			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

 
			{$limitsql}

		");
while($thread = $db->fetch_array($query))

		");
while($thread = $db->fetch_array($query))

		{

		{

			$threads[$thread['tid']] = $thread['tid'];
if($thread['firstpost'])
{
$firstposts[$thread['tid']] = $thread['firstpost'];

			$threads[$thread['tid']] = $thread['tid'];
if($thread['firstpost'])
{
$firstposts[$thread['tid']] = $thread['firstpost'];

			}

			}

		}
if(count($threads) < 1)
{

		}
if(count($threads) < 1)
{

Zeile 549Zeile 559
				SELECT p.pid
FROM ".TABLE_PREFIX."posts p
WHERE p.pid IN ($firstposts) AND p.visible>0

				SELECT p.pid
FROM ".TABLE_PREFIX."posts p
WHERE p.pid IN ($firstposts) AND p.visible>0

 
				{$limitsql}

			");
while($post = $db->fetch_array($query))
{

			");
while($post = $db->fetch_array($query))
{

Zeile 564Zeile 575
		"querycache" => ""
);
}

		"querycache" => ""
);
}





/**
* Perform a thread and post search under MySQL or MySQLi using boolean fulltext capabilities
*

/**
* Perform a thread and post search under MySQL or MySQLi using boolean fulltext capabilities
*

Zeile 599Zeile 610
		$keywords_exp = explode("\"", $keywords);
$inquote = false;
foreach($keywords_exp as $phrase)

		$keywords_exp = explode("\"", $keywords);
$inquote = false;
foreach($keywords_exp as $phrase)

		{

		{

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

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

Zeile 667Zeile 678
		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.")";

		}
}

		}
}

	$datecut = "";
if($search['postdate'])
{
if($search['pddir'] == 0)
{
$datecut = "<=";

	$datecut = "";
if($search['postdate'])
{
if($search['pddir'] == 0)
{
$datecut = "<=";

		}
else
{

		}
else
{

			$datecut = ">=";
}
$now = time();

			$datecut = ">=";
}
$now = time();

Zeile 703Zeile 714
		else
{
$thread_replycut = " AND t.replies <= '".intval($search['numreplies'])."'";

		else
{
$thread_replycut = " AND t.replies <= '".intval($search['numreplies'])."'";

		}
}

		}
}


$forumin = "";
$fidlist = array();


$forumin = "";
$fidlist = array();

 
	$searchin = array();

	if($search['forums'] != "all")

	if($search['forums'] != "all")

	{

	{

		if(!is_array($search['forums']))
{
$search['forums'] = array(intval($search['forums']));

		if(!is_array($search['forums']))
{
$search['forums'] = array(intval($search['forums']));

		}

		}

		foreach($search['forums'] as $forum)
{
$forum = intval($forum);
if(!$searchin[$forum])

		foreach($search['forums'] as $forum)
{
$forum = intval($forum);
if(!$searchin[$forum])

			{
$query = $db->query("SELECT f.fid FROM ".TABLE_PREFIX."forums f LEFT JOIN ".TABLE_PREFIX."forumpermissions p ON (f.fid=p.fid AND p.gid='".$mybb->user[usergroup]."') WHERE INSTR(CONCAT(',',parentlist,','),',$forum,') > 0 AND active!='no' AND (ISNULL(p.fid) OR p.cansearch='yes')");
if($db->num_rows($query) == 1)
{
$forumin .= " AND t.fid='$forum' ";
$searchin[$fid] = 1;
}
else
{
while($sforum = $db->fetch_array($query))
{
$fidlist[] = $sforum['fid'];
}
if(count($fidlist) > 1)
{
$forumin = " AND t.fid IN (".implode(",", $fidlist).")";
}

			{
$query = $db->query("SELECT DISTINCT f.fid FROM ".TABLE_PREFIX."forums f LEFT JOIN ".TABLE_PREFIX."forumpermissions p ON (f.fid=p.fid AND p.gid='".$mybb->user['usergroup']."') WHERE INSTR(CONCAT(',',parentlist,','),',$forum,') > 0 AND active!='no' AND (ISNULL(p.fid) OR p.cansearch='yes')");
while($sforum = $db->fetch_array($query))
{
$fidlist[] = $sforum['fid'];













				}

				}

 
			}
}
if(count($fidlist) == 1)
{
$forumin .= " AND t.fid='$forum' ";
$searchin[$fid] = 1;
}
else
{
if(count($fidlist) > 1)
{
$forumin = " AND t.fid IN (".implode(",", $fidlist).")";

			}
}
}

			}
}
}

Zeile 743Zeile 755
	if($unsearchforums)
{
$permsql = " AND t.fid NOT IN ($unsearchforums)";

	if($unsearchforums)
{
$permsql = " AND t.fid NOT IN ($unsearchforums)";

	}

	}

	$inactiveforums = get_inactive_forums();
if($inactiveforums)

	$inactiveforums = get_inactive_forums();
if($inactiveforums)

	{

	{

		$permsql .= " AND t.fid NOT IN ($inactiveforums)";

		$permsql .= " AND t.fid NOT IN ($inactiveforums)";

 
	}

$limitsql = "";
if(intval($mybb->settings['searchhardlimit']) > 0)
{
$limitsql = "LIMIT ".intval($mybb->settings['searchhardlimit']);

	}

// Searching both posts and thread titles

	}

// Searching both posts and thread titles

Zeile 761Zeile 779
			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin

			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $subject_lookin

 
			{$limitsql}

		");
while($thread = $db->fetch_array($query))
{

		");
while($thread = $db->fetch_array($query))
{

Zeile 775Zeile 794
			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE 1=1 $post_datecut $thread_replycut $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE 1=1 $post_datecut $thread_replycut $forumin $post_usersql $permsql AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%' $message_lookin

 
			{$limitsql}

		");
while($post = $db->fetch_array($query))
{

		");
while($post = $db->fetch_array($query))
{

Zeile 797Zeile 817
			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

			SELECT t.tid, t.firstpost
FROM ".TABLE_PREFIX."threads t
WHERE 1=1 $thread_datecut $thread_replycut $forumin $thread_usersql $permsql AND t.visible>0 $subject_lookin

 
			{$limitsql}

		");
while($thread = $db->fetch_array($query))
{

		");
while($thread = $db->fetch_array($query))
{

Zeile 819Zeile 840
				SELECT p.pid
FROM ".TABLE_PREFIX."posts p
WHERE p.pid IN ($firstposts) AND p.visible>0

				SELECT p.pid
FROM ".TABLE_PREFIX."posts p
WHERE p.pid IN ($firstposts) AND p.visible>0

 
				{$limitsql}

			");
while($post = $db->fetch_array($query))
{

			");
while($post = $db->fetch_array($query))
{