Vergleich search.php - 1.8.15 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 90Zeile 90
			}
break;
case "forum":

			}
break;
case "forum":

			$sortfield = "t.fid";

			$sortfield = "f.name";

			break;
case "starter":
if($search['resulttype'] == "threads")

			break;
case "starter":
if($search['resulttype'] == "threads")

Zeile 235Zeile 235
	{
$threadcount = 0;


	{
$threadcount = 0;


		// Moderators can view unapproved threads
$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)
$unapproved_where = "t.visible>=-1";
}
elseif($db->num_rows($query))
{
// Normal moderators
$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))
{
$unapproved_where .= " OR (t.visible = -1 AND t.fid IN(".implode(',', $deleted_forums)."))";
}
$unapproved_where .= ')';
}
else
{
// Normal users
$unapproved_where = 't.visible>0';
}

		// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where_t = get_visible_where('t');









































// If we have saved WHERE conditions, execute them
if($search['querycache'] != "")
{
$where_conditions = $search['querycache'];


// If we have saved WHERE conditions, execute them
if($search['querycache'] != "")
{
$where_conditions = $search['querycache'];

			$query = $db->simple_select("threads t", "t.tid", $where_conditions. " AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%' ORDER BY t.lastpost DESC {$limitsql}");

			$query = $db->simple_select("threads t", "t.tid", $where_conditions. " AND ({$unapproved_where_t}) AND t.closed NOT LIKE 'moved|%' ORDER BY t.lastpost DESC {$limitsql}");

			while($thread = $db->fetch_array($query))
{
$threads[$thread['tid']] = $thread['tid'];
$threadcount++;

			while($thread = $db->fetch_array($query))
{
$threads[$thread['tid']] = $thread['tid'];
$threadcount++;

			}

			}

			// Build our list of threads.
if($threadcount > 0)
{

			// Build our list of threads.
if($threadcount > 0)
{

Zeile 294Zeile 255
			}
// No results.
else

			}
// No results.
else

			{
error($lang->error_nosearchresults);

			{
error($lang->error_nosearchresults);

			}
$where_conditions = "t.tid IN (".$search['threads'].")";
}

			}
$where_conditions = "t.tid IN (".$search['threads'].")";
}

Zeile 303Zeile 264
		else
{
$where_conditions = "t.tid IN (".$search['threads'].")";

		else
{
$where_conditions = "t.tid IN (".$search['threads'].")";

			$query = $db->simple_select("threads t", "COUNT(t.tid) AS resultcount", $where_conditions. " AND {$unapproved_where} AND t.closed NOT LIKE 'moved|%' {$limitsql}");

			$query = $db->simple_select("threads t", "COUNT(t.tid) AS resultcount", $where_conditions. " AND ({$unapproved_where_t}) AND t.closed NOT LIKE 'moved|%' {$limitsql}");

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

if(!$count['resultcount'])

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

if(!$count['resultcount'])

Zeile 339Zeile 300
		if($inactiveforums)
{
$permsql .= " AND t.fid NOT IN ($inactiveforums)";

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

 
		}

$pages = ceil($threadcount / $perpage);
if($page > $pages)
{
$start = 0;
$page = 1;

		}

// Begin selecting matching threads, cache them.

		}

// Begin selecting matching threads, cache them.

Zeile 352Zeile 320
			SELECT t.*, u.username AS userusername
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)

			SELECT t.*, u.username AS userusername
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|%'


			LEFT JOIN ".TABLE_PREFIX."forums f ON (t.fid=f.fid)
WHERE $where_conditions AND ({$unapproved_where_t}) {$permsql} AND t.closed NOT LIKE 'moved|%'

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

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

Zeile 378Zeile 347
		// 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)
{

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

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

			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 388Zeile 357

// Fetch the read threads.
if($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0)


// Fetch the read threads.
if($mybb->user['uid'] && $mybb->settings['threadreadcut'] > 0)

		{

		{

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

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

Zeile 425Zeile 394
			}
$thread['username'] = htmlspecialchars_uni($thread['username']);
$thread['profilelink'] = build_profile_link($thread['username'], $thread['uid']);

			}
$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
if($thread['prefix'] != 0)
{
$thread['threadprefix'] .= ' ';

			// If this thread has a prefix, insert a space between prefix and subject
if($thread['prefix'] != 0)
{
$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']);


Zeile 442Zeile 411
				$posticon['path'] = htmlspecialchars_uni($posticon['path']);
$posticon['name'] = htmlspecialchars_uni($posticon['name']);
eval("\$icon = \"".$templates->get("search_results_icon")."\";");

				$posticon['path'] = htmlspecialchars_uni($posticon['path']);
$posticon['name'] = htmlspecialchars_uni($posticon['name']);
eval("\$icon = \"".$templates->get("search_results_icon")."\";");

			}
else

			}
else

			{
$icon = " ";
}

			{
$icon = " ";
}

Zeile 523Zeile 492
			}
if($thread['closed'] == 1)
{

			}
if($thread['closed'] == 1)
{

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

				$folder .= "close";
$folder_label .= $lang->icon_close;

			}
$folder .= "folder";


			}
$folder .= "folder";


Zeile 574Zeile 543
					eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");
}
eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");

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

			}
else

			}
else

			{
$threadpages = '';
$morelink = '';

			{
$threadpages = '';
$morelink = '';

Zeile 585Zeile 554
			$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$lastposteruid = $thread['lastposteruid'];
if(!$lastposteruid && !$thread['lastposter'])

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

			{

			{

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

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

			}

			}

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

			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)

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

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

			{

			{

				$lastposterlink = $lastposter;

				$lastposterlink = $lastposter;

			}

			}

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

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





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

$thread['forumlink'] = '';
if($forumcache[$thread['fid']])

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

$thread['forumlink'] = '';
if($forumcache[$thread['fid']])

			{

			{

				$thread['forumlink_link'] = get_forum_link($thread['fid']);
$thread['forumlink_name'] = $forumcache[$thread['fid']]['name'];
eval("\$thread['forumlink'] = \"".$templates->get("search_results_threads_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"))
{

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

Zeile 627Zeile 596

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

			{

			{

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

Zeile 636Zeile 605
				{
$attachment_count = $lang->attachment_count;
}

				{
$attachment_count = $lang->attachment_count;
}





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

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

			}

			}

			else
{
$attachment_count = '';

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


// 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']}|") !== false)

				{

				{

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

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

Zeile 662Zeile 631

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


// 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 716Zeile 685
				eval("\$customthreadtools = \"".$templates->get("search_results_threads_inlinemoderation_custom")."\";");
}
eval("\$inlinemod = \"".$templates->get("search_results_threads_inlinemoderation")."\";");

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

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

$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 732Zeile 701
		if(!$search['posts'])
{
error($lang->error_nosearchresults);

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

		}

		}


$postcount = 0;



$postcount = 0;


		// Moderators can view unapproved threads
$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)
$unapproved_where = "visible >= -1";
}
elseif($db->num_rows($query))
{
// Normal moderators
$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))
{
$unapproved_where .= " OR (visible = -1 AND fid IN(".implode(',', $deleted_forums)."))";
}
$unapproved_where .= ')';
}
else
{
// Normal users
$unapproved_where = 'visible = 1';
}

		// Moderators can view unapproved threads and deleted threads from forums they moderate
$unapproved_where = get_visible_where();










































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


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

Zeile 794Zeile 723
		$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 {$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 810Zeile 739
			$onlyusfids = array();

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

			$onlyusfids = array();

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

			{

			{

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

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

Zeile 832Zeile 761
				$permsql .= " OR fid IN ($inactiveforums)";
}


				$permsql .= " OR fid IN ($inactiveforums)";
}


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

			// Find threads in our list that we don't have permission to view and remove them
$query = $db->simple_select("threads", "tid", "tid IN(".$db->escape_string(implode(',', array_keys($tids))).") AND (NOT ({$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) != true)

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

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

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

Zeile 844Zeile 773
						unset($pids[$pid]);
unset($tids[$thread['tid']]);
}

						unset($pids[$pid]);
unset($tids[$thread['tid']]);
}

 
					unset($tids[$thread['tid']]);

				}
}
unset($temp_pids);

				}
}
unset($temp_pids);

Zeile 855Zeile 785
		if(!$postcount)
{
error($lang->error_nosearchresults);

		if(!$postcount)
{
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));


Zeile 869Zeile 799
			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)}) AND {$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;
}

		}


		}


		$results = '';

		$results = '';

 

$pages = ceil($postcount / $perpage);
if($page > $pages)
{
$start = 0;
$page = 1;
}


$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
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)


$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
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)

 
			LEFT JOIN ".TABLE_PREFIX."forums f ON (t.fid=f.fid)

			WHERE p.pid IN (".$db->escape_string($search['posts']).")
ORDER BY $sortfield $order
LIMIT $start, $perpage

			WHERE p.pid IN (".$db->escape_string($search['posts']).")
ORDER BY $sortfield $order
LIMIT $start, $perpage

Zeile 928Zeile 866
			}

$post['forumlink'] = '';

			}

$post['forumlink'] = '';

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

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

			{
$post['forumlink_link'] = get_forum_link($post['fid']);
$post['forumlink_name'] = $forumcache[$post['fid']]['name'];

			{
$post['forumlink_link'] = get_forum_link($post['fid']);
$post['forumlink_name'] = $forumcache[$post['fid']]['name'];

Zeile 1017Zeile 955
			}
if($post['thread_closed'] == 1)
{

			}
if($post['thread_closed'] == 1)
{

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

				$folder .= "close";
$folder_label .= $lang->icon_close;

			}
$folder .= "folder";


			}
$folder .= "folder";


Zeile 1051Zeile 989
				'allow_mycode' => 1,
'allow_smilies' => 0,
'allow_imgcode' => 0,

				'allow_mycode' => 1,
'allow_smilies' => 0,
'allow_imgcode' => 0,

 
				'me_username' => $post['username'],

				'filter_badwords' => 1
);

				'filter_badwords' => 1
);

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

			$post['message'] = strip_tags($parser->text_parse_message($post['message'], $parser_options));

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

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

Zeile 1066Zeile 1005

$thread_url = get_thread_link($post['tid']);
$post_url = get_post_link($post['pid'], $post['tid']);


$thread_url = get_thread_link($post['tid']);
$post_url = get_post_link($post['pid'], $post['tid']);





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

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

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

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

		}


		}


		$plugins->run_hooks("search_results_end");

		$plugins->run_hooks("search_results_end");





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

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

Zeile 1159Zeile 1098
	}
$inactiveforums = get_inactive_forums();
if($inactiveforums)

	}
$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)
{
$onlyusfids[] = $fid;
}
}
if(!empty($onlyusfids))
{
$where_sql .= " AND fid NOT IN(".implode(',', $onlyusfids).")";
}

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

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

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

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

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

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

	{














































































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

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

	}





	}

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


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


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

Zeile 1246Zeile 1112
	// 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(!empty($onlyusfids))

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

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


















































































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

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

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

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

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

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

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

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

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

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

	}

$options = array(

	}

$options = array(

Zeile 1284Zeile 1231
	{
$tids .= $comma.$tid;
$comma = ',';

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

	}

	}


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


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

Zeile 1305Zeile 1252
elseif($mybb->input['action'] == "finduserthreads")
{
$where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";

elseif($mybb->input['action'] == "finduserthreads")
{
$where_sql = "uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";





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

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

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

 

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


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


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

Zeile 1393Zeile 1344
		$where_sql .= " AND fid NOT IN ($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)
{
$onlyusfids[] = $fid;
}
}
if(!empty($onlyusfids))
{





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

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

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

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

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

	



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

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

Zeile 1478Zeile 1433
	{
$where_sql .= " AND fid NOT IN ($inactiveforums)";
}

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

 

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


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


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

Zeile 1490Zeile 1449
		{
$onlyusfids[] = $fid;
}

		{
$onlyusfids[] = $fid;
}

	}

	}

	if(!empty($onlyusfids))

	if(!empty($onlyusfids))

	{

	{

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

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

	}


	}


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

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

Zeile 1504Zeile 1463
			$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 1522Zeile 1481
	$db->insert_query("searchlog", $searcharray);
redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}

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

elseif($mybb->input['action'] == "do_search" && $mybb->request_method == "post")

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

{
$plugins->run_hooks("search_do_search_start");


{
$plugins->run_hooks("search_do_search_start");