当前位置: 首页>>代码示例>>PHP>>正文


PHP TeamSpeak3类代码示例

本文整理汇总了PHP中TeamSpeak3的典型用法代码示例。如果您正苦于以下问题:PHP TeamSpeak3类的具体用法?PHP TeamSpeak3怎么用?PHP TeamSpeak3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TeamSpeak3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ts3_co

function ts3_co()
{
    global $ts3_selected, $ts3_host;
    $ts3_host = TeamSpeak3::factory("serverquery://213.246.55.19:10011/?nickname=MOGG");
    $ts3_host->serverSelect(1);
    return $ts3_selected = $ts3_host->serverGetSelected();
    //$ts3_myid = $ts3_host->whoamiGet('client_id') ;
    //$ts3_defaultchan = $ts3_host->whoamiGet('client_channel_id') ;
}
开发者ID:OlivierLamiraux,项目名称:mtgas,代码行数:9,代码来源:ts3.php

示例2: get_avatars

function get_avatars($ts3, $mysqlcon, $lang, $dbname, $slowmode, $jobid, $timezone)
{
    $starttime = microtime(true);
    $sqlmsg = '';
    $sqlerr = 0;
    $count = 0;
    try {
        usleep($slowmode);
        $tsfilelist = $ts3->channelFileList($cid = "0", $cpw = "", $path = "/");
    } catch (Exception $e) {
        if ($e->getCode() != 1281) {
            echo DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u "), "get_avatars 1:", $e->getCode(), ': ', "Error by getting Avatarlist: ", $e->getMessage(), "\n";
            $sqlmsg .= $e->getCode() . ': ' . "Error by getting Avatarlist: " . $e->getMessage();
            $sqlerr++;
        }
    }
    $fsfilelist = opendir(substr(__DIR__, 0, -4) . 'avatars/');
    while (false !== ($fsfile = readdir($fsfilelist))) {
        if ($fsfile != '.' && $fsfile != '..') {
            $fsfilelistarray[$fsfile] = filemtime(substr(__DIR__, 0, -4) . 'avatars/' . $fsfile);
        }
    }
    if (isset($tsfilelist)) {
        foreach ($tsfilelist as $tsfile) {
            $fullfilename = '/' . $tsfile['name'];
            $uuidasbase16 = substr($tsfile['name'], 7);
            if (!isset($fsfilelistarray[$uuidasbase16 . '.png']) || $tsfile['datetime'] > $fsfilelistarray[$uuidasbase16 . '.png']) {
                if (substr($tsfile['name'], 0, 7) == 'avatar_') {
                    try {
                        usleep($slowmode);
                        $avatar = $ts3->transferInitDownload($clientftfid = "5", $cid = "0", $name = $fullfilename, $cpw = "", $seekpos = 0);
                        $transfer = TeamSpeak3::factory("filetransfer://" . $avatar["host"] . ":" . $avatar["port"]);
                        $tsfile = $transfer->download($avatar["ftkey"], $avatar["size"]);
                        $avatarfilepath = substr(__DIR__, 0, -4) . 'avatars/' . $uuidasbase16 . '.png';
                        echo DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u "), "Download avatar: ", $fullfilename, "\n";
                        file_put_contents($avatarfilepath, $tsfile);
                        $count++;
                    } catch (Exception $e) {
                        echo DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u "), "get_avatars 2:", $e->getCode(), ': ', "Error by download Avatar: ", $e->getMessage(), "\n";
                        $sqlmsg .= $e->getCode() . ': ' . "Error by download Avatar: " . $e->getMessage();
                        $sqlerr++;
                    }
                }
            }
        }
    }
    $buildtime = microtime(true) - $starttime;
    if ($sqlerr == 0) {
        if ($mysqlcon->exec("UPDATE {$dbname}.job_log SET status='0', runtime='{$buildtime}' WHERE id='{$jobid}'") === false) {
            echo DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u "), "get_avatars 3:", print_r($mysqlcon->errorInfo()), "\n";
        }
    } else {
        if ($mysqlcon->exec("UPDATE {$dbname}.job_log SET status='1', err_msg='{$sqlmsg}', runtime='{$buildtime}' WHERE id='{$jobid}'") === false) {
            echo DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u "), "get_avatars 4:", print_r($mysqlcon->errorInfo()), "\n";
        }
    }
}
开发者ID:TS-N-net,项目名称:ranksystem_dev,代码行数:57,代码来源:get_avatars.php

示例3: __construct

 function __construct()
 {
     try {
         // $this->cfg = Tools::getConfig('tsconfig_dev');
         $this->cfg = Tools::getConfig('tsconfig');
         $this->ts3 = TeamSpeak3::factory("serverquery://{$this->cfg['user']}:{$this->cfg['pass']}@{$this->cfg['host']}:{$this->cfg['qPort']}/?server_port={$this->cfg['sPort']}&nickname={$this->cfg['nick']}");
     } catch (Exception $e) {
         Tools::Log('error', 'Error', array($e));
     }
 }
开发者ID:creativewild,项目名称:ts3Chan,代码行数:10,代码来源:TsAPI.php

示例4: __construct

 /**
  * @param integer $port
  * @param string $user
  * @param string $pass
  */
 public function __construct($host, $port, $user, $pass, $timeout = 1)
 {
     $this->user = $user;
     $this->pass = $pass;
     try {
         $uri = 'serverquery://' . $host . ':' . $port;
         $uri .= '?timeout=' . $timeout . '&use_offline_as_virtual=1#no_query_clients';
         $this->query = \TeamSpeak3::factory($uri);
         $this->online = true;
     } catch (\TeamSpeak3_Transport_Exception $e) {
         $this->online = false;
     }
 }
开发者ID:Onneil,项目名称:dedipanel,代码行数:18,代码来源:QueryGateway.php

示例5: ts3connect

function ts3connect()
{
    require_once 'libraries/TeamSpeak3/TeamSpeak3.php';
    if (strlen(QUERYDISPLAYNAME) < 3) {
        $extension = "";
    } else {
        $extension = '&nickname=' . urlencode(QUERYDISPLAYNAME);
    }
    try {
        $ts3 = TeamSpeak3::factory('serverquery://' . QUERYUSER . ':' . QUERYPASS . '@' . IP . ':' . QUERYPORT . '?server_port=' . SERVERPORT . $extension);
    } catch (TeamSpeak3_Exception $e) {
        return $e;
    }
    return $ts3;
}
开发者ID:Multivit4min,项目名称:GroupAssigner,代码行数:15,代码来源:index.php

示例6: connect

 function connect($ip, $qport, $port, $name, $pass, $display = "CPTBot")
 {
     $e = false;
     $server = null;
     try {
         $server = TeamSpeak3::factory("serverquery://{$name}:{$pass}@{$ip}:{$qport}/?nickname={$display}&server_port={$port}");
     } catch (Exception $exc) {
         $e = true;
     }
     if ($e) {
         say("Couldn't reach Server {$ip}.");
         return null;
     } else {
         return new Server($server);
     }
 }
开发者ID:twyK,项目名称:CPTBot,代码行数:16,代码来源:exec.php

示例7: getData

 public static function getData(JRegistry $params, stdClass $module)
 {
     if (!$params->get('server_host') || !$params->get('server_port') || !$params->get('query_port') || !$params->get('query_login') || !$params->get('query_password')) {
         return JText::_('MOD_TEAMSPEAK3_BASIC_CONFIGURATION_MISSING');
     }
     $cache = JFactory::getCache('teamspeak3', 'output');
     $cache->setCaching(1);
     $cache->setLifeTime($params->get('cache_time', 5));
     $query = array();
     $query['server_port'] = $params->get('server_port');
     $query['timeout'] = $params->get('connection_timeout', 10);
     if ($params->get('no_query_clients', 1)) {
         $query['no_query_clients'] = 1;
     }
     $query = http_build_query($query);
     $url = 'serverquery://' . $params->get('query_login') . ':' . $params->get('query_password') . '@' . $params->get('server_host') . ':' . $params->get('query_port') . '/?' . $query;
     $key = md5($url);
     if (!($data = $cache->get($key))) {
         try {
             $ts3 = TeamSpeak3::factory($url);
             $html = new TeamSpeak3_Viewer_Html_Joomla($params);
             $html->loadCacheIcons();
             $data = new stdClass();
             $data->infos = $ts3->getInfo(true, true);
             $data->infos['caching_timestamp'] = JFactory::getDate('now', 'UTC')->toSql();
             if ($params->get('channel_id')) {
                 try {
                     $channel = $ts3->channelGetById($params->get('channel_id'));
                 } catch (TeamSpeak3_Exception $e) {
                     return $e->getMessage() . ' (' . $e->getCode() . ')';
                 }
                 $data->viewer = $channel->getViewer($html);
             } else {
                 $data->viewer = $ts3->getViewer($html);
             }
             $html->storeCacheIcons();
             $data->title = $html->getModuleTitle();
             $cache->store($data, $key);
         } catch (TeamSpeak3_Exception $e) {
             return $e->getMessage() . ' (' . $e->getCode() . ')';
         }
     }
     if ($params->get('module_title')) {
         $module->title = $data->title;
     }
     return $data;
 }
开发者ID:b2un0,项目名称:joomla-module-teamspeak-3,代码行数:47,代码来源:helper.php

示例8: checkConnection

function checkConnection($ip, $qport, $sport, $user, $pass, $nick)
{
    require_once 'libraries/TeamSpeak3/TeamSpeak3.php';
    if (strlen($nick) < 3) {
        $extension = '';
    } else {
        $extension = '&nickname=' . urlencode($nick);
    }
    try {
        $ts3 = TeamSpeak3::factory('serverquery://' . $user . ':' . $pass . '@' . $ip . ':' . $qport . '?server_port=' . $sport . $extension);
        $ts3->clientList();
        $ts3->getInfo();
    } catch (TeamSpeak3_Exception $e) {
        return '<b>TS3 Error:</b> ' . $e->getMessage();
    }
    return true;
}
开发者ID:Multivit4min,项目名称:GroupAssigner,代码行数:17,代码来源:admin.php

示例9: 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();
     }
 }
开发者ID:bgame-hunter,项目名称:temars-eve-api,代码行数:65,代码来源:TEA_TS.php

示例10: iconUpload

 /**
  * Uploads a given icon file content to the server and returns the ID of the icon.
  *
  * @param  string $data
  * @return integer
  */
 public function iconUpload($data)
 {
     $crc = crc32($data);
     $size = strlen($data);
     $upload = $this->transferInitUpload(rand(0x0, 0xffff), 0, "/icon_" . $crc, $size);
     $transfer = TeamSpeak3::factory("filetransfer://" . $upload["host"] . ":" . $upload["port"]);
     $transfer->upload($upload["ftkey"], $upload["seekpos"], $data);
     return $crc;
 }
开发者ID:TS-N-net,项目名称:ranksystem_dev,代码行数:15,代码来源:Server.php

示例11: function_exists

    $extension_openssl_text = $extension_openssl ? "Yes" : "No";
    $extension_simplexml = function_exists('simplexml_load_string');
    $extension_simplexml_color = $extension_simplexml ? "green" : "red";
    $extension_simplexml_text = $extension_simplexml ? "Yes" : "No";
    $mod_automod = version_compare($config['automod_version'], '1.0.2', '>=') ? true : false;
    $mod_automod_color = $mod_automod ? "green" : "red";
    $mod_automod_text = $mod_automod ? "Yes" : "No";
    // TeamSpeak stuff
    try {
        $nickname = "TeamSpeakDebugGuy";
        $testMessage = "Awesome, TeamSpeak integration is working!";
        $errorCode = 0;
        $errorMsg = "No errors found!";
        $teamspeak_UID_color = !empty($user->data['eveapi_ts']) ? "green" : "red";
        $teamspeak_UID_text = !empty($user->data['eveapi_ts']) ? $user->data['eveapi_ts'] : "Unknown";
        $ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $config["eveapi_ts_username"] . ":" . $config["eveapi_ts_password"] . "@" . $config["eveapi_ts_ip"] . ":" . $config["eveapi_ts_port_query"] . "/?server_port=" . $config["eveapi_ts_port_server"] . "&nickname=" . $nickname);
        $ts3_VirtualServer->clientGetByUid($user->data['eveapi_ts'])->poke($testMessage);
    } catch (Exception $e) {
        $errorCode = $e->getCode();
        $errorMsg = $e->getMessage();
    }
    $error_color = $errorCode == 0 ? "green" : "red";
    ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="en-gb" lang="en-gb">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Language" content="en-gb">
    
开发者ID:shibdib,项目名称:API-Registration-Mod-Revisited,代码行数:30,代码来源:eveapi_check.php

示例12: TeamSpeak3_Viewer_Html

<?php

// load framework files
require_once "libraries/TeamSpeak3/TeamSpeak3.php";
// connect to local server, authenticate and spawn an object for the virtual server on port 9987
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://serveradmin:648925@ts3.fatalaggressionboss.com:10011/?server_port=9987");
// build and display HTML treeview using custom image paths (remote icons will be embedded using data URI sheme)
#echo $ts3_VirtualServer->getViewer(new TeamSpeak3_Viewer_Html("images/icons/", "images/flags/", "data:image"));
echo $ts3_VirtualServer->getViewer(new TeamSpeak3_Viewer_Html());
开发者ID:ArcaneChaos,项目名称:boss-member-manager,代码行数:9,代码来源:ts3viewer.php

示例13: header

 * along with this program. If not, see <http://www.gnu.org/licenses/>
 */
header("Content-type: text/xml; charset=utf-8");
// Errors destroy the xmlvalidity
//error_reporting(0);
require_once "include/app.config.php";
require_once "../include/calladmin_helpers.php";
require_once "include/TeamSpeak3/TeamSpeak3.php";
$helpers = new CallAdmin_Helpers();
// Key set and no key given or key is wrong
if (!isset($_GET['key']) || !$helpers->keyToServerKeys($access_keys, $_GET['key'])) {
    $helpers->printXmlError("APP_AUTH_FAILURE", "CallAdmin_Ts3");
}
$ts3 = new TeamSpeak3();
try {
    $ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $user . ":" . $password . "@" . $host . ":" . $queryport . "/?server_port=" . $port);
    $count = 0;
    $uid = "";
    //$name = "";
    foreach ($ts3_VirtualServer->clientList() as $ts3_Client) {
        $uid = (string) $ts3_Client['client_unique_identifier'];
        //$name = (string)$ts3_Client['client_nickname'];
        // Is listed as admin, add him to the count
        if (in_array($uid, $access_keys[$_GET['key']])) {
            $count++;
        }
    }
} catch (TeamSpeak3_Adapter_ServerQuery_Exception $e) {
    // Nope
    $helpers->printXmlError($e->getMessage(), "CallAdmin_Ts3");
}
开发者ID:GentSynthax,项目名称:CallAdmin,代码行数:31,代码来源:onlinecount.php

示例14: array

<?php

try {
    require_once "../libraries/TeamSpeak3/TeamSpeak3.php";
    include '../data/config.php';
    echo "Conectando al servidor TeamSpeak</br>";
    $connect = "serverquery://" . $USER_QUERY . ":" . $PASS_QUERY . "@" . $HOST_QUERY . ":" . $PORT_QUERY . "/?server_port=" . $SERVER_PORT . "";
    $ts3_VirtualServer = TeamSpeak3::factory($connect);
    // Conseguimos array con los grupos
    $server_groups = $ts3_VirtualServer->serverGroupList();
    $servergroups = array();
    foreach ($server_groups as $group) {
        if ($group->type != 1) {
            continue;
        }
        if (in_array($group["sortid"], $SID_GROUP)) {
            $servergroups[] = array('name' => (string) $group, 'id' => $group->sgid, 'type' => $group->type, 'icon' => $group->iconDownload());
        }
    }
    echo "Iniciando Descarga de iconos...</br>";
    // Iteramos por grupo para guardar a archivo
    foreach ($servergroups as $group) {
        // ya estaba descargada la wea xD
        file_put_contents("./icons/" . $group['id'] . ".png", $group['icon']);
        echo "Archivo iconos/icons/" . $group['id'] . ".png" . " Creado para el grupo " . $group['name'] . "<br>";
    }
} catch (Exception $e) {
    if ($DEBUG == True) {
        //print_r($e);
        echo "[DEBUG] Ha ocurrido un error inesperado <br>";
        echo "[DEBUG] Mensaje de error DEBUG: " . $e->getMessage() . "<br>";
开发者ID:qeekus,项目名称:TS3IconManager,代码行数:31,代码来源:geticonos.php

示例15: avatarDownload

 /**
  * Downloads and returns the clients avatar file content.
  *
  * @return TeamSpeak3_Helper_String
  */
 public function avatarDownload()
 {
     if ($this["client_flag_avatar"] == 0) {
         return;
     }
     $download = $this->getParent()->transferInitDownload($this->getId(), 0, $this->avatarGetName());
     $transfer = TeamSpeak3::factory("filetransfer://" . $this->getParent()->getAdapterHost() . ":" . $download["port"]);
     return $transfer->download($download["ftkey"], $download["size"]);
 }
开发者ID:ECP-Black,项目名称:ECP,代码行数:14,代码来源:Client.php


注:本文中的TeamSpeak3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。