Vergleich search.php - 1.8.3 - 1.8.14

  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 .= ",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 .= ",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_inlinemodcol_empty,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";
$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' => '');

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

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

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

Zeile 216Zeile 217

// Inline Mod Column for moderators
$inlinemodcol = $inlinecookie = '';


// Inline Mod Column for moderators
$inlinemodcol = $inlinecookie = '';

	$is_mod = $is_supermod = false;

	$is_mod = $is_supermod = $show_inline_moderation = false;

	if($mybb->usergroup['issupermod'])
{
$is_supermod = true;
}
if($is_supermod || is_moderator())
{

	if($mybb->usergroup['issupermod'])
{
$is_supermod = true;
}
if($is_supermod || is_moderator())
{

		eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol")."\";");

 
		$inlinecookie = "inlinemod_search".$sid;
$inlinecount = 0;
$is_mod = true;
$return_url = 'search.php?'.htmlspecialchars_uni($_SERVER['QUERY_STRING']);
}

		$inlinecookie = "inlinemod_search".$sid;
$inlinecount = 0;
$is_mod = true;
$return_url = 'search.php?'.htmlspecialchars_uni($_SERVER['QUERY_STRING']);
}





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

// Moderators can view unapproved threads

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

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

Zeile 245Zeile 245
		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 = '(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 334Zeile 353
			FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE $where_conditions AND {$unapproved_where} {$permsql} AND t.closed NOT LIKE 'moved|%'

			FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE $where_conditions AND {$unapproved_where} {$permsql} AND t.closed NOT LIKE 'moved|%'

			ORDER BY $sortfield $order

			ORDER BY $sortfield $order

			LIMIT $start, $perpage
");


			LIMIT $start, $perpage
");


Zeile 359Zeile 378
		// 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.")");


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

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

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

Zeile 373Zeile 393
			while($readthread = $db->fetch_array($query))
{
$thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline'];

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

			}
}

			}
}


if(!$mybb->settings['maxmultipagelinks'])


if(!$mybb->settings['maxmultipagelinks'])

		{

		{

			$mybb->settings['maxmultipagelinks'] = 5;
}

$results = '';

			$mybb->settings['maxmultipagelinks'] = 5;
}

$results = '';





		foreach($thread_cache as $thread)
{
$bgcolor = alt_trow();

		foreach($thread_cache as $thread)
{
$bgcolor = alt_trow();

Zeile 393Zeile 413
			if($thread['visible'] == 0)
{
$bgcolor = 'trow_shaded';

			if($thread['visible'] == 0)
{
$bgcolor = 'trow_shaded';

			}

			}

			elseif($thread['visible'] == -1)

			elseif($thread['visible'] == -1)

			{

			{

				$bgcolor = 'trow_shaded trow_deleted';

				$bgcolor = 'trow_shaded trow_deleted';

			}

			}


if($thread['userusername'])


if($thread['userusername'])

			{

			{

				$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 410Zeile 431
			{
$thread['threadprefix'] .= ' ';
}

			{
$thread['threadprefix'] .= ' ';
}





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

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





			if(isset($icon_cache[$thread['icon']]))
{
$posticon = $icon_cache[$thread['icon']];

			if(isset($icon_cache[$thread['icon']]))
{
$posticon = $icon_cache[$thread['icon']];

Zeile 452Zeile 473
				if($forum_read == 0 || $forum_read < $read_cutoff)
{
$forum_read = $read_cutoff;

				if($forum_read == 0 || $forum_read < $read_cutoff)
{
$forum_read = $read_cutoff;

				}

				}

			}
else
{

			}
else
{

Zeile 492Zeile 513
			else
{
$new_class = 'subject_old';

			else
{
$new_class = 'subject_old';

				$folder_label .= $lang->icon_no_new;
}

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

				$folder_label .= $lang->icon_no_new;
}

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

			{
$folder .= "hot";
$folder_label .= $lang->icon_hot;

			{
$folder .= "hot";
$folder_label .= $lang->icon_hot;

Zeile 517Zeile 538
			$threadpages = '';
$morelink = '';
$thread['posts'] = $thread['replies'] + 1;

			$threadpages = '';
$morelink = '';
$thread['posts'] = $thread['replies'] + 1;

			if(is_moderator($thread['fid'], "canviewunapprove"))

			if(is_moderator($thread['fid'], "canviewdeleted") == true || is_moderator($thread['fid'], "canviewunapprove") == true)

			{

			{

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












				if(is_moderator($thread['fid'], "canviewdeleted") == true)
{
$thread['posts'] += $thread['deletedposts'];
}
if(is_moderator($thread['fid'], "canviewunapprove") == true)
{
$thread['posts'] += $thread['unapprovedposts'];
}
}
elseif($group_permissions[$thread['fid']]['canviewdeletionnotice'] != 0)
{
$thread['posts'] += $thread['deletedposts'];

			}

			}

 


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

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

Zeile 549Zeile 582
				$thread['multipage'] = '';
}
$lastpostdate = my_date('relative', $thread['lastpost']);

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

			$lastposter = $thread['lastposter'];

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

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

 
			if(!$lastposteruid && !$thread['lastposter'])
{
$lastposter = htmlspecialchars_uni($lang->guest);
}
else
{
$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)
{
$lastposterlink = $lastposter;

			$thread_link = get_thread_link($thread['tid']);

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

			}
else
{

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

			}

			}


// If this thread has 1 or more attachments show the papperclip
if($mybb->settings['enableattachments'] == 1 && $thread['attachmentcount'] > 0)


// If this thread has 1 or more attachments show the papperclip
if($mybb->settings['enableattachments'] == 1 && $thread['attachmentcount'] > 0)

Zeile 601Zeile 640
				eval("\$attachment_count = \"".$templates->get("forumdisplay_thread_attachment_count")."\";");
}
else

				eval("\$attachment_count = \"".$templates->get("forumdisplay_thread_attachment_count")."\";");
}
else

			{

			{

				$attachment_count = '';
}


				$attachment_count = '';
}


			$inline_edit_tid = $thread['tid'];


			$inline_edit_tid = $thread['tid'];


			// Inline thread moderation
$inline_mod_checkbox = '';
if($is_supermod || is_moderator($thread['fid']))
{

			// Inline thread moderation
$inline_mod_checkbox = '';
if($is_supermod || is_moderator($thread['fid']))
{

				if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$thread['tid']}|"))

				if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$thread['tid']}|") !== false)

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

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

				}

				}

				else
{
$inlinecheck = '';
}

				else
{
$inlinecheck = '';
}

 

// If this user is allowed to use the inline moderation tools for at least one thread, include the necessary scripts
$show_inline_moderation = true;


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

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

Zeile 634Zeile 677
		{
error($lang->error_nosearchresults);
}

		{
error($lang->error_nosearchresults);
}

		$multipage = multipage($threadcount, $perpage, $page, "search.php?action=results&amp;sid=$sid&amp;sortby=$sortby&amp;order=$order&amp;uid=".$mybb->get_input('uid', 1));

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

		if($upper > $threadcount)
{
$upper = $threadcount;
}

// Inline Thread Moderation Options

		if($upper > $threadcount)
{
$upper = $threadcount;
}

// Inline Thread Moderation Options

		if($is_mod)

		if($show_inline_moderation)

		{

		{

 
			eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol")."\";");


			// If user has moderation tools available, prepare the Select All feature
$lang->page_selected = $lang->sprintf($lang->page_selected, count($thread_cache));
$lang->all_selected = $lang->sprintf($lang->all_selected, (int)$threadcount);

			// If user has moderation tools available, prepare the Select All feature
$lang->page_selected = $lang->sprintf($lang->page_selected, count($thread_cache));
$lang->all_selected = $lang->sprintf($lang->all_selected, (int)$threadcount);

Zeile 663Zeile 708
			while($tool = $db->fetch_array($query))
{
eval("\$customthreadtools .= \"".$templates->get("search_results_threads_inlinemoderation_custom_tool")."\";");

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

			}
// Build inline moderation dropdown

			}
// Build inline moderation dropdown

			if(!empty($customthreadtools))
{
eval("\$customthreadtools = \"".$templates->get("search_results_threads_inlinemoderation_custom")."\";");
}
eval("\$inlinemod = \"".$templates->get("search_results_threads_inlinemoderation")."\";");

			if(!empty($customthreadtools))
{
eval("\$customthreadtools = \"".$templates->get("search_results_threads_inlinemoderation_custom")."\";");
}
eval("\$inlinemod = \"".$templates->get("search_results_threads_inlinemoderation")."\";");

		}

$plugins->run_hooks("search_results_end");





		}
elseif($is_mod)
{
eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol_empty")."\";");
}

$plugins->run_hooks("search_results_end");


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


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

Zeile 680Zeile 729
	else // Displaying results as posts
{
if(!$search['posts'])

	else // Displaying results as posts
{
if(!$search['posts'])

		{
error($lang->error_nosearchresults);
}

$postcount = 0;

		{
error($lang->error_nosearchresults);
}

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

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

		{

		{

			// Normal moderators

			// 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();
if((int)$mybb->settings['searchhardlimit'] > 0)

		}

$post_cache_options = array();
if((int)$mybb->settings['searchhardlimit'] > 0)

		{

		{

			$post_cache_options['limit'] = (int)$mybb->settings['searchhardlimit'];

			$post_cache_options['limit'] = (int)$mybb->settings['searchhardlimit'];

		}


		}


		if(strpos($sortfield, 'p.') !== false)

		if(strpos($sortfield, 'p.') !== false)

		{

		{

			$post_cache_options['order_by'] = str_replace('p.', '', $sortfield);
$post_cache_options['order_dir'] = $order;

			$post_cache_options['order_by'] = str_replace('p.', '', $sortfield);
$post_cache_options['order_dir'] = $order;

		}

		}


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

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

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

Zeile 736Zeile 801
		}

if(!empty($pids))

		}

if(!empty($pids))

		{

		{

			$temp_pids = array();

			$temp_pids = array();

 

$group_permissions = forum_permissions();
$permsql = '';
$onlyusfids = array();

foreach($group_permissions as $fid => $forum_permissions)
{
if(!empty($forum_permissions['canonlyviewownthreads']))
{
$onlyusfids[] = $fid;
}
}

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


// 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} 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 758Zeile 850

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


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





		if(!$postcount)

		if(!$postcount)

		{

		{

			error($lang->error_nosearchresults);

			error($lang->error_nosearchresults);

		}

		}


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


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





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

// Read threads

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

// Read threads

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

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

			$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 815Zeile 907
			{
$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['thread_subject'] = htmlspecialchars_uni($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']);
$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['name'] = htmlspecialchars_uni($posticon['name']);
eval("\$icon = \"".$templates->get("search_results_icon")."\";");

				$posticon = $icon_cache[$post['icon']];
$posticon['path'] = str_replace("{theme}", $theme['imgdir'], $posticon['path']);
$posticon['path'] = htmlspecialchars_uni($posticon['path']);
$posticon['name'] = htmlspecialchars_uni($posticon['name']);
eval("\$icon = \"".$templates->get("search_results_icon")."\";");

			}

			}

			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 931Zeile 1024
			$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'];
}
if(my_strlen($post['subject']) > 50)
{
$post['subject'] = htmlspecialchars_uni(my_substr($post['subject'], 0, 50)."...");

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

			}

			}

			else
{
$post['subject'] = htmlspecialchars_uni($post['subject']);

			else
{
$post['subject'] = htmlspecialchars_uni($post['subject']);

Zeile 978Zeile 1070
			$inline_mod_checkbox = '';
if($is_supermod || is_moderator($post['fid']))
{

			$inline_mod_checkbox = '';
if($is_supermod || is_moderator($post['fid']))
{

				if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$post['pid']}|"))

				if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|{$post['pid']}|") !== false)

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

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

Zeile 987Zeile 1079
				{
$inlinecheck = '';
}

				{
$inlinecheck = '';
}

 

$show_inline_moderation = true;


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

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

Zeile 1001Zeile 1096
		{
error($lang->error_nosearchresults);
}

		{
error($lang->error_nosearchresults);
}

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

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

		if($upper > $postcount)
{
$upper = $postcount;

		}


		}


		// Inline Post Moderation Options

		// Inline Post Moderation Options

		if($is_mod)

		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 1019Zeile 1116

$customthreadtools = $customposttools = '';
switch($db->type)


$customthreadtools = $customposttools = '';
switch($db->type)

			{

			{

				case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", "tid, name, type", "type='p' AND (','||forums||',' LIKE '%,-1,%' OR forums='')");
break;
default:
$query = $db->simple_select("modtools", "tid, name, type", "type='p' AND (CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='')");

				case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", "tid, name, type", "type='p' AND (','||forums||',' LIKE '%,-1,%' OR forums='')");
break;
default:
$query = $db->simple_select("modtools", "tid, name, type", "type='p' AND (CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='')");

			}

			}


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


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

Zeile 1038Zeile 1135
				eval("\$customposttools = \"".$templates->get("search_results_posts_inlinemoderation_custom")."\";");
}
eval("\$inlinemod = \"".$templates->get("search_results_posts_inlinemoderation")."\";");

				eval("\$customposttools = \"".$templates->get("search_results_posts_inlinemoderation_custom")."\";");
}
eval("\$inlinemod = \"".$templates->get("search_results_posts_inlinemoderation")."\";");

 
		}
elseif($is_mod)
{
eval("\$inlinemodcol = \"".$templates->get("search_results_inlinemodcol_empty")."\";");

		}

$plugins->run_hooks("search_results_end");

		}

$plugins->run_hooks("search_results_end");

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

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

	$where_sql = "uid='".$mybb->get_input('uid', 1)."'";

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


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


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

Zeile 1202Zeile 1303
}
elseif($mybb->input['action'] == "finduserthreads")
{

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

	$where_sql = "t.uid='".$mybb->get_input('uid', 1)."'";

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


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


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

Zeile 1253Zeile 1354

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



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


	if($mybb->get_input('fid', 1))

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

	{

	{

		$where_sql .= " AND t.fid='".$mybb->get_input('fid', 1)."'";

		$where_sql .= " AND t.fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";

	}
else if($mybb->get_input('fids'))
{

	}
else if($mybb->get_input('fids'))
{

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

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

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

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

	{
$days = 1;
}
else
{

	{
$days = 1;
}
else
{

		$days = $mybb->get_input('days', 1);

		$days = $mybb->get_input('days', MyBB::INPUT_INT);

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

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


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

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


	if($mybb->get_input('fid', 1))

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

	{

	{

		$where_sql .= " AND t.fid='".$mybb->get_input('fid', 1)."'";

		$where_sql .= " AND t.fid='".$mybb->get_input('fid', MyBB::INPUT_INT)."'";

	}
else if($mybb->get_input('fids'))
{

	}
else if($mybb->get_input('fids'))
{

Zeile 1439Zeile 1540
	$search_data = array(
"keywords" => $mybb->input['keywords'],
"author" => $mybb->get_input('author'),

	$search_data = array(
"keywords" => $mybb->input['keywords'],
"author" => $mybb->get_input('author'),

		"postthread" => $mybb->get_input('postthread', 1),
"matchusername" => $mybb->get_input('matchusername', 1),
"postdate" => $mybb->get_input('postdate', 1),
"pddir" => $mybb->get_input('pddir', 1),

		"postthread" => $mybb->get_input('postthread', 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" => $mybb->input['forums'],

		"findthreadst" => $mybb->get_input('findthreadst', 1),
"numreplies" => $mybb->get_input('numreplies', 1),
"threadprefix" => $mybb->get_input('threadprefix', 2)

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

	);

if(is_moderator() && !empty($mybb->input['visible']))
{

	);

if(is_moderator() && !empty($mybb->input['visible']))
{

		$search_data['visible'] = $mybb->get_input('visible', 1);

		$search_data['visible'] = $mybb->get_input('visible', MyBB::INPUT_INT);

	}

if($db->can_search == true)

	}

if($db->can_search == true)

Zeile 1500Zeile 1601
else if($mybb->input['action'] == "thread")
{
// Fetch thread info

else if($mybb->input['action'] == "thread")
{
// Fetch thread info

	$thread = get_thread($mybb->get_input('tid', 1));
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))

	$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
$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);
}

Zeile 1570Zeile 1665
	$search_data = array(
"keywords" => $mybb->input['keywords'],
"postthread" => 1,

	$search_data = array(
"keywords" => $mybb->input['keywords'],
"postthread" => 1,

		"tid" => $mybb->get_input('tid', 1)

		"tid" => $mybb->get_input('tid', MyBB::INPUT_INT)

	);

if($db->can_search == true)

	);

if($db->can_search == true)