Vergleich showthread.php - 1.6.0 - 1.6.3

  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: showthread.php 5125 2010-07-27 07:28:03Z RyanGordon $

 * $Id: showthread.php 5448 2011-04-16 16:42:29Z Tomm $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 88Zeile 88
else
{
$ismod = false;

else
{
$ismod = false;

 
}

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

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

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

}

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

}

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

Zeile 117Zeile 130
if($ismod == true)
{
$threadcount += $forum_threads['unapprovedthreads'];

if($ismod == true)
{
$threadcount += $forum_threads['unapprovedthreads'];

 
}

// Limit to only our own threads
$uid_only = '';
if($forumpermissions['canonlyviewownthreads'] == 1)
{
$uid_only = " AND uid = '".$mybb->user['uid']."'";

$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly $uid_only", array('limit' => 1));
$threadcount = $db->fetch_field($query, "threads");

}

// If we have 0 threads double check there aren't any "moved" threads
if($threadcount == 0)
{

}

// If we have 0 threads double check there aren't any "moved" threads
if($threadcount == 0)
{

	$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly", array('limit' => 1));

	$query = $db->simple_select("threads", "COUNT(tid) AS threads", "fid = '$fid' $visibleonly $uid_only", array('limit' => 1));

	$threadcount = $db->fetch_field($query, "threads");

	$threadcount = $db->fetch_field($query, "threads");

}

}


$stickybit = " OR sticky=1";
if($thread['sticky'] == 1)


$stickybit = " OR sticky=1";
if($thread['sticky'] == 1)

Zeile 139Zeile 162
		$query = $db->query("
SELECT COUNT(tid) as threads
FROM ".TABLE_PREFIX."threads

		$query = $db->query("
SELECT COUNT(tid) as threads
FROM ".TABLE_PREFIX."threads

			WHERE fid = '$fid' AND (lastpost >= '".intval($thread['lastpost'])."'{$stickybit}) {$visibleonly}

			WHERE fid = '$fid' AND (lastpost >= '".intval($thread['lastpost'])."'{$stickybit}) {$visibleonly} {$uid_only}

			GROUP BY lastpost
ORDER BY lastpost DESC
");
break;
default:

			GROUP BY lastpost
ORDER BY lastpost DESC
");
break;
default:

		$query = $db->simple_select("threads", "COUNT(tid) as threads", "fid = '$fid' AND (lastpost >= '".intval($thread['lastpost'])."'{$stickybit}) {$visibleonly}", array('order_by' => 'lastpost', 'order_dir' => 'desc'));

		$query = $db->simple_select("threads", "COUNT(tid) as threads", "fid = '$fid' AND (lastpost >= '".intval($thread['lastpost'])."'{$stickybit}) {$visibleonly} {$uid_only}", array('order_by' => 'lastpost', 'order_dir' => 'desc'));

}

$thread_position = $db->fetch_field($query, "threads");

}

$thread_position = $db->fetch_field($query, "threads");

Zeile 154Zeile 177
// Build the navigation.
build_forum_breadcrumb($fid, array('num_threads' => $threadcount, 'current_page' => $thread_page));
add_breadcrumb($thread['displayprefix'].$thread['subject'], get_thread_link($thread['tid']));

// Build the navigation.
build_forum_breadcrumb($fid, array('num_threads' => $threadcount, 'current_page' => $thread_page));
add_breadcrumb($thread['displayprefix'].$thread['subject'], get_thread_link($thread['tid']));


// Does the user have permission to view this thread?
$forumpermissions = forum_permissions($forum['fid']);

if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
{
error_no_permission();
}

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

 

// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);


// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);





// If there is no specific action, we must be looking at the thread.
if(!$mybb->input['action'])
{
$mybb->input['action'] = "thread";
}

// If there is no specific action, we must be looking at the thread.
if(!$mybb->input['action'])
{
$mybb->input['action'] = "thread";
}



 

// Jump to the unread posts.
if($mybb->input['action'] == "newpost")


// Jump to the unread posts.
if($mybb->input['action'] == "newpost")

Zeile 194Zeile 203
		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 = my_get_array_cookie("forumread", $fid);

		$forum_read = intval(my_get_array_cookie("forumread", $fid));

	}

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

	}

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

Zeile 220Zeile 229
	
if(!$lastread)
{

	
if(!$lastread)
{

		$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);

		$readcookie = $threadread = intval(my_get_array_cookie("threadread", $thread['tid']));

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

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

Zeile 228Zeile 237
		else
{
$lastread = $forum_read;

		else
{
$lastread = $forum_read;

		}
}

if($cutoff && $lastread < $cutoff)
{
$lastread = $cutoff;
}

		}
}

if($cutoff && $lastread < $cutoff)
{
$lastread = $cutoff;
}

	
// Next, find the proper pid to link to.
$options = array(

	
// Next, find the proper pid to link to.
$options = array(

Zeile 243Zeile 252
		"order_by" => "dateline",
"order_dir" => "asc"
);

		"order_by" => "dateline",
"order_dir" => "asc"
);

 

$lastread = intval($lastread);

	$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline > '{$lastread}'", $options);
$newpost = $db->fetch_array($query);

if($newpost['pid'] && $lastread)
{

	$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline > '{$lastread}'", $options);
$newpost = $db->fetch_array($query);

if($newpost['pid'] && $lastread)
{

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













		$highlight = '';
if($mybb->input['highlight'])
{
$string = "&";
if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
{
$string = "?";
}

$highlight = $string."highlight=".$mybb->input['highlight'];
}

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

	}
else
{

	}
else
{

Zeile 504Zeile 527
			$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

		}
else

		{
$publicnote = '&nbsp;';
if($poll['public'] == 1)

		{
$publicnote = '&nbsp;';
if($poll['public'] == 1)

Zeile 539Zeile 562
	if($forum['open'] != 0)
{
eval("\$newthread = \"".$templates->get("showthread_newthread")."\";");

	if($forum['open'] != 0)
{
eval("\$newthread = \"".$templates->get("showthread_newthread")."\";");





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

Zeile 573Zeile 596
		if($thread['sticky'])
{
$stickch = ' checked="checked"';

		if($thread['sticky'])
{
$stickch = ' checked="checked"';

		}

		}

		$closeoption = "<br /><label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[closethread]\" value=\"1\"{$closelinkch} />&nbsp;<strong>".$lang->close_thread."</strong></label>";
$closeoption .= "<br /><label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[stickthread]\" value=\"1\"{$stickch} />&nbsp;<strong>".$lang->stick_thread."</strong></label>";
$inlinecount = "0";

		$closeoption = "<br /><label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[closethread]\" value=\"1\"{$closelinkch} />&nbsp;<strong>".$lang->close_thread."</strong></label>";
$closeoption .= "<br /><label><input type=\"checkbox\" class=\"checkbox\" name=\"modoptions[stickthread]\" value=\"1\"{$stickch} />&nbsp;<strong>".$lang->stick_thread."</strong></label>";
$inlinecount = "0";

Zeile 590Zeile 613
	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
{
$db->shutdown_query("UPDATE ".TABLE_PREFIX."threads SET views=views+1 WHERE tid='{$tid}'");

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

Zeile 607Zeile 630
			$thread['width'] = 0;
$thread['averagerating'] = 0;
$thread['numratings'] = 0;

			$thread['width'] = 0;
$thread['averagerating'] = 0;
$thread['numratings'] = 0;

		}

		}

		else
{
$thread['averagerating'] = floatval(round($thread['totalratings']/$thread['numratings'], 2));

		else
{
$thread['averagerating'] = floatval(round($thread['totalratings']/$thread['numratings'], 2));

Zeile 640Zeile 663
	
// Can this user perform searches? If so, we can show them the "Search thread" form
if($forumpermissions['cansearch'] != 0)

	
// Can this user perform searches? If so, we can show them the "Search thread" form
if($forumpermissions['cansearch'] != 0)

	{

	{

		eval("\$search_thread = \"".$templates->get("showthread_search")."\";");
}


		eval("\$search_thread = \"".$templates->get("showthread_search")."\";");
}


Zeile 910Zeile 933

// Get the actual posts from the database here.
$posts = '';


// Get the actual posts from the database here.
$posts = '';

		$query = $db->query("

		$query = $db->query("

			SELECT u.*, u.username AS userusername, p.*, f.*, eu.username AS editusername
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)

			SELECT u.*, u.username AS userusername, p.*, f.*, eu.username AS editusername
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)

Zeile 927Zeile 950
			}
$posts .= build_postbit($post);
$post = '';

			}
$posts .= build_postbit($post);
$post = '';

		}

		}

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


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


Zeile 938Zeile 961
		{
case "sqlite":
case "pgsql":

		{
case "sqlite":
case "pgsql":

			$query = $db->query("
SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
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']}'
ORDER BY t.lastpost DESC

			$query = $db->query("
SELECT t.*, t.username AS threadusername, p.displaystyle AS threadprefix, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."') AS relevance
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)
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']}'
ORDER BY t.lastpost DESC

				LIMIT 0, {$mybb->settings['similarlimit']}
");
break;

				LIMIT 0, {$mybb->settings['similarlimit']}
");
break;

Zeile 1029Zeile 1052
		
// Show captcha image for guests if enabled
if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])

		
// Show captcha image for guests if enabled
if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])

		{

		{

			$randomstr = random_str(5);
$imagehash = md5(random_str(12));
$imagearray = array(

			$randomstr = random_str(5);
$imagehash = md5(random_str(12));
$imagearray = array(

Zeile 1039Zeile 1062
			);
$db->insert_query("captcha", $imagearray);
eval("\$captcha = \"".$templates->get("post_captcha")."\";");

			);
$db->insert_query("captcha", $imagearray);
eval("\$captcha = \"".$templates->get("post_captcha")."\";");

		}

		}

		if($mybb->user['signature'])
{
$postoptionschecked['signature'] = 'checked="checked"';
}
if($mybb->user['emailnotify'] == 1)

		if($mybb->user['signature'])
{
$postoptionschecked['signature'] = 'checked="checked"';
}
if($mybb->user['emailnotify'] == 1)

		{

		{

			$postoptionschecked['emailnotify'] = 'checked="checked"';
}
$posthash = md5($mybb->user['uid'].random_str());

			$postoptionschecked['emailnotify'] = 'checked="checked"';
}
$posthash = md5($mybb->user['uid'].random_str());

Zeile 1062Zeile 1085
	{
$customthreadtools = $customposttools = '';
switch($db->type)

	{
$customthreadtools = $customposttools = '';
switch($db->type)

		{

		{

			case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", "tid, name, type", "','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums=''");

			case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", "tid, name, type", "','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums=''");

Zeile 1112Zeile 1135
	}

if($mybb->settings['postlayout'] == "classic")

	}

if($mybb->settings['postlayout'] == "classic")

	{

	{

		eval("\$classic_header = \"".$templates->get("showthread_classic_header")."\";");		
}


		eval("\$classic_header = \"".$templates->get("showthread_classic_header")."\";");		
}


Zeile 1146Zeile 1169
					$doneusers[$user['uid']] = $user['time'];
++$membercount;
if($user['invisible'] == 1)

					$doneusers[$user['uid']] = $user['time'];
++$membercount;
if($user['invisible'] == 1)

					{

					{

						$invisiblemark = "*";

						$invisiblemark = "*";

						++$inviscount;






if($user['uid'] != $mybb->user['uid'])
{
++$inviscount;
}

					}
else
{

					}
else
{

Zeile 1164Zeile 1191
						$comma = $lang->comma;
}
}

						$comma = $lang->comma;
}
}

			}
}














			}
}

$invisonline = '';
$onlinesep2 = $onlinesep = '';
if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1)
{
if($onlinemembers)
{
$onlinesep = $lang->comma;
}

$invisonline = $lang->sprintf($lang->users_browsing_thread_invis, $inviscount);
}


		if($guestcount)

		if($guestcount)

		{






 		{
if($onlinemembers)
{
$onlinesep2 = $lang->comma;
}


			$guestsonline = $lang->sprintf($lang->users_browsing_thread_guests, $guestcount);

			$guestsonline = $lang->sprintf($lang->users_browsing_thread_guests, $guestcount);

		}

if($guestcount && $onlinemembers)
{
$onlinesep = $lang->comma;
}

$invisonline = '';
if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1))
{
$invisonline = $lang->sprintf($lang->users_browsing_thread_invis, $inviscount);
}

if($invisonline != '' && $guestcount)
{
$onlinesep2 = $lang->comma;
}

 		}

















		eval("\$usersbrowsing = \"".$templates->get("showthread_usersbrowsing")."\";");
}


		eval("\$usersbrowsing = \"".$templates->get("showthread_usersbrowsing")."\";");
}