Esempio n. 1
1
    protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
    {
        $visitor = XenForo_Visitor::getInstance();
        if (XenForo_Permission::hasPermission($visitor['permissions'], 'moturdrn_gw2api', 'verified')) {
            require_once "library/Moturdrn/TS3GW2Auth/Includes/TeamSpeak3/ts3admin.class.php";
            $tsAdmin = new ts3admin(XenForo_Application::getOptions()->ts3gw2auth_ts3server, XenForo_Application::getOptions()->ts3gw2auth_ts3sqport);
            if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
                $tsAdmin->login(XenForo_Application::getOptions()->ts3gw2auth_ts3username, XenForo_Application::getOptions()->ts3gw2auth_ts3password);
                $tsAdmin->selectServer(XenForo_Application::getOptions()->ts3gw2auth_ts3port);
            }
            $ts3server = array();
            $serverinfo = $tsAdmin->serverInfo();
            $ts3server['server_name'] = $serverinfo['data']['virtualserver_name'];
            $ts3server['connected_clients'] = $serverinfo['data']['virtualserver_clientsonline'];
            $channellist = $tsAdmin->channelList("-topic -flags -voice -limits -icon");
            $clientlist = $tsAdmin->clientList("-uid -away -voice -times -groups -info -country -icon -ip -badges");
            foreach ($channellist['data'] as $channelInfo) {
                $ts3server['channellist'][$channelInfo['cid']] = $channelInfo;
            }
            foreach ($clientlist['data'] as $clientInfo) {
                if ($clientInfo['client_type'] == 1) {
                    $this->subtractClient($ts3server['channellist'], $clientInfo['cid']);
                } else {
                    $ts3server['clientlist'][] = $clientInfo;
                }
            }
            $ts3server['channellist'] = $this->buildTree($ts3server['channellist']);
            $ts3server['clientlist'] = $this->array_orderby($ts3server['clientlist'], 'client_talk_power', SORT_DESC, 'client_nickname', SORT_ASC);
            $output = "";
            foreach ($ts3server['channellist'] as $channel) {
                $output .= $this->outputChannel($channel, $ts3server['clientlist']);
            }
            $tsOutput = <<<HTML
<b><a href="https://www.gunnars-hold.eu/resources/gunnars-hold-ts-information.10/" class='tschannellink'>* Connection & Server Details</a></b><br />
<b><a href='ts3server://ts3.gunnars-hold.eu/?port=9987' class='tschannellink'>* Or Click Here To Connect Now!</a></b><br /><br />
{$output}
HTML;
        } else {
            $tsOutput = 'You cannot view this item';
        }
        $renderTemplateObject->setParam('tsOutput', $tsOutput);
        return $renderTemplateObject->render();
    }
 function buildCache()
 {
     $teamspeakData = array();
     $config = Config::get();
     switch ($config->ts_version) {
         case 2:
             require 'includes/libs/teamspeak/cyts/cyts.class.php';
             $ts = new cyts();
             if ($ts->connect($config->ts_server, $config->ts_tcpport, $config->ts_udpport, $config->ts_timeout)) {
                 $serverInfo = $ts->info_serverInfo();
                 $teamspeakData = array('password' => '', 'current' => $serverInfo["server_currentusers"], 'maxuser' => $serverInfo["server_maxusers"]);
                 $ts->disconnect();
             } else {
                 $error = $ts->debug();
                 throw new Exception('Teamspeak-Error: ' . implode("<br>\r\n", $error));
             }
             break;
         case 3:
             require 'includes/libs/teamspeak/ts3admin/ts3admin.class.php';
             $tsAdmin = new ts3admin($config->ts_server, $config->ts_udpport, $config->ts_timeout);
             $connected = $tsAdmin->connect();
             if (!$connected['success']) {
                 throw new Exception('Teamspeak-Error: ' . implode("<br>\r\n", $connected['errors']));
             }
             $selected = $tsAdmin->selectServer($config->ts_tcpport, 'port', true);
             if (!$selected['success']) {
                 throw new Exception('Teamspeak-Error: ' . implode("<br>\r\n", $selected['errors']));
             }
             $loggedIn = $tsAdmin->login($config->ts_login, $config->ts_password);
             if (!$loggedIn['success']) {
                 throw new Exception('Teamspeak-Error: ' . implode("<br>\r\n", $loggedIn['errors']));
             }
             $serverInfo = $tsAdmin->serverInfo();
             if (!$serverInfo['success']) {
                 throw new Exception('Teamspeak-Error: ' . implode("<br>\r\n", $serverInfo['errors']));
             }
             $teamspeakData = array('password' => $serverInfo['data']['virtualserver_password'], 'current' => $serverInfo['data']['virtualserver_clientsonline'] - 1, 'maxuser' => $serverInfo['data']['virtualserver_maxclients']);
             $tsAdmin->logout();
             break;
     }
     return $teamspeakData;
 }
<?php

include 'TS3Admin.php';
/*-------SETTINGS-------*/
$ts3_ip = 'localhost';
$ts3_queryport = 10001;
$ts3_user = '******';
$ts3_pass = '******';
/*----------------------*/
$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
    $tsAdmin->login($ts3_user, $ts3_pass);
    $link = mysqli_connect("localhost", "user", "password", "database") or die("Error " . mysqli_error($link));
    $query_mode = "SELECT * FROM server_properties WHERE value = '3' and ident = 'virtualserver_hostmessage_mode'";
    $query_msg = "SELECT * FROM server_properties WHERE value LIKE '%error%' or value LIKE '%plugin%' or value LIKE '%sound%' or value LIKE '%audio%' or value LIKE '%missing%' or value LIKE '%portal%' and ident = 'virtualserver_hostmessage'";
    $query_name = "SELECT * FROM server_properties WHERE value LIKE '%error%' or value LIKE '%plugin%' or value LIKE '%sound%' or value LIKE '%audio%' or value LIKE '%missing%' or value LIKE '%portal%' and ident = 'virtualserver_welcomemessage'";
    // Hostmessage mode
    $result = $link->query($query_mode);
    while ($row = mysqli_fetch_array($result)) {
        $id = $row['server_id'];
        // echo "Selected server id = " . $id . PHP_EOL;
        $tsAdmin->selectServer($id, 'serverId');
        $info = $tsAdmin->serverInfo();
        $data = array();
        $data['virtualserver_hostmessage_mode'] = '0';
        $tsAdmin->serverEdit($data);
        if (count($tsAdmin->getDebugLog()) > 0) {
            foreach ($tsAdmin->getDebugLog() as $logEntry) {
                echo $logEntry . PHP_EOL;
            }
        }
Esempio n. 4
0
function ShowOverviewPage()
{
    global $CONF, $LNG, $PLANET, $USER, $db, $resource;
    $PlanetRess = new ResourceUpdate();
    $PlanetRess->CalcResource();
    $PlanetRess->SavePlanetToDB();
    $template = new template();
    $template->getplanets();
    $AdminsOnline = $AllPlanets = $Moon = array();
    foreach ($template->UserPlanets as $ID => $CPLANET) {
        if ($ID == $_SESSION['planet'] || $CPLANET['planet_type'] == 3) {
            continue;
        }
        if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) {
            $Queue = explode(';', $CPLANET['b_building_id']);
            $CurrBuild = explode(',', $Queue[0]);
            $BuildPlanet = $LNG['tech'][$CurrBuild[0]] . " (" . $CurrBuild[1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($CurrBuild[3] - TIMESTAMP) . ")</span>";
        } else {
            $BuildPlanet = $LNG['ov_free'];
        }
        $AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet);
    }
    if ($PLANET['id_luna'] != 0) {
        $Moon = $db->uniquequery("SELECT `id`, `name` FROM " . PLANETS . " WHERE `id` = '" . $PLANET['id_luna'] . "';");
    }
    if (!empty($PLANET['b_building'])) {
        $Queue = explode(';', $PLANET['b_building_id']);
        $CurrBuild = explode(',', $Queue[0]);
        $Build = $LNG['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')<br><div id="blc">"' . pretty_time($PLANET['b_building'] - TIMESTAMP) . '</div>';
        $template->execscript('BuildTime();');
    } else {
        $Build = $LNG['ov_free'];
    }
    $Teamspeak = '';
    if ($CONF['ts_modon'] == 1) {
        if ($CONF['ts_version'] == 2) {
            include_once ROOT_PATH . "includes/libs/teamspeak/class.teamspeak2." . PHP_EXT;
            $ts = new cyts();
            if ($ts->connect($CONF['ts_server'], $CONF['ts_tcpport'], $CONF['ts_udpport'], $CONF['ts_timeout'])) {
                $tsdata = $ts->info_serverInfo();
                $tsdata2 = $ts->info_globalInfo();
                $ts->disconnect();
                $trafges = pretty_number($tsdata2["total_bytessend"] / 1024 / 1024 + $tsdata2["total_bytesreceived"] / 1024 / 1024);
                $Teamspeak = sprintf($LNG['ov_teamspeak_v2'], $CONF['ts_server'], $CONF['ts_udpport'], $USER['username'], $tsdata["server_currentusers"], $tsdata["server_maxusers"], $tsdata["server_currentchannels"], $trafges);
            } else {
                $Teamspeak = $LNG['ov_teamspeak_not_online'];
            }
        } elseif ($CONF['ts_version'] == 3) {
            $ip = $CONF['ts_server'];
            $port = $CONF['ts_tcpport'];
            $t_port = $CONF['ts_udpport'];
            $sid = $CONF['ts_timeout'];
            require_once ROOT_PATH . "includes/libs/teamspeak/class.teamspeak3." . PHP_EXT;
            $tsAdmin = new ts3admin($ip, $t_port);
            if ($tsAdmin->connect()) {
                $tsAdmin->selectServer($sid);
                #$tsAdmin->login($username, $password); Insert the SA Account Details, if Teamspeak banned you.
                $sinfo = $tsAdmin->serverInfo();
                $tsAdmin->logout();
                $tsAdmin->quit();
                $trafges = round($sinfo['connection_bytes_received_total'] / 1024 / 1024 + $sinfo['connection_bytes_sent_total'] / 1024 / 1024, 2);
                $Debug = $tsAdmin->getDebugLog();
                if ($Debug == "Error while fetching: 'error id=518 msg=not logged in'<br>") {
                    $Teamspeak = sprintf($LNG['ov_teamspeak_v3'], $ip, $port, $USER['username'], $sinfo['virtualserver_password'], $sinfo['virtualserver_clientsonline'] - 1, $sinfo['virtualserver_maxclients'], $sinfo['virtualserver_channelsonline'], $trafges);
                } else {
                    $Teamspeak = $Debug;
                }
            } else {
                $Teamspeak = $LNG['ov_teamspeak_not_online'];
            }
        }
    }
    $OnlineAdmins = $db->query("SELECT `id`,`username` FROM " . USERS . " WHERE `onlinetime` >= '" . (TIMESTAMP - 10 * 60) . "' AND `authlevel` > '0';");
    while ($AdminRow = $db->fetch_array($OnlineAdmins)) {
        $AdminsOnline[$AdminRow['id']] = $AdminRow['username'];
    }
    $db->free_result($OnlineAdmins);
    $template->loadscript('mbContainer.js');
    $template->loadscript('overview.js');
    $template->execscript('GetFleets(true);');
    $template->page_header();
    $template->page_topnav();
    $template->page_leftmenu();
    $template->page_planetmenu();
    $template->page_footer();
    $template->assign_vars(array('user_rank' => sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $LNG['ov_of'], $CONF['users_amount']), 'is_news' => $CONF['OverviewNewsFrame'], 'news' => makebr($CONF['OverviewNewsText']), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'buildtime' => $PLANET['b_building'], 'userid' => $USER['id'], 'username' => $USER['username'], 'build' => $Build, 'Moon' => $Moon, 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'Teamspeak' => $Teamspeak, 'messages' => $USER['new_message'] > 0 ? $USER['new_message'] == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($USER['new_message'])) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ov_news' => $LNG['ov_news'], 'fcm_moon' => $LNG['fcm_moon'], 'ov_server_time' => $LNG['ov_server_time'], 'ov_planet' => $LNG['ov_planet'], 'ov_planetmenu' => $LNG['ov_planetmenu'], 'ov_diameter' => $LNG['ov_diameter'], 'ov_distance_unit' => $LNG['ov_distance_unit'], 'ov_developed_fields' => $LNG['ov_developed_fields'], 'ov_max_developed_fields' => $LNG['ov_max_developed_fields'], 'ov_fields' => $LNG['ov_fields'], 'ov_temperature' => $LNG['ov_temperature'], 'ov_aprox' => $LNG['ov_aprox'], 'ov_temp_unit' => $LNG['ov_temp_unit'], 'ov_to' => $LNG['ov_to'], 'ov_position' => $LNG['ov_position'], 'ov_points' => $LNG['ov_points'], 'ov_events' => $LNG['ov_events'], 'ov_admins_online' => $LNG['ov_admins_online'], 'ov_no_admins_online' => $LNG['ov_no_admins_online'], 'ov_userbanner' => $LNG['ov_userbanner'], 'ov_teamspeak' => $LNG['ov_teamspeak'], 'ov_your_planet' => $LNG['ov_your_planet'], 'ov_coords' => $LNG['ov_coords'], 'ov_planet_name' => $LNG['ov_planet_name'], 'ov_actions' => $LNG['ov_actions'], 'ov_abandon_planet' => $LNG['ov_abandon_planet'], 'ov_planet_rename' => $LNG['ov_planet_rename'], 'ov_planet_rename_action' => $LNG['ov_planet_rename_action'], 'ov_password' => $LNG['ov_password'], 'ov_with_pass' => $LNG['ov_with_pass'], 'ov_security_confirm' => $LNG['ov_security_confirm'], 'ov_security_request' => $LNG['ov_security_request'], 'ov_delete_planet' => $LNG['ov_delete_planet'], 'ov_planet_abandoned' => $LNG['ov_planet_abandoned'], 'path' => PROTOCOL . $_SERVER['HTTP_HOST'] . HTTP_ROOT));
    $template->show("overview_body.tpl");
}
Esempio n. 5
0
require 'class/ts3admin.class.php';
#Podłączanie config.php
require 'config.php';
#Podłączanie functions.php
require 'functions.php';
echo "\n";
logo();
echo "Checking version...\n";
$version = str_replace(array("\t", "\n"), "", checkversion());
if ($version != $config['bot']['version']) {
    echo "Warning!\nLatest version: " . $version . "\nYour version: " . $config['bot']['version'] . "\nWe recommend update\n\n";
} else {
    echo "OK! - Version up to date\n\n";
}
#Budowanie nowego obiektu
$tsAdmin = new ts3admin($config['server']['ip'], $config['server']['queryport']);
#Sprawdzanie połączenia z serwerem
if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
    #Logowanie się na użytkownika Query
    $tsAdmin->login($config['query']['login'], $config['query']['password']);
    #Wybieranie serwera
    $tsAdmin->selectServer($config['server']['port']);
    #Ustawianie nazwy bota
    $tsAdmin->setName($config['bot']['nickname']);
    #Przenoszenie bota do wybranego kanału
    $whoami = $tsAdmin->getElement('data', $tsAdmin->whoAmI());
    $tsAdmin->clientMove($whoami['client_id'], $config['bot']['channel']);
    echo "Connection established!\n";
    $clients['aktualnie'] = listaclientow();
    $clients['record'] = str_replace(array("\t", "\n"), "", file_get_contents('tmp/userecord.txt'));
    #Pętla z funkcjami bota
Esempio n. 6
0
<?php

/**
  * 
  *			Ts-Islam
  *
**/
require "lib/ts3admin.class.php";
include 'config.php';
$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
    $tsAdmin->login($ts3_user, $ts3_pass);
    $tsAdmin->selectServer($ts3_port);
    $tsAdmin->setName($bot_nickname);
    $whoami = $tsAdmin->getElement('data', $tsAdmin->whoAmI());
    $tsAdmin->clientMove($whoami['client_id'], $bot_move);
    while (1) {
        $serverInfo = $tsAdmin->getElement('data', $tsAdmin->serverInfo());
        $clientsOnline = $serverInfo['virtualserver_clientsonline'] - $serverInfo['virtualserver_queryclientsonline'];
        if ($Channel == 1) {
            $tsAdmin->channelEdit($channel_id, array('channel_name' => $channel_name . ' ' . $clientsOnline));
        }
        if ($Server == 1) {
            $tsAdmin->serverEdit(array('virtualserver_name' => $server_name . ' ' . $clientsOnline));
        }
        sleep($sleep);
    }
} else {
    echo "Connetcion Problem";
}
Esempio n. 7
0
 public function doAuthUnAuth($action, $ts3_dbid)
 {
     $this->_ts3group = XenForo_Application::getOptions()->ts3gw2auth_verified_group;
     $this->_ts3server = XenForo_Application::getOptions()->ts3gw2auth_ts3server;
     $this->_ts3port = XenForo_Application::getOptions()->ts3gw2auth_ts3port;
     $this->_ts3sqport = XenForo_Application::getOptions()->ts3gw2auth_ts3serverquery;
     $this->_ts3user = XenForo_Application::getOptions()->ts3gw2auth_ts3username;
     $this->_ts3pass = XenForo_Application::getOptions()->ts3gw2auth_ts3password;
     $this->_gw2world = XenForo_Application::getOptions()->ts3gw2auth_worldid;
     $this->_ts3prefix = XenForo_Application::getOptions()->ts3gw2auth_keyprefix;
     require_once "library/Moturdrn/TS3GW2Auth/Includes/TeamSpeak3/ts3admin.class.php";
     $tsAdmin = new ts3admin($this->_ts3server, $this->_ts3sqport);
     if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
         $tsAdmin->login($this->_ts3user, $this->_ts3pass);
         $tsAdmin->selectServer($this->_ts3port);
     }
     if ($action == 'Auth') {
         $tsAdmin->serverGroupAddClient($this->_ts3group, $ts3_dbid);
     } elseif ($action == 'UnAuth') {
         $tsAdmin->serverGroupDeleteClient($this->_ts3group, $ts3_dbid);
     }
 }
Esempio n. 8
0
<?php 
require 'ts3admin.class.php';
require 'config.php';
$tsAdmin = new ts3admin($config['ip'], $config['query_port']);
if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
    $tsAdmin->login($config['login'], $config['password']);
    $tsAdmin->selectServer($config['port']);
    $tsAdmin->setName($config['name']);
    $poketimer = date('r');
    #Pke function
    function poke()
    {
        global $config;
        global $tsAdmin;
        global $poketimer;
        #Zamiana listy grup na tablice
        $groups = explode(',', $config['group']);
        #Sprawdzenie czy można już wysłać poke
        if (date('r') > $poketimer) {
            #Sprawdzanie każdej grupy
            foreach ($groups as $temp_groups) {
                #Pobranie danych członków grupy
                $ids = $tsAdmin->serverGroupClientList($temp_groups, true);
                #Sprawdzenie każdego członka grupy
                foreach ($ids['data'] as $ids_temp) {
                    #Pobranie nicku oraz spradzenie dostępności użytkownika
                    $find = $tsAdmin->clientFind($ids_temp['client_nickname']);
                    #Jeżeli znaleziono użytkownika
                    if ($find['success'] == true) {
                        foreach ($find['data'] as $find_temp) {
                            #Wysyłanie poke
Esempio n. 9
0
 public static function refreshAPIData()
 {
     /*
      * We need the Teamspeak 3 and GW2 API libraries
      */
     require_once "library/Moturdrn/TS3GW2Auth/Includes/GW2_API_Tools/GW2_API_Tools.php";
     require_once "library/Moturdrn/TS3GW2Auth/Includes/TeamSpeak3/ts3admin.class.php";
     $tsAdmin = new ts3admin(XenForo_Application::getOptions()->ts3gw2auth_ts3server, XenForo_Application::getOptions()->ts3gw2auth_ts3serverquery);
     if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
         $tsAdmin->login(XenForo_Application::getOptions()->ts3gw2auth_ts3username, XenForo_Application::getOptions()->ts3gw2auth_ts3password);
         $tsAdmin->selectServer(XenForo_Application::getOptions()->ts3gw2auth_ts3port);
     }
     $logArray = array();
     /*
      * Create the Auth model for getting keys etc
      */
     $authModel = XenForo_Model::create('Moturdrn_TS3GW2Auth_Model_Auth');
     $checkSchedule = self::CHECK_EVERY_HOURS;
     $lastChecked_date = date('Y-m-d H:i:s', strtotime("-{$checkSchedule} hours"));
     $lastChecked = strtotime($lastChecked_date);
     $auths = $authModel->getAuthOlderThan($lastChecked);
     $checkDate = strtotime("now");
     foreach ($auths as $auth) {
         $APIData = gw2_api_request('/v2/account', $auth['gw2_apikey']);
         $response = json_decode($APIData[count($APIData) - 1], true);
         /* API Returned OK - Key Valid */
         if ($APIData[0] == 'HTTP/1.1 200 OK') {
             /**     @var $authWriter Moturdrn_TS3GW2Auth_DataWriter_Auth   * */
             $authWriter = XenForo_DataWriter::create('Moturdrn_TS3GW2Auth_DataWriter_Auth');
             $authWriter->setExistingData($auth['ts3_uniqueid']);
             $authWriter->set('gw2_name', $response['name']);
             $authWriter->set('gw2_account_guid', $response['id']);
             $authWriter->set('gw2_world', $response['world']);
             $authWriter->set('last_check', $checkDate);
             $authWriter->save();
             /* API Returned Bad Request - Key Revoked */
         } elseif ($APIData[0] == 'HTTP/1.1 400 Bad Request' && $response['text'] == 'invalid key') {
             /**     @var $authWriter Moturdrn_TS3GW2Auth_DataWriter_Auth   * */
             $authWriter = XenForo_DataWriter::create('Moturdrn_TS3GW2Auth_DataWriter_Auth');
             $authWriter->setExistingData($auth['ts3_uniqueid']);
             $authWriter->set('gw2_world', 0);
             $authWriter->save();
             $logWriter = XenForo_DataWriter::create('Moturdrn_TS3GW2Auth_DataWriter_Log');
             $logWriter->set('date', $checkDate);
             $logWriter->set('ts3_uniqueid', $auth['ts3_uniqueid']);
             $logWriter->set('ts3_dbid', $auth['ts3_dbid']);
             $logWriter->set('message', 'API Key Not Valid');
             $logWriter->set('apikey', $auth['gw2_apikey']);
             $logWriter->set('apidata', serialize($APIData));
             $logWriter->set('extradata', '');
             $logWriter->save();
         }
     }
     /*
      * Get Verified TS3 IDs and Unverified TS3 IDs
      */
     $verified = $authModel->getAuthVerified(XenForo_Application::getOptions()->ts3gw2auth_worldid);
     $verifiedMembers = $currentMembers = $newMembers = $oldMembers = array();
     foreach ($verified as $key => $addToGroup) {
         $verifiedMembers[] = $addToGroup['ts3_uniqueid'];
     }
     $group_members = $tsAdmin->serverGroupClientList(XenForo_Application::getOptions()->ts3gw2auth_verified_group, true);
     foreach ($group_members['data'] as $member) {
         $currentMembers[] = $member['client_unique_identifier'];
     }
     $newMembers = array_diff($verifiedMembers, $currentMembers);
     $oldMembers = array_diff($currentMembers, $verifiedMembers);
     foreach ($newMembers as $newMember) {
         $ts3_dbid = $tsAdmin->clientGetDbIdFromUid($newMember);
         if ($ts3_dbid['success'] == 1) {
             $tsAdmin->serverGroupAddClient(XenForo_Application::getOptions()->ts3gw2auth_verified_group, $ts3_dbid['data']['cldbid']);
         }
     }
     foreach ($oldMembers as $oldMember) {
         $ts3_dbid = $tsAdmin->clientGetDbIdFromUid($oldMember);
         if ($ts3_dbid['success'] == 1) {
             $tsAdmin->serverGroupDeleteClient(XenForo_Application::getOptions()->ts3gw2auth_verified_group, $ts3_dbid['data']['cldbid']);
         }
     }
 }
Esempio n. 10
0
<?php

/**
  * 
  *			Ts-Islam
  *
**/
date_default_timezone_set("Asia/Riyadh");
require "libraries/ts3admin.class.php";
include 'config.php';
$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
    $tsAdmin->login($ts3_user, $ts3_pass);
    $tsAdmin->selectServer($ts3_port);
    $tsAdmin->setName($bot_nickname);
    $whoami = $tsAdmin->getElement('data', $tsAdmin->whoAmI());
    $tsAdmin->clientMove($whoami['client_id'], $bot_move);
    //█▀▀█ ▄█─ █▀█ █▀▀█ █▀▀ ─█▀█─ ▄▀▀▄ ▀▀▀█ ▄▀▀▄ ▄▀▀▄
    //█▄▀█ ─█─ ─▄▀ ──▀▄ ▀▀▄ █▄▄█▄ █▄▄─ ──█─ ▄▀▀▄ ▀▄▄█
    //█▄▄█ ▄█▄ █▄▄ █▄▄█ ▄▄▀ ───█─ ▀▄▄▀ ─▐▌─ ▀▄▄▀ ─▄▄▀
    //▄
    //─
    //▀
    $line1[0] = "█▀▀█";
    $line2[0] = "█▄▀█";
    $line3[0] = "█▄▄█";
    $line1[1] = "▄█─";
    $line2[1] = "─█─";
    $line3[1] = "▄█▄";
    $line1[2] = "█▀█";
    $line2[2] = "─▄▀";
Esempio n. 11
0
function tslink_update_groups($mybb_uid)
{
    if (!isset($messages)) {
        $messages = [];
    }
    $messages[] = 'In the following part we gonna update the user his groups on the TS server.';
    require __DIR__ . '/config.php';
    // Connect to the database.
    $ConnectDB = new mysqli($hostname, $username, $password, $database);
    // check connection
    if ($ConnectDB->connect_errno) {
        die($ConnectDB->connect_error);
    }
    // Get the member from the mybb database.
    $getit = "SELECT * FROM {$table} WHERE uid = '{$mybb_uid}' LIMIT 1";
    $messages['getit_query'] = $getit;
    $rows = $ConnectDB->query($getit);
    $row = $rows->fetch_array(MYSQLI_ASSOC);
    $messages['found_member'] = 'User ID: ' . $row['uid'] . ' Username: '******'username'];
    // Get the memberstatus from the user.
    $memberstatus = $row['memberstatus'];
    $messages['memberstatus'] = $memberstatus;
    // Let's determine which servergroup to use according to the status of the user.
    if ($memberstatus == '2') {
        $ServerGroupID_ToAdd = $ts3_sgid_vip_member;
    } elseif ($memberstatus == '1') {
        $ServerGroupID_ToAdd = $ts3_sgid_don_member;
    } else {
        $ServerGroupID_ToAdd = $ts3_sgid_member;
    }
    $messages['ServerGroupID_ToAdd'] = $ServerGroupID_ToAdd;
    // Get the user's unique id's from the mybb database
    $get_ts_uids = 'SELECT * FROM ' . TABLE_PREFIX . "tslink_uids WHERE uid = '{$mybb_uid}' ";
    $messages['get_ts_uids_query'] = $get_ts_uids;
    $ts_unique_ids = $ConnectDB->query($get_ts_uids);
    foreach ($ts_unique_ids as $ts_unique_id) {
        $messages['registered_ts_db_entries'][] = 'TS UID: ' . $ts_unique_id['ts_uid'] . ' TS CLDBID: ' . $ts_unique_id['ts_cldbid'];
    }
    $messages['groups_wont_be_removed'] = implode(',', $ts3_sgid_dont_remove);
    // Build a new ts3admin object.
    $ts3 = new ts3admin($ts3_server, $ts3_query_port);
    // Connect to the TS server.
    if ($ts3->getElement('success', $ts3->connect())) {
        $messages['ts_connection'] = 'Successful';
        // Login to the TS server.
        if ($ts3->getElement('success', $ts3->login($ts3_username, $ts3_password))) {
            $messages['ts3_login'] = '******';
            // Select virtual server.
            if ($ts3->getElement('success', $ts3->selectServer($ts3_server_port))) {
                $messages['ts3_virtual_server_select'] = 'Successful';
                // Set displayed name in TS to given
                $ts3->setName($ts3_nickname);
                foreach ($ts_unique_ids as $ts_unique_id) {
                    // First lets remove all groups the user is member of.
                    // First get all servergroups the user is member of.
                    $ClientServerGroups = $ts3->servergroupsbyclientid($ts_unique_id['ts_cldbid']);
                    $csg = [];
                    $c = 0;
                    if (is_array($ClientServerGroups['data'])) {
                        foreach ($ClientServerGroups['data'] as $ClientServerGroup) {
                            $messages['found_groups']['CLDBID_' . $ts_unique_id['ts_cldbid']][] = 'sgid: ' . $ClientServerGroup['sgid'] . ' Name: ' . $ClientServerGroup['name'];
                        }
                    }
                    // For every servergroup found, remove it.
                    if (is_array($ClientServerGroups['data'])) {
                        foreach ($ClientServerGroups['data'] as $Client_ServerGroup) {
                            $csg[] = $Client_ServerGroup['sgid'];
                        }
                    }
                    foreach ($csg as $ClientServerGroupID) {
                        // Except for the servergroups we don't want to have removed.
                        if (!in_array($ClientServerGroupID, $ts3_sgid_dont_remove)) {
                            try {
                                $messages['SGID_' . $ClientServerGroupID]['removing_from'][] = 'CLDBID: ' . $ts_unique_id['ts_cldbid'];
                                $removeResults = $ts3->serverGroupDeleteClient($ClientServerGroupID, $ts_unique_id['ts_cldbid']);
                                if ($removeResults['success']) {
                                    $messages['SGID_' . $ClientServerGroupID]['removing_from_result']['CLDBID_' . $ts_unique_id['ts_cldbid']] = 'Succes.';
                                } else {
                                    $messages['SGID_' . $ClientServerGroupID]['removing_from_result']['CLDBID_' . $ts_unique_id['ts_cldbid']] = $removeResults['errors'];
                                }
                            } catch (Exception $e) {
                                // Catches the error(s) if any. But don't do anything with it.
                            }
                        }
                    }
                    $c++;
                    try {
                        // Add the user to the servergroup.
                        $messages['SGID_' . $ServerGroupID_ToAdd]['adding_to'][] = 'CLDBID: ' . $ts_unique_id['ts_cldbid'];
                        $serverGroupAddClientResults = $ts3->serverGroupAddClient($ServerGroupID_ToAdd, $ts_unique_id['ts_cldbid']);
                        if ($serverGroupAddClientResults['success']) {
                            $messages['SGID_' . $ServerGroupID_ToAdd]['adding_to_result']['CLDBID_' . $ts_unique_id['ts_cldbid']] = 'Succes.';
                        } else {
                            $messages['SGID_' . $ServerGroupID_ToAdd]['adding_to_result']['CLDBID_' . $ts_unique_id['ts_cldbid']] = $serverGroupAddClientResults['errors'];
                        }
                        //$messages[$ServerGroupID_ToAdd]['adding_to_result'][] = $serverGroupAddClientResults;
                    } catch (Exception $e) {
                        // Catches the error(s) if any. But don't do anything with it.
                    }
                }
            } else {
                echo '<p>Could not select the virtual server.</p> <p>Please check the TS server port in the config!</p> <p>Also make sure this (UDP) port is open in the outgoing firewall!</p>';
                $messages['ts3_virtual_server_select'] = 'Could not select the virtual server.';
            }
        } else {
            echo '<p>Could not login to the TS server.</p> <p>Please check the username and password in the config!</p>';
            $messages['ts3_login'] = '******';
        }
    } else {
        echo '<p>Connection to the TS server could not be established.</p> <p>Please check the TS server and TS server query port in the config!</p> <p>Also make sure this (TCP) port is open in the outgoing firewall!</p>';
        $messages['ts3_connect'] = 'Connection to the TS server could not be established.';
    }
    if (count($ts3->getDebugLog()) > 0) {
        $messages['ts3_add_remove_debuglog'] = $ts3->getDebugLog();
    }
    // Close connection
    $ConnectDB->close();
    return $messages;
}
Esempio n. 12
0
#avoid serveradmin
$ts3_pass = $configs['pass'];
$ts3_port = $configs['port'];
$mode = $configs['mode'];
#1: send to client | 2: send to channel | 3: send to server
$target = $configs['target'];
#serverID
$botName = $configs['botName'];
$channel_deafults = array("channel_flag_permanent" => 1, "channel_codec" => 4, "channel_codec_quality" => 6);
$permissions_deafult = array("i_channel_needed_delete_power" => '75', "i_channel_needed_permission_modify_power" => '70');
$channel_info = array('0' => array('channel_name' => "[cspacer000] Channel Name", 'channel_topic' => "Throws on the Go"), '1' => array('channel_name' => "Channel 01", 'channel_topic' => "This is a sub-level channel"), '2' => array('channel_name' => "Channel 02", 'channel_topic' => "This is a sub-level channel"), '3' => array('channel_name' => "Channel 03", 'channel_topic' => "This is a sub-level channel"));
/*-------TS3 Object-------*/
#Include ts3admin.class.php
require "../vendor/autoload.php";
#build a new ts3admin object
$tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
if ($tsAdmin->getElement('success', $tsAdmin->connect())) {
    #login as serveradmin
    $tsAdmin->login($ts3_user, $ts3_pass);
    #select teamspeakserver
    $tsAdmin->selectServer($ts3_port);
    #set bot name
    $tsAdmin->setName($botName);
    #Create channel
    //Check that there is channel information to be used
    if (!empty($channel_info)) {
        //Loop through array to create each channel
        foreach ($channel_info as $key => $value) {
            //Merge custom channel information with default settings
            $merged_array = $value + $channel_deafults;
            // preserves keys
Esempio n. 13
0
<?php

header("Content-type: image/jpeg");
putenv('GDFONTPATH=' . realpath('.'));
require_once "ts3admin.class.php";
$config = array('ip' => '127.0.0.1', 'port' => '9987', 'query_port' => '10011');
$tsServer = new ts3admin($config['ip'], $config['query_port']);
if ($tsServer->getElement('success', $tsServer->connect())) {
    $tsServer->selectServer($config['port']);
    $player = $tsServer->hostInfo();
    $clients = $tsServer->clientList();
    $name = $tsServer->serverList();
    $hostname = preg_replace("/[^a-zA-Z0-9_ %\\[\\]\\.\\(\\)%@#\$!\\/:|,-]/s", "", $name['data']['0']['virtualserver_name']);
    $plr_count = $player['data']['virtualservers_total_clients_online'];
    $max_plrs = $player['data']['virtualservers_total_maxclients'];
} else {
    $max_plrs = "0";
    $hostname = "Serwer jest OFFLINE!!!";
    $plr_count = "0";
}
$image = imagecreatefromjpeg("ts.jpg");
$color = ImageColorAllocate($image, 255, 255, 255);
$colorobr = ImageColorAllocate($image, 0, 0, 0);
imagettftext($image, 10, 0, -10, 8, $color, "visitor.ttf", $hostname);
imagettftext($image, 10, 0, 225, 17, $color, "visitor.ttf", $config['ip'] . $config['port']);
imagettftext($image, 10, 0, 310, 8, $color, "visitor.ttf", $plr_count . "/" . $max_plrs);
imagealphablending($image, false);
imagesavealpha($image, true);
imagepng($image);
ImageDestroy($image);
Esempio n. 14
-1
<?php

$ts = new ts3admin(gethostbyname('123.123.123.123'), 10011);
$ts_connect = $ts->connect();
if (!$ts_connect['success']) {
    exit;
}
$ts_login = $ts->login("serveradmin", "password");
if (!$ts_login['success']) {
    exit;
}
$ts_selectServer = $ts->selectServer(9987);
if (!$ts_selectServer['success']) {
    exit;
}