Vergleich forumdisplay.php - 1.6.5 - 1.6.7

  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 5627 2011-10-06 07:52:01Z Tomm $

 * $Id: forumdisplay.php 5765 2012-03-27 09:52:45Z Tomm $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 84Zeile 84
if($mybb->user['uid'] == 0)
{
// Cookie'd forum read time

if($mybb->user['uid'] == 0)
{
// Cookie'd forum read time

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

if(!is_array($forumsread))

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

if(is_array($forumsread) && empty($forumsread))

 	{
if($mybb->cookies['mybb']['readallforums'])
{

 	{
if($mybb->cookies['mybb']['readallforums'])
{

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

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

	}

	}


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


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

}


}


// Get the forum moderators if the setting is enabled.
if($mybb->settings['modlist'] != 0)
{

// Get the forum moderators if the setting is enabled.
if($mybb->settings['modlist'] != 0)
{

Zeile 132Zeile 132
if($mybb->settings['subforumsindex'] != 0)
{
$showdepth = 3;

if($mybb->settings['subforumsindex'] != 0)
{
$showdepth = 3;

}

}

else
{
$showdepth = 2;

else
{
$showdepth = 2;

Zeile 163Zeile 163
}

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")
{
eval("\$searchforum = \"".$templates->get("forumdisplay_searchforum")."\";");


if($fpermissions['cansearch'] != 0 && $foruminfo['type'] == "f")
{
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 191Zeile 212
				if($moderator['isgroup'])
{
if(in_array($moderator['id'], $done_moderators['groups']))

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

					{
continue;
}

					{
continue;
}

					$moderators .= $comma.htmlspecialchars_uni($moderator['title']);
$done_moderators['groups'][] = $moderator['id'];
}

					$moderators .= $comma.htmlspecialchars_uni($moderator['title']);
$done_moderators['groups'][] = $moderator['id'];
}

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

				$comma = $lang->comma;
}
}

 
	}

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

	}
}
$comma = '';

	}
}
$comma = '';

Zeile 313Zeile 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 352Zeile 378
else
{
$can_edit_titles = 0;

else
{
$can_edit_titles = 0;

}

unset($rating);

}

unset($rating);


// Pick out some sorting options.
// First, the date cut for the threads.


// Pick out some sorting options.
// First, the date cut for the threads.

Zeile 388Zeile 414
	$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')";

}

}

else
{
$datecutsql = '';

else
{
$datecutsql = '';

Zeile 421Zeile 447

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


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

{

{

	$mybb->input['sortby'] = $foruminfo['defaultsortby'];
}

	$mybb->input['sortby'] = $foruminfo['defaultsortby'];
}





$t = "t.";

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

$t = "t.";

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

Zeile 432Zeile 458
{
case "subject":
$sortfield = "subject";

{
case "subject":
$sortfield = "subject";

		break;

		break;

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

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

		break;

		break;

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

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

		break;

		break;

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

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

Zeile 449Zeile 475
		break;
case "started":
$sortfield = "dateline";

		break;
case "started":
$sortfield = "dateline";

		break;

		break;

	default:
$sortby = "lastpost";
$sortfield = "lastpost";
$mybb->input['sortby'] = "lastpost";
break;

	default:
$sortby = "lastpost";
$sortfield = "lastpost";
$mybb->input['sortby'] = "lastpost";
break;

}

}


$sortsel[$mybb->input['sortby']] = "selected=\"selected\"";



$sortsel[$mybb->input['sortby']] = "selected=\"selected\"";


Zeile 486Zeile 512
{
$useronly = "AND uid={$mybb->user['uid']}";
$tuseronly = "AND t.uid={$mybb->user['uid']}";

{
$useronly = "AND uid={$mybb->user['uid']}";
$tuseronly = "AND t.uid={$mybb->user['uid']}";

}

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

}

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

{

// How many posts are there?

{

// How many posts are there?

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


Zeile 628Zeile 654
}

// Get Announcements

}

// Get Announcements

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

if(!is_array($forum_stats))

if($has_announcements == true)



{

{

	$forum_stats = $cache->read("forumdisplay", true);

if(is_array($forum_stats) && ($forum_stats[-1]['announcements'] || $forum_stats[$fid]['announcements']))

	$limit = '';
$announcements = '';
if($mybb->settings['announcementlimit'])

	{

	{

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

		{

		{

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

			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();
}

		$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($announcements)












		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("\$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)));

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








		}

		}

		else if(!empty($cookie))

		else

		{

		{

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

			$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))
{
my_setcookie("mybb[announcements]", addslashes(serialize($cookie)), -1);

	}
}


	}
}


Zeile 775Zeile 794
		}
}


		}
}


	if($foruminfo['allowtratings'] != 0 && $mybb->user['uid'] && $tids && $ratings == true)

	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

	{
// 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

Zeile 943Zeile 962
		{
eval("\$threads .= \"".$templates->get("forumdisplay_threads_sep")."\";");
$shownormalsep = false;

		{
eval("\$threads .= \"".$templates->get("forumdisplay_threads_sep")."\";");
$shownormalsep = false;

		}

		}


$rating = '';


$rating = '';

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

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

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

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

Zeile 991Zeile 1010
			$thread['pages'] = ceil($thread['pages']);

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

			$thread['pages'] = ceil($thread['pages']);

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

			{

			{

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

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

			{

			{

				$pagesstop = $thread['pages'];

				$pagesstop = $thread['pages'];

			}

			}


for($i = 1; $i <= $pagesstop; ++$i)
{
$page_link = get_thread_link($thread['tid'], $i);
eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");


for($i = 1; $i <= $pagesstop; ++$i)
{
$page_link = get_thread_link($thread['tid'], $i);
eval("\$threadpages .= \"".$templates->get("forumdisplay_thread_multipage_page")."\";");

			}


			}


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

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

		}

		}

		else

		else

		{

		{

			$threadpages = '';
$morelink = '';
$thread['multipage'] = '';

			$threadpages = '';
$morelink = '';
$thread['multipage'] = '';

Zeile 1022Zeile 1041
			{
$inlinecheck = "checked=\"checked\"";
++$inlinecount;

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

			}

			}

			else
{
$inlinecheck = '';

			else
{
$inlinecheck = '';

Zeile 1070Zeile 1089
			else
{
$last_read = $read_cutoff;

			else
{
$last_read = $read_cutoff;

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

if($forum_read > $last_read)

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

if($forum_read > $last_read)

		{
$last_read = $forum_read;
}

		{
$last_read = $forum_read;
}

Zeile 1127Zeile 1146
		else
{
$inline_edit_class = "";

		else
{
$inline_edit_class = "";

		}

		}

		$load_inline_edit_js = 1;

$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
$lastposter = $thread['lastposter'];
$lastposteruid = $thread['lastposteruid'];

		$load_inline_edit_js = 1;

$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
$lastposter = $thread['lastposter'];
$lastposteruid = $thread['lastposteruid'];





		// Don't link to guest's profiles (they have no profile).
if($lastposteruid == 0)
{

		// Don't link to guest's profiles (they have no profile).
if($lastposteruid == 0)
{

Zeile 1143Zeile 1162
		else
{
$lastposterlink = build_profile_link($lastposter, $lastposteruid);

		else
{
$lastposterlink = build_profile_link($lastposter, $lastposteruid);

		}


		}


		$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);

		$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);





		// Threads and posts requiring moderation
if($thread['unapprovedposts'] > 0 && $ismod)
{

		// Threads and posts requiring moderation
if($thread['unapprovedposts'] > 0 && $ismod)
{

Zeile 1161Zeile 1180
			}

$unapproved_posts = " <span title=\"{$unapproved_posts_count}\">(".my_number_format($thread['unapprovedposts']).")</span>";

			}

$unapproved_posts = " <span title=\"{$unapproved_posts_count}\">(".my_number_format($thread['unapprovedposts']).")</span>";

		}

		}

		else

		else

		{

		{

			$unapproved_posts = '';
}


			$unapproved_posts = '';
}


Zeile 1171Zeile 1190
		if($thread['attachmentcount'] > 0)
{
if($thread['attachmentcount'] > 1)

		if($thread['attachmentcount'] > 0)
{
if($thread['attachmentcount'] > 1)

			{

			{

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

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

			}

			}


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


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

		}

		}

		else

		else

		{

		{

			$attachment_count = '';
}


			$attachment_count = '';
}


Zeile 1192Zeile 1211
	$customthreadtools = '';
if($ismod)
{

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

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

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

		{
switch($db->type)

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

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

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

			{

			{

				eval("\$customthreadtools .= \"".$templates->get("forumdisplay_inlinemoderation_custom_tool")."\";");

				eval("\$customthreadtools .= \"".$templates->get("forumdisplay_inlinemoderation_custom_tool")."\";");

 
			}

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

			}
}

			}
}

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






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

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