Vergleich showthread.php - 1.6.11 - 1.6.16

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 44Zeile 44
		);
$query = $db->simple_select("posts", "tid", "pid=".$mybb->input['pid'], $options);
$post = $db->fetch_array($query);

		);
$query = $db->simple_select("posts", "tid", "pid=".$mybb->input['pid'], $options);
$post = $db->fetch_array($query);

 
		
if(empty($post))
{
// post does not exist --> show error message
error($lang->error_invalidpost);
}


		$mybb->input['tid'] = $post['tid'];
}

		$mybb->input['tid'] = $post['tid'];
}

}


}


// Get the thread details from the database.
$thread = get_thread($mybb->input['tid']);

// Get the thread details from the database.
$thread = get_thread($mybb->input['tid']);

 

if(!$thread || substr($thread['closed'], 0, 6) == "moved|")
{
error($lang->error_invalidthread);
}


// Get thread prefix if there is one.
$thread['threadprefix'] = '';


// Get thread prefix if there is one.
$thread['threadprefix'] = '';

Zeile 63Zeile 75
		$thread['threadprefix'] = $threadprefix['prefix'].' ';
$thread['displayprefix'] = $threadprefix['displaystyle'].' ';
}

		$thread['threadprefix'] = $threadprefix['prefix'].' ';
$thread['displayprefix'] = $threadprefix['displaystyle'].' ';
}

}

if(substr($thread['closed'], 0, 6) == "moved|")
{
$thread['tid'] = 0;

 
}

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

}

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

Zeile 102Zeile 109
}

// Make sure we are looking at a real thread here.

}

// Make sure we are looking at a real thread here.

if(!$thread || ($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))

if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))

{
error($lang->error_invalidthread);

{
error($lang->error_invalidthread);

}

$forumpermissions = forum_permissions($thread['fid']);


}

$forumpermissions = forum_permissions($thread['fid']);


// Does the user have permission to view this thread?
if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
{
error_no_permission();
}


// Does the user have permission to view this thread?
if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
{
error_no_permission();
}


if(isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
{
error_no_permission();
}

$archive_url = build_archive_link("thread", $tid);


if(isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
{
error_no_permission();
}

$archive_url = build_archive_link("thread", $tid);


// Does the thread belong to a valid forum?
$forum = get_forum($fid);
if(!$forum || $forum['type'] != "f")

// Does the thread belong to a valid forum?
$forum = get_forum($fid);
if(!$forum || $forum['type'] != "f")

Zeile 165Zeile 172
	{
$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($thread['lastpost'] > $cutoff)

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

		{

		{

			if($thread_read)
{
$lastread = $thread_read;

			if($thread_read)
{
$lastread = $thread_read;

Zeile 195Zeile 202
   {
$lastread = $cutoff;
}

   {
$lastread = $cutoff;
}

	

	

	// Next, find the proper pid to link to.
$options = array(
"limit_start" => 0,

	// Next, find the proper pid to link to.
$options = array(
"limit_start" => 0,

Zeile 223Zeile 230
		}

header("Location: ".htmlspecialchars_decode(get_post_link($newpost['pid'], $tid)).$highlight."#pid{$newpost['pid']}");

		}

header("Location: ".htmlspecialchars_decode(get_post_link($newpost['pid'], $tid)).$highlight."#pid{$newpost['pid']}");

	}
else
{

	}
else
{

		// show them to the last post
$mybb->input['action'] = "lastpost";
}

		// show them to the last post
$mybb->input['action'] = "lastpost";
}

Zeile 284Zeile 291
		"order_dir" => "desc"
);
$query = $db->simple_select('posts', 'pid', "tid='{$nextthread['tid']}'", $options);

		"order_dir" => "desc"
);
$query = $db->simple_select('posts', 'pid', "tid='{$nextthread['tid']}'", $options);





	// Redirect to the proper page.
$pid = $db->fetch_field($query, "pid");
header("Location: ".htmlspecialchars_decode(get_post_link($pid, $nextthread['tid']))."#pid{$pid}");

	// Redirect to the proper page.
$pid = $db->fetch_field($query, "pid");
header("Location: ".htmlspecialchars_decode(get_post_link($pid, $nextthread['tid']))."#pid{$pid}");

Zeile 334Zeile 341
if($mybb->settings['showforumpagesbreadcrumb'])
{
// How many pages are there?

if($mybb->settings['showforumpagesbreadcrumb'])
{
// How many pages are there?

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

	if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)

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

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

Zeile 522Zeile 529
		else
{
$totpercent = "0%";

		else
{
$totpercent = "0%";

		}


		}


		// Check if user is allowed to edit posts; if so, show "edit poll" link.
if(!is_moderator($fid, 'caneditposts'))
{

		// Check if user is allowed to edit posts; if so, show "edit poll" link.
if(!is_moderator($fid, 'caneditposts'))
{

Zeile 538Zeile 545
		if($alreadyvoted || $showresults)
{
if($alreadyvoted)

		if($alreadyvoted || $showresults)
{
if($alreadyvoted)

			{

			{

				$pollstatus = $lang->already_voted;

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

				$pollstatus = $lang->already_voted;

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

Zeile 553Zeile 560
			$lang->total_votes = $lang->sprintf($lang->total_votes, $totalvotes);
eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";");
$plugins->run_hooks("showthread_poll_results");

			$lang->total_votes = $lang->sprintf($lang->total_votes, $totalvotes);
eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";");
$plugins->run_hooks("showthread_poll_results");

		}

		}

		else
{
$publicnote = '&nbsp;';

		else
{
$publicnote = '&nbsp;';

Zeile 583Zeile 590

// Mark this thread as read
mark_thread_read($tid, $fid);


// Mark this thread as read
mark_thread_read($tid, $fid);





	// If the forum is not open, show closed newreply button unless the user is a moderator of this forum.
if($forum['open'] != 0)
{

	// If the forum is not open, show closed newreply button unless the user is a moderator of this forum.
if($forum['open'] != 0)
{

Zeile 591Zeile 598

// Show the appropriate reply button if this thread is open or closed
if($thread['closed'] == 1)


// Show the appropriate reply button if this thread is open or closed
if($thread['closed'] == 1)

		{

		{

			eval("\$newreply = \"".$templates->get("showthread_newreply_closed")."\";");

			eval("\$newreply = \"".$templates->get("showthread_newreply_closed")."\";");

		}

		}

		else
{
eval("\$newreply = \"".$templates->get("showthread_newreply")."\";");

		else
{
eval("\$newreply = \"".$templates->get("showthread_newreply")."\";");

		}
}

		}
}


// Create the admin tools dropdown box.
if($ismod == true)


// Create the admin tools dropdown box.
if($ismod == true)

Zeile 641Zeile 648
	if($mybb->settings['delayedthreadviews'] == 1)
{
$db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");

	if($mybb->settings['delayedthreadviews'] == 1)
{
$db->shutdown_query("INSERT INTO ".TABLE_PREFIX."threadviews (tid) VALUES('{$tid}')");

	}
else

	}
else

	{
$db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}

	{
$db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");
}

Zeile 808Zeile 815
	else // Linear display
{
$threadexbox = '';

	else // Linear display
{
$threadexbox = '';

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

		if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)

		{

		{

			$mybb->settings['postperpage'] = 20;

			$mybb->settings['postsperpage'] = 20;

		}

// Figure out if we need to display multiple pages.

		}

// Figure out if we need to display multiple pages.

Zeile 882Zeile 889
		{
$start = 0;
$page = 1;

		{
$start = 0;
$page = 1;

		}

		}

		$upper = $start+$perpage;

// Work out if we have terms to highlight

		$upper = $start+$perpage;

// Work out if we have terms to highlight

Zeile 912Zeile 919
			if(!empty($mybb->input['highlight']))
{
if(is_array($mybb->input['highlight']))

			if(!empty($mybb->input['highlight']))
{
if(is_array($mybb->input['highlight']))

				{

				{

					foreach($mybb->input['highlight'] as $highlight_word)
{
$highlight .= "&amp;highlight[]=".urlencode($highlight_word);

					foreach($mybb->input['highlight'] as $highlight_word)
{
$highlight .= "&amp;highlight[]=".urlencode($highlight_word);

Zeile 941Zeile 948
		$comma = '';
$query = $db->simple_select("posts p", "p.pid", "p.tid='$tid' $visible", array('order_by' => 'p.dateline', 'limit_start' => $start, 'limit' => $perpage));
while($getid = $db->fetch_array($query))

		$comma = '';
$query = $db->simple_select("posts p", "p.pid", "p.tid='$tid' $visible", array('order_by' => 'p.dateline', 'limit_start' => $start, 'limit' => $perpage));
while($getid = $db->fetch_array($query))

		{

		{

			// Set the ID of the first post on page to $pid if it doesn't hold any value
// to allow this value to be used for Thread Mode/Linear Mode links
// and ensure the user lands on the correct page after changing view mode

			// Set the ID of the first post on page to $pid if it doesn't hold any value
// to allow this value to be used for Thread Mode/Linear Mode links
// and ensure the user lands on the correct page after changing view mode

Zeile 986Zeile 993
			ORDER BY p.dateline
");
while($post = $db->fetch_array($query))

			ORDER BY p.dateline
");
while($post = $db->fetch_array($query))

		{

		{

			if($thread['firstpost'] == $post['pid'] && $thread['visible'] == 0)
{
$post['visible'] = 0;
}
$posts .= build_postbit($post);
$post = '';

			if($thread['firstpost'] == $post['pid'] && $thread['visible'] == 0)
{
$post['visible'] = 0;
}
$posts .= build_postbit($post);
$post = '';

		}

		}

		$plugins->run_hooks("showthread_linear");
}


		$plugins->run_hooks("showthread_linear");
}


Zeile 1001Zeile 1008
	$similarthreads = '';
if($mybb->settings['showsimilarthreads'] != 0)
{

	$similarthreads = '';
if($mybb->settings['showsimilarthreads'] != 0)
{

 
		$own_perm = '';
if($forumpermissions['canonlyviewownthreads'] == 1)
{
$own_perm = " AND t.uid={$mybb->user['uid']}";
}


		switch($db->type)
{
case "pgsql":

		switch($db->type)
{
case "pgsql":

Zeile 1008Zeile 1021
					SELECT t.*, t.username AS threadusername, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid), plainto_tsquery ('".$db->escape_string($thread['subject'])."') AS query

					SELECT t.*, t.username AS threadusername, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid), plainto_tsquery ('".$db->escape_string($thread['subject'])."') AS query

					WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.subject @@ query

					WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.subject @@ query{$own_perm}

					ORDER BY t.lastpost DESC
OFFSET 0 LIMIT {$mybb->settings['similarlimit']}
");

					ORDER BY t.lastpost DESC
OFFSET 0 LIMIT {$mybb->settings['similarlimit']}
");

Zeile 1018Zeile 1031
					SELECT t.*, t.username AS threadusername, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)

					SELECT t.*, t.username AS threadusername, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)

					WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'

					WHERE t.fid='{$thread['fid']}' AND t.tid!='{$thread['tid']}' AND t.visible='1' AND t.closed NOT LIKE 'moved|%'{$own_perm} AND MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') >= '{$mybb->settings['similarityrating']}'

					ORDER BY t.lastpost DESC
LIMIT 0, {$mybb->settings['similarlimit']}
");

					ORDER BY t.lastpost DESC
LIMIT 0, {$mybb->settings['similarlimit']}
");

Zeile 1034Zeile 1047
			if($similar_thread['icon'] > 0 && $icon_cache[$similar_thread['icon']])
{
$icon = $icon_cache[$similar_thread['icon']];

			if($similar_thread['icon'] > 0 && $icon_cache[$similar_thread['icon']])
{
$icon = $icon_cache[$similar_thread['icon']];

 
				$icon['path'] = htmlspecialchars_uni($icon['path']);
$icon['name'] = htmlspecialchars_uni($icon['name']);

				$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else

				$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else