Vergleich search.php - 1.8.2 - 1.8.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 166Zeile 166
	$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 184
			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 234
	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 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 418Zeile 438
			{
$posticon = $icon_cache[$thread['icon']];
$posticon['path'] = str_replace("{theme}", $theme['imgdir'], $posticon['path']);

			{
$posticon = $icon_cache[$thread['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

				eval("\$icon = \"".$templates->get("search_results_icon")."\";");
}
else

Zeile 490Zeile 512
			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 .= "hot";
$folder_label .= $lang->icon_hot;

				$folder_label .= $lang->icon_no_new;
}

if($thread['replies'] >= $mybb->settings['hottopic'] || $thread['views'] >= $mybb->settings['hottopicviews'])
{
$folder .= "hot";
$folder_label .= $lang->icon_hot;

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

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

Zeile 519Zeile 541
			{
$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'];

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

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

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

				}

				}

				else

				else

				{

				{

					$pagesstop = $thread['pages'];
}
for($i = 1; $i <= $pagesstop; ++$i)
{
$page_link = get_thread_link($thread['tid'], $i).$highlight;
eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");

					$pagesstop = $thread['pages'];
}
for($i = 1; $i <= $pagesstop; ++$i)
{
$page_link = get_thread_link($thread['tid'], $i).$highlight;
eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");

				}

				}

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

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

			}
else
{

			}
else
{

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

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

Zeile 556Zeile 583
			if($lastposteruid == 0)
{
$lastposterlink = $lastposter;

			if($lastposteruid == 0)
{
$lastposterlink = $lastposter;

			}
else

			}
else

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

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

Zeile 632Zeile 659
		{
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;

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

Zeile 656Zeile 683
					break;
default:
$query = $db->simple_select("modtools", "tid, name", "type='t' AND (CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='')");

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

			}

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

			}

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

				eval("\$customthreadtools .= \"".$templates->get("search_results_threads_inlinemoderation_custom_tool")."\";");
}
// Build inline moderation dropdown

				eval("\$customthreadtools .= \"".$templates->get("search_results_threads_inlinemoderation_custom_tool")."\";");
}
// Build inline moderation dropdown

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

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

		{
error($lang->error_nosearchresults);
}

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

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

		{

		{

			// Super moderators (and admins)

			// 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 726Zeile 769
		$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'];
$tids[$post['tid']][$post['pid']] = $post['pid'];

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

		}


		}


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

		if(!empty($pids))
{
$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 774Zeile 844
			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 822Zeile 892
			{
$posticon = $icon_cache[$post['icon']];
$posticon['path'] = str_replace("{theme}", $theme['imgdir'], $posticon['path']);

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

				eval("\$icon = \"".$templates->get("search_results_icon")."\";");
}
else

Zeile 830Zeile 902
			}

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

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

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

Zeile 854Zeile 926
				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
{

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


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


Zeile 897Zeile 969
				else
{
$last_read = $mybb->user['lastvisit'];

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

				}

				}

			}

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

			}

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

Zeile 958Zeile 1030
			);
$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)."...";
}
else

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

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

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





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


Zeile 978Zeile 1050
				{
$inlinecheck = "checked=\"checked\"";
++$inlinecount;

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

				}

				}

				else
{
$inlinecheck = '';

				else
{
$inlinecheck = '';

Zeile 997Zeile 1069
		{
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)

		if($upper > $postcount)

		{

		{

			$upper = $postcount;
}


			$upper = $postcount;
}


Zeile 1045Zeile 1117
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();


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


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

Zeile 1072Zeile 1144
	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'
);


	}

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


	// Do we have a hard search limit?
if($mybb->settings['searchhardlimit'] > 0)

	// Do we have a hard search limit?
if($mybb->settings['searchhardlimit'] > 0)

	{

	{

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

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

	}

	}


$pids = '';


$pids = '';

	$comma = '';

	$comma = '';

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

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

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

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

	{

	{

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

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

Zeile 1121Zeile 1193
}
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 1160Zeile 1232
	if($mybb->settings['searchhardlimit'] > 0)
{
$options['limit'] = (int)$mybb->settings['searchhardlimit'];

	if($mybb->settings['searchhardlimit'] > 0)
{
$options['limit'] = (int)$mybb->settings['searchhardlimit'];

	}

$pids = '';

	}

$pids = '';

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

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

	{

	{

			$pids .= $comma.$pid;

			$pids .= $comma.$pid;

			$comma = ',';

			$comma = ',';

	}

$tids = '';

	}

$tids = '';

Zeile 1178Zeile 1250
	{
$tids .= $comma.$tid;
$comma = ',';

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

	}

$sid = md5(uniqid(microtime(), true));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],

	}

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

		"dateline" => TIME_NOW,
"ipaddress" => $db->escape_binary($session->packedip),
"threads" => $db->escape_string($tids),

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

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

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

$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 = "t.uid='".$mybb->get_input('uid', MyBB::INPUT_INT)."'";

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


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


Zeile 1249Zeile 1321

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

		"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'] == "getdaily")
{

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

	{

	{

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

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

Zeile 1370Zeile 1442
	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 = md5(uniqid(microtime(), true));
$searcharray = array(

Zeile 1390Zeile 1462
	redirect("search.php?action=results&sid=".$sid, $lang->redirect_searchresults);
}
elseif($mybb->input['action'] == "do_search" && $mybb->request_method == "post")

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

{

{

	$plugins->run_hooks("search_do_search_start");

// Check if search flood checking is enabled and user is not admin

	$plugins->run_hooks("search_do_search_start");

// Check if search flood checking is enabled and user is not admin

Zeile 1435Zeile 1507
	$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 1496Zeile 1568
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 1566Zeile 1632
	$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)