Zeile 21 | Zeile 21 |
---|
require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
|
require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php";
|
require_once MYBB_ROOT."/inc/functions_indicators.php";
| require_once MYBB_ROOT."inc/functions_indicators.php";
|
require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
| require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
Zeile 44 | Zeile 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 65 | Zeile 77 |
---|
} }
|
} }
|
if(substr($thread['closed'], 0, 6) == "moved|")
| $reply_subject = $parser->parse_badwords($thread['subject']); $thread['subject'] = htmlspecialchars_uni($reply_subject); // Subject too long? Shorten it to avoid error message if(my_strlen($reply_subject) > 85)
|
{
|
{
|
$thread['tid'] = 0;
| $reply_subject = my_substr($reply_subject, 0, 82).'...';
|
}
|
}
|
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
| $reply_subject = htmlspecialchars_uni($reply_subject);
|
$tid = $thread['tid']; $fid = $thread['fid'];
| $tid = $thread['tid']; $fid = $thread['fid'];
|
Zeile 90 | Zeile 104 |
---|
$ismod = true; } else
|
$ismod = true; } else
|
{
| {
|
$ismod = false;
|
$ismod = false;
|
}
| }
|
// Make sure we are looking at a real thread here.
|
// Make sure we are looking at a real thread here.
|
if(!$thread['tid'] || ($thread['visible'] == 0 && $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']);
// Does the user have permission to view this thread? if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
|
$forumpermissions = forum_permissions($thread['fid']);
// Does the user have permission to view this thread? if($forumpermissions['canview'] != 1 || $forumpermissions['canviewthreads'] != 1)
|
{ error_no_permission(); }
| { error_no_permission(); }
|
if(isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid']) { 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);
// Does the thread belong to a valid forum?
| $archive_url = build_archive_link("thread", $tid);
// Does the thread belong to a valid forum?
|
Zeile 120 | Zeile 134 |
---|
if(!$forum || $forum['type'] != "f") { error($lang->error_invalidforum);
|
if(!$forum || $forum['type'] != "f") { error($lang->error_invalidforum);
|
}
| }
|
// 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']);
|
Zeile 150 | Zeile 164 |
---|
} } else
|
} } else
|
{
| {
|
$forum_read = intval(my_get_array_cookie("forumread", $fid)); }
| $forum_read = intval(my_get_array_cookie("forumread", $fid)); }
|
Zeile 160 | Zeile 174 |
---|
if($thread['lastpost'] > $cutoff) { if($thread_read)
|
if($thread['lastpost'] > $cutoff) { if($thread_read)
|
{
| {
|
$lastread = $thread_read;
|
$lastread = $thread_read;
|
} else {
| } else {
|
// Set $lastread to zero to make sure 'lastpost' is invoked in the last IF $lastread = 0; }
| // Set $lastread to zero to make sure 'lastpost' is invoked in the last IF $lastread = 0; }
|
Zeile 190 | Zeile 204 |
---|
} // Next, find the proper pid to link to.
|
} // Next, find the proper pid to link to.
|
$options = array(
| $options = array(
|
"limit_start" => 0, "limit" => 1, "order_by" => "dateline",
| "limit_start" => 0, "limit" => 1, "order_by" => "dateline",
|
Zeile 277 | Zeile 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}");
|
exit; }
| exit; }
|
Zeile 327 | Zeile 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 511 | Zeile 525 |
---|
if($poll['totvotes']) { $totpercent = "100%";
|
if($poll['totvotes']) { $totpercent = "100%";
|
} else {
| } else {
|
$totpercent = "0%"; }
| $totpercent = "0%"; }
|
Zeile 761 | Zeile 775 |
---|
} $attachcache = array();
|
} $attachcache = array();
|
if($thread['attachmentcount'] > 0)
| if($thread['attachmentcount'] > 0 || is_moderator($fid, 'caneditposts'))
|
{ // Get the attachments for this post. $query = $db->simple_select("attachments", "*", "pid=".$mybb->input['pid']);
| { // Get the attachments for this post. $query = $db->simple_select("attachments", "*", "pid=".$mybb->input['pid']);
|
Zeile 801 | Zeile 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 817 | Zeile 831 |
---|
if(!empty($mybb->input['pid'])) { $post = get_post($mybb->input['pid']);
|
if(!empty($mybb->input['pid'])) { $post = get_post($mybb->input['pid']);
|
$query = $db->query(" SELECT COUNT(p.dateline) AS count FROM ".TABLE_PREFIX."posts p WHERE p.tid = '{$tid}' AND p.dateline <= '{$post['dateline']}' {$visible} "); $result = $db->fetch_field($query, "count"); if(($result % $perpage) == 0)
| if($post)
|
{
|
{
|
$page = $result / $perpage; } else { $page = intval($result / $perpage) + 1;
| $query = $db->query(" SELECT COUNT(p.dateline) AS count FROM ".TABLE_PREFIX."posts p WHERE p.tid = '{$tid}' AND p.dateline <= '{$post['dateline']}' {$visible} "); $result = $db->fetch_field($query, "count"); if(($result % $perpage) == 0) { $page = $result / $perpage; } else { $page = intval($result / $perpage) + 1; }
|
} }
| } }
|
Zeile 948 | Zeile 965 |
---|
$pids = "pid IN($pids)"; $attachcache = array();
|
$pids = "pid IN($pids)"; $attachcache = array();
|
if($thread['attachmentcount'] > 0)
| if($thread['attachmentcount'] > 0 || is_moderator($fid, 'caneditposts'))
|
{ // Now lets fetch all of the attachments for these posts. $query = $db->simple_select("attachments", "*", $pids);
| { // Now lets fetch all of the attachments for these posts. $query = $db->simple_select("attachments", "*", $pids);
|
Zeile 991 | Zeile 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 998 | Zeile 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 1008 | Zeile 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']} ");
|