Vergleich search.php - 1.2.8 - 1.2.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * $Id: search.php 3163 2007-06-26 18:38:25Z CraKteR $

 * $Id: search.php 3478 2007-11-15 04:11:36Z Tikitiki $

 */



 */



Zeile 41Zeile 41

$now = time();



$now = time();


// Clear out searches older than a month

// Clear out searches older than a month 

if($rand == 3)
{
$timecut = time()-60*60*24*30;

if($rand == 3)
{
$timecut = time()-60*60*24*30;

Zeile 105Zeile 105
			{
$sortfield = "p.dateline";
}

			{
$sortfield = "p.dateline";
}

 
			$sortby = 'lastpost';

			break;
}

if($order != "asc")
{
$order = "desc";

			break;
}

if($order != "asc")
{
$order = "desc";

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

	}

// Work out pagination, which page we're at, as well as the limits.
$perpage = $mybb->settings['threadsperpage'];
$page = intval($mybb->input['page']);
if($page > 0)

	}

// Work out pagination, which page we're at, as well as the limits.
$perpage = $mybb->settings['threadsperpage'];
$page = intval($mybb->input['page']);
if($page > 0)

	{

	{

		$start = ($page-1) * $perpage;
}
else

		$start = ($page-1) * $perpage;
}
else

Zeile 130Zeile 138
	$upper = $end;

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

	$upper = $end;

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

 
	
eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_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();

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


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


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

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

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

			$query = $db->simple_select(TABLE_PREFIX."threads t", "t.tid", $where_conditions. " AND t.visible>0 AND t.closed NOT LIKE 'moved|%'");

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

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

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

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

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

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

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

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

if(!$count['resultcount'])

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

if(!$count['resultcount'])

Zeile 280Zeile 296
			if(!$lastread)
{
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);

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

				if($readcookie > $forumread)
{
$lastread = $readcookie;
}
elseif($forumread > $mybb->user['lastvisit'])
{
$lastread = $forumread;

				if($readcookie > $forumread)
{
$lastread = $readcookie;
}
elseif($forumread > $mybb->user['lastvisit'])
{
$lastread = $forumread;

				}
else
{

				}
else
{

Zeile 410Zeile 426
			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE $where_conditions AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%'

			FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE $where_conditions AND p.visible>0 AND t.visible>0 AND t.closed NOT LIKE 'moved|%'

 
			{$limitsql}

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


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


Zeile 458Zeile 475
			if($post['userusername'])
{
$post['username'] = $post['userusername'];

			if($post['userusername'])
{
$post['username'] = $post['userusername'];

			}

			}

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

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

Zeile 469Zeile 486
			{
$posticon = $icon_cache[$post['icon']];
$icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";

			{
$posticon = $icon_cache[$post['icon']];
$icon = "<img src=\"".$posticon['path']."\" alt=\"".$posticon['name']."\" />";

			}
else
{

			}
else
{

				$icon = "&nbsp;";

				$icon = "&nbsp;";

			}

			}


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


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

			{

			{

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

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

			}
else
{

			}
else
{

				$post['forumlink'] = "";
}
// Determine the folder

				$post['forumlink'] = "";
}
// Determine the folder

Zeile 512Zeile 529
				if($readcookie > $forumread)
{
$lastread = $readcookie;

				if($readcookie > $forumread)
{
$lastread = $readcookie;

				}

				}

				elseif($forumread > $mybb->user['lastvisit'])
{
$lastread = $forumread;

				elseif($forumread > $mybb->user['lastvisit'])
{
$lastread = $forumread;

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

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

			}

			}

			$folder .= "folder";

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

			$folder .= "folder";

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

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

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

{


{	


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

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


if($mybb->input['fid'])
{
$where_sql .= " AND t.fid='".intval($mybb->input['fid'])."'";
}

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

$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $db->escape_string($session->ipaddress),
"threads" => '',
"posts" => '',
"searchtype" => "titles",
"resulttype" => "threads",
"querycache" => $db->escape_string($where_sql),
);

$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);


if($mybb->input['fid'])
{
$where_sql .= " AND t.fid='".intval($mybb->input['fid'])."'";
}

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

$sid = md5(uniqid(microtime(), 1));
$searcharray = array(
"sid" => $db->escape_string($sid),
"uid" => $mybb->user['uid'],
"dateline" => time(),
"ipaddress" => $db->escape_string($session->ipaddress),
"threads" => '',
"posts" => '',
"searchtype" => "titles",
"resulttype" => "threads",
"querycache" => $db->escape_string($where_sql),
);

$plugins->run_hooks("search_do_search_process");
$db->insert_query(TABLE_PREFIX."searchlog", $searcharray);

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

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

Zeile 760Zeile 776
		$where_sql .= " AND t.fid NOT IN ($inactiveforums)";
}


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






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

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

Zeile 781Zeile 797
elseif($mybb->input['action'] == "do_search" && $mybb->request_method == "post")
{
$plugins->run_hooks("search_do_search_start");

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
if($mybb->settings['searchfloodtime'] > 0 && $mybb->usergroup['cancp'] != 'yes')
{

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

Zeile 803Zeile 819
		// Users last search was within the flood time, show the error. 
if($last_search['sid'] && $remaining_time > 0)
{

		// Users last search was within the flood time, show the error. 
if($last_search['sid'] && $remaining_time > 0)
{

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








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

			error($lang->error_searchflooding);
}
}

			error($lang->error_searchflooding);
}
}