Vergleich search.php - 1.8.5 - 1.8.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 13Zeile 13
define('THIS_SCRIPT', 'search.php');

$templatelist = "search,forumdisplay_thread_gotounread,search_results_threads_thread,search_results_threads,search_results_posts,search_results_posts_post,search_results_icon,search_forumlist_forum,search_forumlist";

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

$templatelist = "search,forumdisplay_thread_gotounread,search_results_threads_thread,search_results_threads,search_results_posts,search_results_posts_post,search_results_icon,search_forumlist_forum,search_forumlist";

$templatelist .= ",multipage,multipage_breadcrumb,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start,forumdisplay_thread_multipage_more,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage";

$templatelist .= ",multipage,multipage_breadcrumb,multipage_end,multipage_jump_page,multipage_nextpage,multipage_page,multipage_page_current,multipage_page_link_current,multipage_prevpage,multipage_start";

$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";

$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";

$templatelist .= ",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,search_moderator_options";
$templatelist .= ",forumdisplay_thread_attachment_count,search_threads_inlinemoderation_selectall,search_posts_inlinemoderation_selectall,post_prefixselect_prefix,post_prefixselect_multiple";


$templatelist .= ",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 .= ",forumdisplay_thread_attachment_count,search_threads_inlinemoderation_selectall,search_posts_inlinemoderation_selectall,post_prefixselect_prefix,post_prefixselect_multiple,search_orderarrow";
$templatelist .= ",search_results_posts_forumlink,search_results_threads_forumlink,forumdisplay_thread_multipage_more,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage,search_moderator_options";


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


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

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

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

	
$orderarrow = array('replies' => '', 'views' => '', 'subject' => '', 'forum' => '', 'starter' => '', 'lastpost' => '', 'dateline' => '');


$orderarrow = array('replies' => '', 'views' => '', 'subject' => '', 'forum' => '', 'starter' => '', 'lastpost' => '', 'dateline' => '');


eval("\$orderarrow['$sortby'] = \"".$templates->get("search_orderarrow")."\";");


eval("\$orderarrow['$sortby'] = \"".$templates->get("search_orderarrow")."\";");





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

$threads = array();

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

$threads = array();





	if($mybb->user['uid'] == 0)
{
// Build a forum cache.

	if($mybb->user['uid'] == 0)
{
// Build a forum cache.

Zeile 184Zeile 185
			SELECT fid
FROM ".TABLE_PREFIX."forums
WHERE active != 0

			SELECT fid
FROM ".TABLE_PREFIX."forums
WHERE active != 0

			ORDER BY pid, disporder
");


			ORDER BY pid, disporder
");


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

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

Zeile 234Zeile 235
	if($search['resulttype'] == "threads")
{
$threadcount = 0;

	if($search['resulttype'] == "threads")
{
$threadcount = 0;





		// Moderators can view unapproved threads

		// Moderators can view unapproved threads

		$query = $db->simple_select("moderators", "fid", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')");

		$query = $db->simple_select("moderators", "fid, canviewunapprove, canviewdeleted", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')");

		if($mybb->usergroup['issupermod'] == 1)

		if($mybb->usergroup['issupermod'] == 1)

		{

		{

			// Super moderators (and admins)
$unapproved_where = "t.visible>=-1";
}
elseif($db->num_rows($query))
{
// Normal moderators

			// Super moderators (and admins)
$unapproved_where = "t.visible>=-1";
}
elseif($db->num_rows($query))
{
// Normal moderators

			$moderated_forums = '0';
while($forum = $db->fetch_array($query))




















			$unapprove_forums = array();
$deleted_forums = array();
$unapproved_where = '(t.visible = 1';
while($moderator = $db->fetch_array($query))
{
if($moderator['canviewunapprove'] == 1)
{
$unapprove_forums[] = $moderator['fid'];
}

if($moderator['canviewdeleted'] == 1)
{
$deleted_forums[] = $moderator['fid'];
}
}

if(!empty($unapprove_forums))
{
$unapproved_where .= " OR (t.visible = 0 AND t.fid IN(".implode(',', $unapprove_forums)."))";
}
if(!empty($deleted_forums))

			{

			{

				$moderated_forums .= ','.$forum['fid'];

				$unapproved_where .= " OR (t.visible = -1 AND t.fid IN(".implode(',', $deleted_forums)."))";

			}

			}

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

			$unapproved_where .= ')';

		}
else
{

		}
else
{

Zeile 404Zeile 424
			{
$thread['username'] = $thread['userusername'];
}

			{
$thread['username'] = $thread['userusername'];
}

 
			$thread['username'] = htmlspecialchars_uni($thread['username']);

			$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);

// If this thread has a prefix, insert a space between prefix and subject

			$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);

// If this thread has a prefix, insert a space between prefix and subject

Zeile 502Zeile 523
				$folder_label .= $lang->icon_hot;
}
if($thread['closed'] == 1)

				$folder_label .= $lang->icon_hot;
}
if($thread['closed'] == 1)

			{
$folder .= "lock";
$folder_label .= $lang->icon_lock;
}
$folder .= "folder";

			{
$folder .= "lock";
$folder_label .= $lang->icon_lock;
}
$folder .= "folder";


if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)


if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)

			{

			{

				$mybb->settings['postsperpage'] = 20;

				$mybb->settings['postsperpage'] = 20;

			}


			}


			$thread['pages'] = 0;
$thread['multipage'] = '';
$threadpages = '';

			$thread['pages'] = 0;
$thread['multipage'] = '';
$threadpages = '';

Zeile 522Zeile 543
			{
$thread['posts'] += $thread['unapprovedposts'];
}

			{
$thread['posts'] += $thread['unapprovedposts'];
}

 
			if(is_moderator($thread['fid'], "canviewdeleted"))
{
$thread['posts'] += $thread['deletedposts'];
}


			if($thread['posts'] > $mybb->settings['postsperpage'])
{
$thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
$thread['pages'] = ceil($thread['pages']);
if($thread['pages'] > $mybb->settings['maxmultipagelinks'])

			if($thread['posts'] > $mybb->settings['postsperpage'])
{
$thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
$thread['pages'] = ceil($thread['pages']);
if($thread['pages'] > $mybb->settings['maxmultipagelinks'])

				{

				{

					$pagesstop = $mybb->settings['maxmultipagelinks'] - 1;
$page_link = get_thread_link($thread['tid'], $thread['pages']).$highlight;
eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
}
else

					$pagesstop = $mybb->settings['maxmultipagelinks'] - 1;
$page_link = get_thread_link($thread['tid'], $thread['pages']).$highlight;
eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");
}
else

				{

				{

					$pagesstop = $thread['pages'];

					$pagesstop = $thread['pages'];

				}

				}

				for($i = 1; $i <= $pagesstop; ++$i)
{
$page_link = get_thread_link($thread['tid'], $i).$highlight;

				for($i = 1; $i <= $pagesstop; ++$i)
{
$page_link = get_thread_link($thread['tid'], $i).$highlight;

Zeile 548Zeile 574
				$threadpages = '';
$morelink = '';
$thread['multipage'] = '';

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

			}

			}

			$lastpostdate = my_date('relative', $thread['lastpost']);

			$lastpostdate = my_date('relative', $thread['lastpost']);

			$lastposter = $thread['lastposter'];

			$lastposter = htmlspecialchars_uni($thread['lastposter']);

			$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$lastposteruid = $thread['lastposteruid'];
$thread_link = get_thread_link($thread['tid']);

			$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$lastposteruid = $thread['lastposteruid'];
$thread_link = get_thread_link($thread['tid']);

Zeile 561Zeile 587
				$lastposterlink = $lastposter;
}
else

				$lastposterlink = $lastposter;
}
else

			{

			{

				$lastposterlink = build_profile_link($lastposter, $lastposteruid);

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


 
			$thread['forumlink'] = '';

			if($forumcache[$thread['fid']])

			if($forumcache[$thread['fid']])

			{
$thread['forumlink'] = "<a href=\"".get_forum_link($thread['fid'])."\">".$forumcache[$thread['fid']]['name']."</a>";
}
else
{
$thread['forumlink'] = "";
}


			{
$thread['forumlink_link'] = get_forum_link($thread['fid']);
$thread['forumlink_name'] = $forumcache[$thread['fid']]['name'];
eval("\$thread['forumlink'] = \"".$templates->get("search_results_threads_forumlink")."\";");
}




			// If this user is the author of the thread and it is not closed or they are a moderator, they can edit
if(($thread['uid'] == $mybb->user['uid'] && $thread['closed'] != 1 && $mybb->user['uid'] != 0 && $fpermissions[$thread['fid']]['caneditposts'] == 1) || is_moderator($thread['fid'], "caneditposts"))
{
$inline_edit_class = "subject_editable";

			// If this user is the author of the thread and it is not closed or they are a moderator, they can edit
if(($thread['uid'] == $mybb->user['uid'] && $thread['closed'] != 1 && $mybb->user['uid'] != 0 && $fpermissions[$thread['fid']]['caneditposts'] == 1) || is_moderator($thread['fid'], "caneditposts"))
{
$inline_edit_class = "subject_editable";

			}

			}

			else

			else

			{

			{

				$inline_edit_class = "";
}


				$inline_edit_class = "";
}


Zeile 593Zeile 618
				if($thread['attachmentcount'] > 1)
{
$attachment_count = $lang->sprintf($lang->attachment_count_multiple, $thread['attachmentcount']);

				if($thread['attachmentcount'] > 1)
{
$attachment_count = $lang->sprintf($lang->attachment_count_multiple, $thread['attachmentcount']);

				}

				}

				else
{
$attachment_count = $lang->attachment_count;

				else
{
$attachment_count = $lang->attachment_count;

Zeile 676Zeile 701
		$plugins->run_hooks("search_results_end");

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

		$plugins->run_hooks("search_results_end");

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

		output_page($searchresults);
}

		output_page($searchresults);
}

	else // Displaying results as posts
{
if(!$search['posts'])
{
error($lang->error_nosearchresults);

	else // Displaying results as posts
{
if(!$search['posts'])
{
error($lang->error_nosearchresults);

		}

$postcount = 0;


		}

$postcount = 0;


		// Moderators can view unapproved threads

		// Moderators can view unapproved threads

		$query = $db->simple_select("moderators", "fid", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')");

		$query = $db->simple_select("moderators", "fid, canviewunapprove, canviewdeleted", "(id='{$mybb->user['uid']}' AND isgroup='0') OR (id='{$mybb->user['usergroup']}' AND isgroup='1')");

		if($mybb->usergroup['issupermod'] == 1)
{
// Super moderators (and admins)

		if($mybb->usergroup['issupermod'] == 1)
{
// Super moderators (and admins)

			$p_unapproved_where = "visible >= -1";
$t_unapproved_where = "visible < -1";

			$unapproved_where = "visible >= -1";


		}
elseif($db->num_rows($query))
{
// Normal moderators

		}
elseif($db->num_rows($query))
{
// Normal moderators

			$moderated_forums = '0';
while($forum = $db->fetch_array($query))





















			$unapprove_forums = array();
$deleted_forums = array();
$unapproved_where = '(visible = 1';

while($moderator = $db->fetch_array($query))
{
if($moderator['canviewunapprove'] == 1)
{
$unapprove_forums[] = $moderator['fid'];
}

if($moderator['canviewdeleted'] == 1)
{
$deleted_forums[] = $moderator['fid'];
}
}

if(!empty($unapprove_forums))
{
$unapproved_where .= " OR (visible = 0 AND fid IN(".implode(',', $unapprove_forums)."))";
}
if(!empty($deleted_forums))

			{

			{

				$moderated_forums .= ','.$forum['fid'];
$test_moderated_forums[$forum['fid']] = $forum['fid'];

				$unapproved_where .= " OR (visible = -1 AND fid IN(".implode(',', $deleted_forums)."))";


			}

			}

			$p_unapproved_where = "(visible>0 OR (visible IN (-1,0) AND fid IN ({$moderated_forums})))";
$t_unapproved_where = "(visible<0 AND (visible <1 OR fid NOT IN ({$moderated_forums})))";

			$unapproved_where .= ')';


		}
else
{
// Normal users

		}
else
{
// Normal users

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

			$unapproved_where = 'visible = 1';


		}

$post_cache_options = array();

		}

$post_cache_options = array();

Zeile 729Zeile 770
		$tids = array();
$pids = array();
// Make sure the posts we're viewing we have permission to view.

		$tids = array();
$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))
{

		$query = $db->simple_select("posts", "pid, tid", "pid IN(".$db->escape_string($search['posts']).") AND {$unapproved_where}", $post_cache_options);
while($post = $db->fetch_array($query))
{

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

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

Zeile 768Zeile 809
			}

// Check the thread records as well. If we don't have permissions, remove them from the listing.

			}

// 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}{$permsql} OR closed LIKE 'moved|%')");

			$query = $db->simple_select("threads", "tid", "tid IN(".$db->escape_string(implode(',', $pids)).") AND ({$unapproved_where}{$permsql} OR closed LIKE 'moved|%')");

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

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

				if(array_key_exists($thread['tid'], $tids) != false)

				if(array_key_exists($thread['tid'], $tids) != true)

				{
$temp_pids = $tids[$thread['tid']];
foreach($temp_pids as $pid)

				{
$temp_pids = $tids[$thread['tid']];
foreach($temp_pids as $pid)

Zeile 796Zeile 837
		$search['posts'] = implode(',', array_keys($pids));

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

		$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(".$db->escape_string($tids).")");
while($readthread = $db->fetch_array($query))

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

				$readthreads[$readthread['tid']] = $readthread['dateline'];

			}

			}

		}

$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({$db->escape_string($tids)}) AND {$p_unapproved_where}");

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

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

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

Zeile 818Zeile 859
		}

$results = '';

		}

$results = '';





		$query = $db->query("
SELECT p.*, u.username AS userusername, t.subject AS thread_subject, t.replies AS thread_replies, t.views AS thread_views, t.lastpost AS thread_lastpost, t.closed AS thread_closed, t.uid as thread_uid
FROM ".TABLE_PREFIX."posts p

		$query = $db->query("
SELECT p.*, u.username AS userusername, t.subject AS thread_subject, t.replies AS thread_replies, t.views AS thread_views, t.lastpost AS thread_lastpost, t.closed AS thread_closed, t.uid as thread_uid
FROM ".TABLE_PREFIX."posts p

Zeile 843Zeile 884
			{
$post['username'] = $post['userusername'];
}

			{
$post['username'] = $post['userusername'];
}

 
			$post['username'] = htmlspecialchars_uni($post['username']);

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

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

Zeile 859Zeile 901
			else
{
$icon = "&nbsp;";

			else
{
$icon = "&nbsp;";

			}

			}





 
			$post['forumlink'] = '';

			if(!empty($forumcache[$thread['fid']]))
{

			if(!empty($forumcache[$thread['fid']]))
{

				$post['forumlink'] = "<a href=\"".get_forum_link($post['fid'])."\">".$forumcache[$post['fid']]['name']."</a>";
}
else
{
$post['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 959Zeile 1001
			$post['thread_replies'] = my_number_format($post['thread_replies']);
$post['thread_views'] = my_number_format($post['thread_views']);


			$post['thread_replies'] = my_number_format($post['thread_replies']);
$post['thread_views'] = my_number_format($post['thread_views']);


 
			$post['forumlink'] = '';

			if($forumcache[$post['fid']])
{

			if($forumcache[$post['fid']])
{

				$post['forumlink'] = "<a href=\"".get_forum_link($post['fid'])."\">".$forumcache[$post['fid']]['name']."</a>";
}
else
{
$post['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")."\";");



			}

if(!$post['subject'])

			}

if(!$post['subject'])

			{

			{

				$post['subject'] = $post['message'];

				$post['subject'] = $post['message'];

			}

			}

			if(my_strlen($post['subject']) > 50)
{
$post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50)."...");

			if(my_strlen($post['subject']) > 50)
{
$post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50)."...");

Zeile 990Zeile 1031
			);
$post['message'] = strip_tags($parser->parse_message($post['message'], $parser_options));
if(my_strlen($post['message']) > 200)

			);
$post['message'] = strip_tags($parser->parse_message($post['message'], $parser_options));
if(my_strlen($post['message']) > 200)

			{

			{

				$prev = my_substr($post['message'], 0, 200)."...";

				$prev = my_substr($post['message'], 0, 200)."...";

			}

			}

			else

			else

			{

			{

				$prev = $post['message'];
}
$posted = my_date('relative', $post['dateline']);

				$prev = $post['message'];
}
$posted = my_date('relative', $post['dateline']);

Zeile 1010Zeile 1051
				{
$inlinecheck = "checked=\"checked\"";
++$inlinecount;

				{
$inlinecheck = "checked=\"checked\"";
++$inlinecount;

				}

				}

				else
{
$inlinecheck = '';

				else
{
$inlinecheck = '';

Zeile 1031Zeile 1072
		}
$multipage = multipage($postcount, $perpage, $page, "search.php?action=results&amp;sid=".htmlspecialchars_uni($mybb->get_input('sid'))."&amp;sortby=$sortby&amp;order=$order&amp;uid=".$mybb->get_input('uid', MyBB::INPUT_INT));
if($upper > $postcount)

		}
$multipage = multipage($postcount, $perpage, $page, "search.php?action=results&amp;sid=".htmlspecialchars_uni($mybb->get_input('sid'))."&amp;sortby=$sortby&amp;order=$order&amp;uid=".$mybb->get_input('uid', MyBB::INPUT_INT));
if($upper > $postcount)

		{

		{

			$upper = $postcount;
}


			$upper = $postcount;
}


Zeile 1072Zeile 1113

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

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

// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();


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

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

	foreach($group_permissions as $fid => $forum_permissions)
{
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)

Zeile 1104Zeile 1145
	if(!empty($onlyusfids))
{
$where_sql .= " AND fid NOT IN(".implode(',', $onlyusfids).")";

	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'];

	}

$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 = '';
$query = $db->simple_select("posts", "pid", "{$where_sql}", $options);
while($pid = $db->fetch_field($query, "pid"))

	{

	{

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

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

Zeile 1133Zeile 1174
	{
$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 1197Zeile 1238
	$pids = '';
$comma = '';
$query = $db->simple_select("posts", "pid", "{$where_sql}", $options);

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

	while($pid = $db->fetch_field($query, "pid"))
{

	while($pid = $db->fetch_field($query, "pid"))
{

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

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

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

		"querycache" => $db->escape_string($where_sql),
"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'] == "getnew")
{

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

if($mybb->get_input('fid', MyBB::INPUT_INT))
{
$where_sql .= " AND t.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 t.fid IN (".implode(',', $fids).")";
}
}

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

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

$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" => '',
"posts" => '',
"resulttype" => "threads",
"querycache" => $db->escape_string($where_sql),
"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'] == "getnew")
{

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

if($mybb->get_input('fid', MyBB::INPUT_INT))
{
$where_sql .= " AND t.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 t.fid IN (".implode(',', $fids).")";
}
}

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

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

$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" => '',
"posts" => '',
"resulttype" => "threads",
"querycache" => $db->escape_string($where_sql),
"keywords" => ''
);


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

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

Zeile 1366Zeile 1407
	{
$fids = explode(',', $mybb->get_input('fids'));
foreach($fids as $key => $fid)

	{
$fids = explode(',', $mybb->get_input('fids'));
foreach($fids as $key => $fid)

		{

		{

			$fids[$key] = (int)$fid;

			$fids[$key] = (int)$fid;

		}


		}


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

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

	}


	}


	$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)
{
$where_sql .= " AND t.fid NOT IN ($inactiveforums)";

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

	}


	}


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

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

	// 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(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)
{
$onlyusfids[] = $fid;

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

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

	}

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

	}

$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),

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

Zeile 1427Zeile 1468

// Check if search flood checking is enabled and user is not admin
if($mybb->settings['searchfloodtime'] > 0 && $mybb->usergroup['cancp'] != 1)


// 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

		// Fetch the time this user last searched
if($mybb->user['uid'])
{
$conditions = "uid='{$mybb->user['uid']}'";
}
else

		{

		{

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

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

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

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

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

Zeile 1529Zeile 1570
{
// Fetch thread info
$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));

{
// Fetch thread info
$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));

	if(is_moderator($fid))
{
$ismod = true;
}
else
{
$ismod = false;
}
if(!$thread || ($thread['visible'] != 1 && $ismod == false && ($thread['visible'] != -1 || $mybb->settings['soft_delete'] != 1 || $mybb->settings['soft_delete_show_own'] != 1 || !$mybb->user['uid'] || $mybb->user['uid'] != $thread['uid'])) || ($thread['visible'] > 1 && $ismod == true))

	$ismod = is_moderator($thread['fid']);

if(!$thread || ($thread['visible'] != 1 && $ismod == false && ($thread['visible'] != -1 || $mybb->settings['soft_delete'] != 1 || !$mybb->user['uid'] || $mybb->user['uid'] != $thread['uid'])) || ($thread['visible'] > 1 && $ismod == true))







	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}