Vergleich showthread.php - 1.6.10 - 1.6.14

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 21Zeile 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 50Zeile 50

// 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 65Zeile 70
	}
}


	}
}


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 95Zeile 102
}

// 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);
}

Zeile 109Zeile 116
}

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

}

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

{

{

	error_no_permission();
}


	error_no_permission();
}


Zeile 152Zeile 159
	else
{
$forum_read = intval(my_get_array_cookie("forumread", $fid));

	else
{
$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 167Zeile 174
			{
// 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;

			}
}
}


			}
}
}


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

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

Zeile 214Zeile 221

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


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





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

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

	}

	}

	else
{
// show them to the last post

	else
{
// show them to the last post

Zeile 228Zeile 235
if($mybb->input['action'] == "lastpost")
{
if(my_strpos($thread['closed'], "moved|"))

if($mybb->input['action'] == "lastpost")
{
if(my_strpos($thread['closed'], "moved|"))

	{

	{

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

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

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

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

	$options = array(

	$options = array(

		"limit_start" => 0,
"limit" => 1,
"order_by" => "lastpost"

		"limit_start" => 0,
"limit" => 1,
"order_by" => "lastpost"

Zeile 286Zeile 293

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


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

{

{

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

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

Zeile 300Zeile 307
	if(!$nextthread['tid'])
{
error($lang->error_nonextoldest);

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

	}

	}

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

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

Zeile 308Zeile 315
		"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}");
exit;

	// Redirect to the proper page.
$pid = $db->fetch_field($query, "pid");
header("Location: ".htmlspecialchars_decode(get_post_link($pid, $nextthread['tid']))."#pid{$pid}");
exit;

}


}


if(!empty($mybb->input['pid']))
{
$pid = $mybb->input['pid'];

if(!empty($mybb->input['pid']))
{
$pid = $mybb->input['pid'];

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

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

	}


	}


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

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

Zeile 401Zeile 408
	if($thread['firstpost'] == 0)
{
update_first_post($tid);

	if($thread['firstpost'] == 0)
{
update_first_post($tid);

	}


	}


	// Does this thread have a poll?
if($thread['poll'])
{

	// Does this thread have a poll?
if($thread['poll'])
{

Zeile 761Zeile 768
		}

$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 817Zeile 824
		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 948Zeile 958
			$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 991Zeile 1001
	$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 998Zeile 1014
					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 1008Zeile 1024
					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']}
");