authenticate("U_TimeOffset,U_Groups"); $toffset = ""; isset($user['U_TimeOffset']) && $toffset = $user['U_TimeOffset']; // --------------------------------- // Split their groups into an array if (!$user['U_Groups']) { $user['U_Groups'] = "-4-"; } $Grouparray = split("-",$user['U_Groups']); $gsize = sizeof($Grouparray); // ------------------------- // Delete the inactive users $html = new html; $Outdated = $html -> get_date() - 600; $query = " DELETE FROM {$config['tbprefix']}Online WHERE O_Last < $Outdated "; $dbh -> do_query($query); // ------------------ // Send a html header $html -> send_header($ubbt_lang['ONLINE_HEAD'],$Cat,"",$user); $query = " SELECT t1.O_Username, t1.O_Last, t1.O_What,t1.O_Extra,t1.O_Read,t2.U_Status,t2.U_Visible,t2.U_Extra1,t2.U_Title,t2.U_Color,t2.U_OnlineFormat,t2.U_Number FROM {$config['tbprefix']}Online AS t1, {$config['tbprefix']}Users AS t2 WHERE t1.O_Username = t2.U_Username ORDER BY t1.O_Last DESC "; $reged = $dbh -> do_query($query); $regrows = $dbh -> total_rows($reged); $color = "lighttable"; // Array key tracker $x = 0; while (list($Username,$Last,$RealWhat,$Extra,$Read,$Status,$Visible,$ICQ,$Title,$Color,$OnlineFormat,$Uid) = $dbh -> fetch_array($reged) ) { // ----------------------------------------------- // Let's see if we need to block some information $Private = 0; if ($user['U_Status'] != "Administrator") { $Private = 1; if ($Read) { for ($i=0; $i<=$gsize; $i++) { if (!preg_match("/[0-9]/",$Grouparray[$i])) { continue; }; if (!strstr($Read,"-$Grouparray[$i]")) { $Private = 1; } else { $Private = 0; break; } } } } // ------------------------------------------------------ // Replace their location with something that makes sense if (stristr($RealWhat,"faq_")) { $RealWhat = "faq_english"; } $What = $ubbt_lang[$RealWhat]; if (!$What) { $What = $ubbt_lang['all_admin']; } if ( ($user['U_Status'] != "Administrator") && ($Visible == "no") ) { continue; } $extra = ""; if ($Visible == "no") { $extra = "(I)"; } $regrow[$x]['extra'] = $extra; $Last = $html -> convert_time($Last,$toffset); $EUsername = $Uid; $PUsername = $Username; if ($Color) { $PUsername = "$Username"; } $regrow[$x]['color'] = $color; $regrow[$x]['EUsername'] = $EUsername; $regrow[$x]['PUsername'] = $PUsername; if ($Status == "Administrator") { $Status = $ubbt_lang['USER_ADMIN']; } if ($Status == "Moderator") { $Status = $ubbt_lang['USER_MOD']; } if ($Status == "User") { $Status = $ubbt_lang['USER_USER']; } // ----------------------------------------------------- // Here we give more information on what they are doing if ( ($OnlineFormat == "no") && ($user['U_Status'] != "Administrator") ) { $Private = 1; } if ( ($Extra) && (!$Private) ){ if (( $RealWhat == "postlist") || ($RealWhat == "newpost") ){ if (!isset($Boards[$Extra])) { $query = "SELECT Bo_Title FROM {$config['tbprefix']}Boards WHERE Bo_Keyword='$Extra'"; $sti = $dbh -> do_query($query); list($Boards[$Extra]) = $dbh -> fetch_array($sti); } $Extra = "
      $Boards[$Extra]
"; } elseif ($RealWhat == "showflat") { list($board,$number,$subject) = split("_SEP_",$Extra); $Extra = "
      $subject
"; } elseif ($RealWhat == "showthreaded") { list($board,$number,$subject) = split("_SEP_",$Extra); $Extra = "
      $subject
"; } elseif ($RealWhat == "newreply") { list($board,$number,$subject) = split("_SEP_",$Extra); $Extra = "
      $subject
"; } elseif ($RealWhat == "addpost") { list($board,$number,$subject) = split("_SEP_",$Extra); if ($subject) { $Extra = "
      $subject
"; } else { if (!isset($Boards[$board])) { $query = "SELECT Bo_Title FROM {$config['tbprefix']}Boards WHERE Bo_Keyword='$board'"; $sti = $dbh -> do_query($query); list($Boards[$board]) = $dbh -> fetch_array($sti); } $Extra = "
      $Boards[$board]
"; } } } if ( ($Extra) && ($Private) ){ $Extra = "
      ({$ubbt_lang['Private']})"; } if ( (preg_match('/^\d+$/',$ICQ)) && ($config['ICQ_Status']) ) { $icqindicator = "\"*\""; } else { $icqindicator = ""; } # Added by LK $Title = stripslashes($Title); if ($Extra == "0") { $Extra = ""; } $regrow[$x]['icqindicator'] = $icqindicator; $regrow[$x]['Status'] = $Status; $regrow[$x]['Title'] = $Title; $regrow[$x]['Last'] = $Last; $regrow[$x]['What'] = $What; $regrow[$x]['Extra'] = $Extra; $color = $html -> switch_colors($color); $x++; } $regsize = 0; if (isset($regrow)) { $regsize = sizeof($regrow); } $dbh -> finish_sth($reged); // ---------------------------------------- // Now show the one's that aren't logged in $query = " SELECT O_Username,O_Last,O_What,O_Extra FROM {$config['tbprefix']}Online WHERE O_Username LIKE '-ANON-%' ORDER BY O_Last DESC "; $unreged = $dbh -> do_query($query); $anonrows = $dbh -> total_rows($unreged); if ($user['U_Status'] == "Administrator") { $column = $ubbt_lang['FROM_IP']; } else { $column = $ubbt_lang['USERNAME_TEXT']; } $color = "lighttable"; $What = ""; $Extra = ""; // Anonrow array key number $x = 0; while (list($Username,$Last,$RealWhat,$Extra) = $dbh -> fetch_array($unreged) ) { $anonrow[$x]['color'] = $color; // ------------------------------------------------------ // Replace their location with something that makes sense if (stristr($RealWhat,"faq_")) { $RealWhat = "faq_english"; } $What = $ubbt_lang[$RealWhat]; if ($user['U_Status'] == "Administrator") { $piece['0'] = ""; preg_match("/-ANON-(.*)/",$Username,$piece); $Username = $piece['1']; } else { $Username = $ubbt_lang['ANON_TEXT']; } $Last = $html -> convert_time($Last,$toffset); // ----------------------------------------------------- // Here we give more information on what they are doing if ($Extra){ if (( $RealWhat == "postlist") || ($RealWhat == "newpost") ){ if (!isset($Boards[$Extra])) { $query = "SELECT Bo_Title FROM {$config['tbprefix']}Boards WHERE Bo_Keyword='$Extra'"; $sti = $dbh -> do_query($query); list($Boards[$Extra]) = $dbh -> fetch_array($sti); } $Extra = "
      $Boards[$Extra]
"; } elseif ($RealWhat == "showflat") { list($board,$number,$subject) = split("_SEP_",$Extra); $Extra = "
      $subject
"; } elseif ($RealWhat == "showthreaded") { list($board,$number,$subject) = split("_SEP_",$Extra); $Extra = "
      $subject
"; } elseif ($RealWhat == "newreply") { list($board,$number,$subject) = split("_SEP_",$Extra); $Extra = "
      $subject
"; } elseif ($RealWhat == "addpost") { list($board,$number,$subject) = split("_SEP_",$Extra); if ($subject) { $Extra = "
      $subject
"; } else { if (!$Boards[$board]) { $query = "SELECT Bo_Title FROM {$config['tbprefix']}Boards WHERE Bo_Keyword='$board'"; $sti = $dbh -> do_query($query); list($Boards[$board]) = $dbh -> fetch_array($sti); } $Extra = "
      $Boards[$board]
"; } } } if (!$Extra) { $Extra = ""; } $anonrow[$x]['Username'] = $Username; $anonrow[$x]['Last'] = $Last; $anonrow[$x]['What'] = $What; $anonrow[$x]['Extra'] = $Extra; $x++; $color = $html -> switch_colors($color); } if (isset($anonrow)) { $anonsize = sizeof($anonrow); } else { $anonsize = "0"; } $dbh -> finish_sth($unreged); // --------------------- // Grab the tablewrapper list($tbopen,$tbclose) = $html -> table_wrapper(); if (!$debug) { include("$thispath/templates/$tempstyle/online.tmpl"); } // Send the footer $html -> send_footer(); ?>