Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: showthread.php 4038 2008-07-25 08:50:26Z dennis $
| * $Id: showthread.php 4276 2008-11-23 03:01:33Z Tikitiki $
|
*/
define("IN_MYBB", 1);
|
*/
define("IN_MYBB", 1);
|
| define('THIS_SCRIPT', 'showthread.php');
|
$templatelist = "showthread,postbit,postbit_author_user,postbit_author_guest,showthread_newthread,showthread_newreply,showthread_newreply_closed,postbit_sig,showthread_newpoll,postbit_avatar,postbit_profile,postbit_find,postbit_pm,postbit_www,postbit_email,postbit_edit,postbit_quote,postbit_report,postbit_signature, postbit_online,postbit_offline,postbit_away,postbit_gotopost,showthread_ratethread,showthread_inline_ratethread,showthread_moderationoptions"; $templatelist .= ",multipage_prevpage,multipage_nextpage,multipage_page_current,multipage_page,multipage_start,multipage_end,multipage"; $templatelist .= ",postbit_editedby,showthread_similarthreads,showthread_similarthreads_bit,postbit_iplogged_show,postbit_iplogged_hiden,showthread_quickreply"; $templatelist .= ",forumjump_advanced,forumjump_special,forumjump_bit,showthread_multipage,postbit_reputation,postbit_quickdelete,postbit_attachments,thumbnails_thumbnail,postbit_attachments_attachment,postbit_attachments_thumbnails,postbit_attachments_images_image,postbit_attachments_images,postbit_posturl";
|
$templatelist = "showthread,postbit,postbit_author_user,postbit_author_guest,showthread_newthread,showthread_newreply,showthread_newreply_closed,postbit_sig,showthread_newpoll,postbit_avatar,postbit_profile,postbit_find,postbit_pm,postbit_www,postbit_email,postbit_edit,postbit_quote,postbit_report,postbit_signature, postbit_online,postbit_offline,postbit_away,postbit_gotopost,showthread_ratethread,showthread_inline_ratethread,showthread_moderationoptions"; $templatelist .= ",multipage_prevpage,multipage_nextpage,multipage_page_current,multipage_page,multipage_start,multipage_end,multipage"; $templatelist .= ",postbit_editedby,showthread_similarthreads,showthread_similarthreads_bit,postbit_iplogged_show,postbit_iplogged_hiden,showthread_quickreply"; $templatelist .= ",forumjump_advanced,forumjump_special,forumjump_bit,showthread_multipage,postbit_reputation,postbit_quickdelete,postbit_attachments,thumbnails_thumbnail,postbit_attachments_attachment,postbit_attachments_thumbnails,postbit_attachments_images_image,postbit_attachments_images,postbit_posturl";
|
$templatelist .= ",postbit_inlinecheck,showthread_inlinemoderation,postbit_attachments_thumbnails_thumbnail,postbit_quickquote,postbit_qqmessage,postbit_seperator,postbit_groupimage,postbit_multiquote,showthread_search,postbit_warn,postbit_warninglevel,showthread_moderationoptions_custom_tool,showthread_moderationoptions_custom,showthread_inlinemoderation_custom_tool,showthread_inlinemoderation_custom,postbit_classic,showthread_classic_header";
| $templatelist .= ",postbit_inlinecheck,showthread_inlinemoderation,postbit_attachments_thumbnails_thumbnail,postbit_quickquote,postbit_qqmessage,postbit_seperator,postbit_groupimage,postbit_multiquote,showthread_search,postbit_warn,postbit_warninglevel,showthread_moderationoptions_custom_tool,showthread_moderationoptions_custom,showthread_inlinemoderation_custom_tool,showthread_inlinemoderation_custom,postbit_classic,showthread_classic_header,showthread_poll_resultbit,showthread_poll_results";
|
require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
| require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
|
Zeile 47 | Zeile 48 |
---|
}
// Get the thread details from the database.
|
}
// Get the thread details from the database.
|
$options = array( "limit" => 1 );
| |
$thread = get_thread($mybb->input['tid']);
|
$thread = get_thread($mybb->input['tid']);
|
|
|
if(substr($thread['closed'], 0, 6) == "moved|") { $thread['tid'] = 0; }
|
if(substr($thread['closed'], 0, 6) == "moved|") { $thread['tid'] = 0; }
|
|
|
$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;
| if(!$thread['username']) { $thread['username'] = $lang->guest;
|
Zeile 81 | Zeile 78 |
---|
if(!$thread['tid'] || ($thread['visible'] == 0 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true)) { error($lang->error_invalidthread);
|
if(!$thread['tid'] || ($thread['visible'] == 0 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true)) { error($lang->error_invalidthread);
|
}
$archive_url = build_archive_link("thread", $tid);
| }
$archive_url = build_archive_link("thread", $tid);
|
// Build the navigation. build_forum_breadcrumb($fid); add_breadcrumb($thread['subject'], get_thread_link($thread['tid']));
| // Build the navigation. build_forum_breadcrumb($fid); add_breadcrumb($thread['subject'], get_thread_link($thread['tid']));
|
Zeile 94 | Zeile 91 |
---|
if(!$forum || $forum['type'] != "f") { error($lang->error_invalidforum);
|
if(!$forum || $forum['type'] != "f") { error($lang->error_invalidforum);
|
}
| }
|
// Does the user have permission to view this thread? $forumpermissions = forum_permissions($forum['fid']);
| // Does the user have permission to view this thread? $forumpermissions = forum_permissions($forum['fid']);
|
Zeile 121 | Zeile 118 |
---|
$query = $db->simple_select("threadsread", "dateline", "uid='{$mybb->user['uid']}' AND tid='{$thread['tid']}'"); $thread_read = $db->fetch_field($query, "dateline");
|
$query = $db->simple_select("threadsread", "dateline", "uid='{$mybb->user['uid']}' AND tid='{$thread['tid']}'"); $thread_read = $db->fetch_field($query, "dateline");
|
// Get forum read date $forumread = my_get_array_cookie("forumread", $fid);
// If last visit is greater than forum read, change forum read date if($mybb->user['lastvisit'] > $forumread)
| if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])
|
{
|
{
|
$forumread = $mybb->user['lastvisit'];
| $query = $db->simple_select("forumsread", "dateline", "fid='{$fid}' AND uid='{$mybb->user['uid']}'"); $forum_read = $db->fetch_field($query, "dateline"); $read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24; if($forum_read == 0 || $forum_read < $read_cutoff) { $forum_read = $read_cutoff; } } else { $forum_read = my_get_array_cookie("forumread", $fid);
|
}
|
}
|
if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forumread)
| if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read)
|
{ $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)
|
Zeile 144 | Zeile 149 |
---|
} } }
|
} } }
|
|
|
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) {
| if($readcookie > $forum_read) {
|
$lastread = $readcookie;
|
$lastread = $readcookie;
|
}
| }
|
else {
|
else {
|
$lastread = $forumread;
| $lastread = $forum_read;
|
} }
|
} }
|
|
|
// 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 167 | Zeile 174 |
---|
$newpost = $db->fetch_array($query); if($newpost['pid']) {
|
$newpost = $db->fetch_array($query); if($newpost['pid']) {
|
header("Location:".htmlspecialchars_decode(get_post_link($newpost['pid'], $tid))."#pid{$newpost['pid']}");
| header("Location: ".htmlspecialchars_decode(get_post_link($newpost['pid'], $tid))."#pid{$newpost['pid']}");
|
} else {
| } else {
|
Zeile 202 | Zeile 209 |
---|
$query = $db->simple_select('posts', 'pid', "tid={$tid}", $options); $pid = $db->fetch_field($query, "pid"); }
|
$query = $db->simple_select('posts', 'pid', "tid={$tid}", $options); $pid = $db->fetch_field($query, "pid"); }
|
header("Location:".htmlspecialchars_decode(get_post_link($pid, $tid))."#pid{$pid}");
| header("Location: ".htmlspecialchars_decode(get_post_link($pid, $tid))."#pid{$pid}");
|
exit; }
| exit; }
|
Zeile 228 | Zeile 235 |
---|
"order_by" => "dateline", "order_dir" => "desc" );
|
"order_by" => "dateline", "order_dir" => "desc" );
|
$query = $db->simple_select('posts', 'pid', "tid={$nextthread['tid']}");
| $query = $db->simple_select('posts', 'pid', "tid='{$nextthread['tid']}'", $options);
|
// Redirect to the proper page. $pid = $db->fetch_field($query, "pid");
|
// Redirect to the proper page. $pid = $db->fetch_field($query, "pid");
|
header("Location:".htmlspecialchars_decode(get_post_link($pid, $nextthread['tid']))."#pid{$pid}");
| header("Location: ".htmlspecialchars_decode(get_post_link($pid, $nextthread['tid']))."#pid{$pid}");
|
}
// Jump to the next oldest posts.
| }
// Jump to the next oldest posts.
|
Zeile 258 | Zeile 265 |
---|
"order_by" => "dateline", "order_dir" => "desc" );
|
"order_by" => "dateline", "order_dir" => "desc" );
|
$query = $db->simple_select("posts", "pid", "tid=".$nextthread['tid']);
| $query = $db->simple_select("posts", "pid", "tid='".$nextthread['tid']."'", $options);
|
// Redirect to the proper page. $pid = $db->fetch_field($query, "pid");
|
// Redirect to the proper page. $pid = $db->fetch_field($query, "pid");
|
header("Location:".htmlspecialchars_decode(get_post_link($pid, $nextthread['tid']))."#pid{$pid}");
| header("Location: ".htmlspecialchars_decode(get_post_link($pid, $nextthread['tid']))."#pid{$pid}");
|
}
if($mybb->input['pid'])
| }
if($mybb->input['pid'])
|
Zeile 427 | Zeile 434 |
---|
} eval("\$pollbox = \"".$templates->get("showthread_poll")."\";"); $plugins->run_hooks("showthread_poll");
|
} eval("\$pollbox = \"".$templates->get("showthread_poll")."\";"); $plugins->run_hooks("showthread_poll");
|
}
} else {
| }
} else {
|
$pollbox = ""; }
| $pollbox = ""; }
|
Zeile 523 | Zeile 530 |
---|
} else {
|
} else {
|
$thread['averagerating'] = intval(round($thread['totalratings']/$thread['numratings'], 2)); $thread['width'] = $thread['averagerating']*20;
| $thread['averagerating'] = floatval(round($thread['totalratings']/$thread['numratings'], 2)); $thread['width'] = intval($thread['averagerating'])*20;
|
$thread['numratings'] = intval($thread['numratings']); }
| $thread['numratings'] = intval($thread['numratings']); }
|
Zeile 617 | Zeile 624 |
---|
// Is there actually a pid to display? if(!$showpost['pid'])
|
// Is there actually a pid to display? if(!$showpost['pid'])
|
{
| {
|
error($lang->error_invalidpost); }
| error($lang->error_invalidpost); }
|
Zeile 707 | Zeile 714 |
---|
if($page > $pages || $page <= 0) {
|
if($page > $pages || $page <= 0) {
|
$page = 1; }
if($page) {
| $page = 1; }
if($page) {
|
$start = ($page-1) * $perpage;
|
$start = ($page-1) * $perpage;
|
}
| }
|
else { $start = 0; $page = 1;
|
else { $start = 0; $page = 1;
|
}
| }
|
$upper = $start+$perpage;
|
$upper = $start+$perpage;
|
| // Work out if we have terms to highlight $highlight = ""; if($mybb->input['highlight']) { if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1)) { $highlight = "?highlight=".urlencode($mybb->input['highlight']); } else { $highlight = "&highlight=".urlencode($mybb->input['highlight']); } }
|
|
|
$multipage = multipage($postcount, $perpage, $page, str_replace("{tid}", $tid, THREAD_URL_PAGED));
| $multipage = multipage($postcount, $perpage, $page, str_replace("{tid}", $tid, THREAD_URL_PAGED.$highlight));
|
if($postcount > $perpage) { eval("\$threadpages = \"".$templates->get("showthread_multipage")."\";");
| if($postcount > $perpage) { eval("\$threadpages = \"".$templates->get("showthread_multipage")."\";");
|
Zeile 755 | Zeile 776 |
---|
{ // If there are no pid's the thread is probably awaiting approval. error($lang->error_invalidthread);
|
{ // If there are no pid's the thread is probably awaiting approval. error($lang->error_invalidthread);
|
}
| }
|
// Get the actual posts from the database here. $pfirst = true; $posts = '';
| // Get the actual posts from the database here. $pfirst = true; $posts = '';
|
Zeile 790 | Zeile 811 |
---|
case "sqlite3": case "sqlite2": case "pgsql":
|
case "sqlite3": case "sqlite2": case "pgsql":
|
$query = $db->query(" SELECT t.*, t.username AS threadusername, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."' WITH QUERY EXPANSION) 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']}'
| $query = $db->query(" 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']}'
|
ORDER BY t.lastpost DESC LIMIT 0, {$mybb->settings['similarlimit']} "); break; default: $query = $db->query("
|
ORDER BY t.lastpost DESC LIMIT 0, {$mybb->settings['similarlimit']} "); break; default: $query = $db->query("
|
SELECT t.*, t.username AS threadusername, u.username, MATCH (t.subject) AGAINST ('".$db->escape_string($thread['subject'])."' WITH QUERY EXPANSION) AS relevance
| 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)
|
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'])."' WITH QUERY EXPANSION) >= '{$mybb->settings['similarityrating']}'
| 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']} ");
| ORDER BY t.lastpost DESC LIMIT 0, {$mybb->settings['similarlimit']} ");
|