Vergleich search.php - 1.2.1 - 1.2.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

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

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

 *

 *

 * $Id: search.php 2180 2006-09-02 07:36:22Z chris $

 * $Id: search.php 3163 2007-06-26 18:38:25Z CraKteR $

 */



 */



Zeile 40Zeile 40
}

$now = time();

}

$now = time();

 

// Clear out searches older than a month
if($rand == 3)
{
$timecut = time()-60*60*24*30;
$db->delete_query(TABLE_PREFIX."searchlog", "dateline<='$timecut'");
}


if($mybb->input['action'] == "results")
{


if($mybb->input['action'] == "results")
{

Zeile 50Zeile 57
	if(!$search['sid'])
{
error($lang->error_invalidsearch);

	if(!$search['sid'])
{
error($lang->error_invalidsearch);

	}

$plugins->run_hooks("search_results_start");

	}

$plugins->run_hooks("search_results_start");


// Decide on our sorting fields and sorting order.


// Decide on our sorting fields and sorting order.

	$order = strtolower($mybb->input['order']);
$sortby = $mybb->input['sortby'];

	$order = strtolower(htmlspecialchars($mybb->input['order']));
$sortby = htmlspecialchars($mybb->input['sortby']);


switch($sortby)
{


switch($sortby)
{

Zeile 77Zeile 84
			}
break;
case "forum":

			}
break;
case "forum":

			$sortfield = "t.fid";
break;

			$sortfield = "t.fid";
break;

		case "starter":
if($search['resulttype'] == "threads")
{

		case "starter":
if($search['resulttype'] == "threads")
{

Zeile 135Zeile 142
	{
$threadcount = 0;
// If we have saved WHERE conditions, execute them

	{
$threadcount = 0;
// If we have saved WHERE conditions, execute them

		if($search['querycache'] != "")
{

		if($search['querycache'] != "")
{

			$where_conditions = $search['querycache'];
$query = $db->simple_select(TABLE_PREFIX."threads t", "t.tid", $where_conditions. " AND t.visible>0 AND t.closed NOT LIKE 'moved|%'");
while($thread = $db->fetch_array($query))

			$where_conditions = $search['querycache'];
$query = $db->simple_select(TABLE_PREFIX."threads t", "t.tid", $where_conditions. " AND t.visible>0 AND t.closed NOT LIKE 'moved|%'");
while($thread = $db->fetch_array($query))

Zeile 415Zeile 422
		$tids = array();
$query = $db->query("
SELECT p.tid

		$tids = array();
$query = $db->query("
SELECT p.tid

			FROM ".TABLE_PREFIX."posts p

			FROM ".TABLE_PREFIX."posts p

			LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE $where_conditions AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%'
ORDER BY $sortfield $order

			LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE $where_conditions AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%'
ORDER BY $sortfield $order

Zeile 451Zeile 458
			if($post['userusername'])
{
$post['username'] = $post['userusername'];

			if($post['userusername'])
{
$post['username'] = $post['userusername'];

			}

			}

			$post['profilelink'] = build_profile_link($post['username'], $post['uid']);
$post['subject'] = $parser->parse_badwords($post['subject']);
$post['subject'] = htmlspecialchars_uni($post['subject']);

			$post['profilelink'] = build_profile_link($post['username'], $post['uid']);
$post['subject'] = $parser->parse_badwords($post['subject']);
$post['subject'] = htmlspecialchars_uni($post['subject']);

Zeile 462Zeile 469
			{
$posticon = $icon_cache[$post['icon']];
$icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";

			{
$posticon = $icon_cache[$post['icon']];
$icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";

			}

			}

			else
{
$icon = "&nbsp;";

			else
{
$icon = "&nbsp;";

Zeile 509Zeile 516
				elseif($forumread > $mybb->user['lastvisit'])
{
$lastread = $forumread;

				elseif($forumread > $mybb->user['lastvisit'])
{
$lastread = $forumread;

				}

				}

				else
{
$lastread = $mybb->user['lastvisit'];

				else
{
$lastread = $mybb->user['lastvisit'];

Zeile 550Zeile 557
			else
{
$post['forumlink'] = "";

			else
{
$post['forumlink'] = "";

			}


			}


			if(!$post['subject'])
{
$post['subject'] = $post['message'];

			if(!$post['subject'])
{
$post['subject'] = $post['message'];

Zeile 573Zeile 580
				$prev = htmlspecialchars_uni($post['message']);
}
$posted = my_date($mybb->settings['dateformat'], $post['dateline']).", ".my_date($mybb->settings['timeformat'], $post['dateline']);

				$prev = htmlspecialchars_uni($post['message']);
}
$posted = my_date($mybb->settings['dateformat'], $post['dateline']).", ".my_date($mybb->settings['timeformat'], $post['dateline']);





			$plugins->run_hooks("search_results_post");
eval("\$results .= \"".$templates->get("search_results_posts_post")."\";");
}

			$plugins->run_hooks("search_results_post");
eval("\$results .= \"".$templates->get("search_results_posts_post")."\";");
}

Zeile 595Zeile 602
elseif($mybb->input['action'] == "findguest")
{
$where_sql = "p.uid='0'";

elseif($mybb->input['action'] == "findguest")
{
$where_sql = "p.uid='0'";


$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
}

$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $db->escape_string($session->ipaddress),
"threads" => '',
"posts" => '',


$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
}

$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $db->escape_string($session->ipaddress),
"threads" => '',
"posts" => '',

		"searchtype" => "titles",
"resulttype" => "posts",
"querycache" => $db->escape_string($where_sql),

		"searchtype" => "titles",
"resulttype" => "posts",
"querycache" => $db->escape_string($where_sql),

Zeile 624Zeile 631
	redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input['action'] == "finduser")

	redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input['action'] == "finduser")

{
$where_sql = "p.uid='".intval($mybb->input['uid'])."'";

$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
}


{
$where_sql = "p.uid='".intval($mybb->input['uid'])."'";

$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
}


	$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),

	$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),

Zeile 648Zeile 655
		"posts" => '',
"searchtype" => "titles",
"resulttype" => "posts",

		"posts" => '',
"searchtype" => "titles",
"resulttype" => "posts",

		"querycache" => $db->escape_string($where_sql),
);

		"querycache" => $db->escape_string($where_sql),
);

	$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);

	$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);

Zeile 661Zeile 668
	$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{

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

		$where_sql .= " AND t.fid NOT IN ($unsearchforums)";

		$where_sql .= " AND t.fid NOT IN ($unsearchforums)";

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

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

Zeile 689Zeile 696
{

$where_sql = "t.lastpost >= '".$mybb->user['lastvisit']."'";

{

$where_sql = "t.lastpost >= '".$mybb->user['lastvisit']."'";


if($mybb->input['fid'])
{
$where_sql .= " AND t.fid='".intval($mybb->input['fid'])."'";
}

$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
}

$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $db->escape_string($session->ipaddress),
"threads" => '',
"posts" => '',
"searchtype" => "titles",
"resulttype" => "threads",
"querycache" => $db->escape_string($where_sql),
);

$plugins->run_hooks("search_do_search_process");


if($mybb->input['fid'])
{
$where_sql .= " AND t.fid='".intval($mybb->input['fid'])."'";
}

$unsearchforums = get_unsearchable_forums();
if($unsearchforums)
{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}
$inactiveforums = get_inactive_forums();
if($inactiveforums)
{
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
}

$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $db->escape_string($session->ipaddress),
"threads" => '',
"posts" => '',
"searchtype" => "titles",
"resulttype" => "threads",
"querycache" => $db->escape_string($where_sql),
);

$plugins->run_hooks("search_do_search_process");

	$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input['action'] == "getdaily")
{
if($mybb->input['days'] < 1)

	$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input['action'] == "getdaily")
{
if($mybb->input['days'] < 1)

	{
$days = 1;
}
else
{
$days = intval($mybb->input['days']);

	{
$days = 1;





	}

	}

	$datecut = time()-(68400*$days);






	else
{
$days = intval($mybb->input['days']);
}
$datecut = time()-(86400*$days);


	$where_sql = "t.lastpost >='".$datecut."'";

if($mybb->input['fid'])

	$where_sql = "t.lastpost >='".$datecut."'";

if($mybb->input['fid'])

Zeile 743Zeile 750
	}

$unsearchforums = get_unsearchable_forums();

	}

$unsearchforums = get_unsearchable_forums();

	if($unsearchforums)

	if($unsearchforums)

	{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}

	{
$where_sql .= " AND t.fid NOT IN ($unsearchforums)";
}

Zeile 790Zeile 797
		$timecut = time()-$mybb->settings['searchfloodtime'];
$query = $db->simple_select(TABLE_PREFIX."searchlog", "*", "$conditions AND dateline >= '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC"));
$last_search = $db->fetch_array($query);

		$timecut = time()-$mybb->settings['searchfloodtime'];
$query = $db->simple_select(TABLE_PREFIX."searchlog", "*", "$conditions AND dateline >= '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC"));
$last_search = $db->fetch_array($query);

		// Users last search was within the flood time, show the error
if($last_search['sid'])





// We shouldn't show remaining time if time is 0 or under.
$remaining_time = $mybb->settings['searchfloodtime']-(time()-$last_search['dateline']);
// Users last search was within the flood time, show the error.
if($last_search['sid'] && $remaining_time > 0)

		{

		{

			$remaining_time = $mybb->settings['searchfloodtime']-(time()-$last_search['dateline']);

 
			$lang->error_searchflooding = sprintf($lang->error_searchflooding, $mybb->settings['searchfloodtime'], $remaining_time);
error($lang->error_searchflooding);
}

			$lang->error_searchflooding = sprintf($lang->error_searchflooding, $mybb->settings['searchfloodtime'], $remaining_time);
error($lang->error_searchflooding);
}

Zeile 814Zeile 823
		"matchusername" => $mybb->input['matchusername'],
"postdate" => $mybb->input['postdate'],
"pddir" => $mybb->input['pddir'],

		"matchusername" => $mybb->input['matchusername'],
"postdate" => $mybb->input['postdate'],
"pddir" => $mybb->input['pddir'],

		"forums" => $mybb->input['forums']



		"forums" => $mybb->input['forums'],
"findthreadst" => $mybb->input['findthreadst'],
"numreplies" => $mybb->input['numreplies']

	);

if($config['dbtype'] == "mysql" || $config['dbtype'] == "mysqli")

	);

if($config['dbtype'] == "mysql" || $config['dbtype'] == "mysqli")

Zeile 848Zeile 859

$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);



$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);


	if(strtolower($mybb->input['sortordr']) == "asc" || strtolower($mybb->input['sortordr'] == "desc"))

	if(strtolower($mybb->input['sortordr']) == "asc" || strtolower($mybb->input['sortordr']) == "desc")

	{
$sortorder = $mybb->input['sortordr'];
}

	{
$sortorder = $mybb->input['sortordr'];
}