Vergleich search.php - 1.8.26 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 188Zeile 188
			ORDER BY pid, disporder
");


			ORDER BY pid, disporder
");


		$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);








		if(isset($mybb->cookies['mybb']['forumread']))
{
$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
}
else
{
$forumsread = array();
}

	}
else

	}
else

	{

	{

		// Build a forum cache.
$query = $db->query("
SELECT f.fid, fr.dateline AS lastread

		// Build a forum cache.
$query = $db->query("
SELECT f.fid, fr.dateline AS lastread

Zeile 201Zeile 208
			ORDER BY pid, disporder
");
}

			ORDER BY pid, disporder
");
}





	while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)
{

	while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)
{

			if($forumsread[$forum['fid']])

			if(!empty($forumsread[$forum['fid']]))

			{
$forum['lastread'] = $forumsread[$forum['fid']];
}
}

			{
$forum['lastread'] = $forumsread[$forum['fid']];
}
}

		$readforums[$forum['fid']] = $forum['lastread'];










if(isset($forum['lastread']))
{
$readforums[$forum['fid']] = $forum['lastread'];
}
else
{
$readforums[$forum['fid']] = '';
}

	}
$fpermissions = forum_permissions();

// Inline Mod Column for moderators

	}
$fpermissions = forum_permissions();

// Inline Mod Column for moderators

	$inlinemodcol = $inlinecookie = '';

	$inlinemodcol = $inlinecookie = $inline_edit_js = '';

	$is_mod = $is_supermod = $show_inline_moderation = false;
if($mybb->usergroup['issupermod'])
{

	$is_mod = $is_supermod = $show_inline_moderation = false;
if($mybb->usergroup['issupermod'])
{

Zeile 255Zeile 270
			}
// No results.
else

			}
// No results.
else

			{
error($lang->error_nosearchresults);
}
$where_conditions = "t.tid IN (".$search['threads'].")";
}

			{
error($lang->error_nosearchresults);
}
$where_conditions = "t.tid IN (".$search['threads'].")";
}

		// This search doesn't use a query cache, results stored in search table.
else
{

		// This search doesn't use a query cache, results stored in search table.
else
{

Zeile 368Zeile 383
		if(!$mybb->settings['maxmultipagelinks'])
{
$mybb->settings['maxmultipagelinks'] = 5;

		if(!$mybb->settings['maxmultipagelinks'])
{
$mybb->settings['maxmultipagelinks'] = 5;

		}

$results = '';

		}

$results = '';


foreach($thread_cache as $thread)
{


foreach($thread_cache as $thread)
{

Zeile 415Zeile 430
			else
{
$icon = " ";

			else
{
$icon = " ";

			}

			}

			if($thread['poll'])
{
$prefix = $lang->poll_prefix;

			if($thread['poll'])
{
$prefix = $lang->poll_prefix;

Zeile 437Zeile 452
			if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])
{
$forum_read = $readforums[$thread['fid']];

			if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])
{
$forum_read = $readforums[$thread['fid']];





				$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)

				$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)

				{

				{

					$forum_read = $read_cutoff;

					$forum_read = $read_cutoff;

				}
}

				}
}

			else
{

			else
{

				$forum_read = $forumsread[$thread['fid']];








				if(isset($forumsread[$thread['fid']]))
{
$forum_read = $forumsread[$thread['fid']];
}
else
{
$forum_read = '';
}

			}

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read)
{
if($thread['lastread'])

			}

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read)
{
if($thread['lastread'])

				{

				{

					$last_read = $thread['lastread'];
}
else
{
$last_read = $read_cutoff;

					$last_read = $thread['lastread'];
}
else
{
$last_read = $read_cutoff;

				}
}
else

				}
}
else

			{
$last_read = my_get_array_cookie("threadread", $thread['tid']);

			{
$last_read = my_get_array_cookie("threadread", $thread['tid']);

			}

			}


if($forum_read > $last_read)


if($forum_read > $last_read)

			{

			{

				$last_read = $forum_read;
}


				$last_read = $forum_read;
}


Zeile 483Zeile 505
			{
$new_class = 'subject_old';
$folder_label .= $lang->icon_no_new;

			{
$new_class = 'subject_old';
$folder_label .= $lang->icon_no_new;

			}

			}


if($thread['replies'] >= $mybb->settings['hottopic'] || $thread['views'] >= $mybb->settings['hottopicviews'])
{


if($thread['replies'] >= $mybb->settings['hottopic'] || $thread['views'] >= $mybb->settings['hottopicviews'])
{

Zeile 549Zeile 571
				$threadpages = '';
$morelink = '';
$thread['multipage'] = '';

				$threadpages = '';
$morelink = '';
$thread['multipage'] = '';

			}

			}

			$lastpostdate = my_date('relative', $thread['lastpost']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$lastposteruid = $thread['lastposteruid'];
if(!$lastposteruid && !$thread['lastposter'])

			$lastpostdate = my_date('relative', $thread['lastpost']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$lastposteruid = $thread['lastposteruid'];
if(!$lastposteruid && !$thread['lastposter'])

			{

			{

				$lastposter = htmlspecialchars_uni($lang->guest);

				$lastposter = htmlspecialchars_uni($lang->guest);

			}
else

			}
else

			{
$lastposter = htmlspecialchars_uni($thread['lastposter']);
}
$thread_link = get_thread_link($thread['tid']);

			{
$lastposter = htmlspecialchars_uni($thread['lastposter']);
}
$thread_link = get_thread_link($thread['tid']);





			// Don't link to guest's profiles (they have no profile).
if($lastposteruid == 0)

			// Don't link to guest's profiles (they have no profile).
if($lastposteruid == 0)

			{

			{

				$lastposterlink = $lastposter;
}
else
{
$lastposterlink = build_profile_link($lastposter, $lastposteruid);

				$lastposterlink = $lastposter;
}
else
{
$lastposterlink = build_profile_link($lastposter, $lastposteruid);

			}


			}


			$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);


			$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);


Zeile 651Zeile 673
		{
$upper = $threadcount;
}

		{
$upper = $threadcount;
}

 

$selectall = '';
$inlinemod = '';


// Inline Thread Moderation Options
if($show_inline_moderation)


// Inline Thread Moderation Options
if($show_inline_moderation)

Zeile 728Zeile 753
		{
$pids[$post['pid']] = $post['tid'];
$tids[$post['tid']][$post['pid']] = $post['pid'];

		{
$pids[$post['pid']] = $post['tid'];
$tids[$post['tid']][$post['pid']] = $post['pid'];

		}

		}


if(!empty($pids))
{


if(!empty($pids))
{

Zeile 739Zeile 764
			$onlyusfids = array();

foreach($group_permissions as $fid => $forum_permissions)

			$onlyusfids = array();

foreach($group_permissions as $fid => $forum_permissions)

			{

			{

				if(!empty($forum_permissions['canonlyviewownthreads']))
{
$onlyusfids[] = $fid;

				if(!empty($forum_permissions['canonlyviewownthreads']))
{
$onlyusfids[] = $fid;

Zeile 749Zeile 774
			if($onlyusfids)
{
$permsql .= " OR (fid IN(".implode(',', $onlyusfids).") AND uid!={$mybb->user['uid']})";

			if($onlyusfids)
{
$permsql .= " OR (fid IN(".implode(',', $onlyusfids).") AND uid!={$mybb->user['uid']})";

			}

			}

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

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

Zeile 809Zeile 834
			while($post = $db->fetch_array($query))
{
$dot_icon[$post['tid']] = true;

			while($post = $db->fetch_array($query))
{
$dot_icon[$post['tid']] = true;

			}
}

			}
}


$results = '';



$results = '';


Zeile 851Zeile 876
			$post['subject'] = $parser->parse_badwords($post['subject']);
$post['thread_subject'] = $parser->parse_badwords($post['thread_subject']);
$post['thread_subject'] = htmlspecialchars_uni($post['thread_subject']);

			$post['subject'] = $parser->parse_badwords($post['subject']);
$post['thread_subject'] = $parser->parse_badwords($post['thread_subject']);
$post['thread_subject'] = htmlspecialchars_uni($post['thread_subject']);





			if(isset($icon_cache[$post['icon']]))

			if(isset($icon_cache[$post['icon']]))

			{

			{

				$posticon = $icon_cache[$post['icon']];
$posticon['path'] = str_replace("{theme}", $theme['imgdir'], $posticon['path']);
$posticon['path'] = htmlspecialchars_uni($posticon['path']);

				$posticon = $icon_cache[$post['icon']];
$posticon['path'] = str_replace("{theme}", $theme['imgdir'], $posticon['path']);
$posticon['path'] = htmlspecialchars_uni($posticon['path']);

Zeile 863Zeile 888
			else
{
$icon = "&nbsp;";

			else
{
$icon = "&nbsp;";

			}

			}


$post['forumlink'] = '';
if(!empty($forumcache[$post['fid']]))


$post['forumlink'] = '';
if(!empty($forumcache[$post['fid']]))

Zeile 871Zeile 896
				$post['forumlink_link'] = get_forum_link($post['fid']);
$post['forumlink_name'] = $forumcache[$post['fid']]['name'];
eval("\$post['forumlink'] = \"".$templates->get("search_results_posts_forumlink")."\";");

				$post['forumlink_link'] = get_forum_link($post['fid']);
$post['forumlink_name'] = $forumcache[$post['fid']]['name'];
eval("\$post['forumlink'] = \"".$templates->get("search_results_posts_forumlink")."\";");

			}


			}


			// Determine the folder
$folder = '';
$folder_label = '';

			// Determine the folder
$folder = '';
$folder_label = '';

Zeile 880Zeile 905
			$isnew = 0;
$donenew = 0;
$last_read = 0;

			$isnew = 0;
$donenew = 0;
$last_read = 0;

			$post['thread_lastread'] = $readthreads[$post['tid']];

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])










if(isset($readthreads[$post['tid']]))
{
$post['thread_lastread'] = $readthreads[$post['tid']];
}
else
{
$post['thread_lastread'] = '';
}

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])

			{
$forum_read = $readforums[$post['fid']];

$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)

			{
$forum_read = $readforums[$post['fid']];

$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)

				{

				{

					$forum_read = $read_cutoff;
}
}
else
{

					$forum_read = $read_cutoff;
}
}
else
{

				$forum_read = $forumsread[$post['fid']];








				if(isset($forumsread[$post['fid']]))
{
$forum_read = $forumsread[$post['fid']];
}
else
{
$forum_read = '';
}

			}

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forum_read)

			}

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forum_read)

Zeile 1041Zeile 1081
		{
$upper = $postcount;
}

		{
$upper = $postcount;
}

 

$selectall = '';
$inlinemod = '';


// Inline Post Moderation Options
if($show_inline_moderation)
{
eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol")."\";");


// Inline Post Moderation Options
if($show_inline_moderation)
{
eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol")."\";");





			// If user has moderation tools available, prepare the Select All feature
$num_results = $db->num_rows($query);
$lang->page_selected = $lang->sprintf($lang->page_selected, (int)$num_results);

			// If user has moderation tools available, prepare the Select All feature
$num_results = $db->num_rows($query);
$lang->page_selected = $lang->sprintf($lang->page_selected, (int)$num_results);

Zeile 1068Zeile 1111
			while($tool = $db->fetch_array($query))
{
eval("\$customposttools .= \"".$templates->get("search_results_posts_inlinemoderation_custom_tool")."\";");

			while($tool = $db->fetch_array($query))
{
eval("\$customposttools .= \"".$templates->get("search_results_posts_inlinemoderation_custom_tool")."\";");

			}

			}

			// Build inline moderation dropdown
if(!empty($customposttools))
{

			// Build inline moderation dropdown
if(!empty($customposttools))
{

Zeile 1085Zeile 1128

eval("\$searchresults = \"".$templates->get("search_results_posts")."\";");
output_page($searchresults);


eval("\$searchresults = \"".$templates->get("search_results_posts")."\";");
output_page($searchresults);

	}
}

	}
}

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

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


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

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where = get_visible_where();
$where_sql .= " AND ({$unapproved_where})";

$permsql = "";
$onlyusfids = array();

// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
foreach($group_permissions as $fid => $forum_permissions)
{
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)
{
$onlyusfids[] = $fid;
}
}
if(!empty($onlyusfids))
{
$where_sql .= " AND fid NOT IN(".implode(',', $onlyusfids).")";
}

$options = array(
'order_by' => 'dateline',
'order_dir' => 'desc'
);

// Do we have a hard search limit?
if($mybb->settings['searchhardlimit'] > 0)
{
$options['limit'] = (int)$mybb->settings['searchhardlimit'];
}

$pids = '';
$comma = '';
$query = $db->simple_select("posts", "pid", "{$where_sql}", $options);
while($pid = $db->fetch_field($query, "pid"))
{
$pids .= $comma.$pid;
$comma = ',';
}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))
{
$tids .= $comma.$tid;
$comma = ',';
}

$sid = md5(uniqid(microtime(), true));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_binary($session->packedip),
"threads" => $db->escape_string($tids),
"posts" => $db->escape_string($pids),
"resulttype" => "posts",
"querycache" => '',
"keywords" => ''
);
$plugins->run_hooks("search_do_search_process");
$db->insert_query("searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input['action'] == "finduser")
{
$where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";

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

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where = get_visible_where();
$where_sql .= " AND ({$unapproved_where})";


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

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where = get_visible_where();
$where_sql .= " AND ({$unapproved_where})";



















































































$permsql = "";
$onlyusfids = array();


$permsql = "";
$onlyusfids = array();

Zeile 1201Zeile 1163
	}
if(!empty($onlyusfids))
{

	}
if(!empty($onlyusfids))
{

		$where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))";

		$where_sql .= " AND fid NOT IN(".implode(',', $onlyusfids).")";

	}

$options = array(

	}

$options = array(

		'order_by' => 'dateline',
'order_dir' => 'desc'

		'order_by' => 'dateline DESC, pid DESC',


	);

// Do we have a hard search limit?

	);

// Do we have a hard search limit?

Zeile 1220Zeile 1181
	$query = $db->simple_select("posts", "pid", "{$where_sql}", $options);
while($pid = $db->fetch_field($query, "pid"))
{

	$query = $db->simple_select("posts", "pid", "{$where_sql}", $options);
while($pid = $db->fetch_field($query, "pid"))
{

			$pids .= $comma.$pid;
$comma = ',';

		$pids .= $comma.$pid;
$comma = ',';

	}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))

	}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))

	{
$tids .= $comma.$tid;
$comma = ',';

	{
$tids .= $comma.$tid;
$comma = ',';

	}

$sid = md5(uniqid(microtime(), true));

	}

$sid = md5(uniqid(microtime(), true));

Zeile 1249Zeile 1210
	$db->insert_query("searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}

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

elseif($mybb->input['action'] == "finduserthreads")

elseif($mybb->input['action'] == "finduser")

{
$where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";


{
$where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";


Zeile 1278Zeile 1239
		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))
{
$where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))";
}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))
{
$tids .= $comma.$tid;
$comma = ',';
}

$sid = md5(uniqid(microtime(), true));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_binary($session->packedip),
"threads" => $db->escape_string($tids),
"posts" => '',
"resulttype" => "threads",

















































































		}
}
if(!empty($onlyusfids))
{
$where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))";
}

$options = array(
'order_by' => 'dateline DESC, pid DESC',
);

// Do we have a hard search limit?
if($mybb->settings['searchhardlimit'] > 0)
{
$options['limit'] = (int)$mybb->settings['searchhardlimit'];
}

$pids = '';
$comma = '';
$query = $db->simple_select("posts", "pid", "{$where_sql}", $options);
while($pid = $db->fetch_field($query, "pid"))
{
$pids .= $comma.$pid;
$comma = ',';
}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))
{
$tids .= $comma.$tid;
$comma = ',';
}

$sid = md5(uniqid(microtime(), true));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_binary($session->packedip),
"threads" => $db->escape_string($tids),
"posts" => $db->escape_string($pids),
"resulttype" => "posts",
"querycache" => '',
"keywords" => ''
);
$plugins->run_hooks("search_do_search_process");
$db->insert_query("searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input['action'] == "finduserthreads")
{
$where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";

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

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where = get_visible_where();
$where_sql .= " AND ({$unapproved_where})";

$permsql = "";
$onlyusfids = array();

// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
foreach($group_permissions as $fid => $forum_permissions)
{
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)
{
$onlyusfids[] = $fid;
}
}
if(!empty($onlyusfids))
{
$where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))";
}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))
{
$tids .= $comma.$tid;
$comma = ',';
}

$sid = md5(uniqid(microtime(), true));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_binary($session->packedip),
"threads" => $db->escape_string($tids),
"posts" => '',
"resulttype" => "threads",

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

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

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

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

{

$where_sql = "lastpost >= '".(int)$mybb->user['lastvisit']."'";

if($mybb->get_input('fid', MyBB::INPUT_INT))
{
$where_sql .= " AND fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";
}
else if($mybb->get_input('fids'))
{
$fids = explode(',', $mybb->get_input('fids'));
foreach($fids as $key => $fid)
{
$fids[$key] = (int)$fid;
}

if(!empty($fids))
{
$where_sql .= " AND fid IN (".implode(',', $fids).")";
}
}

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

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where = get_visible_where();
$where_sql .= " AND ({$unapproved_where})";

$permsql = "";
$onlyusfids = array();

// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
foreach($group_permissions as $fid => $forum_permissions)
{
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)
{
$onlyusfids[] = $fid;
}
}
if(!empty($onlyusfids))
{
$where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))";
}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))

{

$where_sql = "lastpost >= '".(int)$mybb->user['lastvisit']."'";

if($mybb->get_input('fid', MyBB::INPUT_INT))
{
$where_sql .= " AND fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";
}
else if($mybb->get_input('fids'))
{
$fids = explode(',', $mybb->get_input('fids'));
foreach($fids as $key => $fid)
{
$fids[$key] = (int)$fid;
}

if(!empty($fids))
{
$where_sql .= " AND fid IN (".implode(',', $fids).")";
}
}

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

// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where = get_visible_where();
$where_sql .= " AND ({$unapproved_where})";

$permsql = "";
$onlyusfids = array();

// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
foreach($group_permissions as $fid => $forum_permissions)
{
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)
{
$onlyusfids[] = $fid;
}
}
if(!empty($onlyusfids))
{
$where_sql .= "AND ((fid IN(".implode(',', $onlyusfids).") AND uid='{$mybb->user['uid']}') OR fid NOT IN(".implode(',', $onlyusfids)."))";
}

$tids = '';
$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))

	{

	{

			$tids .= $comma.$tid;
$comma = ',';

		$tids .= $comma.$tid;
$comma = ',';

	}

	}





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

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

Zeile 1393Zeile 1434
}
elseif($mybb->input['action'] == "getdaily")
{

}
elseif($mybb->input['action'] == "getdaily")
{

	if($mybb->get_input('days', MyBB::INPUT_INT) < 1)

	if($mybb->get_input('days', MyBB::INPUT_INT) < 1)

	{
$days = 1;
}
else
{
$days = $mybb->get_input('days', MyBB::INPUT_INT);

	{
$days = 1;
}
else
{
$days = $mybb->get_input('days', MyBB::INPUT_INT);

	}

	}

	$datecut = TIME_NOW-(86400*$days);

	$datecut = TIME_NOW-(86400*$days);





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

if($mybb->get_input('fid', MyBB::INPUT_INT))

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

if($mybb->get_input('fid', MyBB::INPUT_INT))

Zeile 1412Zeile 1453
	else if($mybb->get_input('fids'))
{
$fids = explode(',', $mybb->get_input('fids'));

	else if($mybb->get_input('fids'))
{
$fids = explode(',', $mybb->get_input('fids'));

		foreach($fids as $key => $fid)
{
$fids[$key] = (int)$fid;
}

		foreach($fids as $key => $fid)
{
$fids[$key] = (int)$fid;
}


if(!empty($fids))
{


if(!empty($fids))
{

Zeile 1459Zeile 1500
	$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))

	$comma = '';
$query = $db->simple_select("threads", "tid", $where_sql);
while($tid = $db->fetch_field($query, "tid"))

	{
$tids .= $comma.$tid;
$comma = ',';

	{
$tids .= $comma.$tid;
$comma = ',';

	}

$sid = md5(uniqid(microtime(), true));

	}

$sid = md5(uniqid(microtime(), true));

Zeile 1484Zeile 1525
elseif($mybb->input['action'] == "do_search")
{
$plugins->run_hooks("search_do_search_start");

elseif($mybb->input['action'] == "do_search")
{
$plugins->run_hooks("search_do_search_start");





	// Check if search flood checking is enabled and user is not admin
if($mybb->settings['searchfloodtime'] > 0 && $mybb->usergroup['cancp'] != 1)
{
// Fetch the time this user last searched
if($mybb->user['uid'])

	// Check if search flood checking is enabled and user is not admin
if($mybb->settings['searchfloodtime'] > 0 && $mybb->usergroup['cancp'] != 1)
{
// Fetch the time this user last searched
if($mybb->user['uid'])

		{

		{

			$conditions = "uid='{$mybb->user['uid']}'";
}
else

			$conditions = "uid='{$mybb->user['uid']}'";
}
else

Zeile 1501Zeile 1542
		$query = $db->simple_select("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

		$query = $db->simple_select("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'])

		if(!empty($last_search['sid']))

		{
$remaining_time = $mybb->settings['searchfloodtime']-(TIME_NOW-$last_search['dateline']);
if($remaining_time == 1)
{
$lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']);

		{
$remaining_time = $mybb->settings['searchfloodtime']-(TIME_NOW-$last_search['dateline']);
if($remaining_time == 1)
{
$lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']);

			}

			}

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

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

	}

	}

	if($mybb->get_input('showresults') == "threads")

	if($mybb->get_input('showresults') == "threads")

	{

	{

		$resulttype = "threads";
}
else
{

		$resulttype = "threads";
}
else
{

		$resulttype = "posts";










		$resulttype = "posts";
}

if(isset($mybb->input['forums']) && is_array($mybb->input['forums']))
{
$forums = $mybb->get_input('forums', MyBB::INPUT_ARRAY);
}
else
{
$forums = array($mybb->get_input('forums'));

	}

$search_data = array(

	}

$search_data = array(

Zeile 1531Zeile 1581
		"matchusername" => $mybb->get_input('matchusername', MyBB::INPUT_INT),
"postdate" => $mybb->get_input('postdate', MyBB::INPUT_INT),
"pddir" => $mybb->get_input('pddir', MyBB::INPUT_INT),

		"matchusername" => $mybb->get_input('matchusername', MyBB::INPUT_INT),
"postdate" => $mybb->get_input('postdate', MyBB::INPUT_INT),
"pddir" => $mybb->get_input('pddir', MyBB::INPUT_INT),

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

		"forums" => $forums,

		"findthreadst" => $mybb->get_input('findthreadst', MyBB::INPUT_INT),
"numreplies" => $mybb->get_input('numreplies', MyBB::INPUT_INT),
"threadprefix" => $mybb->get_input('threadprefix', MyBB::INPUT_ARRAY)

		"findthreadst" => $mybb->get_input('findthreadst', MyBB::INPUT_INT),
"numreplies" => $mybb->get_input('numreplies', MyBB::INPUT_INT),
"threadprefix" => $mybb->get_input('threadprefix', MyBB::INPUT_ARRAY)

Zeile 1551Zeile 1601
		else
{
$search_results = perform_search_mysql($search_data);

		else
{
$search_results = perform_search_mysql($search_data);

		}
}

		}
}

	else
{
error($lang->error_no_search_support);

	else
{
error($lang->error_no_search_support);

Zeile 1632Zeile 1682
		$query = $db->simple_select("searchlog", "*", "$conditions AND dateline > '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC"));
$last_search = $db->fetch_array($query);


		$query = $db->simple_select("searchlog", "*", "$conditions AND dateline > '$timecut'", array('order_by' => "dateline", 'order_dir' => "DESC"));
$last_search = $db->fetch_array($query);


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

		if($last_search)




		{

		{

			if($remaining_time == 1)
{
$lang->error_searchflooding = $lang->sprintf($lang->error_searchflooding_1, $mybb->settings['searchfloodtime']);
}
else

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


			{

			{

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









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

			}

			}

			error($lang->error_searchflooding);

 
		}
}


		}
}