Vergleich portal.php - 1.6.9 - 1.6.18

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 32Zeile 32
	}
}


	}
}


$templatelist = "portal_welcome,portal_welcome_membertext,portal_stats,portal_search,portal_whosonline_memberbit,portal_whosonline,portal_latestthreads_thread_lastpost,portal_latestthreads_thread,portal_latestthreads,portal_announcement_numcomments_no,portal_announcement,portal_announcement_numcomments,portal_pms,portal";


$templatelist = "portal_welcome,portal_welcome_membertext,portal_stats,portal_search,portal_whosonline_memberbit,portal_whosonline,portal_latestthreads_thread,portal_latestthreads,portal_announcement_numcomments_no,portal_announcement,portal_announcement_numcomments,portal_pms,portal";
$templatelist .= ",portal_welcome_guesttext,postbit_attachments_thumbnails_thumbnail,postbit_attachments_images_image,postbit_attachments_attachment,postbit_attachments_thumbnails,postbit_attachments_images,postbit_attachments";


require_once $change_dir."/global.php";
require_once MYBB_ROOT."inc/functions_post.php";


require_once $change_dir."/global.php";
require_once MYBB_ROOT."inc/functions_post.php";

Zeile 56Zeile 57
if($unviewable)
{
$unviewwhere = " AND fid NOT IN ($unviewable)";

if($unviewable)
{
$unviewwhere = " AND fid NOT IN ($unviewable)";

 
	$tunviewwhere = " AND t.fid NOT IN ($unviewable)";

}

}

 

// get inactive forums
$inactive = get_inactive_forums(true);
if($inactive)
{
$inactivewhere = " AND fid NOT IN ($inactive)";
$tinactivewhere = " AND t.fid NOT IN ($inactive)";
}


// If user is known, welcome them
if($mybb->settings['portal_showwelcome'] != 0)
{
if($mybb->user['uid'] != 0)
{
// Get number of new posts, threads, announcements

// If user is known, welcome them
if($mybb->settings['portal_showwelcome'] != 0)
{
if($mybb->user['uid'] != 0)
{
// Get number of new posts, threads, announcements

		$query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");

		$query = $db->simple_select("posts", "COUNT(pid) AS newposts", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' {$unviewwhere}{$inactivewhere}");

		$newposts = $db->fetch_field($query, "newposts");
if($newposts)

		$newposts = $db->fetch_field($query, "newposts");
if($newposts)

		{ 

		{

			// If there aren't any new posts, there is no point in wasting two more queries

			// If there aren't any new posts, there is no point in wasting two more queries

			$query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' $unviewwhere");

			$query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' {$unviewwhere}{$inactivewhere}");

			$newthreads = $db->fetch_field($query, "newthreads");

			$newthreads = $db->fetch_field($query, "newthreads");


$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
if(is_array($announcementsfids))
{
foreach($announcementsfids as $fid)


if(!empty($mybb->settings['portal_announcementsfid']))
{
$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
if(is_array($announcementsfids))

				{

				{

					$fid_array[] = intval($fid);	








					foreach($announcementsfids as $fid)
{
$fid_array[] = intval($fid);
}

$announcementsfids = implode(',', $fid_array);
$query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$announcementsfids.") {$unviewwhere}{$inactivewhere}");
$newann = $db->fetch_field($query, "newann");

				}

				}

				
$announcementsfids = implode(',', $fid_array);
$query = $db->simple_select("threads", "COUNT(tid) AS newann", "visible=1 AND dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$announcementsfids.") $unviewwhere");
$newann = $db->fetch_field($query, "newann");

 
			}

if(!$newthreads)

			}

if(!$newthreads)

			{

			{

				$newthreads = 0;
}


				$newthreads = 0;
}


Zeile 103Zeile 117

// Make the text
if($newann == 1)


// Make the text
if($newann == 1)

		{

		{

			$lang->new_announcements = $lang->new_announcement;
}
else

			$lang->new_announcements = $lang->new_announcement;
}
else

Zeile 113Zeile 127
		if($newthreads == 1)
{
$lang->new_threads = $lang->new_thread;

		if($newthreads == 1)
{
$lang->new_threads = $lang->new_thread;

		}
else
{

		}
else
{

			$lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
}
if($newposts == 1)
{
$lang->new_posts = $lang->new_post;

			$lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
}
if($newposts == 1)
{
$lang->new_posts = $lang->new_post;

		}

		}

		else
{
$lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);

		else
{
$lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);

Zeile 163Zeile 177
	if($mybb->user['uid'] != 0 && $mybb->user['receivepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->settings['enablepms'] != 0)
{
switch($db->type)

	if($mybb->user['uid'] != 0 && $mybb->user['receivepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->settings['enablepms'] != 0)
{
switch($db->type)

		{

		{

			case "sqlite":
case "pgsql":
$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total", "uid='".$mybb->user['uid']."'");
$messages['pms_total'] = $db->fetch_field($query, "pms_total");

			case "sqlite":
case "pgsql":
$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total", "uid='".$mybb->user['uid']."'");
$messages['pms_total'] = $db->fetch_field($query, "pms_total");

				



				$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='".$mybb->user['uid']."' AND CASE WHEN status = '0' AND folder = '0' THEN TRUE ELSE FALSE END");
$messages['pms_unread'] = $db->fetch_field($query, "pms_unread");
break;

				$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_unread", "uid='".$mybb->user['uid']."' AND CASE WHEN status = '0' AND folder = '0' THEN TRUE ELSE FALSE END");
$messages['pms_unread'] = $db->fetch_field($query, "pms_unread");
break;

Zeile 176Zeile 190
				$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='".$mybb->user['uid']."'");
$messages = $db->fetch_array($query);
}

				$query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='".$mybb->user['uid']."'");
$messages = $db->fetch_array($query);
}

		



		// the SUM() thing returns "" instead of 0
if($messages['pms_unread'] == "")
{

		// the SUM() thing returns "" instead of 0
if($messages['pms_unread'] == "")
{

Zeile 212Zeile 226

// Get the online users
if($mybb->settings['portal_showwol'] != 0 && $mybb->usergroup['canviewonline'] != 0)


// Get the online users
if($mybb->settings['portal_showwol'] != 0 && $mybb->usergroup['canviewonline'] != 0)

{

{

	$timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
$comma = '';
$guestcount = 0;

	$timesearch = TIME_NOW - $mybb->settings['wolcutoff'];
$comma = '';
$guestcount = 0;

Zeile 227Zeile 241
	");
while($user = $db->fetch_array($query))
{

	");
while($user = $db->fetch_array($query))
{

	



		// Create a key to test if this user is a search bot.
$botkey = my_strtolower(str_replace("bot=", '', $user['sid']));

		// Create a key to test if this user is a search bot.
$botkey = my_strtolower(str_replace("bot=", '', $user['sid']));

		



		if($user['uid'] == "0")

		if($user['uid'] == "0")

		{

		{

			++$guestcount;
}
elseif(my_strpos($user['sid'], "bot=") !== false && $session->bots[$botkey])

			++$guestcount;
}
elseif(my_strpos($user['sid'], "bot=") !== false && $session->bots[$botkey])

Zeile 247Zeile 261
			if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
{
++$membercount;

			if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
{
++$membercount;

				



				$doneusers[$user['uid']] = $user['time'];

				$doneusers[$user['uid']] = $user['time'];

				



				// If the user is logged in anonymously, update the count for that.

				// If the user is logged in anonymously, update the count for that.

				if($user['invisible'] == 1)
{

				if($user['invisible'] == 1)
{

					++$anoncount;
}

					++$anoncount;
}

				



				if($user['invisible'] == 1)
{
$invisiblemark = "*";

				if($user['invisible'] == 1)
{
$invisiblemark = "*";

				}

				}

				else
{
$invisiblemark = '';
}

				else
{
$invisiblemark = '';
}

				



				if(($user['invisible'] == 1 && ($mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])) || $user['invisible'] != 1)

				if(($user['invisible'] == 1 && ($mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])) || $user['invisible'] != 1)

				{

				{

					$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
$user['profilelink'] = get_profile_link($user['uid']);
eval("\$onlinemembers .= \"".$templates->get("portal_whosonline_memberbit", 1, 0)."\";");

					$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
$user['profilelink'] = get_profile_link($user['uid']);
eval("\$onlinemembers .= \"".$templates->get("portal_whosonline_memberbit", 1, 0)."\";");

Zeile 275Zeile 289
			}
}
}

			}
}
}

	



	$onlinecount = $membercount + $guestcount + $botcount;

	$onlinecount = $membercount + $guestcount + $botcount;

	



	// If we can see invisible users add them to the count
if($mybb->usergroup['canviewwolinvis'] == 1)

	// If we can see invisible users add them to the count
if($mybb->usergroup['canviewwolinvis'] == 1)

	{

	{

		$onlinecount += $anoncount;
}

		$onlinecount += $anoncount;
}

	



	// If we can't see invisible users but the user is an invisible user incriment the count by one
if($mybb->usergroup['canviewwolinvis'] != 1 && $mybb->user['invisible'] == 1)
{

	// If we can't see invisible users but the user is an invisible user incriment the count by one
if($mybb->usergroup['canviewwolinvis'] != 1 && $mybb->user['invisible'] == 1)
{

Zeile 293Zeile 307
	// Most users online
$mostonline = $cache->read("mostonline");
if($onlinecount > $mostonline['numusers'])

	// Most users online
$mostonline = $cache->read("mostonline");
if($onlinecount > $mostonline['numusers'])

	{

	{

		$time = TIME_NOW;
$mostonline['numusers'] = $onlinecount;
$mostonline['time'] = $time;

		$time = TIME_NOW;
$mostonline['numusers'] = $onlinecount;
$mostonline['time'] = $time;

Zeile 317Zeile 331

// Latest forum discussions
if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'])


// Latest forum discussions
if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'])

{

{

	$altbg = alt_trow();
$threadlist = '';
$query = $db->query("
SELECT t.*, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)

	$altbg = alt_trow();
$threadlist = '';
$query = $db->query("
SELECT t.*, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)

		WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC

		WHERE 1=1 {$tunviewwhere}{$tinactivewhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC

		LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
);
while($thread = $db->fetch_array($query))

		LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
);
while($thread = $db->fetch_array($query))

	{

	{

		$forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);

// Make sure we can view this thread

		$forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);

// Make sure we can view this thread

Zeile 346Zeile 360
			$lastposterlink = $thread['lastposter'];
}
else

			$lastposterlink = $thread['lastposter'];
}
else

		{

		{

			$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
}
if(my_strlen($thread['subject']) > 25)

			$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
}
if(my_strlen($thread['subject']) > 25)

Zeile 360Zeile 374
		$altbg = alt_trow();
}
if($threadlist)

		$altbg = alt_trow();
}
if($threadlist)

	{ 

	{

		// Show the table only if there are threads
eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
}
}

		// Show the table only if there are threads
eval("\$latestthreads = \"".$templates->get("portal_latestthreads")."\";");
}
}


// Get latest news announcements
// First validate announcement fids:
$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
if(is_array($announcementsfids))
{
foreach($announcementsfids as $fid)
{
$fid_array[] = intval($fid);
}
$announcementsfids = implode(',', $fid_array);
}
// And get them!
foreach($forum_cache as $fid => $f)
{
if(is_array($fid_array) && in_array($fid, $fid_array))
{
$forum[$fid] = $f;
}
}

$numannouncements = intval($mybb->settings['portal_numannouncements']);
if(!$numannouncements)
{
$numannouncements = 10; // Default back to 10
}

$pids = '';
$tids = '';
$comma = '';
$query = $db->query("
SELECT p.pid, p.message, p.tid, p.smilieoff
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE t.fid IN (".$announcementsfids.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
ORDER BY t.dateline DESC
LIMIT 0, {$numannouncements}"
);
while($getid = $db->fetch_array($query))
{
$pids .= ",'{$getid['pid']}'";
$tids .= ",'{$getid['tid']}'";
$posts[$getid['tid']] = $getid;
}
$pids = "pid IN(0{$pids})";
// Now lets fetch all of the attachments for these posts
$query = $db->simple_select("attachments", "*", $pids);
while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}

if(is_array($forum))
{
foreach($forum as $fid => $forumrow)
{
$forumpermissions[$fid] = forum_permissions($fid);
}
}

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

 

$announcements = '';


$announcements = '';

$query = $db->query("
SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
WHERE t.fid IN (".$announcementsfids.") AND t.tid IN (0{$tids}) AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.dateline DESC
LIMIT 0, {$numannouncements}"
);
while($announcement = $db->fetch_array($query))

if(!empty($mybb->settings['portal_announcementsfid']))









{

{

	// Make sure we can view this announcement
if($forumpermissions[$announcement['fid']]['canview'] == 0 || $forumpermissions[$announcement['fid']]['canviewthreads'] == 0 || $forumpermissions[$announcement['fid']]['canonlyviewownthreads'] == 1 && $announcement['uid'] != $mybb->user['uid'])
{
continue;
}

$announcement['message'] = $posts[$announcement['tid']]['message'];
$announcement['pid'] = $posts[$announcement['tid']]['pid'];
$announcement['smilieoff'] = $posts[$announcement['tid']]['smilieoff'];
$announcement['threadlink'] = get_thread_link($announcement['tid']);

if($announcement['uid'] == 0)
{
$profilelink = htmlspecialchars_uni($announcement['threadusername']);
}
else
{
$profilelink = build_profile_link($announcement['username'], $announcement['uid']);
}

if(!$announcement['username'])
{
$announcement['username'] = $announcement['threadusername'];
}
$announcement['subject'] = htmlspecialchars_uni($parser->parse_badwords($announcement['subject']));
if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']])
{
$icon = $icon_cache[$announcement['icon']];
$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else
{
$icon = "&nbsp;";
}
if($announcement['avatar'] != '')
{
$avatar_dimensions = explode("|", $announcement['avatardimensions']);
if($avatar_dimensions[0] && $avatar_dimensions[1])

	// Get latest news announcements
// First validate announcement fids:
$announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
if(is_array($announcementsfids))
{
foreach($announcementsfids as $fid)

































		{

		{

			$avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";

			$fid_array[] = intval($fid);

		}

		}

		if (!stristr($announcement['avatar'], 'http://'))






		$announcementsfids = implode(',', $fid_array);
}
// And get them!
foreach($forum_cache as $fid => $f)
{
if(is_array($fid_array) && in_array($fid, $fid_array))

		{

		{

			$announcement['avatar'] = $mybb->settings['bburl'] . '/' . $announcement['avatar'];
}
$avatar = "<td class=\"trow1\" width=\"1\" align=\"center\" valign=\"top\"><img src=\"{$announcement['avatar']}\" alt=\"\" {$avatar_width_height} /></td>";

			$forum[$fid] = $f;
}


	}

	}

	else
{
$avatar = '';
}
$anndate = my_date($mybb->settings['dateformat'], $announcement['dateline']);
$anntime = my_date($mybb->settings['timeformat'], $announcement['dateline']);

 




	if($announcement['replies'])


	$numannouncements = intval($mybb->settings['portal_numannouncements']);
if(!$numannouncements)

	{

	{

		eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments")."\";");
}
else
{
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments_no")."\";");
$lastcomment = '';
}

$plugins->run_hooks("portal_announcement");

$parser_options = array(
"allow_html" => $forum[$announcement['fid']]['allowhtml'],
"allow_mycode" => $forum[$announcement['fid']]['allowmycode'],
"allow_smilies" => $forum[$announcement['fid']]['allowsmilies'],
"allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'],
"allow_videocode" => $forum[$announcement['fid']]['allowvideocode'],
"filter_badwords" => 1
);
if($announcement['smilieoff'] == 1)
{
$parser_options['allow_smilies'] = 0;
}



















		$numannouncements = 10; // Default back to 10
}

$pids = '';
$tids = '';
$comma = '';
$posts = array();
$query = $db->query("
SELECT p.pid, p.message, p.tid, p.smilieoff
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE t.fid IN (".$announcementsfids."){$tunviewwhere} AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
ORDER BY t.dateline DESC
LIMIT 0, {$numannouncements}"
);
while($getid = $db->fetch_array($query))
{
$pids .= ",'{$getid['pid']}'";
$tids .= ",'{$getid['tid']}'";
$posts[$getid['tid']] = $getid;
}
if(!empty($posts))
{
$pids = "pid IN(0{$pids})";
// Now lets fetch all of the attachments for these posts
$query = $db->simple_select("attachments", "*", $pids);
while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}

if(is_array($forum))
{
foreach($forum as $fid => $forumrow)
{
$forumpermissions[$fid] = forum_permissions($fid);
}
}

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





	$message = $parser->parse_message($announcement['message'], $parser_options);

if(is_array($attachcache[$announcement['pid']]))
{ // This post has 1 or more attachments
$validationcount = 0;
$id = $announcement['pid'];
foreach($attachcache[$id] as $aid => $attachment)



		$query = $db->query("
SELECT t.*, t.username AS threadusername, u.username, u.avatar, u.avatardimensions
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
WHERE t.fid IN (".$announcementsfids.") AND t.tid IN (0{$tids}) AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.dateline DESC
LIMIT 0, {$numannouncements}"
);
while($announcement = $db->fetch_array($query))

		{

		{

			if($attachment['visible'])
{ // There is an attachment thats visible!
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
$attachment['filesize'] = get_friendly_size($attachment['filesize']);
$ext = get_extension($attachment['filename']);
if($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg")
{
$isimage = true;
}
else
{
$isimage = false;
}
$attachment['icon'] = get_attachment_icon($ext);
// Support for [attachment=id] code
if(stripos($message, "[attachment=".$attachment['aid']."]") !== false)
{
if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
{ // We have a thumbnail to show (and its not the "SMALL" enough image
eval("\$attbit = \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
}
elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
{
// Image is small enough to show - no thumbnail
eval("\$attbit = \"".$templates->get("postbit_attachments_images_image")."\";");
}
else
{
// Show standard link to attachment
eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";");
}
$message = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $message);
}
else
























































			// Make sure we can view this announcement
if($forumpermissions[$announcement['fid']]['canview'] == 0 || $forumpermissions[$announcement['fid']]['canviewthreads'] == 0 || $forumpermissions[$announcement['fid']]['canonlyviewownthreads'] == 1 && $announcement['uid'] != $mybb->user['uid'])
{
continue;
}

$announcement['message'] = $posts[$announcement['tid']]['message'];
$announcement['pid'] = $posts[$announcement['tid']]['pid'];
$announcement['smilieoff'] = $posts[$announcement['tid']]['smilieoff'];
$announcement['threadlink'] = get_thread_link($announcement['tid']);

if($announcement['uid'] == 0)
{
$profilelink = htmlspecialchars_uni($announcement['threadusername']);
}
else
{
$profilelink = build_profile_link($announcement['username'], $announcement['uid']);
}

if(!$announcement['username'])
{
$announcement['username'] = $announcement['threadusername'];
}
$announcement['subject'] = htmlspecialchars_uni($parser->parse_badwords($announcement['subject']));
if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']])
{
$icon = $icon_cache[$announcement['icon']];
$icon['path'] = htmlspecialchars_uni($icon['path']);
$icon['name'] = htmlspecialchars_uni($icon['name']);
$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else
{
$icon = "&nbsp;";
}
if($announcement['avatar'] != '')
{
$avatar_dimensions = explode("|", $announcement['avatardimensions']);
if($avatar_dimensions[0] && $avatar_dimensions[1])
{
$avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
}
if (!stristr($announcement['avatar'], 'http://'))
{
$announcement['avatar'] = $mybb->settings['bburl'] . '/' . $announcement['avatar'];
}
$announcement['avatar'] = htmlspecialchars_uni($announcement['avatar']);
$avatar = "<td class=\"trow1\" width=\"1\" align=\"center\" valign=\"top\"><img src=\"{$announcement['avatar']}\" alt=\"\" {$avatar_width_height} /></td>";
}
else
{
$avatar = '';
}
$anndate = my_date($mybb->settings['dateformat'], $announcement['dateline']);
$anntime = my_date($mybb->settings['timeformat'], $announcement['dateline']);

if($announcement['replies'])
{
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments")."\";");
}
else
{
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments_no")."\";");
$lastcomment = '';
}

$plugins->run_hooks("portal_announcement");

$parser_options = array(
"allow_html" => $forum[$announcement['fid']]['allowhtml'],
"allow_mycode" => $forum[$announcement['fid']]['allowmycode'],
"allow_smilies" => $forum[$announcement['fid']]['allowsmilies'],
"allow_imgcode" => $forum[$announcement['fid']]['allowimgcode'],
"allow_videocode" => $forum[$announcement['fid']]['allowvideocode'],
"filter_badwords" => 1
);
if($announcement['smilieoff'] == 1)
{
$parser_options['allow_smilies'] = 0;
}

$message = $parser->parse_message($announcement['message'], $parser_options);

if(is_array($attachcache[$announcement['pid']]))
{ // This post has 1 or more attachments
$validationcount = 0;
$id = $announcement['pid'];
foreach($attachcache[$id] as $aid => $attachment)

				{

				{

					if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
{ // We have a thumbnail to show
eval("\$post['thumblist'] .= \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
if($tcount == 5)



					if($attachment['visible'])
{ // There is an attachment thats visible!
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
$attachment['filesize'] = get_friendly_size($attachment['filesize']);
$ext = get_extension($attachment['filename']);
if($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg")

						{

						{

							$thumblist .= "<br />";
$tcount = 0;














































							$isimage = true;
}
else
{
$isimage = false;
}
$attachment['icon'] = get_attachment_icon($ext);
// Support for [attachment=id] code
if(stripos($message, "[attachment=".$attachment['aid']."]") !== false)
{
if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
{ // We have a thumbnail to show (and its not the "SMALL" enough image
eval("\$attbit = \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
}
elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
{
// Image is small enough to show - no thumbnail
eval("\$attbit = \"".$templates->get("postbit_attachments_images_image")."\";");
}
else
{
// Show standard link to attachment
eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";");
}
$message = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $message);
}
else
{
if($attachment['thumbnail'] != "SMALL" && $attachment['thumbnail'] != '')
{ // We have a thumbnail to show
eval("\$post['thumblist'] .= \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
if($tcount == 5)
{
$thumblist .= "<br />";
$tcount = 0;
}
++$tcount;
}
elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
{
// Image is small enough to show - no thumbnail
eval("\$post['imagelist'] .= \"".$templates->get("postbit_attachments_images_image")."\";");
}
else
{
eval("\$post['attachmentlist'] .= \"".$templates->get("postbit_attachments_attachment")."\";");
}

						}

						}

						++$tcount;
}
elseif($attachment['thumbnail'] == "SMALL" && $forumpermissions[$announcement['fid']]['candlattachments'] == 1)
{
// Image is small enough to show - no thumbnail
eval("\$post['imagelist'] .= \"".$templates->get("postbit_attachments_images_image")."\";");

 
					}
else
{

					}
else
{

						eval("\$post['attachmentlist'] .= \"".$templates->get("postbit_attachments_attachment")."\";");

						$validationcount++;

					}

					}

 
				}
if($post['thumblist'])
{
eval("\$post['attachedthumbs'] = \"".$templates->get("postbit_attachments_thumbnails")."\";");
}
if($post['imagelist'])
{
eval("\$post['attachedimages'] = \"".$templates->get("postbit_attachments_images")."\";");
}
if($post['attachmentlist'] || $post['thumblist'] || $post['imagelist'])
{
eval("\$post['attachments'] = \"".$templates->get("postbit_attachments")."\";");

				}
}

				}
}

			else
{
$validationcount++;
}
}
if($post['thumblist'])
{
eval("\$post['attachedthumbs'] = \"".$templates->get("postbit_attachments_thumbnails")."\";");
}
if($post['imagelist'])
{
eval("\$post['attachedimages'] = \"".$templates->get("postbit_attachments_images")."\";");
}
if($post['attachmentlist'] || $post['thumblist'] || $post['imagelist'])
{
eval("\$post['attachments'] = \"".$templates->get("postbit_attachments")."\";");


eval("\$announcements .= \"".$templates->get("portal_announcement")."\";");
unset($post);














		}
}

		}
}


eval("\$announcements .= \"".$templates->get("portal_announcement")."\";");
unset($post);

 
}

$plugins->run_hooks("portal_end");

}

$plugins->run_hooks("portal_end");