Files
IPB/upload/sources/lib/func_chat.php
T
2025-12-19 00:21:15 -08:00

161 lines
4.5 KiB
PHP

<?php
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-24 22:17:00 +0100 (Mon, 24 Oct 2005) $
| > $Revision: 64 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
| > IPChat functions
| > Script written by Matt Mecham
| > Date started: 29th September 2003
|
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.";
exit();
}
class func_chat
{
var $class = "";
var $server = "";
var $html = "";
function func_chat()
{
$this->server = str_replace( 'http://', '', $this->ipsclass->vars['chat04_whodat_server_addr'] );
}
//-----------------------------------------
// register_class($class)
//
// Register a $this-> with this class
//
//-----------------------------------------
function register_class()
{
// NO LONGER NEEDED
}
//-----------------------------------------
// Print online list
//-----------------------------------------
function get_online_list()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_ids = array();
$to_load = array();
// Let's use the new config vars if they are available, else revert to the legacy variable names
$_hide_whoschatting = $this->ipsclass->vars['chat_hide_whoschatting'] ? $this->ipsclass->vars['chat_hide_whoschatting'] : $this->ipsclass->vars['chat04_hide_whoschatting'];
$_who_on = $this->ipsclass->vars['chat_who_on'] ? $this->ipsclass->vars['chat_who_on'] : $this->ipsclass->vars['chat04_who_on'];
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $_who_on )
{
return;
}
//-----------------------------------------
// Sort and show :D
//-----------------------------------------
if ( is_array( $this->ipsclass->cache['chatting'] ) AND count( $this->ipsclass->cache['chatting'] ) )
{
foreach( $this->ipsclass->cache['chatting'] as $id => $data )
{
if ( $data['updated'] < ( time() - 120 ) )
{
continue;
}
$to_load[ $id ] = $id;
}
}
//-----------------------------------------
// Got owt?
//-----------------------------------------
if ( count($to_load) )
{
$this->ipsclass->DB->build_query( array( 'select' => 'id, members_display_name, mgroup',
'from' => 'members',
'where' => "id IN(".implode(",",$to_load).")",
'order' => 'members_display_name' ) );
$this->ipsclass->DB->exec_query();
while ( $m = $this->ipsclass->DB->fetch_row() )
{
$m['prefix'] = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ]['prefix'];
$m['suffix'] = $this->ipsclass->cache['group_cache'][ $m['mgroup'] ]['suffix'];
$member_ids[] = "<a href=\"{$this->ipsclass->base_url}showuser={$m['id']}\">{$m['prefix']}{$m['members_display_name']}{$m['suffix']}</a>";
}
}
//-----------------------------------------
// Got owt?
//-----------------------------------------
if ( count( $member_ids ) )
{
$final = implode( ",\n", $member_ids );
$this->html = $this->ipsclass->compiled_templates['skin_boards']->whoschatting_show( intval(count($member_ids)), $final );
}
else
{
if ( ! $_hide_whoschatting )
{
$this->html = $this->ipsclass->compiled_templates['skin_boards']->whoschatting_empty();
}
}
return $this->html;
}
}
?>