Zeile 6 | Zeile 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 2454 2006-11-28 17:30:16Z CraKteR $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 45 | Zeile 45 |
---|
$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 79 | Zeile 84 |
---|
$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 90 | Zeile 95 |
---|
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 100 | Zeile 105 |
---|
$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 124 | Zeile 129 |
---|
// 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 136 | Zeile 141 |
---|
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 199 | Zeile 204 |
---|
{ $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 211 | Zeile 216 |
---|
} } 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 229 | Zeile 234 |
---|
"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 283 | Zeile 288 |
---|
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']);
| $optionsarray = explode("||~|~||", $poll['options']); $votesarray = explode("||~|~||", $poll['votes']); $poll['question'] = htmlspecialchars_uni($poll['question']);
|
Zeile 332 | Zeile 337 |
---|
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 354 | Zeile 359 |
---|
{ $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&pid={$poll['pid']}\">{$lang->edit_poll}</a>";
|
$edit_poll = ''; } else { $edit_poll = "| <a href=\"polls.php?action=editpoll&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']); eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";"); $plugins->run_hooks("showthread_poll_results");
| $lang->total_votes = sprintf($lang->total_votes, $poll['numvotes']); eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";"); $plugins->run_hooks("showthread_poll_results");
|
Zeile 403 | Zeile 408 |
---|
// Create the forum jump dropdown box. $forumjump = build_forum_jump("", $fid, 1);
|
// Create the forum jump dropdown box. $forumjump = build_forum_jump("", $fid, 1);
|
|
|
// Mark this thread read for the currently logged in user. if($mybb->settings['threadreadcut'] && ($mybb->user['uid'] != 0)) {
| // Mark this thread read for the currently logged in user. if($mybb->settings['threadreadcut'] && ($mybb->user['uid'] != 0)) {
|
Zeile 428 | Zeile 433 |
---|
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 439 | Zeile 444 |
---|
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 463 | Zeile 468 |
---|
$inlinecount = "0"; $inlinecookie = "inlinemod_thread".$tid; $plugins->run_hooks("showthread_ismod");
|
$inlinecount = "0"; $inlinecookie = "inlinemod_thread".$tid; $plugins->run_hooks("showthread_ismod");
|
}
| }
|
else { $adminoptions = " ";
| else { $adminoptions = " ";
|
Zeile 511 | Zeile 516 |
---|
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 524 | Zeile 529 |
---|
// 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 548 | Zeile 553 |
---|
// 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 616 | Zeile 620 |
---|
{ $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 628 | Zeile 632 |
---|
$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 723 | Zeile 727 |
---|
++$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 = " "; } if(!$similar_thread['username']) { $similar_thread['username'] = $similar_thread['threadusername']; $similar_thread['profilelink'] = $similar_thread['threadusername'];
|
$icon = " "; } 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 760 | Zeile 764 |
---|
$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 796 | Zeile 800 |
---|
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 813 | Zeile 817 |
---|
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 821 | Zeile 826 |
---|
{ $indentsize = 0; }
|
{ $indentsize = 0; }
|
|
|
++$indent; if(is_array($tree[$replyto])) {
| ++$indent; if(is_array($tree[$replyto])) {
|
Zeile 829 | Zeile 835 |
---|
$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 849 | Zeile 851 |
---|
{ 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);
|