Vergleich showthread.php - 1.2.0 - 1.2.3

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

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

 * $Id: showthread.php 2164 2006-08-30 06:17:49Z chris $

 * $Id: showthread.php 2542 2006-12-19 23:43:47Z Tikitiki $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

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

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

 
	$pid = $mybb->input['pid'];

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


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


Zeile 45Zeile 46
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$tid = $thread['tid'];
$fid = $thread['fid'];

$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$tid = $thread['tid'];
$fid = $thread['fid'];

 

if(!$thread['username'])
{
$thread['username'] = $lang->guest;
}


// Is the currently logged in user a moderator of this forum?
if(is_moderator($fid) == "yes")


// Is the currently logged in user a moderator of this forum?
if(is_moderator($fid) == "yes")

Zeile 79Zeile 85
$forumpermissions = forum_permissions($forum['fid']);

if($forumpermissions['canview'] != "yes" || $forumpermissions['canviewthreads'] != "yes")

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

if($forumpermissions['canview'] != "yes" || $forumpermissions['canviewthreads'] != "yes")

{

{

	error_no_permission();
}

	error_no_permission();
}





// Check that this forum is not password protected.
check_forum_password($forum['fid'], $forum['password']);


// Check that this forum is not password protected.
check_forum_password($forum['fid'], $forum['password']);


Zeile 90Zeile 96
if(!$mybb->input['action'])
{
$mybb->input['action'] = "thread";

if(!$mybb->input['action'])
{
$mybb->input['action'] = "thread";

}

}


// Jump to the last post.
if($mybb->input['action'] == "lastpost")


// Jump to the last post.
if($mybb->input['action'] == "lastpost")

Zeile 100Zeile 106
		$query = $db->query("
SELECT p.pid
FROM ".TABLE_PREFIX."posts p, ".TABLE_PREFIX."threads t

		$query = $db->query("
SELECT p.pid
FROM ".TABLE_PREFIX."posts p, ".TABLE_PREFIX."threads t

			WHERE t.fid='".$thread[fid]."' AND t.closed NOT LIKE 'moved|%' AND p.tid=t.tid

			WHERE t.fid='".$thread['fid']."' AND t.closed NOT LIKE 'moved|%' AND p.tid=t.tid

			ORDER BY p.dateline DESC
LIMIT 0, 1
");

			ORDER BY p.dateline DESC
LIMIT 0, 1
");

Zeile 124Zeile 130
// Jump to the next newest posts.
if($mybb->input['action'] == "nextnewest")
{

// Jump to the next newest posts.
if($mybb->input['action'] == "nextnewest")
{

	$options = array(
"limit_start" => 0,
"limit" => 1,

	$options = array(
"limit_start" => 0,
"limit" => 1,

		"order_by" => "lastpost"
);
$query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid={$thread['fid']} AND lastpost > {$thread['lastpost']} AND visible=1 AND closed NOT LIKE 'moved|%'", $options);

		"order_by" => "lastpost"
);
$query = $db->simple_select(TABLE_PREFIX.'threads', '*', "fid={$thread['fid']} AND lastpost > {$thread['lastpost']} AND visible=1 AND closed NOT LIKE 'moved|%'", $options);

Zeile 136Zeile 142
	if(!$nextthread['tid'])
{
error($lang->error_nonextnewest);

	if(!$nextthread['tid'])
{
error($lang->error_nonextnewest);

	}
$options = array(
"limit_start" => 0,
"limit" => 1,

	}
$options = array(
"limit_start" => 0,
"limit" => 1,

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

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

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

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

		{

		{

			if($thread_read)

			if($thread_read)

			{

			{

				$lastread = $thread_read;

				$lastread = $thread_read;

			}

			}

			else
{
$lastread = 1;

			else
{
$lastread = 1;

Zeile 211Zeile 217
		}
}
if(!$lastread)

		}
}
if(!$lastread)

	{

	{

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

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

Zeile 229Zeile 235
		"order_by" => "dateline",
"order_dir" => "asc"
);

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

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

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

	$newpost = $db->fetch_array($query);
if($newpost['pid'])
{
header("Location:showthread.php?tid={$tid}&pid={$newpost['pid']}#pid{$newpost['pid']}");

	$newpost = $db->fetch_array($query);
if($newpost['pid'])
{
header("Location:showthread.php?tid={$tid}&pid={$newpost['pid']}#pid{$newpost['pid']}");

	}
else
{

	}
else
{

		header("Location:showthread.php?action=lastpost&tid={$tid}");
}
}

		header("Location:showthread.php?action=lastpost&tid={$tid}");
}
}

Zeile 283Zeile 289
			if($_COOKIE['pollvotes'][$poll['pid']])
{
$alreadyvoted = 1;

			if($_COOKIE['pollvotes'][$poll['pid']])
{
$alreadyvoted = 1;

			}
}

			}
}

		$optionsarray = explode("||~|~||", $poll['options']);
$votesarray = explode("||~|~||", $poll['votes']);
$poll['question'] = htmlspecialchars_uni($poll['question']);
$polloptions = '';

		$optionsarray = explode("||~|~||", $poll['options']);
$votesarray = explode("||~|~||", $poll['votes']);
$poll['question'] = htmlspecialchars_uni($poll['question']);
$polloptions = '';

 
		$totalvotes = 0;


for($i = 1; $i <= $poll['numoptions']; $i++)
{


for($i = 1; $i <= $poll['numoptions']; $i++)
{

Zeile 308Zeile 315

$option = $parser->parse_message($optionsarray[$i-1], $parser_options);
$votes = $votesarray[$i-1];


$option = $parser->parse_message($optionsarray[$i-1], $parser_options);
$votes = $votesarray[$i-1];

 
			$totalvotes += $votes;

			$number = $i;

// Mark the option the user voted for.

			$number = $i;

// Mark the option the user voted for.

Zeile 332Zeile 340
				else
{
$percent = number_format($votes / $poll['totvotes'] * 100, 2);

				else
{
$percent = number_format($votes / $poll['totvotes'] * 100, 2);

				}

				}

				$imagewidth = round(($percent/3) * 5);
eval("\$polloptions .= \"".$templates->get("showthread_poll_resultbit")."\";");
}

				$imagewidth = round(($percent/3) * 5);
eval("\$polloptions .= \"".$templates->get("showthread_poll_resultbit")."\";");
}

Zeile 354Zeile 362
		{
$totpercent = "100%";
}

		{
$totpercent = "100%";
}

		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') != 'yes')


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

		{

		{

			$edit_poll = '';
}
else
{
$edit_poll = "| <a href=\"polls.php?action=editpoll&amp;pid={$poll['pid']}\">{$lang->edit_poll}</a>";

			$edit_poll = '';
}
else
{
$edit_poll = "| <a href=\"polls.php?action=editpoll&amp;pid={$poll['pid']}\">{$lang->edit_poll}</a>";

		}

		}


// Decide what poll status to show depending on the status of the poll and whether or not the user voted already.
if($alreadyvoted || $showresults)
{
if($alreadyvoted)


// Decide what poll status to show depending on the status of the poll and whether or not the user voted already.
if($alreadyvoted || $showresults)
{
if($alreadyvoted)

			{

			{

				$pollstatus = $lang->already_voted;
}
else
{
$pollstatus = $lang->poll_closed;

				$pollstatus = $lang->already_voted;
}
else
{
$pollstatus = $lang->poll_closed;

			}
$lang->total_votes = sprintf($lang->total_votes, $poll['numvotes']);

			}
$lang->total_votes = sprintf($lang->total_votes, $totalvotes);

			eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";");
$plugins->run_hooks("showthread_poll_results");
}

			eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";");
$plugins->run_hooks("showthread_poll_results");
}

Zeile 428Zeile 436
		if($thread['closed'] == "yes")
{
eval("\$newreply = \"".$templates->get("showthread_newreply_closed")."\";");

		if($thread['closed'] == "yes")
{
eval("\$newreply = \"".$templates->get("showthread_newreply_closed")."\";");

		}

		}

		else

		else

		{

		{

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

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

Zeile 439Zeile 447
	if($ismod == true)
{
if($pollbox)

	if($ismod == true)
{
if($pollbox)

		{

		{

			$adminpolloptions = "<option value=\"deletepoll\">".$lang->delete_poll."</option>";

			$adminpolloptions = "<option value=\"deletepoll\">".$lang->delete_poll."</option>";

		}

		}

		if($thread['visible'] != 1)
{
$approveunapprovethread = "<option value=\"approvethread\">".$lang->approve_thread."</option>";

		if($thread['visible'] != 1)
{
$approveunapprovethread = "<option value=\"approvethread\">".$lang->approve_thread."</option>";

		}

		}

		else
{
$approveunapprovethread = "<option value=\"unapprovethread\">".$lang->unapprove_thread."</option>";
}
if($thread['closed'] == "yes")

		else
{
$approveunapprovethread = "<option value=\"unapprovethread\">".$lang->unapprove_thread."</option>";
}
if($thread['closed'] == "yes")

		{

		{

			$closelinkch = "checked";

			$closelinkch = "checked";

		}

		}

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

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

Zeile 463Zeile 471
		$inlinecount = "0";
$inlinecookie = "inlinemod_thread".$tid;
$plugins->run_hooks("showthread_ismod");

		$inlinecount = "0";
$inlinecookie = "inlinemod_thread".$tid;
$plugins->run_hooks("showthread_ismod");

	}

	}

	else
{
$adminoptions = "&nbsp;";

	else
{
$adminoptions = "&nbsp;";

Zeile 511Zeile 519
	if($forum['allowtratings'] == "yes" && $forumpermissions['canratethreads'] == "yes")
{
eval("\$ratethread = \"".$templates->get("showthread_ratethread")."\";");

	if($forum['allowtratings'] == "yes" && $forumpermissions['canratethreads'] == "yes")
{
eval("\$ratethread = \"".$templates->get("showthread_ratethread")."\";");

	}

	}

	// Work out if we are showing unapproved posts as well (if the user is a moderator etc.)
if($ismod)

	// Work out if we are showing unapproved posts as well (if the user is a moderator etc.)
if($ismod)

	{

	{

		$visible = "AND (p.visible='0' OR p.visible='1')";

		$visible = "AND (p.visible='0' OR p.visible='1')";

	}

	}

	else
{
$visible = "AND p.visible='1'";

	else
{
$visible = "AND p.visible='1'";

Zeile 524Zeile 532

// Threaded or lineair display?
if($mybb->input['mode'] == "threaded")


// Threaded or lineair display?
if($mybb->input['mode'] == "threaded")

	{

	{

		$isfirst = 1;

// Are we linked to a specific pid?
if($mybb->input['pid'])

		$isfirst = 1;

// Are we linked to a specific pid?
if($mybb->input['pid'])

		{

		{

			$where = "AND p.pid='".$mybb->input['pid']."'";
}
else
{
$where = " ORDER BY dateline ASC LIMIT 0, 1";

			$where = "AND p.pid='".$mybb->input['pid']."'";
}
else
{
$where = " ORDER BY dateline ASC LIMIT 0, 1";

		}
$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 548Zeile 556

// Choose what pid to display.
if(!$mybb->input['pid'])


// Choose what pid to display.
if(!$mybb->input['pid'])

		{

		{

			$mybb->input['pid'] = $showpost['pid'];

			$mybb->input['pid'] = $showpost['pid'];

		}

		}


// Is there actually a pid to display?
if(!$showpost['pid'])
{


// Is there actually a pid to display?
if(!$showpost['pid'])
{

			error($lang->invalidpost);

			error($lang->error_invalidpost);

		}

// Get the attachments for this post.
$query = $db->simple_select(TABLE_PREFIX."attachments", "*", "pid=".$mybb->input['pid']);
while($attachment = $db->fetch_array($query))

		}

// Get the attachments for this post.
$query = $db->simple_select(TABLE_PREFIX."attachments", "*", "pid=".$mybb->input['pid']);
while($attachment = $db->fetch_array($query))

		{

		{

			$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;

			$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;

		}

		}


// Build the threaded post display tree.
$query = $db->query("


// Build the threaded post display tree.
$query = $db->query("

			SELECT u.*, u.username AS userusername, p.*
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
WHERE p.tid='$tid'
$visible
ORDER BY p.dateline
");
while($post = $db->fetch_array($query))
{
if(!$postsdone[$post['pid']])
{
$tree[$post['replyto']][$post['pid']] = $post;
if($post['pid'] == $mybb->input['pid'] || ($isfirst && !$mybb->input['pid']))
{
$isfirst = 0;
}
$postsdone[$post['pid']] = 1;
}
}

            SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline
FROM ".TABLE_PREFIX."posts p
WHERE p.tid='$tid'
$visible
ORDER BY p.dateline
");
while($post = $db->fetch_array($query))
{
if(!$postsdone[$post['pid']])
{
if($post['pid'] == $mybb->input['pid'] || ($isfirst && !$mybb->input['pid']))
{
$isfirst = 0;
}
$tree[$post['replyto']][$post['pid']] = $post;
$postsdone[$post['pid']] = 1;
}
}


		$threadedbits = buildtree();
$posts = build_postbit($showpost);
eval("\$threadexbox = \"".$templates->get("showthread_threadedbox")."\";");

		$threadedbits = buildtree();
$posts = build_postbit($showpost);
eval("\$threadexbox = \"".$templates->get("showthread_threadedbox")."\";");

Zeile 616Zeile 623
			{
$page = intval($result / $perpage) + 1;
}

			{
$page = intval($result / $perpage) + 1;
}

		}

		}

		// Recount replies if user is a moderator to take into account unapproved posts.
if($ismod)
{

		// Recount replies if user is a moderator to take into account unapproved posts.
if($ismod)
{

Zeile 628Zeile 635
		$pages = ceil($pages);

if($mybb->input['page'] == "last")

		$pages = ceil($pages);

if($mybb->input['page'] == "last")

		{

		{

			$page = $pages;

			$page = $pages;

		}

		}


if($page > $pages)


if($page > $pages)

		{

		{

			$page = 1;

			$page = 1;

		}

		}


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


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

		}

		}

		else
{
$start = 0;

		else
{
$start = 0;

Zeile 723Zeile 730
			++$count;
$trow = alt_trow();
if($similar_thread['icon'] > 0 && $icon_cache[$similar_thread['icon']])

			++$count;
$trow = alt_trow();
if($similar_thread['icon'] > 0 && $icon_cache[$similar_thread['icon']])

			{

			{

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

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

			}
else
{

			}
else
{

				$icon = "&nbsp;";
}
if(!$similar_thread['username'])
{
$similar_thread['username'] = $similar_thread['threadusername'];
$similar_thread['profilelink'] = $similar_thread['threadusername'];

				$icon = "&nbsp;";
}
if(!$similar_thread['username'])
{
$similar_thread['username'] = $similar_thread['threadusername'];
$similar_thread['profilelink'] = $similar_thread['threadusername'];

			}
else

			}
else

			{
$similar_thread['profilelink'] = build_profile_link($similar_thread['username'], $similar_thread['uid']);
}

			{
$similar_thread['profilelink'] = build_profile_link($similar_thread['username'], $similar_thread['uid']);
}

Zeile 760Zeile 767
			$similar_thread['replies'] = my_number_format($similar_thread['replies']);
$similar_thread['views'] = my_number_format($similar_thread['views']);
eval("\$similarthreadbits .= \"".$templates->get("showthread_similarthreads_bit")."\";");

			$similar_thread['replies'] = my_number_format($similar_thread['replies']);
$similar_thread['views'] = my_number_format($similar_thread['views']);
eval("\$similarthreadbits .= \"".$templates->get("showthread_similarthreads_bit")."\";");

		}

		}

		if($count)
{
eval("\$similarthreads = \"".$templates->get("showthread_similarthreads")."\";");

		if($count)
{
eval("\$similarthreads = \"".$templates->get("showthread_similarthreads")."\";");

Zeile 796Zeile 803
			eval("\$customthreadtools = \"".$templates->get("showthread_moderationoptions_custom")."\";");
}
eval("\$moderationoptions = \"".$templates->get("showthread_moderationoptions")."\";");

			eval("\$customthreadtools = \"".$templates->get("showthread_moderationoptions_custom")."\";");
}
eval("\$moderationoptions = \"".$templates->get("showthread_moderationoptions")."\";");

	}

	}

	$lang->newthread_in = sprintf($lang->newthread_in, $forum['name']);
eval("\$showthread = \"".$templates->get("showthread")."\";");
$plugins->run_hooks("showthread_end");

	$lang->newthread_in = sprintf($lang->newthread_in, $forum['name']);
eval("\$showthread = \"".$templates->get("showthread")."\";");
$plugins->run_hooks("showthread_end");

Zeile 813Zeile 820
function buildtree($replyto="0", $indent="0")
{
global $tree, $mybb, $theme, $mybb, $pid, $tid, $templates, $parser;

function buildtree($replyto="0", $indent="0")
{
global $tree, $mybb, $theme, $mybb, $pid, $tid, $templates, $parser;

 
	

	if($indent)
{
$indentsize = 13 * $indent;

	if($indent)
{
$indentsize = 13 * $indent;

Zeile 821Zeile 829
	{
$indentsize = 0;
}

	{
$indentsize = 0;
}

 
	

	++$indent;
if(is_array($tree[$replyto]))
{

	++$indent;
if(is_array($tree[$replyto]))
{

Zeile 829Zeile 838
			$postdate = my_date($mybb->settings['dateformat'], $post['dateline']);
$posttime = my_date($mybb->settings['timeformat'], $post['dateline']);
$post['subject'] = htmlspecialchars_uni($parser->parse_badwords($post['subject']));

			$postdate = my_date($mybb->settings['dateformat'], $post['dateline']);
$posttime = my_date($mybb->settings['timeformat'], $post['dateline']);
$post['subject'] = htmlspecialchars_uni($parser->parse_badwords($post['subject']));

 
			

			if(!$post['subject'])
{
$post['subject'] = "[".$lang->no_subject."]";
}

			if(!$post['subject'])
{
$post['subject'] = "[".$lang->no_subject."]";
}

			if($post['userusername'])
{
$post['profilelink'] = build_profile_link($post['userusername'], $post['uid']);
}
else
{
$post['profilelink'] = $post['username'];
}

			
$post['profilelink'] = build_profile_link($post['username'], $post['uid']);







			if($mybb->input['pid'] == $post['pid'])
{
eval("\$posts .= \"".$templates->get("showthread_threaded_bitactive")."\";");

			if($mybb->input['pid'] == $post['pid'])
{
eval("\$posts .= \"".$templates->get("showthread_threaded_bitactive")."\";");

Zeile 849Zeile 854
			{
eval("\$posts .= \"".$templates->get("showthread_threaded_bit")."\";");
}

			{
eval("\$posts .= \"".$templates->get("showthread_threaded_bit")."\";");
}

 
			

			if($tree[$post['pid']])
{
$posts .= buildtree($post['pid'], $indent);

			if($tree[$post['pid']])
{
$posts .= buildtree($post['pid'], $indent);