Vergleich showthread.php - 1.4.0 - 1.4.1

  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 4081 2008-08-08 01:47:02Z 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 73Zeile 70
	$ismod = true;
}
else

	$ismod = true;
}
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);


}

$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 94Zeile 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 141Zeile 138
			else
{
$lastread = 1;

			else
{
$lastread = 1;

			}
}
}

			}
}
}

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

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

		{

		{

			$lastread = $readcookie;
}
else
{
$lastread = $forumread;
}

			$lastread = $readcookie;
}
else
{
$lastread = $forumread;
}

	}

	}

	// 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 189Zeile 186
			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
{
$options = array(

	else
{
$options = array(

Zeile 228Zeile 225
		"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");

Zeile 237Zeile 234

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


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

{
$options = array(

{
$options = array(

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

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

Zeile 258Zeile 255
		"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");

Zeile 520Zeile 517
			$thread['width'] = 0;
$thread['averagerating'] = 0;
$thread['numratings'] = 0;

			$thread['width'] = 0;
$thread['averagerating'] = 0;
$thread['numratings'] = 0;

		}

		}

		else
{
$thread['averagerating'] = intval(round($thread['totalratings']/$thread['numratings'], 2));
$thread['width'] = $thread['averagerating']*20;
$thread['numratings'] = intval($thread['numratings']);
}

		else
{
$thread['averagerating'] = intval(round($thread['totalratings']/$thread['numratings'], 2));
$thread['width'] = $thread['averagerating']*20;
$thread['numratings'] = intval($thread['numratings']);
}





		// Check if we have already voted on this thread - it won't show hover effect then.
$query = $db->simple_select("threadratings", "uid", "tid='{$tid}' AND uid='{$mybb->user['uid']}'");
$rated = $db->fetch_field($query, 'uid');

		// Check if we have already voted on this thread - it won't show hover effect then.
$query = $db->simple_select("threadratings", "uid", "tid='{$tid}' AND uid='{$mybb->user['uid']}'");
$rated = $db->fetch_field($query, 'uid');





		$not_rated = '';
if(!$rated)
{

		$not_rated = '';
if(!$rated)
{

Zeile 543Zeile 540
	}
// 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')";
}
else

		$visible = "AND (p.visible='0' OR p.visible='1')";
}
else

Zeile 565Zeile 562
		foreach($ignore_list as $uid)
{
$ignored_users[$uid] = 1;

		foreach($ignore_list as $uid)
{
$ignored_users[$uid] = 1;

		}
}

		}
}

	
// Which thread mode is our user using?
if(!isset($mybb->input['mode']))
{
if(!empty($mybb->user['threadmode'])) // Take user's default preference first (if there is one) and run with it

	
// Which thread mode is our user using?
if(!isset($mybb->input['mode']))
{
if(!empty($mybb->user['threadmode'])) // Take user's default preference first (if there is one) and run with it

		{

		{

			$mybb->input['mode'] = $mybb->user['threadmode'];
}
else if($mybb->settings['threadusenetstyle'] == 1)
{
$mybb->input['mode'] = 'threaded';

			$mybb->input['mode'] = $mybb->user['threadmode'];
}
else if($mybb->settings['threadusenetstyle'] == 1)
{
$mybb->input['mode'] = 'threaded';

		}

		}

		else
{
$mybb->input['mode'] = 'linear';
}
}

		else
{
$mybb->input['mode'] = 'linear';
}
}





	// Threaded or linear display?
if($mybb->input['mode'] == 'threaded')
{
$isfirst = 1;

	// Threaded or linear display?
if($mybb->input['mode'] == 'threaded')
{
$isfirst = 1;





		// Are we linked to a specific pid?
if($mybb->input['pid'])
{

		// Are we linked to a specific pid?
if($mybb->input['pid'])
{

Zeile 613Zeile 610
		if(!$mybb->input['pid'])
{
$mybb->input['pid'] = $showpost['pid'];

		if(!$mybb->input['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'])
{

Zeile 671Zeile 668
		if($mybb->input['page'] != "last")
{
$page = intval($mybb->input['page']);

		if($mybb->input['page'] != "last")
{
$page = intval($mybb->input['page']);

		}

		}

		if($mybb->input['pid'])
{
$query = $db->query("

		if($mybb->input['pid'])
{
$query = $db->query("

Zeile 682Zeile 679
			");
$result = $db->fetch_field($query, "count");
if(($result % $perpage) == 0)

			");
$result = $db->fetch_field($query, "count");
if(($result % $perpage) == 0)

			{

			{

				$page = $result / $perpage;
}
else

				$page = $result / $perpage;
}
else

Zeile 706Zeile 703
		}

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));
if($postcount > $perpage)
{

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

Zeile 732Zeile 729
		$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 752
		{
// 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 787
			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']}
");