Vergleich search.php - 1.6.4 - 1.6.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: search.php 5442 2011-04-16 09:09:38Z jammerx2 $

 * $Id$

 */

 */



 

define("IN_MYBB", 1);
define("IGNORE_CLEAN_VARS", "sid");
define('THIS_SCRIPT', 'search.php');


define("IN_MYBB", 1);
define("IGNORE_CLEAN_VARS", "sid");
define('THIS_SCRIPT', 'search.php');





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

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

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



$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,forumdisplay_threadlist_inlineedit_js,search_threads_inlinemoderation_selectall,search_posts_inlinemoderation_selectall,multipage_prevpage";


require_once "./global.php";

require_once "./global.php";

 


require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_search.php";
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_search.php";
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;





// Load global language phrases
$lang->load("search");


// Load global language phrases
$lang->load("search");


Zeile 48Zeile 50

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


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

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

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

}

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

}

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

Zeile 66Zeile 68
	$plugins->run_hooks("search_results_start");

// Decide on our sorting fields and sorting order.

	$plugins->run_hooks("search_results_start");

// Decide on our sorting fields and sorting order.

	$order = my_strtolower(htmlspecialchars($mybb->input['order']));
$sortby = my_strtolower(htmlspecialchars($mybb->input['sortby']));

	$order = my_strtolower(htmlspecialchars_uni($mybb->input['order']));
$sortby = my_strtolower(htmlspecialchars_uni($mybb->input['sortby']));


switch($sortby)
{


switch($sortby)
{

Zeile 76Zeile 78
			break;
case "views":
$sortfield = "t.views";

			break;
case "views":
$sortfield = "t.views";

			break;

			break;

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

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

			{

			{

				$sortfield = "t.subject";

				$sortfield = "t.subject";

			}

			}

			else
{
$sortfield = "p.subject";
}
break;
case "forum":

			else
{
$sortfield = "p.subject";
}
break;
case "forum":

			$sortfield = "t.fid";

			$sortfield = "t.fid";

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

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

Zeile 113Zeile 115
				$sortby = "dateline";
}
break;

				$sortby = "dateline";
}
break;

	}


	}


	if($order != "asc")
{
$order = "desc";
$oppsortnext = "asc";
$oppsort = $lang->asc;

	if($order != "asc")
{
$order = "desc";
$oppsortnext = "asc";
$oppsort = $lang->asc;

	}

	}

	else
{
$oppsortnext = "desc";
$oppsort = $lang->desc;

	else
{
$oppsortnext = "desc";
$oppsort = $lang->desc;

	}


	}


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

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

	{

	{

		$mybb->settings['threadsperpage'] = 20;
}


		$mybb->settings['threadsperpage'] = 20;
}


Zeile 138Zeile 140
	if($page > 0)
{
$start = ($page-1) * $perpage;

	if($page > 0)
{
$start = ($page-1) * $perpage;

	}

	}

	else
{
$start = 0;

	else
{
$start = 0;

Zeile 151Zeile 153
	// Work out if we have terms to highlight
$highlight = "";
if($search['keywords'])

	// Work out if we have terms to highlight
$highlight = "";
if($search['keywords'])

	{

	{

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

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

Zeile 175Zeile 177
	$threads = array();

if($mybb->user['uid'] == 0)

	$threads = array();

if($mybb->user['uid'] == 0)

	{
// Build a forum cache.

	{
// Build a forum cache.

		$query = $db->query("
SELECT fid
FROM ".TABLE_PREFIX."forums

		$query = $db->query("
SELECT fid
FROM ".TABLE_PREFIX."forums

Zeile 184Zeile 186
			ORDER BY pid, disporder
");


			ORDER BY pid, disporder
");


		$forumsread = unserialize($mybb->cookies['mybb']['forumread']);

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

	}
else
{

	}
else
{

Zeile 197Zeile 199
			ORDER BY pid, disporder
");
}

			ORDER BY pid, disporder
");
}

 


	while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)

	while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)

Zeile 214Zeile 217
	$inlinemodcol = $inlinecookie = '';
$is_mod = $is_supermod = false;
if($mybb->usergroup['issupermod'])

	$inlinemodcol = $inlinecookie = '';
$is_mod = $is_supermod = false;
if($mybb->usergroup['issupermod'])

	{

	{

		$is_supermod = true;
}
if($is_supermod || is_moderator())

		$is_supermod = true;
}
if($is_supermod || is_moderator())

Zeile 258Zeile 261
		if($search['querycache'] != "")
{
$where_conditions = $search['querycache'];

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

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

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

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

Zeile 364Zeile 367
			{
$thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline'];
}

			{
$thread_cache[$readthread['tid']]['lastread'] = $readthread['dateline'];
}

 
		}

if(!$mybb->settings['maxmultipagelinks'])
{
$mybb->settings['maxmultipagelinks'] = 5;

		}

foreach($thread_cache as $thread)

		}

foreach($thread_cache as $thread)

Zeile 414Zeile 422
			{
$folder = "dot_";
$folder_label .= $lang->icon_dot;

			{
$folder = "dot_";
$folder_label .= $lang->icon_dot;

			}

			}

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

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

Zeile 501Zeile 509
			{
$thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
$thread['pages'] = ceil($thread['pages']);

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

				if($thread['pages'] > 4)

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

				{

				{

					$pagesstop = 4;

					$pagesstop = $mybb->settings['maxmultipagelinks'] - 1;

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

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

Zeile 816Zeile 824
			$donenew = 0;
$last_read = 0;
$post['thread_lastread'] = $readthreads[$post['tid']];

			$donenew = 0;
$last_read = 0;
$post['thread_lastread'] = $readthreads[$post['tid']];

			if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forumread)


















if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])
{
$forum_read = $readforums[$post['fid']];

$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)
{
$forum_read = $read_cutoff;
}
}
else
{
$forum_read = $forumsread[$post['fid']];
}

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $post['thread_lastpost'] > $forum_read)

			{
$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($post['thread_lastpost'] > $cutoff)

			{
$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($post['thread_lastpost'] > $cutoff)

Zeile 841Zeile 865
			if(!$last_read)
{
$readcookie = $threadread = my_get_array_cookie("threadread", $post['tid']);

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

				if($readcookie > $forumread)

				if($readcookie > $forum_read)

				{
$last_read = $readcookie;
}

				{
$last_read = $readcookie;
}

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

				elseif($forum_read > $mybb->user['lastvisit'])

				{

				{

					$last_read = $forumread;

					$last_read = $forum_read;

				}
else
{

				}
else
{

Zeile 872Zeile 896
				$folder .= "hot";
$folder_label .= $lang->icon_hot;
}

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

			if($thread['thread_closed'] == 1)

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

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

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

Zeile 956Zeile 980
			$num_results = $db->num_rows($query);
$lang->page_selected = $lang->sprintf($lang->page_selected, intval($num_results));
$lang->select_all = $lang->sprintf($lang->select_all, intval($postcount));

			$num_results = $db->num_rows($query);
$lang->page_selected = $lang->sprintf($lang->page_selected, intval($num_results));
$lang->select_all = $lang->sprintf($lang->select_all, intval($postcount));

			$lang->all_selected = $lang->sprintf($lang->page_selected, intval($postcount));

			$lang->all_selected = $lang->sprintf($lang->all_selected, intval($postcount));

			eval("\$selectall = \"".$templates->get("search_posts_inlinemoderation_selectall")."\";");

$customthreadtools = $customposttools = '';

			eval("\$selectall = \"".$templates->get("search_posts_inlinemoderation_selectall")."\";");

$customthreadtools = $customposttools = '';

Zeile 1193Zeile 1217
elseif($mybb->input['action'] == "getnew")
{


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


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

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


if($mybb->input['fid'])
{


if($mybb->input['fid'])
{

Zeile 1442Zeile 1466
	{
$sortorder = "desc";
}

	{
$sortorder = "desc";
}

	$sortby = htmlspecialchars($mybb->input['sortby']);

	$sortby = htmlspecialchars_uni($mybb->input['sortby']);

	$plugins->run_hooks("search_do_search_end");
redirect("search.php?action=results&sid=".$sid."&sortby=".$sortby."&order=".$sortorder, $lang->redirect_searchresults);
}

	$plugins->run_hooks("search_do_search_end");
redirect("search.php?action=results&sid=".$sid."&sortby=".$sortby."&order=".$sortorder, $lang->redirect_searchresults);
}

Zeile 1468Zeile 1492
	{
error($lang->error_closedinvalidforum);
}

	{
error($lang->error_closedinvalidforum);
}

	if($forum_permissions['canview'] == 0 || $forum_permissions['canviewthreads'] != 1)

	if($forum_permissions['canview'] == 0 || $forum_permissions['canviewthreads'] != 1 || (isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']))

	{
error_no_permission();
}

	{
error_no_permission();
}