Vergleich showthread.php - 1.4.0 - 1.4.6

  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 4351 2009-04-17 02:37:21Z 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 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']);

$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 81Zeile 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 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 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;

			$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 167Zeile 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 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 228Zeile 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 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 337Zeile 344
				"allow_imgcode" => $forum['allowimgcode'],
"filter_badwords" => 1
);

				"allow_imgcode" => $forum['allowimgcode'],
"filter_badwords" => 1
);





			$option = $parser->parse_message($optionsarray[$i-1], $parser_options);
$votes = $votesarray[$i-1];
$totalvotes += $votes;

			$option = $parser->parse_message($optionsarray[$i-1], $parser_options);
$votes = $votesarray[$i-1];
$totalvotes += $votes;

Zeile 348Zeile 355
			{
$optionbg = "trow2";
$votestar = "*";

			{
$optionbg = "trow2";
$votestar = "*";

			}

			}

			else

			else

			{

			{

				$optionbg = "trow1";
$votestar = "";
}

				$optionbg = "trow1";
$votestar = "";
}

Zeile 359Zeile 366
			if($alreadyvoted || $showresults)
{
if(intval($votes) == "0")

			if($alreadyvoted || $showresults)
{
if(intval($votes) == "0")

				{

				{

					$percent = "0";

					$percent = "0";

				}

				}

				else
{
$percent = number_format($votes / $poll['totvotes'] * 100, 2);

				else
{
$percent = number_format($votes / $poll['totvotes'] * 100, 2);

Zeile 369Zeile 376
				$imagewidth = round(($percent/3) * 5);
$imagerowwidth = $imagewidth + 10;
eval("\$polloptions .= \"".$templates->get("showthread_poll_resultbit")."\";");

				$imagewidth = round(($percent/3) * 5);
$imagerowwidth = $imagewidth + 10;
eval("\$polloptions .= \"".$templates->get("showthread_poll_resultbit")."\";");

			}
else

			}
else

			{
if($poll['multiple'] == 1)

			{
if($poll['multiple'] == 1)

				{

				{

					eval("\$polloptions .= \"".$templates->get("showthread_poll_option_multiple")."\";");

					eval("\$polloptions .= \"".$templates->get("showthread_poll_option_multiple")."\";");

				}

				}

				else
{
eval("\$polloptions .= \"".$templates->get("showthread_poll_option")."\";");
}

				else
{
eval("\$polloptions .= \"".$templates->get("showthread_poll_option")."\";");
}

			}
}

			}
}


// If there are any votes at all, all votes together will be 100%; if there are no votes, all votes together will be 0%.
if($poll['totvotes'])


// If there are any votes at all, all votes together will be 100%; if there are no votes, all votes together will be 0%.
if($poll['totvotes'])

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
{

	}
else
{

Zeile 523Zeile 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(round($thread['averagerating']))*20;

			$thread['numratings'] = intval($thread['numratings']);
}


			$thread['numratings'] = intval($thread['numratings']);
}


Zeile 568Zeile 575
		}
}


		}
}


	// Which thread mode is our user using?















	// Which thread mode is our user using by default?
if(!empty($mybb->user['threadmode']))
{
$defaultmode = $mybb->user['threadmode'];
}
else if($mybb->settings['threadusenetstyle'] == 1)
{
$defaultmode = 'threaded';
}
else
{
$defaultmode = 'linear';
}

// If mode is unset, set the default mode

	if(!isset($mybb->input['mode']))
{

	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';
}
else
{
$mybb->input['mode'] = 'linear';
}

		$mybb->input['mode'] = $defaultmode;












	}

// Threaded or linear display?

	}

// Threaded or linear display?

Zeile 707Zeile 717

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;
}
$upper = $start+$perpage;

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

 
		
// Work out if we have terms to highlight
$highlight = "";
$threadmode = "";
if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
{
if($mybb->input['highlight'])
{
$highlight = "?highlight=".urlencode($mybb->input['highlight']);
}

if($defaultmode != "linear")
{
if($mybb->input['highlight'])
{
$threadmode = "&amp;mode=linear";
}
else
{
$threadmode = "?mode=linear";
}
}
}
else
{
if($mybb->input['highlight'])
{
$highlight = "&amp;highlight=".urlencode($mybb->input['highlight']);
}

if($defaultmode != "linear")
{
$threadmode = "&amp;mode=linear";
}
}





		$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.$threadmode)); 

		if($postcount > $perpage)
{
eval("\$threadpages = \"".$templates->get("showthread_multipage")."\";");

		if($postcount > $perpage)
{
eval("\$threadpages = \"".$templates->get("showthread_multipage")."\";");

Zeile 755Zeile 800
		{
// 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 790Zeile 835
			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']}
");