Vergleich showthread.php - 1.4.0 - 1.4.2

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 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 4178 2008-09-06 16:39:10Z 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 = "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";

Zeile 47Zeile 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']);

if(substr($thread['closed'], 0, 6) == "moved|")

$thread = get_thread($mybb->input['tid']);

if(substr($thread['closed'], 0, 6) == "moved|")

Zeile 71Zeile 68
if(is_moderator($fid))
{
$ismod = true;

if(is_moderator($fid))
{
$ismod = true;

}

}

else

else

{

{

	$ismod = false;

	$ismod = false;

}

}


// Make sure we are looking at a real thread here.
if(!$thread['tid'] || ($thread['visible'] == 0 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);


// Make sure we are looking at a real thread here.
if(!$thread['tid'] || ($thread['visible'] == 0 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

}


}


$archive_url = build_archive_link("thread", $tid);

// Build the navigation.

$archive_url = build_archive_link("thread", $tid);

// Build the navigation.

Zeile 121Zeile 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 144Zeile 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;
}
else
{

		{
$lastread = $readcookie;
}
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 166Zeile 173
	$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline > '{$lastread}'", $options);
$newpost = $db->fetch_array($query);
if($newpost['pid'])

	$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline > '{$lastread}'", $options);
$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 178Zeile 185

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


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

{

{

	if(my_strpos($thread['closed'], "moved|"))
{
$query = $db->query("

	if(my_strpos($thread['closed'], "moved|"))
{
$query = $db->query("

Zeile 189Zeile 196
			ORDER BY p.dateline DESC
LIMIT 1
");

			ORDER BY p.dateline DESC
LIMIT 1
");

		$pid = $db->fetch_field($query, "pid");

		$pid = $db->fetch_field($query, "pid");

	}
else
{

	}
else
{

Zeile 202Zeile 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 222Zeile 229
	{
error($lang->error_nonextnewest);
}

	{
error($lang->error_nonextnewest);
}

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

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

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

		"limit" => 1,
"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 246Zeile 253
	);
$query = $db->simple_select("threads", "*", "fid=".$thread['fid']." AND lastpost < ".$thread['lastpost']." AND visible=1 AND closed NOT LIKE 'moved|%'", $options);
$nextthread = $db->fetch_array($query);

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





	// Are there actually next oldest posts?
if(!$nextthread['tid'])
{

	// Are there actually next oldest posts?
if(!$nextthread['tid'])
{

Zeile 258Zeile 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 427Zeile 434
			}
eval("\$pollbox = \"".$templates->get("showthread_poll")."\";");
$plugins->run_hooks("showthread_poll");

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

		}

}
else
{
$pollbox = "";

		}

}
else
{
$pollbox = "";

	}

// Create the forum jump dropdown box.

	}

// Create the forum jump dropdown box.

Zeile 706Zeile 713
		}

if($page > $pages || $page <= 0)

		}

if($page > $pages || $page <= 0)

		{
$page = 1;
}

		{
$page = 1;
}


if($page)


if($page)

		{

		{

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

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

		}

		}

		else
{
$start = 0;
$page = 1;
}
$upper = $start+$perpage;

		else
{
$start = 0;
$page = 1;
}
$upper = $start+$perpage;


$multipage = multipage($postcount, $perpage, $page, str_replace("{tid}", $tid, THREAD_URL_PAGED));















		
// 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 = "&amp;highlight=".urlencode($mybb->input['highlight']);
}
}

$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 732Zeile 753
		$comma = '';
$query = $db->simple_select("posts p", "p.pid", "p.tid='$tid' $visible", array('order_by' => 'p.dateline', 'limit_start' => $start, 'limit' => $perpage));
while($getid = $db->fetch_array($query))

		$comma = '';
$query = $db->simple_select("posts p", "p.pid", "p.tid='$tid' $visible", array('order_by' => 'p.dateline', 'limit_start' => $start, 'limit' => $perpage));
while($getid = $db->fetch_array($query))

		{

		{

			$pids .= "$comma'{$getid['pid']}'";
$comma = ",";
}

			$pids .= "$comma'{$getid['pid']}'";
$comma = ",";
}

Zeile 755Zeile 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;


// Get the actual posts from the database here.
$pfirst = true;

Zeile 790Zeile 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']}
");