Vergleich portal.php - 1.6.11 - 1.6.17

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 57Zeile 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");

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

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

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

Zeile 79Zeile 89
				{
foreach($announcementsfids as $fid)
{

				{
foreach($announcementsfids as $fid)
{

						$fid_array[] = intval($fid);	

						$fid_array[] = intval($fid);

					}

					}

					



					$announcementsfids = implode(',', $fid_array);

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

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

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

Zeile 91Zeile 101
			if(!$newthreads)
{
$newthreads = 0;

			if(!$newthreads)
{
$newthreads = 0;

			}

			}


if(!$newann)
{
$newann = 0;
}


if(!$newann)
{
$newann = 0;
}

		}
else

		}
else

		{
$newposts = 0;
$newthreads = 0;

		{
$newposts = 0;
$newthreads = 0;

Zeile 117Zeile 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_threads = $lang->sprintf($lang->new_threads, $newthreads);
}
if($newposts == 1)

Zeile 131Zeile 141
			$lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
}
eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");

			$lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
}
eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");


}


}

	else
{
$lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');

	else
{
$lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');

Zeile 172Zeile 182
			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 "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 180Zeile 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 231Zeile 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")
{
++$guestcount;
}
elseif(my_strpos($user['sid'], "bot=") !== false && $session->bots[$botkey])

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

		{

		{

			// The user is a search bot.
$onlinemembers .= $comma.format_name($session->bots[$botkey], $session->botgroup);
$comma = $lang->comma;

			// The user is a search bot.
$onlinemembers .= $comma.format_name($session->bots[$botkey], $session->botgroup);
$comma = $lang->comma;

Zeile 251Zeile 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($user['invisible'] == 1)
{
++$anoncount;
}

				// If the user is logged in anonymously, update the count for that.
if($user['invisible'] == 1)
{
++$anoncount;
}

				



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

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

Zeile 268Zeile 278
				{
$invisiblemark = '';
}

				{
$invisiblemark = '';
}

				



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

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

Zeile 279Zeile 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)
{
$onlinecount += $anoncount;
}

	// If we can see invisible users add them to the count
if($mybb->usergroup['canviewwolinvis'] == 1)
{
$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 328Zeile 338
		SELECT t.*, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)

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

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

Zeile 407Zeile 417
		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)

		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

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

		LIMIT 0, {$numannouncements}"
);
while($getid = $db->fetch_array($query))

	{

	{

		$pids .= ",'{$getid['pid']}'";
$tids .= ",'{$getid['tid']}'";
$posts[$getid['tid']] = $getid;

		$pids .= ",'{$getid['pid']}'";
$tids .= ",'{$getid['tid']}'";
$posts[$getid['tid']] = $getid;

Zeile 425Zeile 435
		while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;

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


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

			}

			}

		}

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

		}

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

Zeile 451Zeile 461
			if($forumpermissions[$announcement['fid']]['canview'] == 0 || $forumpermissions[$announcement['fid']]['canviewthreads'] == 0 || $forumpermissions[$announcement['fid']]['canonlyviewownthreads'] == 1 && $announcement['uid'] != $mybb->user['uid'])
{
continue;

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

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

			if($announcement['uid'] == 0)

			{

			{

				$profilelink = htmlspecialchars_uni($announcement['threadusername']);

				$profilelink = htmlspecialchars_uni($announcement['threadusername']);

			}

			}

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

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

			



			if(!$announcement['username'])
{
$announcement['username'] = $announcement['threadusername'];

			if(!$announcement['username'])
{
$announcement['username'] = $announcement['threadusername'];

Zeile 475Zeile 485
			if($announcement['icon'] > 0 && $icon_cache[$announcement['icon']])
{
$icon = $icon_cache[$announcement['icon']];

			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 = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else

Zeile 491Zeile 503
				if (!stristr($announcement['avatar'], 'http://'))
{
$announcement['avatar'] = $mybb->settings['bburl'] . '/' . $announcement['avatar'];

				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 = "<td class=\"trow1\" width=\"1\" align=\"center\" valign=\"top\"><img src=\"{$announcement['avatar']}\" alt=\"\" {$avatar_width_height} /></td>";
}
else

Zeile 500Zeile 513
			}
$anndate = my_date($mybb->settings['dateformat'], $announcement['dateline']);
$anntime = my_date($mybb->settings['timeformat'], $announcement['dateline']);

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

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

			}

			}

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

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

			



			$plugins->run_hooks("portal_announcement");

$parser_options = array(

			$plugins->run_hooks("portal_announcement");

$parser_options = array(

Zeile 527Zeile 540
			}

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

			}

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

			



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

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