Vergleich forumdisplay.php - 1.6.3 - 1.6.9

  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$

 */

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
");

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

	// Cookie'd forum read time
$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);












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










 	if(is_array($forumsread) && empty($forumsread))
{
if($mybb->cookies['mybb']['readallforums'])
{
$forumsread[$fid] = $mybb->cookies['mybb']['lastvisit'];
}
else
{
$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 157Zeile 158

// Make forum jump...
if($mybb->settings['enableforumjump'] != 0)


// Make forum jump...
if($mybb->settings['enableforumjump'] != 0)

{

{

	$forumjump = build_forum_jump("", $fid, 1);

	$forumjump = build_forum_jump("", $fid, 1);

}


}


if($foruminfo['type'] == "f" && $foruminfo['open'] != 0)

if($foruminfo['type'] == "f" && $foruminfo['open'] != 0)

{

{

	eval("\$newthread = \"".$templates->get("forumdisplay_newthread")."\";");

	eval("\$newthread = \"".$templates->get("forumdisplay_newthread")."\";");

}

}


if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f")


if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f")

{

{

	eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";");

	eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";");

 
}

// Gather forum stats
$has_announcements = $has_modtools = false;
$forum_stats = $cache->read("forumsdisplay");

if(is_array($forum_stats))
{
if($forum_stats[-1]['modtools'] || $forum_stats[$fid]['modtools'])
{
// Mod tools are specific to forums, not parents
$has_modtools = true;
}

if($forum_stats[-1]['announcements'] || $forum_stats[$fid]['announcements'])
{
// Global or forum-specific announcements
$has_announcements = true;
}

}

$done_moderators = array(
"users" => array(),
"groups" => array()
);

}

$done_moderators = array(
"users" => array(),
"groups" => array()
);

 


$moderators = '';
$parentlistexploded = explode(",", $parentlist);

$moderators = '';
$parentlistexploded = explode(",", $parentlist);

 


foreach($parentlistexploded as $mfid)
{
// This forum has moderators

foreach($parentlistexploded as $mfid)
{
// This forum has moderators

Zeile 208Zeile 230
				$comma = $lang->comma;
}
}

				$comma = $lang->comma;
}
}

 
	}

if($forum_stats[$mfid]['announcements'])
{
$has_announcements = true;

	}
}
$comma = '';

// If we have a moderators list, load the template
if($moderators)

	}
}
$comma = '';

// If we have a moderators list, load the template
if($moderators)

{

{

	eval("\$moderatedby = \"".$templates->get("forumdisplay_moderatedby")."\";");
}
else
{
$moderatedby = '';

	eval("\$moderatedby = \"".$templates->get("forumdisplay_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 279
				$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 312Zeile 339
	);

$foruminfo['rules'] = $parser->parse_message($foruminfo['rules'], $rules_parser);

	);

$foruminfo['rules'] = $parser->parse_message($foruminfo['rules'], $rules_parser);

	if($foruminfo['rulestype'] == 1)

	if($foruminfo['rulestype'] == 1 || $foruminfo['rulestype'] == 3)

	{
eval("\$rules = \"".$templates->get("forumdisplay_rules")."\";");
}

	{
eval("\$rules = \"".$templates->get("forumdisplay_rules")."\";");
}

Zeile 347Zeile 374
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 389
{
// 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 400
			$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 419
{
$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 436
        $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 452
}

$t = "t.";

}

$t = "t.";





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

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

Zeile 434Zeile 461
		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 499
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";
}

{
$sorturl = get_forum_link($fid).$string."datecut=$datecut";
}

Zeile 488Zeile 515
}

if($fpermissions['canviewthreads'] != 0)

}

if($fpermissions['canviewthreads'] != 0)

{


{


	// How many posts are there?
if($datecut > 0 || $fpermissions['canonlyviewownthreads'] == 1)
{

	// How many posts are there?
if($datecut > 0 || $fpermissions['canonlyviewownthreads'] == 1)
{

Zeile 519Zeile 546
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)


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

{

{

	$page = intval($mybb->input['page']);
$start = ($page-1) * $perpage;
$pages = $threadcount / $perpage;

	$page = intval($mybb->input['page']);
$start = ($page-1) * $perpage;
$pages = $threadcount / $perpage;

Zeile 533Zeile 560
	{
$start = 0;
$page = 1;

	{
$start = 0;
$page = 1;

	}
}
else
{

	}
}
else
{

	$start = 0;
$page = 1;
}

	$start = 0;
$page = 1;
}

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


		$and = "&";
}


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

	if($datecut > 0)

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

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

Zeile 591Zeile 618
}
$multipage = multipage($threadcount, $perpage, $page, $page_url);


}
$multipage = multipage($threadcount, $perpage, $page, $page_url);


if($foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)

if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0 && $fpermissions['canviewthreads'] != 0)

{
$lang->load("ratethread");

{
$lang->load("ratethread");

 


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

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

Zeile 601Zeile 629
			break;
default:
$ratingadd = "(t.totalratings/t.numratings) AS averagerating, ";

			break;
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 626Zeile 653
	++$colspan;
}


	++$colspan;
}


// 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)
{
eval("\$modann = \"".$templates->get("forumdisplay_announcements_announcement_modbit")."\";");
}
else






































// Get Announcements
if($has_announcements == true)
{
$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 = my_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($mybb->settings['allowthreadratings'] != 0 && $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))
{
// Clean up cookie crumbs
my_setcookie('mybb[announcements]', 0, (TIME_NOW - (60*60*24*365)));
}
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")

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

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

 
		}
}

if($mybb->settings['allowthreadratings'] != 0 && $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 830
// 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 875
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 = '';
$load_inline_edit_js = 0;
if(is_array($threadcache))
{

$unreadpost = 0;
$threads = '';
$load_inline_edit_js = 0;
if(is_array($threadcache))
{

 
	if(!$mybb->settings['maxmultipagelinks'])
{
$mybb->settings['maxmultipagelinks'] = 5;
}

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


	foreach($threadcache as $thread)
{
$plugins->run_hooks("forumdisplay_thread");

	foreach($threadcache as $thread)
{
$plugins->run_hooks("forumdisplay_thread");

Zeile 849Zeile 936
		}

// 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'] = $parser->parse_badwords($thread['subject']);

Zeile 886Zeile 975
		}

$rating = '';

		}

$rating = '';

		if($foruminfo['allowtratings'] != 0)

		if($mybb->settings['allowthreadratings'] != 0 && $foruminfo['allowtratings'] != 0)

		{
if($moved[0] == "moved")
{

		{
if($moved[0] == "moved")
{

Zeile 915Zeile 1004
		$morelink = '';
$thread['posts'] = $thread['replies'] + 1;


		$morelink = '';
$thread['posts'] = $thread['replies'] + 1;


		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 930Zeile 1014
			$thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
$thread['pages'] = ceil($thread['pages']);


			$thread['pages'] = $thread['posts'] / $mybb->settings['postsperpage'];
$thread['pages'] = ceil($thread['pages']);


			if($thread['pages'] > 5)

			if($thread['pages'] > $mybb->settings['maxmultipagelinks'])

			{

			{

				$pagesstop = 4;

				$pagesstop = $mybb->settings['maxmultipagelinks'] - 1;

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

				$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'];

			}

			}


for($i = 1; $i <= $pagesstop; ++$i)
{


for($i = 1; $i <= $pagesstop; ++$i)
{

Zeile 948Zeile 1032
			}

eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");

			}

eval("\$thread['multipage'] = \"".$templates->get("forumdisplay_thread_multipage")."\";");

		}

		}

		else
{
$threadpages = '';

		else
{
$threadpages = '';

Zeile 962Zeile 1046
			{
$inlinecheck = "checked=\"checked\"";
++$inlinecount;

			{
$inlinecheck = "checked=\"checked\"";
++$inlinecount;

			}

			}

			else
{
$inlinecheck = '';
}

			else
{
$inlinecheck = '';
}





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

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

		}

		}

		else
{
$modbit = '';

		else
{
$modbit = '';

		}


		}


		if($moved[0] == "moved")
{
$prefix = $lang->moved_prefix;

		if($moved[0] == "moved")
{
$prefix = $lang->moved_prefix;

Zeile 1002Zeile 1086
		$donenew = 0;

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read)

		$donenew = 0;

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'] && $thread['lastpost'] > $forum_read)

		{

		{

			if($thread['lastread'])
{
$last_read = $thread['lastread'];

			if($thread['lastread'])
{
$last_read = $thread['lastread'];

			}

			}

			else
{
$last_read = $read_cutoff;
}

			else
{
$last_read = $read_cutoff;
}

		}

		}

		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)

		{

		{

			$last_read = $forum_read;

			$last_read = $forum_read;

		}

		}


if($thread['lastpost'] > $last_read && $moved[0] != "moved")
{


if($thread['lastpost'] > $last_read && $moved[0] != "moved")
{

Zeile 1030Zeile 1114
			$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 1109Zeile 1193

// If this thread has 1 or more attachments show the papperclip
if($thread['attachmentcount'] > 0)


// If this thread has 1 or more attachments show the papperclip
if($thread['attachmentcount'] > 0)

		{

		{

			if($thread['attachmentcount'] > 1)
{
$attachment_count = $lang->sprintf($lang->attachment_count_multiple, $thread['attachmentcount']);

			if($thread['attachmentcount'] > 1)
{
$attachment_count = $lang->sprintf($lang->attachment_count_multiple, $thread['attachmentcount']);

Zeile 1118Zeile 1202
			{
$attachment_count = $lang->attachment_count;
}

			{
$attachment_count = $lang->attachment_count;
}





			eval("\$attachment_count = \"".$templates->get("forumdisplay_thread_attachment_count")."\";");

			eval("\$attachment_count = \"".$templates->get("forumdisplay_thread_attachment_count")."\";");

		}

		}

		else
{
$attachment_count = '';

		else
{
$attachment_count = '';

		}


		}


		eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";");
}

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

		eval("\$threads .= \"".$templates->get("forumdisplay_thread")."\";");
}

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

		switch($db->type)

		if(is_moderator($fid, "canusecustomtools") && $has_modtools == true)

		{

		{

			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")."\";");
}

if(!empty($customthreadtools))
{
eval("\$customthreadtools = \"".$templates->get("forumdisplay_inlinemoderation_custom")."\";");





			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")."\";");
}

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

		}

		}

 


		eval("\$inlinemod = \"".$templates->get("forumdisplay_inlinemoderation")."\";");

		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 1288
	$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'])));