示例#1
0
 function online_users()
 {
     if ($this->modSettings["tea_ts_warnm"] == 0 && $this->modSettings["tea_ts_kickm"] == 0) {
         return;
     }
     require_once $this->sourcedir . '/TS3_Class/TeamSpeak3.php';
     $tslv = TeamSpeak3::LIB_VERSION;
     TeamSpeak3::init();
     try {
         $ts3 = TeamSpeak3::factory("serverquery://" . $this->modSettings["tea_ts_username"] . ":" . $this->modSettings["tea_ts_password"] . "@" . $this->modSettings["tea_ts_host"] . ":" . $this->modSettings["tea_ts_qport"] . "/?server_port=" . $this->modSettings["tea_ts_port"] . "&blocking=0");
         $clist = $ts3->clientList();
         foreach ($clist as $c) {
             if ($c->client_type == 0) {
                 $clid = (string) $c->client_unique_identifier;
                 $cnick = (string) $c->client_nickname;
                 $smf = $this->smcFunc['db_query']('', "SELECT id, tsid, dbid, name, warnstart, lastwarn FROM {db_prefix}tea_ts_users WHERE tsid = '" . $clid . "'");
                 $smf = $this->tea->select($smf);
                 if (!empty($smf)) {
                     $warned = FALSE;
                     $kick = FALSE;
                     $time = time() - $this->modSettings["tea_ts_warnm"] * 60;
                     if ($smf[0][5] < $time) {
                         $char = $smf[0][3];
                         //	$chars = $this -> tea -> get_all_chars($smf[0][0]);
                         $name = $this->format_ts_name($smf[0][0], $char);
                         //	$aid = NULL;
                         if (!empty($name)) {
                             //		foreach($chars as $i => $ch)
                             //		{
                             //			if($ch[0] == $char)
                             //				$aid = $i;
                             //		}
                             if ($name != $cnick) {
                                 if ($this->modSettings["tea_ts_kickm"] != 0 && $smf[0][4] != 0 && $smf[0][4] < time() - $this->modSettings["tea_ts_kickm"] * 60) {
                                     $c->kick(TeamSpeak3::KICK_SERVER, 'Incorrect Nickname, Expecting: ' . $name);
                                     $this->smcFunc['db_query']('', "UPDATE {db_prefix}tea_ts_users SET lastwarn = 0, warnstart = 0 WHERE tsid = '" . $clid . "'");
                                 } elseif ($this->modSettings["tea_ts_warnm"] != 0) {
                                     $c->poke('Incorrect Nickname, Expecting: ' . $name);
                                     $warned = TRUE;
                                 }
                             } else {
                                 $this->smcFunc['db_query']('', "UPDATE {db_prefix}tea_ts_users SET lastwarn = 0, warnstart = 0 WHERE tsid = '" . $clid . "'");
                             }
                         } else {
                             $c->message('Error Unable to Find Character');
                             $warned = TRUE;
                         }
                     }
                     if ($warned) {
                         $sql = '';
                         if ($smf[0][4] == 0) {
                             $sql = ', warnstart = ' . time();
                         }
                         $this->smcFunc['db_query']('', "UPDATE {db_prefix}tea_ts_users SET lastwarn = " . time() . $sql . " WHERE tsid = '" . $clid . "'");
                     }
                 } else {
                     $c->message('Error: SMF Account not Found, Please Register on Forum and use Temars EVE API mod to link Teamspeak to forum');
                 }
             }
         }
     } catch (Exception $e) {
         die($e->getMessage());
         $_SESSION['tea_ts_error'][] = $e->getMessage();
     }
 }
示例#2
0
<?php 
date_default_timezone_set("Europe/Paris");
require_once "libraries/TeamSpeak3/TeamSpeak3.php";
TeamSpeak3::init();
header('Content-Type: text/html; charset=utf8');
$status = "offline";
$count = 0;
$max = 0;
try {
    $ts3 = TeamSpeak3::factory("serverquery://" . $ts3queryuser . ":" . $ts3querypassword . "@" . $ipteamspeak3 . ":" . $ts3queryport . "/?server_port=" . $portteamspeak3 . "&use_offline_as_virtual=1&no_query_clients=1");
    $status = $ts3->getProperty("virtualserver_status");
    $count = $ts3->getProperty("virtualserver_clientsonline") - $ts3->getProperty("virtualserver_queryclientsonline");
    $max = $ts3->getProperty("virtualserver_maxclients");
} catch (Exception $e) {
}