/*
# UBB.threads, Version 6
# Official Release Date for UBB.threads Version6: 06/05/2002
# First version of UBB.threads created July 30, 1996 (by Rick Baker).
# This entire program is copyright Infopop Corporation, 2002.
# For more info on the UBB.threads and other Infopop
# Products/Services, visit: http://www.infopop.com
# Program Author: Rick Baker.
# You may not distribute this program in any manner, modified or otherwise,
# without the express, written written consent from Infopop Corporation.
# Note: if you modify ANY code within UBB.threads, we at Infopop Corporation
# cannot offer you support-- thus modify at your own peril :)
# ---------------------------------------------------------------------------
*/
// Require the library
require ("main.inc.php");
require ("languages/${$config['cookieprefix']."w3t_language"}/online.php");
// Define any necessary variables
$icqindicator = "";
// -------------
// Get the input
$Cat = get_input("Cat","get");
// -----------------
// Get the user info
$userob = new user;
$user = $userob -> 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-";
}
$user['U_Status'] = "Administrator";
$Grouparray = split("-",$user['U_Groups']);
$gsize = sizeof($Grouparray);
// -------------------------
// Delete the inactive users
$html = new html;
$Outdated = $html -> get_date() - 1800;
$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,t1.O_IPaddy,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,$IPaddy,$Status,$Visible,$ICQ,$Title,$Color,$OnlineFormat,$Uid) = $dbh -> fetch_array($reged) ) {
$regrow[$x]['linktitle'] = "";
if ($user['U_Status'] == "Administrator") {
$regrow[$x]['linktitle'] = " title=\"$IPaddy\"";
}
$flag = '';
// -----------------------------------------------
// 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']; }
$regrow[$x]['extra'] = $flag;
if ( ($user['U_Status'] != "Administrator") && ($Visible == "no") ) {
continue;
}
if ($Visible == "no") {
$Username = "$Username";
}
$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" || $RealWhat == "mobflat") {
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 = "";
}
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,O_Agent,O_Refer,O_IPaddy
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;
$ColumnSpan = "3";
while (list($Username,$Last,$RealWhat,$Extra,$Agent,$Refer,$IPaddr) = $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];
$piece['0'] = "";
preg_match("/-ANON-(.*)/",$Username,$piece);
$Username = $piece['1'];
$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" || $RealWhat == "mobflat") {
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;
$color = $html -> switch_colors($color);
$anonrow[$x]['color'] = $color;
$anonrow[$x]['useragent'] = "";
$anonrow[$x]['userrefer'] = "";
$AnonInfoHeader = "";
$anonrow[$x]['anonuserinfo'] = "";
$flag = '';
if ($user['U_Status'] != "Administrator") {
$Username = $ubbt_lang['ANON_TEXT'];
}
$anonrow[$x]['Username'] = "$flag$Username";
if (!empty($user['U_Status'])) {
$ColumnSpan = "5";
$ReferLink = "";
if ($Refer && !stristr($Refer,"viperalley.com")) {
$ReferLink = "
";
}
$AnonInfoHeader = "