Vergleich search.php - 1.01 - 1.13

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 55Zeile 55
		$sortorder = "DESC";
$order = "desc";
}

		$sortorder = "DESC";
$order = "desc";
}

	if($sortby == "subject")
{
$sortfield = "subject";
}
elseif($sortby == "replies")
{
$sortfield = "replies";
}
elseif($sortby == "views")
{
$sortfield = "views";
}
elseif($sortby == "starter")
{
$sortfield = "username";
}
elseif($sortby == "lastposter")
{
$sortfield = "t.lastposter";
}
elseif($sortby == "dateline")
{
$sortfield = "p.dateline";





    if($sortby == "subject")
{
$sortfield = "subject";
}
elseif($sortby == "replies")
{
$sortfield = "replies";
}
elseif($sortby == "views")
{
$sortfield = "views";
}
elseif($sortby == "starter")
{
$sortfield = "username";
}
elseif($sortby == "lastposter")
{
$sortfield = "t.lastposter";
}
elseif($sortby == "dateline")
{
$sortfield = "p.dateline";
}
elseif($sortby == "forum")
{
$sortfield = "f.name";

	}
else
{

	}
else
{

Zeile 214Zeile 218
				}
}
if(!$donenew)

				}
}
if(!$donenew)

			{

			{

				$tread = mygetarraycookie("threadread", $result['tid']);
if($result['lastpost'] > $tread)
{

				$tread = mygetarraycookie("threadread", $result['tid']);
if($result['lastpost'] > $tread)
{

Zeile 347Zeile 351
		"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => $wheresql,

		"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => $wheresql,

		"lookin" => "p.message",
"showposts" => 2
);
$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
$sid = $db->insert_id();

		"lookin" => "p.message",
"showposts" => 2
);
$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
$sid = $db->insert_id();


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

{
$wheresql = "1=1";

{
$wheresql = "1=1";

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

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

	$searcharray = array(
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => addslashes($wheresql),

	$searcharray = array(
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => addslashes($wheresql),

		"lookin" => "p.message",
"showposts" => 2

		"lookin" => "p.message",
"showposts" => 2

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

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

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

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

{
$wheresql = "1=1";

{
$wheresql = "1=1";

	$wheresql .= " AND t.uid='".intval($mybb->input['uid'])."'";
$searcharray = array(
"uid" => $mybb->user['uid'],

	$wheresql .= " AND t.uid='".intval($mybb->input['uid'])."'";
$searcharray = array(
"uid" => $mybb->user['uid'],

Zeile 393Zeile 397
elseif($mybb->input['action'] == "getnew")
{
if(!$mybb->input['days'] < 1)

elseif($mybb->input['action'] == "getnew")
{
if(!$mybb->input['days'] < 1)

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

$wheresql = "1=1";
if($mybb->input['fid'])
{
$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,','),',".intval($mybb->input['fid']).",') > 0 AND (ISNULL(p.fid) OR (p.cansearch='yes' AND p.canview='yes')");
if($db->num_rows($query) == 1)
{
$wheresql .= " AND t.fid='".intval($mybb->input['fid'])."' ";
}
else
{
$wheresql .= " AND t.fid IN ('".intval($mybb->input['fid'])."'";
while($sforum = $db->fetch_array($query))
{
$wheresql .= ",'$sforum[fid]'";
}
$wheresql .= ")";
}
}

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

$wheresql = "1=1";
if($mybb->input['fid'])
{
$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,','),',".intval($mybb->input['fid']).",') > 0 AND (ISNULL(p.fid) OR (p.cansearch='yes' AND p.canview='yes')");
if($db->num_rows($query) == 1)
{
$wheresql .= " AND t.fid='".intval($mybb->input['fid'])."' ";
}
else
{
$wheresql .= " AND t.fid IN ('".intval($mybb->input['fid'])."'";
while($sforum = $db->fetch_array($query))
{
$wheresql .= ",'$sforum[fid]'";
}
$wheresql .= ")";
}
}

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

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

	$searcharray = array(
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => addslashes($wheresql),
"lookin" => "p.message",
"showposts" => 1
);

	$searcharray = array(
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $ipaddress,
"wheresql" => addslashes($wheresql),
"lookin" => "p.message",
"showposts" => 1
);

	$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
$sid = $db->insert_id();

	$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);
$sid = $db->insert_id();

Zeile 486Zeile 490
	if(!$mybb->input['keywords'])
{
if(!$mybb->input['author'])

	if(!$mybb->input['keywords'])
{
if(!$mybb->input['author'])

		{

		{

			error($lang->error_nosearchterms);
}

			error($lang->error_nosearchterms);
}

	}

	}

	
if(trim($mybb->input['keywords']) == '%')
{
error($lang->error_percentnotallowed);

	
if(trim($mybb->input['keywords']) == '%')
{
error($lang->error_percentnotallowed);

	}

	}

	
$plugins->run_hooks("search_do_search_start");


	
$plugins->run_hooks("search_do_search_start");


Zeile 505Zeile 509
	}
else
{

	}
else
{

		$lookin = "p.subject";
}
if($mybb->input['srchtype'] == 1)
{
$op = "AND";
}
elseif($mybb->input['srchtype'] == 3)
{
$op = "||";
}
else
{
$op = "";

		$lookin = "p.subject";













	}

	}

 
	$op = "";

	if($mybb->input['keywords']) {
$wheresql = "(1=0 ";
if($mybb->input['srchtype'] != 2)

	if($mybb->input['keywords']) {
$wheresql = "(1=0 ";
if($mybb->input['srchtype'] != 2)

Zeile 594Zeile 587
		}
foreach($mybb->input['forums'] as $forum)
{

		}
foreach($mybb->input['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(!$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')");

Zeile 635Zeile 629
		$permsql = " AND t.fid NOT IN ($unsearchforums)";
}


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


	$query = $db->query("SELECT p.tid FROM ".TABLE_PREFIX."posts p, ".TABLE_PREFIX."threads t WHERE $wheresql $permsql");
$results = $db->num_rows($query);




	$wheresql .= " AND p.tid=t.tid";

$query = $db->query("SELECT COUNT(p.tid) AS count FROM ".TABLE_PREFIX."posts p, ".TABLE_PREFIX."threads t WHERE $wheresql $permsql");
$count = $db->fetch_array($query);
$results = $count['count'];


if(!$results)
{


if(!$results)
{

Zeile 665Zeile 662
	$plugins->run_hooks("search_do_search_process");
$sid = $db->insert_id();
$plugins->run_hooks("search_do_search_end");

	$plugins->run_hooks("search_do_search_process");
$sid = $db->insert_id();
$plugins->run_hooks("search_do_search_end");

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

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

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