Vergleich search.php - 1.4.0 - 1.4.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
<?php
/**
* MyBB 1.4

<?php
/**
* MyBB 1.4

 * Copyright � 2008 MyBB Group, All Rights Reserved

 * Copyright © 2008 MyBB Group, All Rights Reserved

 *
* Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 *
* Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: search.php 3869 2008-05-27 00:05:03Z Tikitiki $

 * $Id: search.php 4505 2009-11-13 15:59:56Z Tomm $

 */


define("IN_MYBB", 1);
define("IGNORE_CLEAN_VARS", "sid");

 */


define("IN_MYBB", 1);
define("IGNORE_CLEAN_VARS", "sid");

 
define('THIS_SCRIPT', 'search.php');


$templatelist = "search,forumdisplay_thread_gotounread,search_results_threads_thread,search_results_threads,search_results_posts,search_results_posts_post";
$templatelist .= ",multipage_nextpage,multipage_page_current,multipage_page,multipage_start,multipage_end,multipage,forumdisplay_thread_multipage_more,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage";


$templatelist = "search,forumdisplay_thread_gotounread,search_results_threads_thread,search_results_threads,search_results_posts,search_results_posts_post";
$templatelist .= ",multipage_nextpage,multipage_page_current,multipage_page,multipage_start,multipage_end,multipage,forumdisplay_thread_multipage_more,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage";

$templatelist .= ",search_results_posts_inlinecheck,search_results_posts_nocheck,search_results_threads_inlinecheck,search_results_threads_nocheck,search_results_inlinemodcol,search_results_posts_inlinemoderation_custom_tool,search_results_posts_inlinemoderation_custom,search_results_posts_inlinemoderation,search_results_threads_inlinemoderation_custom_tool,search_results_threads_inlinemoderation_custom,search_results_threads_inlinemoderation";

$templatelist .= ",search_results_posts_inlinecheck,search_results_posts_nocheck,search_results_threads_inlinecheck,search_results_threads_nocheck,search_results_inlinemodcol,search_results_posts_inlinemoderation_custom_tool,search_results_posts_inlinemoderation_custom,search_results_posts_inlinemoderation,search_results_threads_inlinemoderation_custom_tool,search_results_threads_inlinemoderation_custom,search_results_threads_inlinemoderation,search_orderarrow";

require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_search.php";

require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_search.php";

Zeile 42Zeile 43
}

$now = TIME_NOW;

}

$now = TIME_NOW;

 
$mybb->input['keywords'] = trim($mybb->input['keywords']);

$limitsql = "";
if(intval($mybb->settings['searchhardlimit']) > 0)
{
$limitsql = "ORDER BY t.dateline DESC LIMIT ".intval($mybb->settings['searchhardlimit']);
}


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


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

Zeile 55Zeile 63
	}

$plugins->run_hooks("search_results_start");

	}

$plugins->run_hooks("search_results_start");





	// Decide on our sorting fields and sorting order.
$order = my_strtolower(htmlspecialchars($mybb->input['order']));
$sortby = my_strtolower(htmlspecialchars($mybb->input['sortby']));

	// Decide on our sorting fields and sorting order.
$order = my_strtolower(htmlspecialchars($mybb->input['order']));
$sortby = my_strtolower(htmlspecialchars($mybb->input['sortby']));

Zeile 94Zeile 102
		case "lastpost":
default:
if($search['resulttype'] == "threads")

		case "lastpost":
default:
if($search['resulttype'] == "threads")

			{

			{

				$sortfield = "t.lastpost";
$sortby = "lastpost";
}

				$sortfield = "t.lastpost";
$sortby = "lastpost";
}

Zeile 107Zeile 115
	}

if($order != "asc")

	}

if($order != "asc")

	{

	{

		$order = "desc";
$oppsortnext = "asc";
$oppsort = $lang->asc;

		$order = "desc";
$oppsortnext = "asc";
$oppsort = $lang->asc;

Zeile 140Zeile 148
	$upper = $end;

// Work out if we have terms to highlight

	$upper = $end;

// Work out if we have terms to highlight

 
	$highlight = "";

	if($search['keywords'])
{
if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
{
$highlight = "?highlight=".urlencode($search['keywords']);

	if($search['keywords'])
{
if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
{
$highlight = "?highlight=".urlencode($search['keywords']);

		}
else

		}
else

		{
$highlight = "&amp;highlight=".urlencode($search['keywords']);

		{
$highlight = "&amp;highlight=".urlencode($search['keywords']);

		}
}


		}
}


	$sorturl = "search.php?action=results&amp;sid={$sid}";
$thread_url = "";
$post_url = "";

	$sorturl = "search.php?action=results&amp;sid={$sid}";
$thread_url = "";
$post_url = "";

Zeile 161Zeile 170
	// Read some caches we will be using
$forumcache = $cache->read("forums");
$icon_cache = $cache->read("posticons");

	// Read some caches we will be using
$forumcache = $cache->read("forums");
$icon_cache = $cache->read("posticons");





	$threads = array();

	$threads = array();

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
























if($mybb->user['uid'] == 0)
{
// Build a forum cache.
$query = $db->query("
SELECT fid
FROM ".TABLE_PREFIX."forums
WHERE active != 0
ORDER BY pid, disporder
");

$forumsread = unserialize($mybb->cookies['mybb']['forumread']);
}
else
{
// Build a forum cache.
$query = $db->query("
SELECT f.fid, fr.dateline AS lastread
FROM ".TABLE_PREFIX."forums f
LEFT JOIN ".TABLE_PREFIX."forumsread fr ON (fr.fid=f.fid AND fr.uid='{$mybb->user['uid']}')
WHERE f.active != 0
ORDER BY pid, disporder
");
}
while($forum = $db->fetch_array($query))

	{

	{

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








		if($mybb->user['uid'] == 0)
{
if($forumsread[$forum['fid']])
{
$forum['lastread'] = $forumsread[$forum['fid']];
}
}
$readforums[$forum['fid']] = $forum['lastread'];

	}

	}



 
	$fpermissions = forum_permissions();

// Inline Mod Column for moderators

	$fpermissions = forum_permissions();

// Inline Mod Column for moderators

Zeile 277Zeile 314
		// Fetch dot icons if enabled
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $thread_cache)
{

		// Fetch dot icons if enabled
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $thread_cache)
{

			$query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='".$mybb->user['uid']."' AND tid IN(".$thread_ids.")");

			$query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='".$mybb->user['uid']."' AND tid IN(".$thread_ids.")"); // Why are we querying the posts table?

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

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

Zeile 333Zeile 370
			$folder = '';
$folder_label = '';
if($thread['dot_icon'])

			$folder = '';
$folder_label = '';
if($thread['dot_icon'])

			{
$folder = "dot_";
$folder_label .= $lang->icon_dot;
}
$gotounread = '';
$isnew = 0;
$donenew = 0;
$lastread = 0;

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forumread)
{
$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($thread['lastpost'] > $cutoff)
{
if($thread['lastread'])
{
$lastread = $thread['lastread'];
}
else
{
$lastread = 1;
}
}
}
$lastread = $thread['lastread'];
if(!$lastread)
{
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);
if($readcookie > $forumread)
{
$lastread = $readcookie;
}
elseif($forumread > $mybb->user['lastvisit'])
{
$lastread = $forumread;
}
else

			{
$folder = "dot_";
$folder_label .= $lang->icon_dot;
}
$gotounread = '';
$isnew = 0;
$donenew = 0;
$last_read = 0;

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)
{
$forum_read = $read_cutoff;
}
}
else
{
$forum_read = $forumsread[$thread['fid']];
}

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







				{

				{

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

					$last_read = $read_cutoff;

				}

				}

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

if($forum_read > $last_read)
{
$last_read = $forum_read;

			}


			}


			if($thread['lastpost'] > $lastread && $lastread)

			if($thread['lastpost'] > $last_read && $last_read)

			{
$folder .= "new";
$new_class = "subject_new";
$folder_label .= $lang->icon_new;

			{
$folder .= "new";
$new_class = "subject_new";
$folder_label .= $lang->icon_new;

				$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");

				$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost").$highlight;

				eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
$unreadpost = 1;
}

				eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
$unreadpost = 1;
}

Zeile 419Zeile 459
				if($thread['pages'] > 4)
{
$pagesstop = 4;

				if($thread['pages'] > 4)
{
$pagesstop = 4;

					$page_link = get_thread_link($thread['tid'], $thread['pages']);

					$page_link = get_thread_link($thread['tid'], $thread['pages']).$highlight;

					eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
}
else

					eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
}
else

Zeile 428Zeile 468
				}
for($i = 1; $i <= $pagesstop; ++$i)
{

				}
for($i = 1; $i <= $pagesstop; ++$i)
{

					$page_link = get_thread_link($thread['tid'], $i);

					$page_link = get_thread_link($thread['tid'], $i).$highlight;

					eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");
}

					eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");
}

				eval("\$thread[multipage] = \"".$templates->get("forumdisplay_thread_multipage")."\";");

				eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");

			}
else
{

			}
else
{

Zeile 564Zeile 604
	}
else // Displaying results as posts
{

	}
else // Displaying results as posts
{

 
		if(!$search['posts'])
{
error($lang->error_nosearchresults);
}


		$postcount = 0;

		$postcount = 0;

		if($search['querycache'] != "")
{
$where_conditions = $search['querycache'];
}
else
{
if(!$search['posts'])
{
error($lang->error_nosearchresults);
}
$where_conditions = "p.pid IN (".$search['posts'].")";
}

 
		
// Moderators can view unapproved threads
$query = $db->simple_select("moderators", "fid", "uid='{$mybb->user['uid']}'");
if($mybb->usergroup['issupermod'] == 1)

		
// Moderators can view unapproved threads
$query = $db->simple_select("moderators", "fid", "uid='{$mybb->user['uid']}'");
if($mybb->usergroup['issupermod'] == 1)

		{

		{

			// Super moderators (and admins)

			// Super moderators (and admins)

			$unapproved_where = "t.visible>-1 AND p.visible>-1";


			$p_unapproved_where = "visible >= 0";
$t_unapproved_where = "visible < 0";

		}
elseif($db->num_rows($query))

		}
elseif($db->num_rows($query))

		{

		{

			// Normal moderators
$moderated_forums = '0';
while($forum = $db->fetch_array($query))
{
$moderated_forums .= ','.$forum['fid'];

			// Normal moderators
$moderated_forums = '0';
while($forum = $db->fetch_array($query))
{
$moderated_forums .= ','.$forum['fid'];

			}
$unapproved_where = "((t.visible>0 AND p.visible>0) OR ((p.visible=0 OR t.visible>-1) AND t.fid IN ({$moderated_forums})))";
}



				$test_moderated_forums[$forum['fid']] = $forum['fid'];
}
$p_unapproved_where = "visible >= 0";
$t_unapproved_where = "visible < 0 AND fid NOT IN ({$moderated_forums})";
}

		else
{
// Normal users

		else
{
// Normal users

			$unapproved_where = 't.visible>0 AND p.visible>0';
}

$query = $db->query("
SELECT COUNT(p.pid) AS resultcount
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE {$where_conditions} AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%'
{$limitsql}
");
$count = $db->fetch_array($query);

if(!$count['resultcount'])
{
error($lang->error_nosearchresults);
}
$postcount = $count['resultcount'];


			$p_unapproved_where = 'visible=1';
$t_unapproved_where = 'visible < 1';
}

$post_cache_options = array();
if(intval($mybb->settings['searchhardlimit']) > 0)
{
$post_cache_options['limit'] = intval($mybb->settings['searchhardlimit']);
}
if(strpos($sortfield, 'p.') !== false)
{
$post_cache_options['order_by'] = str_replace('p.', '', $sortfield);
$post_cache_options['order_dir'] = $order;
}





		$tids = array();

		$tids = array();

		$query = $db->query("
SELECT p.tid
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE {$where_conditions} AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%'
ORDER BY $sortfield $order
LIMIT $start, $perpage
");

		$pids = array();
// Make sure the posts we're viewing we have permission to view.
$query = $db->simple_select("posts", "pid, tid", "pid IN(".$db->escape_string($search['posts']).") AND {$p_unapproved_where}", $post_cache_options);






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

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

			$tids[$post['tid']] = $post['tid'];


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

		}

		}

		$tids = implode(",", $tids);



































		
if(!empty($pids))
{
$temp_pids = array();

// Check the thread records as well. If we don't have permissions, remove them from the listing.
$query = $db->simple_select("threads", "tid", "tid IN(".$db->escape_string(implode(',', $pids)).") AND ({$t_unapproved_where} OR closed LIKE 'moved|%')");
while($thread = $db->fetch_array($query))
{
if(array_key_exists($thread['tid'], $tids) != false)
{
$temp_pids = $tids[$thread['tid']];
foreach($temp_pids as $pid)
{
unset($pids[$pid]);
unset($tids[$thread['tid']]);
}
}
}
unset($temp_pids);
}

// Declare our post count
$postcount = count($pids);

if(!$postcount)
{
error($lang->error_nosearchresults);
}

// And now we have our sanatized post list
$search['posts'] = implode(',', array_keys($pids));

$tids = implode(",", array_keys($tids));


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

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

		{
$query = $db->simple_select("threadsread", "tid, dateline", "uid='".$mybb->user['uid']."' AND tid IN(".$tids.")");

		{
$query = $db->simple_select("threadsread", "tid, dateline", "uid='".$mybb->user['uid']."' AND tid IN(".$db->escape_string($tids).")");

			while($readthread = $db->fetch_array($query))
{
$readthreads[$readthread['tid']] = $readthread['dateline'];

			while($readthread = $db->fetch_array($query))
{
$readthreads[$readthread['tid']] = $readthread['dateline'];

Zeile 644Zeile 706
		$dot_icon = array();
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] != 0)
{

		$dot_icon = array();
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] != 0)
{

			$query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='".$mybb->user['uid']."' AND tid IN(".$tids.")");

			$query = $db->simple_select("posts", "DISTINCT tid,uid", "uid='".$mybb->user['uid']."' AND tid IN(".$db->escape_string($tids).")");

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

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

Zeile 656Zeile 718
			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)

			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)

			WHERE $where_conditions AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%'

			WHERE p.pid IN (".$db->escape_string($search['posts']).")

			ORDER BY $sortfield $order
LIMIT $start, $perpage
");

			ORDER BY $sortfield $order
LIMIT $start, $perpage
");

Zeile 700Zeile 762
			$gotounread = '';
$isnew = 0;
$donenew = 0;

			$gotounread = '';
$isnew = 0;
$donenew = 0;

			$lastread = 0;

			$last_read = 0;

			$post['thread_lastread'] = $readthreads[$post['tid']];
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forumread)
{

			$post['thread_lastread'] = $readthreads[$post['tid']];
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forumread)
{

Zeile 709Zeile 771
				{
if($post['thread_lastread'])
{

				{
if($post['thread_lastread'])
{

						$lastread = $post['thread_lastread'];

						$last_read = $post['thread_lastread'];

					}
else
{

					}
else
{

						$lastread = 1;

						$last_read = 1;

					}
}
}

					}
}
}

Zeile 724Zeile 786
				$folder_label .= $lang->icon_dot;
}


				$folder_label .= $lang->icon_dot;
}


			if(!$lastread)

			if(!$last_read)

			{
$readcookie = $threadread = my_get_array_cookie("threadread", $post['tid']);
if($readcookie > $forumread)
{

			{
$readcookie = $threadread = my_get_array_cookie("threadread", $post['tid']);
if($readcookie > $forumread)
{

					$lastread = $readcookie;

					$last_read = $readcookie;

				}
elseif($forumread > $mybb->user['lastvisit'])
{

				}
elseif($forumread > $mybb->user['lastvisit'])
{

					$lastread = $forumread;

					$last_read = $forumread;

				}
else
{

				}
else
{

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

					$last_read = $mybb->user['lastvisit'];

				}
}


				}
}


			if($post['thread_lastpost'] > $lastread && $lastread)

			if($post['thread_lastpost'] > $last_read && $last_read)

			{
$folder .= "new";
$folder_label .= $lang->icon_new;

			{
$folder .= "new";
$folder_label .= $lang->icon_new;

Zeile 816Zeile 878
			if($is_supermod || is_moderator($post['fid']))
{
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_posts_inlinecheck")."\";");

			if($is_supermod || is_moderator($post['fid']))
{
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_posts_inlinecheck")."\";");

			}

			}

			elseif($is_mod)
{
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_posts_nocheck")."\";");

			elseif($is_mod)
{
eval("\$inline_mod_checkbox = \"".$templates->get("search_results_posts_nocheck")."\";");

Zeile 868Zeile 930
	}
}
elseif($mybb->input['action'] == "findguest")

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






























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

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

// Do we have a hard search limit?
if($mybb->settings['searchhardlimit'] > 0)
{
$options['limit'] = intval($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(), 1));

	$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_string($session->ipaddress),

	$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_string($session->ipaddress),

		"threads" => '',
"posts" => '',

		"threads" => $db->escape_string($tids),
"posts" => $db->escape_string($pids),

		"resulttype" => "posts",

		"resulttype" => "posts",

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

		"querycache" => '',

		"keywords" => ''
);
$plugins->run_hooks("search_do_search_process");

		"keywords" => ''
);
$plugins->run_hooks("search_do_search_process");

Zeile 900Zeile 991
}
elseif($mybb->input['action'] == "finduser")
{

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

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

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

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

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

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

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

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

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

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






























		$where_sql .= " AND fid NOT IN ($inactiveforums)";
}

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

// Do we have a hard search limit?
if($mybb->settings['searchhardlimit'] > 0)
{
$options['limit'] = intval($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(), 1));

	}

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

Zeile 919Zeile 1039
		"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_string($session->ipaddress),

		"uid" => $mybb->user['uid'],
"dateline" => TIME_NOW,
"ipaddress" => $db->escape_string($session->ipaddress),

		"threads" => '',
"posts" => '',

		"threads" => $db->escape_string($tids),
"posts" => $db->escape_string($pids),

		"resulttype" => "posts",

		"resulttype" => "posts",

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

		"querycache" => '',

		"keywords" => ''
);
$plugins->run_hooks("search_do_search_process");

		"keywords" => ''
);
$plugins->run_hooks("search_do_search_process");

Zeile 1089Zeile 1209
			$conditions = "uid='0' AND ipaddress='".$db->escape_string($session->ipaddress)."'";
}
$timecut = TIME_NOW-$mybb->settings['searchfloodtime'];

			$conditions = "uid='0' AND ipaddress='".$db->escape_string($session->ipaddress)."'";
}
$timecut = TIME_NOW-$mybb->settings['searchfloodtime'];

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

		$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'])

		$last_search = $db->fetch_array($query);
// Users last search was within the flood time, show the error
if($last_search['sid'])

Zeile 1212Zeile 1332
			$conditions = "uid='0' AND ipaddress='".$db->escape_string($session->ipaddress)."'";
}
$timecut = TIME_NOW-$mybb->settings['searchfloodtime'];

			$conditions = "uid='0' AND ipaddress='".$db->escape_string($session->ipaddress)."'";
}
$timecut = TIME_NOW-$mybb->settings['searchfloodtime'];

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

		$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.

		$last_search = $db->fetch_array($query);

// We shouldn't show remaining time if time is 0 or under.