Quelltext für diesen Bereich:
Code: Alles auswählen
$connected = array();
$user_ids = array();
while ($row = $db->sql_fetchrow($result) )
{
// User is logged in and therefor not a guest
if ( $row['session_logged_in'] )
{
if ( !in_array($row['user_id'], $user_ids) )
{
$row['style'] = ' class="' . get_user_level_class($row['user_level'], 'gen', $row) . '"';
$connected[] = $row;
$user_ids[] = $row['user_id'];
}
}
else
{
// Skip multiple sessions for one user
if ( $row['session_ip'] != $prev_session_ip )
{
$row['style'] = '';
$connected[] = $row;
}
}
$prev_session_ip = $row['session_ip'];
}
$db->sql_freeresult($result);
// read buddy list
$buddys = array();
if (count($user_ids) > 0)
{
$s_user_ids = implode(', ', $user_ids);
// get base info
$sql = "SELECT * FROM " . BUDDYS_TABLE . " WHERE user_id=" . $userdata['user_id'] . " and buddy_id in ($s_user_ids)";
if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, "Could not obtain buddys information.", '', __LINE__, __FILE__, $sql);
while ( $row = $db->sql_fetchrow($result) )
{
$buddys[ $row['buddy_id'] ]['buddy_ignore'] = $row['buddy_ignore'];
$buddys[ $row['buddy_id'] ]['buddy_my_friend'] = !$row['buddy_ignore'];
$buddys[ $row['buddy_id'] ]['buddy_friend'] = false;
$buddys[ $row['buddy_id'] ]['buddy_visible'] = false;
}
// check if in the topic author's friend list and "always visible" status he granted
$sql = "SELECT * FROM " . BUDDYS_TABLE . " WHERE buddy_id=" . $userdata['user_id'] . " and user_id in ($s_user_ids)";
if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, "Could not obtain buddys information.", '', __LINE__, __FILE__, $sql);
while ( $row = $db->sql_fetchrow($result) )
{
if ( !isset($buddys[ $row['user_id'] ]) ) $buddys[ $row['user_id'] ]['buddy_ignore'] = false;
if ( !isset($buddys[ $row['user_id'] ]) ) $buddys[ $row['user_id'] ]['buddy_my_friend'] = false;
$buddys[ $row['user_id'] ]['buddy_friend'] = !$row['buddy_ignore'];
$buddys[ $row['user_id'] ]['buddy_visible'] = $row['buddy_visible'];
}
$db->sql_freeresult($result);
}
// get visible/not visible status
$user_id = $userdata['user_id'];
$user_level = $userdata['user_level'];
$is_admin = is_admin($userdata);
for ($i=0; $i < count($connected); $i++)
{
$view_user_id = $connected[$i]['user_id'];
$view_is_admin = is_admin($connected[$i]);
$view_online_set = $connected[$i]['user_allow_viewonline'];
$view_ignore = ($is_admin || $view_is_admin || ($view_user_id == $user_id)) ? false : $buddys[$view_user_id]['buddy_ignore'];
$view_friend = $buddys[$view_user_id]['buddy_friend'];
$view_visible = ($is_admin || ($view_user_id == $user_id)) ? YES : $buddys[$view_user_id]['buddy_visible'];
// online/offline/hidden icon
if ($view_user_id == ANONYMOUS)
{
$status = 'guest';
}
else if ($view_ignore)
{
$status = 'offline';
}
else
{
switch ($view_online_set)
{
case NO:
$status = ($view_visible) ? 'hidden' : 'offline';
break;
case YES:
$status = 'online';
break;
case FRIEND_ONLY:
$status = ($view_friend || $view_visible) ? 'hidden' : 'offline';
break;
default:
$status = '???';
}
}
// set the status
switch ($status)
{
case 'guest':
$guests_online++;
break;
case 'offline':
$logged_hidden_online++;
break;
case 'online':
$logged_visible_online++;
break;
case 'hidden':
$connected[$i]['username'] = '<i>' . $connected[$i]['username'] . '</i>';
$logged_hidden_online++;
break;
default:
}
$connected[$i]['status'] = $status;
// add the user to the online list
if ( ($status == 'online') || ($status == 'hidden') )
{
$online_userlist .= ( $online_userlist != '' ) ? ', ' : '';
$online_userlist .= '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $connected[$i]['user_id'] ) . '"' . $connected[$i]['style'] . '>' . $connected[$i]['username'] . '</a>';
}
}
Code: Alles auswählen
$style_color = '';
if ( $row['user_level'] == ADMIN )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
}
else if ( $row['user_level'] == MOD )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
}
if ( $row['user_allow_viewonline'] )
{
$user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
$logged_visible_online++;
}
else
{
$user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
$logged_hidden_online++;
}
Code: Alles auswählen
$user_online_link = color_group_colorize_name($row['user_id']);
if ( $row['user_allow_viewonline'] )
{
$logged_visible_online++;
}
else
{
$logged_hidden_online++;
}
phpbb: Version 2.0.6
Profile Control Panel: Version 1.0.1
Color Groups: Version 1.1.0
MFG
Dave