本文整理汇总了PHP中TeamSpeak3::init方法的典型用法代码示例。如果您正苦于以下问题:PHP TeamSpeak3::init方法的具体用法?PHP TeamSpeak3::init怎么用?PHP TeamSpeak3::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TeamSpeak3
的用法示例。
在下文中一共展示了TeamSpeak3::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: online_users
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: date_default_timezone_set
<?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) {
}