Vergleich forumdisplay.php - 1.6.3 - 1.6.6

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: forumdisplay.php 5440 2011-04-15 10:18:35Z Tomm $

 * $Id: forumdisplay.php 5655 2011-11-27 00:10:00Z Tomm $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 16Zeile 16
$templatelist .= ",forumbit_depth1_forum_lastpost,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage,forumdisplay_thread_multipage_more";
$templatelist .= ",multipage_prevpage,multipage_nextpage,multipage_page_current,multipage_page,multipage_start,multipage_end,multipage";
$templatelist .= ",forumjump_advanced,forumjump_special,forumjump_bit";

$templatelist .= ",forumbit_depth1_forum_lastpost,forumdisplay_thread_multipage_page,forumdisplay_thread_multipage,forumdisplay_thread_multipage_more";
$templatelist .= ",multipage_prevpage,multipage_nextpage,multipage_page_current,multipage_page,multipage_start,multipage_end,multipage";
$templatelist .= ",forumjump_advanced,forumjump_special,forumjump_bit";

$templatelist .= ",forumdisplay_usersbrowsing_guests,forumdisplay_usersbrowsing_user,forumdisplay_usersbrowsing,forumdisplay_inlinemoderation,forumdisplay_thread_modbit,forumdisplay_inlinemoderation_col";

$templatelist .= ",forumdisplay_usersbrowsing_guests,forumdisplay_usersbrowsing_user,forumdisplay_usersbrowsing,forumdisplay_inlinemoderation,forumdisplay_thread_modbit,forumdisplay_inlinemoderation_col,forumdisplay_inlinemoderation_selectall";

$templatelist .= ",forumdisplay_announcements_announcement,forumdisplay_announcements,forumdisplay_threads_sep,forumbit_depth3_statusicon,forumbit_depth3,forumdisplay_sticky_sep,forumdisplay_thread_attachment_count,forumdisplay_threadlist_inlineedit_js,forumdisplay_rssdiscovery,forumdisplay_announcement_rating,forumdisplay_announcements_announcement_modbit,forumdisplay_rules,forumdisplay_rules_link,forumdisplay_thread_gotounread,forumdisplay_nothreads,forumdisplay_inlinemoderation_custom_tool,forumdisplay_inlinemoderation_custom";
require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";

$templatelist .= ",forumdisplay_announcements_announcement,forumdisplay_announcements,forumdisplay_threads_sep,forumbit_depth3_statusicon,forumbit_depth3,forumdisplay_sticky_sep,forumdisplay_thread_attachment_count,forumdisplay_threadlist_inlineedit_js,forumdisplay_rssdiscovery,forumdisplay_announcement_rating,forumdisplay_announcements_announcement_modbit,forumdisplay_rules,forumdisplay_rules_link,forumdisplay_thread_gotounread,forumdisplay_nothreads,forumdisplay_inlinemoderation_custom_tool,forumdisplay_inlinemoderation_custom";
require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";

Zeile 83Zeile 83

if($mybb->user['uid'] == 0)
{


if($mybb->user['uid'] == 0)
{

	// Build a forum cache.
$query = $db->query("
SELECT *
FROM ".TABLE_PREFIX."forums
WHERE active != 0
ORDER BY pid, disporder
");


	// Cookie'd forum read time








	$forumsread = unserialize($mybb->cookies['mybb']['forumread']);

	$forumsread = unserialize($mybb->cookies['mybb']['forumread']);

 
 
if(!is_array($forumsread))
{
if($mybb->cookies['mybb']['readallforums'])
{
$forumsread[$fid] = $mybb->cookies['mybb']['lastvisit'];
}
else
{
$forumsread = array();
}
}





	if(!is_array($forumsread))
{
$forumsread = array();
}

	$query = $db->simple_select("forums", "*", "active != 0", array("order_by" => "pid, disporder"));




}
else
{

}
else
{

	// Build a forum cache.

	// Build a forum cache from the database

	$query = $db->query("
SELECT f.*, fr.dateline AS lastread
FROM ".TABLE_PREFIX."forums f

	$query = $db->query("
SELECT f.*, fr.dateline AS lastread
FROM ".TABLE_PREFIX."forums f

Zeile 109Zeile 111
		ORDER BY pid, disporder
");
}

		ORDER BY pid, disporder
");
}

 


while($forum = $db->fetch_array($query))

while($forum = $db->fetch_array($query))

{
if($mybb->user['uid'] == 0)

{
if($mybb->user['uid'] == 0 && $forumsread[$forum['fid']])

	{

	{

		if($forumsread[$forum['fid']])
{
$forum['lastread'] = $forumsread[$forum['fid']];
}

		$forum['lastread'] = $forumsread[$forum['fid']];




	}

	}

 


	$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
}


	$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
}


Zeile 125Zeile 126
if($mybb->settings['modlist'] != 0)
{
$moderatorcache = $cache->read("moderators");

if($mybb->settings['modlist'] != 0)
{
$moderatorcache = $cache->read("moderators");

}

}


$bgcolor = "trow1";
if($mybb->settings['subforumsindex'] != 0)


$bgcolor = "trow1";
if($mybb->settings['subforumsindex'] != 0)

Zeile 188Zeile 189
			foreach($modtype as $moderator)
{
if($moderator['isgroup'])

			foreach($modtype as $moderator)
{
if($moderator['isgroup'])

				{

				{

					if(in_array($moderator['id'], $done_moderators['groups']))
{
continue;

					if(in_array($moderator['id'], $done_moderators['groups']))
{
continue;

Zeile 220Zeile 221
else
{
$moderatedby = '';

else
{
$moderatedby = '';

}

}


// Get the users browsing this forum.
if($mybb->settings['browsingthisforum'] != 0)


// Get the users browsing this forum.
if($mybb->settings['browsingthisforum'] != 0)

Zeile 252Zeile 253
				$doneusers[$user['uid']] = $user['time'];
++$membercount;
if($user['invisible'] == 1)

				$doneusers[$user['uid']] = $user['time'];
++$membercount;
if($user['invisible'] == 1)

				{

				{

					$invisiblemark = "*";
++$inviscount;
}

					$invisiblemark = "*";
++$inviscount;
}

Zeile 284Zeile 285
	
$invisonline = '';
if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1))

	
$invisonline = '';
if($inviscount && $mybb->usergroup['canviewwolinvis'] != 1 && ($inviscount != 1 && $mybb->user['invisible'] != 1))

	{

	{

		$invisonline = $lang->sprintf($lang->users_browsing_forum_invis, $inviscount);

		$invisonline = $lang->sprintf($lang->users_browsing_forum_invis, $inviscount);

	}

	}

	
if($invisonline != '' && $guestcount)
{

	
if($invisonline != '' && $guestcount)
{

Zeile 300Zeile 301
if($foruminfo['rulestype'] != 0 && $foruminfo['rules'])
{
if(!$foruminfo['rulestitle'])

if($foruminfo['rulestype'] != 0 && $foruminfo['rules'])
{
if(!$foruminfo['rulestitle'])

	{

	{

		$foruminfo['rulestitle'] = $lang->sprintf($lang->forum_rules, $foruminfo['name']);
}


		$foruminfo['rulestitle'] = $lang->sprintf($lang->forum_rules, $foruminfo['name']);
}


Zeile 347Zeile 348
if(is_moderator($fid, "caneditposts") || $fpermissions['caneditposts'] == 1)
{
$can_edit_titles = 1;

if(is_moderator($fid, "caneditposts") || $fpermissions['caneditposts'] == 1)
{
$can_edit_titles = 1;

}

}

else

else

{

{

	$can_edit_titles = 0;
}


	$can_edit_titles = 0;
}


Zeile 362Zeile 363
{
// If the user manually set a date cut, use it.
if($mybb->user['daysprune'])

{
// If the user manually set a date cut, use it.
if($mybb->user['daysprune'])

	{

	{

		$datecut = $mybb->user['daysprune'];
}
else

		$datecut = $mybb->user['daysprune'];
}
else

Zeile 373Zeile 374
			$datecut = $foruminfo['defaultdatecut'];
}
}

			$datecut = $foruminfo['defaultdatecut'];
}
}

}

}

// If there was a manual date cut override, use it.
else
{
$datecut = intval($mybb->input['datecut']);

// If there was a manual date cut override, use it.
else
{
$datecut = intval($mybb->input['datecut']);

}


}


$datecut = intval($datecut);
$datecutsel[$datecut] = "selected=\"selected\"";
if($datecut > 0 && $datecut != 9999)

$datecut = intval($datecut);
$datecutsel[$datecut] = "selected=\"selected\"";
if($datecut > 0 && $datecut != 9999)

{

{

	$checkdate = TIME_NOW - ($datecut * 86400);
$datecutsql = "AND (lastpost >= '$checkdate' OR sticky = '1')";
$datecutsql2 = "AND (t.lastpost >= '$checkdate' OR t.sticky = '1')";

	$checkdate = TIME_NOW - ($datecut * 86400);
$datecutsql = "AND (lastpost >= '$checkdate' OR sticky = '1')";
$datecutsql2 = "AND (t.lastpost >= '$checkdate' OR t.sticky = '1')";

Zeile 392Zeile 393
{
$datecutsql = '';
$datecutsql2 = '';

{
$datecutsql = '';
$datecutsql2 = '';

}


}


// Pick the sort order.
if(!isset($mybb->input['order']) && !empty($foruminfo['defaultsortorder']))
{
$mybb->input['order'] = $foruminfo['defaultsortorder'];
}

// Pick the sort order.
if(!isset($mybb->input['order']) && !empty($foruminfo['defaultsortorder']))
{
$mybb->input['order'] = $foruminfo['defaultsortorder'];
}





$mybb->input['order'] = htmlspecialchars($mybb->input['order']);

switch(my_strtolower($mybb->input['order']))

$mybb->input['order'] = htmlspecialchars($mybb->input['order']);

switch(my_strtolower($mybb->input['order']))

Zeile 409Zeile 410
        $ordersel['asc'] = "selected=\"selected\"";
$oppsort = $lang->desc;
$oppsortnext = "desc";

        $ordersel['asc'] = "selected=\"selected\"";
$oppsort = $lang->desc;
$oppsortnext = "desc";

		break;

		break;

	default:
$sortordernow = "desc";
$ordersel['desc'] = "selected=\"selected\"";
$oppsort = $lang->asc;
$oppsortnext = "asc";
break;

	default:
$sortordernow = "desc";
$ordersel['desc'] = "selected=\"selected\"";
$oppsort = $lang->asc;
$oppsortnext = "asc";
break;

}

}


// Sort by which field?
if(!isset($mybb->input['sortby']) && !empty($foruminfo['defaultsortby']))


// Sort by which field?
if(!isset($mybb->input['sortby']) && !empty($foruminfo['defaultsortby']))

Zeile 425Zeile 426
}

$t = "t.";

}

$t = "t.";





$sortby = htmlspecialchars($mybb->input['sortby']);
switch($mybb->input['sortby'])
{

$sortby = htmlspecialchars($mybb->input['sortby']);
switch($mybb->input['sortby'])
{

Zeile 434Zeile 435
		break;
case "replies":
$sortfield = "replies";

		break;
case "replies":
$sortfield = "replies";

		break;

		break;

	case "views":
$sortfield = "views";
break;
case "starter":
$sortfield = "username";

	case "views":
$sortfield = "views";
break;
case "starter":
$sortfield = "username";

		break;

		break;

	case "rating":
$t = "";
$sortfield = "averagerating";

	case "rating":
$t = "";
$sortfield = "averagerating";

Zeile 472Zeile 473
if(isset($mybb->input['page']) && is_numeric($mybb->input['page']))
{
$sorturl = get_forum_link($fid, $mybb->input['page']).$string."datecut=$datecut";

if(isset($mybb->input['page']) && is_numeric($mybb->input['page']))
{
$sorturl = get_forum_link($fid, $mybb->input['page']).$string."datecut=$datecut";

}
else
{

}
else
{

	$sorturl = get_forum_link($fid).$string."datecut=$datecut";
}
eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_orderarrow")."\";");

	$sorturl = get_forum_link($fid).$string."datecut=$datecut";
}
eval("\$orderarrow['$sortby'] = \"".$templates->get("forumdisplay_orderarrow")."\";");

Zeile 519Zeile 520
if(!$mybb->settings['threadsperpage'])
{
$mybb->settings['threadsperpage'] = 20;

if(!$mybb->settings['threadsperpage'])
{
$mybb->settings['threadsperpage'] = 20;

}

$perpage = $mybb->settings['threadsperpage'];


}

$perpage = $mybb->settings['threadsperpage'];


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

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

Zeile 553Zeile 554
// Assemble page URL
if($mybb->input['sortby'] || $mybb->input['order'] || $mybb->input['datecut']) // Ugly URL
{

// Assemble page URL
if($mybb->input['sortby'] || $mybb->input['order'] || $mybb->input['datecut']) // Ugly URL
{

	$page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED);

	$page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED);

	
if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
{
$q = "?";
$and = '';

	
if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
{
$q = "?";
$and = '';

	}

	}

	else

	else

	{

	{

		$q = '';
$and = "&";
}

		$q = '';
$and = "&";
}

Zeile 569Zeile 570
	if($sortby != "lastpost")
{
$page_url .= "{$q}{$and}sortby={$sortby}";

	if($sortby != "lastpost")
{
$page_url .= "{$q}{$and}sortby={$sortby}";

		$q = '';
$and = "&";
}

		$q = '';
$and = "&";
}

	
if($sortordernow != "desc")
{

	
if($sortordernow != "desc")
{

Zeile 580Zeile 581
		$and = "&";
}


		$and = "&";
}


	if($datecut > 0 && $datecut != 9999)

	if($datecut > 0)

	{
$page_url .= "{$q}{$and}datecut={$datecut}";
}
}
else

	{
$page_url .= "{$q}{$and}datecut={$datecut}";
}
}
else

{

{

	$page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED);
}
$multipage = multipage($threadcount, $perpage, $page, $page_url);

	$page_url = str_replace("{fid}", $fid, FORUM_URL_PAGED);
}
$multipage = multipage($threadcount, $perpage, $page, $page_url);





if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
{
$lang->load("ratethread");

if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
{
$lang->load("ratethread");

 


	switch($db->type)
{
case "pgsql":

	switch($db->type)
{
case "pgsql":

Zeile 602Zeile 604
		default:
$ratingadd = "(t.totalratings/t.numratings) AS averagerating, ";
}

		default:
$ratingadd = "(t.totalratings/t.numratings) AS averagerating, ";
}

 


	$lpbackground = "trow2";
eval("\$ratingcol = \"".$templates->get("forumdisplay_threadlist_rating")."\";");
eval("\$ratingsort = \"".$templates->get("forumdisplay_threadlist_sortrating")."\";");
$colspan = "7";

	$lpbackground = "trow2";
eval("\$ratingcol = \"".$templates->get("forumdisplay_threadlist_rating")."\";");
eval("\$ratingsort = \"".$templates->get("forumdisplay_threadlist_sortrating")."\";");
$colspan = "7";

	$select_voting = "\nLEFT JOIN ".TABLE_PREFIX."threadratings r ON(r.tid=t.tid AND r.uid='{$mybb->user['uid']}')";
$select_rating_user = "r.uid AS rated, ";

 
}
else
{

}
else
{

Zeile 627Zeile 628
}

// Get Announcements

}

// Get Announcements

$limit = '';
$announcements = '';
if($mybb->settings['announcementlimit'])
{
$limit = "LIMIT 0, ".$mybb->settings['announcementlimit'];
}

$sql = build_parent_list($fid, "fid", "OR", $parentlist);
$time = TIME_NOW;
$query = $db->query("
SELECT a.*, u.username
FROM ".TABLE_PREFIX."announcements a
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
WHERE a.startdate<='$time' AND (a.enddate>='$time' OR a.enddate='0') AND ($sql OR fid='-1')
ORDER BY a.startdate DESC $limit
");
$bgcolor = alt_trow(true); // Reset the trow colors
while($announcement = $db->fetch_array($query))
{
if($announcement['startdate'] > $mybb->user['lastvisit'])
{
$new_class = ' class="subject_new"';
$folder = "newfolder";
}
else
{
$new_class = ' class="subject_old"';
$folder = "folder";
}

$announcement['announcementlink'] = get_announcement_link($announcement['aid']);
$announcement['subject'] = $parser->parse_badwords($announcement['subject']);
$announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
$postdate = my_date($mybb->settings['dateformat'], $announcement['startdate']);
$posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']);
$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);

if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
{
eval("\$rating = \"".$templates->get("forumdisplay_announcement_rating")."\";");
$lpbackground = "trow2";
}
else
{
$rating = '';
$lpbackground = "trow1";
}

if($ismod)













































$forum_stats = $cache->read("forumsdisplay");

if(!is_array($forum_stats))
{
$forum_stats = $cache->read("forumdisplay", true);
}

$parentlist_exp = explode(',', $parentlist);
if(is_array($forum_stats) && ($forum_stats[-1]['announcements'] || array_intersect_key(array_flip($parentlist_exp), $forum_stats)))
{
$limit = '';
$announcements = '';
if($mybb->settings['announcementlimit'])
{
$limit = "LIMIT 0, ".$mybb->settings['announcementlimit'];
}

$sql = build_parent_list($fid, "fid", "OR", $parentlist);
$time = TIME_NOW;
$query = $db->query("
SELECT a.*, u.username
FROM ".TABLE_PREFIX."announcements a
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=a.uid)
WHERE a.startdate<='$time' AND (a.enddate>='$time' OR a.enddate='0') AND ($sql OR fid='-1')
ORDER BY a.startdate DESC $limit
");

// See if this announcement has been read in our announcement array
$cookie = array();
if(isset($mybb->cookies['mybb']['announcements']))
{
$cookie = unserialize(stripslashes($mybb->cookies['mybb']['announcements']));
}

$bgcolor = alt_trow(true); // Reset the trow colors
while($announcement = $db->fetch_array($query))
{
if($announcement['startdate'] > $mybb->user['lastvisit'] && !$cookie[$announcement['aid']])
{
$new_class = ' class="subject_new"';
$folder = "newfolder";
}
else
{
$new_class = ' class="subject_old"';
$folder = "folder";
}

// Mmm, eat those announcement cookies if they're older than our last visit
if($cookie[$announcement['aid']] < $mybb->user['lastvisit'])
{
unset($cookie[$announcement['aid']]);
}

$announcement['announcementlink'] = get_announcement_link($announcement['aid']);
$announcement['subject'] = $parser->parse_badwords($announcement['subject']);
$announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
$postdate = my_date($mybb->settings['dateformat'], $announcement['startdate']);
$posttime = my_date($mybb->settings['timeformat'], $announcement['startdate']);
$announcement['profilelink'] = build_profile_link($announcement['username'], $announcement['uid']);

if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)
{
eval("\$rating = \"".$templates->get("forumdisplay_announcement_rating")."\";");
$lpbackground = "trow2";
}
else
{
$rating = '';
$lpbackground = "trow1";
}

if($ismod)
{
eval("\$modann = \"".$templates->get("forumdisplay_announcements_announcement_modbit")."\";");
}
else
{
$modann = '';
}

$plugins->run_hooks("forumdisplay_announcement");
eval("\$announcements .= \"".$templates->get("forumdisplay_announcements_announcement")."\";");
$bgcolor = alt_trow();
}

if($announcements)
{
eval("\$announcementlist = \"".$templates->get("forumdisplay_announcements")."\";");
$shownormalsep = true;
}

if(empty($cookie))

	{

	{

		eval("\$modann = \"".$templates->get("forumdisplay_announcements_announcement_modbit")."\";");


		// Clean up cookie crumbs
my_setcookie('mybb[announcements]', 0, (TIME_NOW - (60*60*24*365)));

	}

	}

	else

	else if(!empty($cookie))

	{

	{

		$modann = '';

		my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);

	}

	}

	
$plugins->run_hooks("forumdisplay_announcement");
eval("\$announcements .= \"".$templates->get("forumdisplay_announcements_announcement")."\";");
$bgcolor = alt_trow();
}

if($announcements)
{
eval("\$announcementlist = \"".$templates->get("forumdisplay_announcements")."\";");
$shownormalsep = true;

 
}

}


$icon_cache = $cache->read("posticons");



$icon_cache = $cache->read("posticons");


if($fpermissions['canviewthreads'] != 0)
{
// Start Getting Threads
$query = $db->query("

if($fpermissions['canviewthreads'] != 0)
{
// Start Getting Threads
$query = $db->query("

		SELECT t.*, p.displaystyle AS threadprefix, {$ratingadd}{$select_rating_user}t.username AS threadusername, u.username

		SELECT t.*, {$ratingadd}t.username AS threadusername, u.username

		FROM ".TABLE_PREFIX."threads t

		FROM ".TABLE_PREFIX."threads t

		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid){$select_voting}
LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid = t.prefix)

		LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)


		WHERE t.fid='$fid' $tuseronly $tvisibleonly $datecutsql2

		WHERE t.fid='$fid' $tuseronly $tvisibleonly $datecutsql2

		GROUP BY t.tid

 
		ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2
LIMIT $start, $perpage
");

		ORDER BY t.sticky DESC, {$t}{$sortfield} $sortordernow $sortfield2
LIMIT $start, $perpage
");

 

$ratings = false;

	while($thread = $db->fetch_array($query))
{
$threadcache[$thread['tid']] = $thread;

	while($thread = $db->fetch_array($query))
{
$threadcache[$thread['tid']] = $thread;

 

if($thread['numratings'] > 0 && $ratings == false)
{
$ratings = true; // Looks for ratings in the forum
}


// If this is a moved thread - set the tid for participation marking and thread read marking to that of the moved thread
if(substr($thread['closed'], 0, 5) == "moved")


// If this is a moved thread - set the tid for participation marking and thread read marking to that of the moved thread
if(substr($thread['closed'], 0, 5) == "moved")

		{

		{

			$tid = substr($thread['closed'], 6);
if(!$tids[$tid])
{

			$tid = substr($thread['closed'], 6);
if(!$tids[$tid])
{

Zeile 732Zeile 773
			{
unset($moved_threads[$tid]);
}

			{
unset($moved_threads[$tid]);
}

 
		}
}

if($foruminfo['allowtratings'] != 0 && $mybb->user['uid'] && $tids && $ratings == true)
{
// Check if we've rated threads on this page
// Guests get the pleasure of not being ID'd, but will be checked when they try and rate
$imp = implode(",", $tids);
$query = $db->simple_select("threadratings", "tid, uid", "tid IN ({$imp}) AND uid = '{$mybb->user['uid']}'");

while($rating = $db->fetch_array($query))
{
$threadcache[$rating['tid']]['rated'] = 1;

		}
}
}

		}
}
}

Zeile 758Zeile 812
// Check participation by the current user in any of these threads - for 'dot' folder icons
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $threadcache)
{

// Check participation by the current user in any of these threads - for 'dot' folder icons
if($mybb->settings['dotfolders'] != 0 && $mybb->user['uid'] && $threadcache)
{

	$query = $db->simple_select("posts", "tid,uid", "uid='{$mybb->user['uid']}' AND tid IN ({$tids})");

	$query = $db->simple_select("posts", "tid,uid", "uid='{$mybb->user['uid']}' AND tid IN ({$tids}) {$visibleonly}");

	while($post = $db->fetch_array($query))
{
if($moved_threads[$post['tid']])

	while($post = $db->fetch_array($query))
{
if($moved_threads[$post['tid']])

Zeile 803Zeile 857
else
{
$forum_read = my_get_array_cookie("forumread", $fid);

else
{
$forum_read = my_get_array_cookie("forumread", $fid);

}







if($mybb->cookies['mybb']['readallforums'] && !$forum_read)
{
$forum_read = $mybb->cookies['mybb']['lastvisit'];
}
}


$unreadpost = 0;
$threads = '';


$unreadpost = 0;
$threads = '';

Zeile 815Zeile 874
		$plugins->run_hooks("forumdisplay_thread");

$moved = explode("|", $thread['closed']);

		$plugins->run_hooks("forumdisplay_thread");

$moved = explode("|", $thread['closed']);





		if($thread['visible'] == 0)
{
$bgcolor = "trow_shaded";

		if($thread['visible'] == 0)
{
$bgcolor = "trow_shaded";

Zeile 849Zeile 908
		}

// If this thread has a prefix, insert a space between prefix and subject

		}

// If this thread has a prefix, insert a space between prefix and subject

 
		$threadprefix = '';

		if($thread['prefix'] != 0)

		if($thread['prefix'] != 0)

		{
$thread['threadprefix'] .= '&nbsp;';
}



		{
$threadprefix = build_prefixes($thread['prefix']);
$thread['threadprefix'] = $threadprefix['displaystyle'].'&nbsp;';
}


		$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);

if($thread['icon'] > 0 && $icon_cache[$thread['icon']])

		$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);

if($thread['icon'] > 0 && $icon_cache[$thread['icon']])

		{

		{

			$icon = $icon_cache[$thread['icon']];
$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else
{
$icon = "&nbsp;";

			$icon = $icon_cache[$thread['icon']];
$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else
{
$icon = "&nbsp;";

		}


		}


		$prefix = '';
if($thread['poll'])

		$prefix = '';
if($thread['poll'])

		{

		{

			$prefix = $lang->poll_prefix;
}


			$prefix = $lang->poll_prefix;
}


Zeile 878Zeile 939
			eval("\$threads .= \"".$templates->get("forumdisplay_sticky_sep")."\";");
$shownormalsep = true;
$donestickysep = true;

			eval("\$threads .= \"".$templates->get("forumdisplay_sticky_sep")."\";");
$shownormalsep = true;
$donestickysep = true;

		}

		}

		else if($thread['sticky'] == 0 && $shownormalsep)
{
eval("\$threads .= \"".$templates->get("forumdisplay_threads_sep")."\";");

		else if($thread['sticky'] == 0 && $shownormalsep)
{
eval("\$threads .= \"".$templates->get("forumdisplay_threads_sep")."\";");

Zeile 903Zeile 964
				{
$not_rated = ' star_rating_notrated';
}

				{
$not_rated = ' star_rating_notrated';
}





				$ratingvotesav = $lang->sprintf($lang->rating_votes_average, $thread['numratings'], $thread['averagerating']);
eval("\$rating = \"".$templates->get("forumdisplay_thread_rating")."\";");
}

				$ratingvotesav = $lang->sprintf($lang->rating_votes_average, $thread['numratings'], $thread['averagerating']);
eval("\$rating = \"".$templates->get("forumdisplay_thread_rating")."\";");
}

		}


		}


		$thread['pages'] = 0;
$thread['multipage'] = '';
$threadpages = '';
$morelink = '';
$thread['posts'] = $thread['replies'] + 1;

		$thread['pages'] = 0;
$thread['multipage'] = '';
$threadpages = '';
$morelink = '';
$thread['posts'] = $thread['replies'] + 1;





		if(!$mybb->settings['postsperpage'])
{
$mybb->settings['postperpage'] = 20;

		if(!$mybb->settings['postsperpage'])
{
$mybb->settings['postperpage'] = 20;

		}


		}


		if($thread['unapprovedposts'] > 0 && $ismod)

		if($thread['unapprovedposts'] > 0 && $ismod)

		{

		{

			$thread['posts'] += $thread['unapprovedposts'];
}


			$thread['posts'] += $thread['unapprovedposts'];
}


Zeile 935Zeile 996
				$pagesstop = 4;
$page_link = get_thread_link($thread['tid'], $thread['pages']);
eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");

				$pagesstop = 4;
$page_link = get_thread_link($thread['tid'], $thread['pages']);
eval("\$morelink = \"".$templates->get("forumdisplay_thread_multipage_more")."\";");

			}

			}

			else
{
$pagesstop = $thread['pages'];

			else
{
$pagesstop = $thread['pages'];

Zeile 966Zeile 1027
			else
{
$inlinecheck = '';

			else
{
$inlinecheck = '';

			}


			}


			$multitid = $thread['tid'];
eval("\$modbit = \"".$templates->get("forumdisplay_thread_modbit")."\";");
}

			$multitid = $thread['tid'];
eval("\$modbit = \"".$templates->get("forumdisplay_thread_modbit")."\";");
}

Zeile 982Zeile 1043
			$thread['tid'] = $moved[1];
$thread['replies'] = "-";
$thread['views'] = "-";

			$thread['tid'] = $moved[1];
$thread['replies'] = "-";
$thread['views'] = "-";

		}


		}


		$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");


		$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");


Zeile 1015Zeile 1076
		else
{
$last_read = my_get_array_cookie("threadread", $thread['tid']);

		else
{
$last_read = my_get_array_cookie("threadread", $thread['tid']);

		}

		}


if($forum_read > $last_read)
{


if($forum_read > $last_read)
{

Zeile 1030Zeile 1091
			$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
$unreadpost = 1;

			$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
$unreadpost = 1;

		}

		}

		else
{
$folder_label .= $lang->icon_no_new;

		else
{
$folder_label .= $lang->icon_no_new;

Zeile 1094Zeile 1155
			if($thread['unapprovedposts'] > 1)
{
$unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_posts_count, $thread['unapprovedposts']);

			if($thread['unapprovedposts'] > 1)
{
$unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_posts_count, $thread['unapprovedposts']);

			}

			}

			else
{
$unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_post_count, 1);

			else
{
$unapproved_posts_count = $lang->sprintf($lang->thread_unapproved_post_count, 1);

Zeile 1132Zeile 1193
	$customthreadtools = '';
if($ismod)
{

	$customthreadtools = '';
if($ismod)
{

		switch($db->type)

		if($forum_stats[-1]['modtools'] || $forum_stats[$fid]['modtools'])

		{

		{

			case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", 'tid, name', "(','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums='') AND type = 't'");
break;
default:
$query = $db->simple_select("modtools", 'tid, name', "(CONCAT(',',forums,',') LIKE '%,$fid,%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='') AND type = 't'");









			switch($db->type)
{
case "pgsql":
case "sqlite":
$query = $db->simple_select("modtools", 'tid, name', "(','||forums||',' LIKE '%,$fid,%' OR ','||forums||',' LIKE '%,-1,%' OR forums='') AND type = 't'");
break;
default:
$query = $db->simple_select("modtools", 'tid, name', "(CONCAT(',',forums,',') LIKE '%,$fid,%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='') AND type = 't'");
}

while($tool = $db->fetch_array($query))
{
eval("\$customthreadtools .= \"".$templates->get("forumdisplay_inlinemoderation_custom_tool")."\";");
}

		}

		}

		while($tool = $db->fetch_array($query))
{
eval("\$customthreadtools .= \"".$templates->get("forumdisplay_inlinemoderation_custom_tool")."\";");
}

if(!empty($customthreadtools))

		else






		{
eval("\$customthreadtools = \"".$templates->get("forumdisplay_inlinemoderation_custom")."\";");
}
eval("\$inlinemod = \"".$templates->get("forumdisplay_inlinemoderation")."\";");

		{
eval("\$customthreadtools = \"".$templates->get("forumdisplay_inlinemoderation_custom")."\";");
}
eval("\$inlinemod = \"".$templates->get("forumdisplay_inlinemoderation")."\";");

	}
}

	}
}


// If there are no unread threads in this forum and no unread child forums - mark it as read
require_once MYBB_ROOT."inc/functions_indicators.php";


// If there are no unread threads in this forum and no unread child forums - mark it as read
require_once MYBB_ROOT."inc/functions_indicators.php";

if(fetch_unread_count($fid) == 0 && $unread_forums == 0)
{




$unread_threads = fetch_unread_count($fid);
if($unread_threads !== false && $unread_threads == 0 && $unread_forums == 0)
{

	mark_forum_read($fid);

	mark_forum_read($fid);

}



}



// Subscription status

// Subscription status

$query = $db->simple_select("forumsubscriptions", "fid", "fid='".$fid."' AND uid='{$mybb->user['uid']}'", array('limit' => 1));
if($db->fetch_field($query, 'fid'))



$add_remove_subscription = 'add';
$add_remove_subscription_text = $lang->subscribe_forum;

if($mybb->user['uid'])

{

{

	$add_remove_subscription = 'remove';
$add_remove_subscription_text = $lang->unsubscribe_forum;
}
else
{
$add_remove_subscription = 'add';
$add_remove_subscription_text = $lang->subscribe_forum;
}

	$query = $db->simple_select("forumsubscriptions", "fid", "fid='".$fid."' AND uid='{$mybb->user['uid']}'", array('limit' => 1));












 
	if($db->fetch_field($query, 'fid'))
{
$add_remove_subscription = 'remove';
$add_remove_subscription_text = $lang->unsubscribe_forum;
}
}


// Is this a real forum with threads?
if($foruminfo['type'] != "c")


// Is this a real forum with threads?
if($foruminfo['type'] != "c")

Zeile 1197Zeile 1263
	$post_code_string = '';
if($mybb->user['uid'])
{

	$post_code_string = '';
if($mybb->user['uid'])
{

		$post_code_string = "&my_post_key=".$mybb->post_code;

		$post_code_string = "&amp;my_post_key=".$mybb->post_code;

	}

$lang->rss_discovery_forum = $lang->sprintf($lang->rss_discovery_forum, htmlspecialchars_uni(strip_tags($foruminfo['name'])));

	}

$lang->rss_discovery_forum = $lang->sprintf($lang->rss_discovery_forum, htmlspecialchars_uni(strip_tags($foruminfo['name'])));