plugins/WhosOnline.php
changeset 1 5cf660b4dce2
parent 0 a314569f8829
equal deleted inserted replaced
0:a314569f8829 1:5cf660b4dce2
    63       ON u.user_id=o.user_id
    63       ON u.user_id=o.user_id
    64     WHERE last_load>'.( time() - 60*5 - 1 ).' ORDER BY username ASC'); if(!$q) $db->_die('');
    64     WHERE last_load>'.( time() - 60*5 - 1 ).' ORDER BY username ASC'); if(!$q) $db->_die('');
    65   $num_guests = 0;
    65   $num_guests = 0;
    66   $num_users = 0;
    66   $num_users = 0;
    67   $users = Array();
    67   $users = Array();
    68   while ( $row = $db->fetchrow() )
    68   while ( $row = $db->fetchrow($q) )
    69   {
    69   {
    70     ( $row['user_id'] == 1 ) ? $num_guests++ : $num_users++;
    70     ( $row['user_id'] == 1 ) ? $num_guests++ : $num_users++;
    71     if($row['user_id'] > 1)
    71     if($row['user_id'] > 1)
    72     {
    72     {
    73       switch($row['user_level'])
    73     	if ( defined('RANK_ID_MEMBER') )
    74       {
    74     	{
    75         case USER_LEVEL_MEMBER:
    75     		// We're in an Enano with rank support
    76         default:
    76     		$rankinfo = $session->get_user_rank($row['user_id']);
    77           $color = '303030';
    77     		$rank_style = $rankinfo['rank_style'];
    78           $weight = 'normal';
    78     	}
    79           break;
    79     	else
    80         case USER_LEVEL_MOD:
    80     	{
    81           $color = '00AA00';
    81 		  switch($row['user_level'])
    82           $weight = 'bold';
    82 		  {
    83           break;
    83 			case USER_LEVEL_MEMBER:
    84         case USER_LEVEL_ADMIN:
    84 			default:
    85           $color = 'AA0000';
    85 			  $color = '303030';
    86           $weight = 'bold';
    86 			  $weight = 'normal';
    87           break;
    87 			  break;
    88       }
    88 			case USER_LEVEL_MOD:
    89       $users[] = "<a href='".makeUrlNS('User', str_replace(' ', '_', $row['username']))."' style='color: #$color; font-weight: $weight'>{$row['username']}</a>";
    89 			  $color = '00AA00';
       
    90 			  $weight = 'bold';
       
    91 			  break;
       
    92 			case USER_LEVEL_ADMIN:
       
    93 			  $color = 'AA0000';
       
    94 			  $weight = 'bold';
       
    95 			  break;
       
    96 		  }
       
    97 		  $rank_style = "color: #$color; font-weight: $weight";
       
    98 		}
       
    99       $users[] = "<a href='".makeUrlNS('User', str_replace(' ', '_', $row['username']))."' style=\"$rank_style\">{$row['username']}</a>";
    90       $whos_online['users'][] = $row['username'];
   100       $whos_online['users'][] = $row['username'];
    91     }
   101     }
    92     else
   102     else
    93     {
   103     {
    94       $whos_online['guests'][] = $row['username'];
   104       $whos_online['guests'][] = $row['username'];