Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: index.php 5480 2011-07-04 21:29:44Z huji $
| * $Id$
|
*/
define("IN_MYBB", 1); define('THIS_SCRIPT', 'index.php');
|
*/
define("IN_MYBB", 1); define('THIS_SCRIPT', 'index.php');
|
$templatelist = "index,index_whosonline,index_welcomemembertext,index_welcomeguest,index_whosonline_memberbit,forumbit_depth1_cat,forumbit_depth1_forum,forumbit_depth2_cat,forumbit_depth2_forum,forumbit_depth1_forum_lastpost,forumbit_depth2_forum_lastpost,index_modcolumn,forumbit_moderators,forumbit_subforums,index_welcomeguesttext"; $templatelist .= ",index_birthdays_birthday,index_birthdays,index_pms,index_loginform,index_logoutlink,index_stats,forumbit_depth3,forumbit_depth3_statusicon,index_boardstats";
| $templatelist = "index,index_whosonline,index_whosonline_memberbit,forumbit_depth1_cat,forumbit_depth2_cat,forumbit_depth2_forum,forumbit_depth1_forum_lastpost,forumbit_depth2_forum_lastpost,forumbit_moderators,forumbit_subforums"; $templatelist .= ",index_birthdays_birthday,index_birthdays,index_loginform,index_logoutlink,index_stats,forumbit_depth3,forumbit_depth3_statusicon,index_boardstats";
|
require_once "./global.php";
| require_once "./global.php";
|
Zeile 38 | Zeile 38 |
---|
//Function call is not fatal if(login_attempt_check(false) !== false) {
|
//Function call is not fatal if(login_attempt_check(false) !== false) {
|
| switch($mybb->settings['username_method']) { case 0: $login_username = $lang->login_username; break; case 1: $login_username = $lang->login_username1; break; case 2: $login_username = $lang->login_username2; break; default: $login_username = $lang->login_username; break; }
|
eval("\$loginform = \"".$templates->get("index_loginform")."\";"); } }
| eval("\$loginform = \"".$templates->get("index_loginform")."\";"); } }
|
Zeile 55 | Zeile 70 |
---|
ORDER BY u.username ASC, s.time DESC ");
|
ORDER BY u.username ASC, s.time DESC ");
|
$forum_viewers = array(); $membercount = 0;
| |
$onlinemembers = '';
|
$onlinemembers = '';
|
$guestcount = 0; $anoncount = 0; $doneusers = array();
| $forum_viewers = $doneusers = array(); $botcount = $membercount = $anoncount = $guestcount = 0;
|
// Fetch spiders $spiders = $cache->read("spiders");
| // Fetch spiders $spiders = $cache->read("spiders");
|
Zeile 75 | Zeile 87 |
---|
if($user['uid'] > 0) { // The user is registered.
|
if($user['uid'] > 0) { // The user is registered.
|
if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
| if(empty($doneusers[$user['uid']]) || $doneusers[$user['uid']] < $user['time'])
|
{ // If the user is logged in anonymously, update the count for that. if($user['invisible'] == 1)
| { // If the user is logged in anonymously, update the count for that. if($user['invisible'] == 1)
|
Zeile 106 | Zeile 118 |
---|
} } elseif(my_strpos($user['sid'], "bot=") !== false && $spiders[$botkey])
|
} } elseif(my_strpos($user['sid'], "bot=") !== false && $spiders[$botkey])
|
{
| {
|
// The user is a search bot. $onlinemembers .= $comma.format_name($spiders[$botkey]['name'], $spiders[$botkey]['usergroup']); $comma = $lang->comma;
| // The user is a search bot. $onlinemembers .= $comma.format_name($spiders[$botkey]['name'], $spiders[$botkey]['usergroup']); $comma = $lang->comma;
|
Zeile 122 | Zeile 134 |
---|
{ $forum_viewers[$user['location1']]++; }
|
{ $forum_viewers[$user['location1']]++; }
|
}
| }
|
// Build the who's online bit on the index page. $onlinecount = $membercount + $guestcount + $botcount;
|
// Build the who's online bit on the index page. $onlinecount = $membercount + $guestcount + $botcount;
|
|
|
if($onlinecount != 1) { $onlinebit = $lang->online_online_plural;
| if($onlinecount != 1) { $onlinebit = $lang->online_online_plural;
|
Zeile 138 | Zeile 150 |
---|
if($membercount != 1) { $memberbit = $lang->online_member_plural;
|
if($membercount != 1) { $memberbit = $lang->online_member_plural;
|
} else
| } else
|
{ $memberbit = $lang->online_member_singular; }
| { $memberbit = $lang->online_member_singular; }
|
Zeile 172 | Zeile 184 |
---|
$bdaytime = TIME_NOW; $bdaydate = my_date("j-n", $bdaytime, '', 0); $year = my_date("Y", $bdaytime, '', 0);
|
$bdaytime = TIME_NOW; $bdaydate = my_date("j-n", $bdaytime, '', 0); $year = my_date("Y", $bdaytime, '', 0);
|
|
|
$bdaycache = $cache->read("birthdays");
|
$bdaycache = $cache->read("birthdays");
|
|
|
if(!is_array($bdaycache)) { $cache->update_birthdays(); $bdaycache = $cache->read("birthdays"); }
|
if(!is_array($bdaycache)) { $cache->update_birthdays(); $bdaycache = $cache->read("birthdays"); }
|
$hiddencount = $bdaycache[$bdaydate]['hiddencount']; $today_bdays = $bdaycache[$bdaydate]['users'];
| $hiddencount = $today_bdays = 0; if(isset($bdaycache[$bdaydate])) { $hiddencount = $bdaycache[$bdaydate]['hiddencount']; $today_bdays = $bdaycache[$bdaydate]['users']; }
|
$comma = ''; if(!empty($today_bdays)) {
|
$comma = ''; if(!empty($today_bdays)) {
|
foreach($today_bdays as $bdayuser)
| if(intval($mybb->settings['showbirthdayspostlimit']) > 0)
|
{
|
{
|
$bday = explode("-", $bdayuser['birthday']); if($year > $bday['2'] && $bday['2'] != '')
| $bdayusers = array(); foreach($today_bdays as $key => $bdayuser_pc)
|
{
|
{
|
$age = " (".($year - $bday['2']).")";
| $bdayusers[$bdayuser_pc['uid']] = $key; }
if(!empty($bdayusers)) { // Find out if our users have enough posts to be seen on our birthday list $bday_sql = implode(",", array_keys($bdayusers)); $query = $db->simple_select("users", "uid, postnum", "uid IN ({$bday_sql})");
while($bdayuser = $db->fetch_array($query)) { if($bdayuser['postnum'] < $mybb->settings['showbirthdayspostlimit']) { unset($today_bdays[$bdayusers[$bdayuser['uid']]]); } } } }
// We still have birthdays - display them in our list! if(!empty($today_bdays)) { foreach($today_bdays as $bdayuser) { if($bdayuser['displaygroup'] == 0) { $bdayuser['displaygroup'] = $bdayuser['usergroup']; }
// If this user's display group can't be seen in the birthday list, skip it if($groupscache[$bdayuser['displaygroup']] && $groupscache[$bdayuser['displaygroup']]['showinbirthdaylist'] != 1) { continue; }
$bday = explode("-", $bdayuser['birthday']); if($year > $bday['2'] && $bday['2'] != '') { $age = " (".($year - $bday['2']).")"; } else { $age = ''; }
$bdayuser['username'] = format_name($bdayuser['username'], $bdayuser['usergroup'], $bdayuser['displaygroup']); $bdayuser['profilelink'] = build_profile_link($bdayuser['username'], $bdayuser['uid']); eval("\$bdays .= \"".$templates->get("index_birthdays_birthday", 1, 0)."\";"); ++$bdaycount; $comma = $lang->comma;
|
}
|
}
|
else { $age = ''; } $bdayuser['username'] = format_name($bdayuser['username'], $bdayuser['usergroup'], $bdayuser['displaygroup']); $bdayuser['profilelink'] = build_profile_link($bdayuser['username'], $bdayuser['uid']); eval("\$bdays .= \"".$templates->get("index_birthdays_birthday", 1, 0)."\";"); ++$bdaycount; $comma = $lang->comma;
| |
} }
|
} }
|
|
|
if($hiddencount > 0)
|
if($hiddencount > 0)
|
{
| {
|
if($bdaycount > 0) { $bdays .= " - "; } $bdays .= "{$hiddencount} {$lang->birthdayhidden}"; }
|
if($bdaycount > 0) { $bdays .= " - "; } $bdays .= "{$hiddencount} {$lang->birthdayhidden}"; }
|
|
|
// If there are one or more birthdays, show them. if($bdaycount > 0 || $hiddencount > 0) { eval("\$birthdays = \"".$templates->get("index_birthdays")."\";");
|
// If there are one or more birthdays, show them. if($bdaycount > 0 || $hiddencount > 0) { eval("\$birthdays = \"".$templates->get("index_birthdays")."\";");
|
}
| }
|
}
// Build the forum statistics to show on the index page.
| }
// Build the forum statistics to show on the index page.
|
Zeile 227 | Zeile 283 |
---|
{ // First, load the stats cache. $stats = $cache->read("stats");
|
{ // First, load the stats cache. $stats = $cache->read("stats");
|
|
|
// Check who's the newest member. if(!$stats['lastusername']) {
| // Check who's the newest member. if(!$stats['lastusername']) {
|
Zeile 251 | Zeile 307 |
---|
$mostonline['numusers'] = $onlinecount; $mostonline['time'] = $time; $cache->update("mostonline", $mostonline);
|
$mostonline['numusers'] = $onlinecount; $mostonline['time'] = $time; $cache->update("mostonline", $mostonline);
|
}
| }
|
$recordcount = $mostonline['numusers']; $recorddate = my_date($mybb->settings['dateformat'], $mostonline['time']); $recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
// Then format that language string. $lang->stats_mostonline = $lang->sprintf($lang->stats_mostonline, my_number_format($recordcount), $recorddate, $recordtime);
|
$recordcount = $mostonline['numusers']; $recorddate = my_date($mybb->settings['dateformat'], $mostonline['time']); $recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
// Then format that language string. $lang->stats_mostonline = $lang->sprintf($lang->stats_mostonline, my_number_format($recordcount), $recorddate, $recordtime);
|
|
|
eval("\$forumstats = \"".$templates->get("index_stats")."\";");
|
eval("\$forumstats = \"".$templates->get("index_stats")."\";");
|
}
| }
|
// Show the board statistics table only if one or more index statistics are enabled.
|
// Show the board statistics table only if one or more index statistics are enabled.
|
if($mybb->settings['showwol'] != 0 || $mybb->settings['showindexstats'] != 0 || ($mybb->settings['showbirthdays'] != 0 && $bdaycount > 0))
| if(($mybb->settings['showwol'] != 0 && $mybb->usergroup['canviewonline'] != 0) || $mybb->settings['showindexstats'] != 0 || ($mybb->settings['showbirthdays'] != 0 && $bdaycount > 0))
|
{ if(!is_array($stats))
|
{ if(!is_array($stats))
|
{
| {
|
// Load the stats cache. $stats = $cache->read("stats");
|
// Load the stats cache. $stats = $cache->read("stats");
|
}
| }
|
$post_code_string = ''; if($mybb->user['uid']) {
| $post_code_string = ''; if($mybb->user['uid']) {
|
Zeile 281 | Zeile 337 |
---|
}
if($mybb->user['uid'] == 0)
|
}
if($mybb->user['uid'] == 0)
|
{ // Build a forum cache. $query = $db->query("
| { // Build a forum cache. $query = $db->query("
|
SELECT * FROM ".TABLE_PREFIX."forums WHERE active != 0
|
SELECT * FROM ".TABLE_PREFIX."forums WHERE active != 0
|
ORDER BY pid, disporder
| ORDER BY pid, disporder
|
");
|
");
|
$forumsread = unserialize($mybb->cookies['mybb']['forumread']);
| $forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);
|
} else
|
} else
|
{
| {
|
// Build a forum cache. $query = $db->query(" SELECT f.*, fr.dateline AS lastread
| // Build a forum cache. $query = $db->query(" SELECT f.*, fr.dateline AS lastread
|
Zeile 303 | Zeile 359 |
---|
ORDER BY pid, disporder "); }
|
ORDER BY pid, disporder "); }
|
|
|
while($forum = $db->fetch_array($query)) { if($mybb->user['uid'] == 0) {
|
while($forum = $db->fetch_array($query)) { if($mybb->user['uid'] == 0) {
|
if($forumsread[$forum['fid']])
| if(!empty($forumsread[$forum['fid']]))
|
{ $forum['lastread'] = $forumsread[$forum['fid']]; }
| { $forum['lastread'] = $forumsread[$forum['fid']]; }
|
Zeile 318 | Zeile 375 |
---|
// Get the forum moderators if the setting is enabled. if($mybb->settings['modlist'] != "off")
|
// Get the forum moderators if the setting is enabled. if($mybb->settings['modlist'] != "off")
|
{
| {
|
$moderatorcache = $cache->read("moderators"); }
| $moderatorcache = $cache->read("moderators"); }
|