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') ; }
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"; } } }
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)); } }
/** * @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; } }
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; }
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); } }
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; }
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; }
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(); } }
/** * 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; }
$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">
<?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://*****:*****@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());
* 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"); }
<?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>";
/** * 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"]); }
require 'app/Infos.php'; require 'app/Keys.php'; require 'inc/db.php'; if (!isset($_SESSION['auth'])) { header('Location: login.php'); exit; } $verify = new \App\Verify($cnx); $verify->checkIndex($_SESSION['auth']['pseudo']); $infos = new \App\Infos($cnx); $port = $infos->getPort($_SESSION['auth']['pseudo']); try { /* CHANGE THIS LINE WITH YOUR TS3 QUERY INFOS */ $ts3_VirtualServer = TeamSpeak3::factory("serverquery://*****:*****@127.0.0.1:10011/?server_port=" . $port); } catch (Exception $e) { $_SESSION['flash']['danger'] = "Error your TS3 server is offline please contact admin to solve this error"; $offline = true; header('Location: offline.php'); exit; } $keys = new \App\Keys($ts3_VirtualServer); $map = $ts3_VirtualServer->getViewer(new TeamSpeak3_Viewer_Html("images/viewer/", "images/countryflags/", "data:image")); if (isset($_GET) && !empty($_GET['key'])) { $keys->generate($_GET['key']); } ?> <body class="hold-transition skin-red layout-boxed"> <div class="wrapper">
function main($id, $mode) { global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; $submit = !empty($_POST['submit']) ? true : false; $error = $data = array(); $s_hidden_fields = ''; $user->add_lang('mods/info_acp_eveapi'); switch ($mode) { case 'register_account': $this->tpl_name = 'ucp_eveapi_account'; $this->page_title = 'UCP_EVEAPI_ACCOUNT'; $data = array('username' => utf8_normalize_nfc(request_var('username', $user->data['username'], true)), 'eveapi_keyid' => request_var('eveapi_keyid', $user->data['eveapi_keyid'], true), 'eveapi_vcode' => request_var('eveapi_vcode', $user->data['eveapi_vcode'], true)); if ($submit) { $check_ary = array('eveapi_keyid' => array(array('string', false, 1, 15)), 'eveapi_vcode' => array(array('string', false, 64, 64))); if ($auth->acl_get('u_chgname') && $config['allow_namechange']) { $check_ary['username'] = array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username')); } $error = validate_data($data, $check_ary); if (!sizeof($error) && $config['eveapi_validation']) { if (!$auth->acl_get('u_chgname') || !$config['allow_namechange']) { $data['username'] = $user->data['username']; } $eveapi_teamSpeakGroups = array(); $characterInfo = eveapi_checkThisCharacter($data['eveapi_keyid'], $data['eveapi_vcode'], $data['username']); if (empty($characterInfo["error"])) { if (!empty($characterInfo["forumGroups"]) || empty($characterInfo["forumGroups"]) && $config['eveapi_nonmember']) { $eveapi_forumGroups = $characterInfo["forumGroups"]; $eveapi_teamSpeakGroups = $characterInfo["TSGroups"]; $extraGroups = eveapi_setForumGroups($user->data['user_id'], $eveapi_forumGroups, $data['username']); if ($config['eveapi_jabber_masterswitch']) { if ($config['eveapi_ejabber_switch']) { eveapi_setJabberAccess($user->data['user_id'], $characterInfo['jabber'], $extraGroups['jabber'], $data['username']); } if ($config['eveapi_openfire_switch']) { eveapi_setOpenFireAccess($user->data['user_id'], $characterInfo['openfire'], $extraGroups['openfire'], $data['username']); } } } else { $error[] = 'This character is not permitted to have an account on this forum.'; } } else { $error = array_merge($error, $characterInfo["error"]); } } $sql_ary = array('user_character_id' => isset($characterInfo["info"]["characterId"]) ? (int) $characterInfo["info"]["characterId"] : 0, 'username' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? $data['username'] : $user->data['username'], 'username_clean' => $auth->acl_get('u_chgname') && $config['allow_namechange'] ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'eveapi_keyid' => $data['eveapi_keyid'], 'eveapi_vcode' => $data['eveapi_vcode']); if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) { add_log('user', $user->data['user_id'], 'LOG_USER_UPDATE_NAME', $user->data['username'], $data['username']); } if ($data['eveapi_keyid'] != $user->data['eveapi_keyid'] || $data['eveapi_vcode'] != $user->data['eveapi_vcode']) { add_log('user', $user->data['user_id'], 'User has updated his/her EVE API information.', $user->data['username'], $data['eveapi_keyid'] . " -> " . $data['eveapi_vcode']); } $message = 'EVEAPI_UPDATED'; if (sizeof($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; $db->sql_query($sql); } } $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], 'EVEAPI_KEYID' => $data['eveapi_keyid'], 'EVEAPI_VCODE' => $data['eveapi_vcode'], 'EVEAPI_ACCESSMASK' => eveapi_getAccessMask(), 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$config['allow_name_chars'] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), 'L_TITLE' => $user->lang['UCP_EVEAPI_ACCOUNT'], 'S_EVEAPI_VALIDATE' => $config['eveapi_validation'] ? true : false, 'S_CHANGE_USERNAME' => $config['allow_namechange'] && $auth->acl_get('u_chgname') ? true : false)); break; case 'register_jabber': $this->tpl_name = 'ucp_eveapi_jabber'; $this->page_title = 'UCP_EVEAPI_JABBER'; if (!$config['eveapi_openfire_switch'] && !$config['eveapi_jabber_masterswitch'] || empty($user->data["eveapi_keyid"]) || empty($user->data["eveapi_vcode"])) { $template->assign_vars(array('L_TITLE' => $user->lang['UCP_EVEAPI_JABBER'], 'L_DISABLED' => $user->lang['EVEAPI_JABBER_DISABLED'])); break; } if ($submit) { $characterInfo = eveapi_checkThisCharacter($user->data['eveapi_keyid'], $user->data['eveapi_vcode'], $user->data['username']); if (empty($characterInfo["error"]) && (!empty($characterInfo["forumGroups"]) || empty($characterInfo["forumGroups"]) && $config['eveapi_nonmember'])) { $eveapi_forumGroups = $characterInfo["forumGroups"]; $extraGroups = eveapi_setForumGroups($user->data['user_id'], $eveapi_forumGroups, $user->data['username']); $password = eveapi_randomString(8); $result = eveapi_setOpenFireAccess($user->data['user_id'], $characterInfo['openfire'], $extraGroups['openfire'], $user->data['username'], $password); if ($result) { $user->data['user_jabber_password'] = $password; } else { $error[] = $user->lang['JABBER_REGISTRATION_FAILED']; } } } $clean_username = str_replace(array(" ", "'"), array("_", "_"), $user->data['username']); $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'JABBER_USERNAME' => $clean_username, 'JABBER_PASSWORD' => $user->data['user_jabber_password'], 'JABBER_HOST' => 'almostawesome.org', 'L_TITLE' => $user->lang['UCP_EVEAPI_JABBER'], 'L_JABBER' => $user->lang['EVEAPI_JABBER_REGISTER'], 'L_JABBER_EXPLAIN' => $user->lang['EVEAPI_JABBER_EXPLAIN'], 'L_JABBER_USERNAME' => $user->lang['EVEAPI_JABBER_USERNAME'], 'L_JABBER_PASSWORD' => $user->lang['EVEAPI_JABBER_PASSWORD'], 'L_JABBER_HOST' => $user->lang['EVEAPI_JABBER_HOST'], 'L_CHANGE_REGISTER' => empty($user->data['user_jabber_password']) ? $user->lang['REGISTER'] : $user->lang['EVEAPI_JABBER_CHANGE_PASSWORD'])); break; case 'register_ts': $this->tpl_name = 'ucp_eveapi_ts'; $this->page_title = 'UCP_EVEAPI_TS'; if (!$config['eveapi_ts_masterswitch']) { $template->assign_vars(array('L_TITLE' => $user->lang['UCP_EVEAPI_TS'], 'L_DISABLED' => $user->lang['EVEAPI_TEAMSPEAK_DISABLED'])); break; } if ($submit) { try { $nickname = $config['eveapi_ts_nickname']; if (eveapi_validateMixedalphanumeric($nickname) != 1) { $nickname = "Cyerus"; } $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); } catch (Exception $e) { $error[] = $user->lang['TEAMSPEAK_CONNECTION_FAILED']; } $eveapi_ts = eveapi_getTeamSpeakUID($user->data['username'], $ts3_VirtualServer); if (empty($eveapi_ts)) { $error[] = $user->lang['TEAMSPEAK_USERNAME_NOT_FOUND']; } else { if (empty($user->data["eveapi_keyid"]) || empty($user->data["eveapi_vcode"])) { $error[] = $user->lang['TEAMSPEAK_NO_API']; } else { $sql_ary = array('eveapi_ts' => $eveapi_ts); $eveapi_teamSpeakGroups = array(); $characterInfo = eveapi_checkThisCharacter($user->data['eveapi_keyid'], $user->data['eveapi_vcode'], $user->data['username']); if (empty($characterInfo["error"]) && (!empty($characterInfo["forumGroups"]) || empty($characterInfo["forumGroups"]) && $config['eveapi_nonmember'])) { $eveapi_forumGroups = $characterInfo["forumGroups"]; $eveapi_teamSpeakGroups = $characterInfo["TSGroups"]; $extraGroups = eveapi_setForumGroups($user->data['user_id'], $eveapi_forumGroups, $user->data['username']); if ($eveapi_ts != $user->data['eveapi_ts'] && !empty($user->data['eveapi_ts'])) { eveapi_setTeamSpeakGroups($user->data['eveapi_ts'], array(), $user->data['username']); } if ($eveapi_ts != "") { $TSverify = eveapi_setTeamSpeakGroups($eveapi_ts, $eveapi_teamSpeakGroups, $user->data['username'], $ts3_VirtualServer, $extraGroups["TS"]); if ($TSverify !== true) { $error[] = $TSverify; $sql_ary['eveapi_ts'] = $eveapi_ts = ""; } } $user->data['eveapi_ts'] = $eveapi_ts; } $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; $db->sql_query($sql); } } } $username = $user->data['username']; if (strlen($username) > 30) { $username = substr($username, 0, 30); } $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'USERNAME' => $username, 'EVEAPI_TS' => empty($user->data['eveapi_ts']) ? $user->lang['EVEAPI_TEAMSPEAK_UID_EMPTY'] : $user->data['eveapi_ts'], 'L_TITLE' => $user->lang['UCP_EVEAPI_TS'], 'L_TEAMSPEAK' => $user->lang['EVEAPI_TEAMSPEAK_REGISTER'], 'L_TEAMSPEAK_EXPLAIN' => $user->lang['EVEAPI_TEAMSPEAK_EXPLAIN'], 'L_TEAMSPEAK_USERNAME' => $user->lang['EVEAPI_TEAMSPEAK_USERNAME'], 'L_TEAMSPEAK_UID' => $user->lang['EVEAPI_TEAMSPEAK_UID'])); break; } $template->assign_vars(array('S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action)); }
<?php require_once "TeamSpeak3.php"; include 'config.php'; error_reporting(0); $ChannelName = $_POST['name']; $idUnica = $_POST['idts']; if (!$ChannelName || !$idUnica) { echo "El nombre del channel y la ID unica tienen que estar"; exit; } $ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $UserAdmin . ":" . $PWQuery . "@" . $IP_TS . ":" . $PuertoQuery . "/?server_port=" . $PuertoTS . ""); $ListaDeChannels = $ts3_VirtualServer->request("channellist")->toString(); if (strpos($ListaDeChannels, $ChannelName)) { echo "El nombre del channel esta en uso, utiliza otro"; exit; } $clID = $ts3_VirtualServer->clientGetByUid($idUnica); $top_cid = $ts3_VirtualServer->channelCreate(array("channel_name" => $ChannelName, "channel_codec" => TeamSpeak3::CODEC_SPEEX_WIDEBAND, "channel_flag_permanent" => TRUE)); $clID = $ts3_VirtualServer->clientGetByUid($idUnica); $infoCliente = $ts3_VirtualServer->execute("clientgetnamefromuid", array("cluid" => $idUnica))->toList(); $cldbid = strval($infoCliente['cldbid']); $ts3_VirtualServer->execute("clientmove", array("clid" => $clID, "cid" => $top_cid)); $ts3_VirtualServer->execute("setclientchannelgroup", array("cldbid" => $cldbid, "cid" => $top_cid, "cgid" => '5')); echo "El channel se creo correctamente.";
<?php $starttime = microtime(true); require_once 'config.php'; require_once 'lang.php'; require_once 'ts3_lib/TeamSpeak3.php'; try { $ts3_ServerInstance = TeamSpeak3::factory("serverquery://" . $cfg["user"] . ":" . $cfg["pass"] . "@" . $cfg["host"] . ":" . $cfg["query"] . "/"); $ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $cfg["user"] . ":" . $cfg["pass"] . "@" . $cfg["host"] . ":" . $cfg["query"] . "/?server_port=" . $cfg["voice"]); require_once 'mysql_connect.php'; try { $ts3_VirtualServer->selfUpdate(array('client_nickname' => $queryname)); } catch (Exception $e) { try { $ts3_VirtualServer->selfUpdate(array('client_nickname' => $queryname2)); } catch (Exception $e) { echo $lang['error'] . $e->getCode() . ': ' . $e->getMessage(); } } $todaydate = time(); $icontime = $todaydate - $warntime; $tschanarr = $ts3_VirtualServer->channelList(); foreach ($tschanarr as $channel) { $tscid[] = $channel['cid']; } if ($deleteicons == 1) { echo $lang['hldelicon'] . PHP_EOL; $count = 0; foreach ($tschanarr as $channel) { $channelid = $channel['cid']; $checkicon = $ts3_VirtualServer->channelPermList($channelid, $permsid = FALSE);
\==========================================/ */ require_once "libraries/TeamSpeak3/TeamSpeak3.php"; try { // هنا الاتصال بالسيرفر وكذا عرفت $config = array(); $config['teamspeakip'] = 'localhost'; $config['QueryName'] = 'serveradmin'; $config['QueryPass'] = ''; $config['QueryPort'] = ''; $config['PortServer'] = ''; $config['GroupIDAdmin'] = ''; $config['GroupIDactivated'] = ''; $config['GroupIDnotactivated'] = ''; $ts3_VirtualServer = TeamSpeak3::factory("serverquery://" . $config['QueryName'] . ":" . $config['QueryPass'] . "@" . $config['teamspeakip'] . ":" . $config['QueryPort'] . "/?server_port=" . $config['PortServer'] . ""); // التعرف التلقائي foreach ($ts3_VirtualServer->clientList() as $cl) { if ($cl->getProperty('connection_client_ip') == $_SERVER['REMOTE_ADDR']) { header('Content-Type: image/png'); // هذه نستعملها للتجارب في المتصفح نصيحة شيلها :) header('refresh: 3; url='); // نهاية الي تشيلة $_SESSION['ggids'] = explode(",", $cl["client_servergroups"]); if (in_array($config['GroupIDnotactivated'], $_SESSION['ggids'])) { $image_file = 'banner_notactivated.png'; } else { if (in_array($config['GroupIDactivated'], $_SESSION['ggids'])) { $image_file = 'banner_activated.png'; } else { if (in_array($config['GroupIDAdmin'], $_SESSION['ggids'])) {
public function cron() { if (!function_exists('user_delete')) { include $phpbb_root_path . 'includes/functions_user.' . $phpEx; } $cronlog = new Logging(); //cronlog("Starting"); // This script will take a while. We should disable max_execution_time. @ini_set('max_execution_time', 900); if ($config['eveapi_validation']) { // ******************************************************************* // ** STANDINGS START ************************************************ // ******************************************************************* $characterID = 0; $standingsCharacterAPI = array(); if ($config['eveapi_s_masterswitch'] && $config['eveapi_s_character'] && $config['eveapi_s_charactername'] != "") { $standingsCharacterAPI = eveapi_getStandingsCharacterAPI(); $pheal = new \Pheal\Pheal($standingsCharacterAPI['keyID'], $standingsCharacterAPI['vCode']); try { $result = $pheal->accountScope->APIKeyInfo(); if ($result->key->accessMask & 16 && ($result->key->type == "Character" || $result->key->type == "Account")) { foreach ($result->key->characters as $character) { if (strtolower($character->characterName) == strtolower($standingsCharacterAPI['characterName'])) { $characterID = $character->characterID; $characterName = $character->characterName; } } } else { cronlog("Wrong accessMask", "Standings Character -> " . $standingsCharacterAPI['characterName']); } } catch (\Pheal\Exceptions\PhealHTTPException $e) { // HTTP error cronlog('EVE API HTTP error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealAPIException $e) { // API error cronlog('EVE API Key error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealConnectionException $e) { // Connection error cronlog('EVE API Connection error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealException $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (Exception $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } if ($characterID > 0) { try { $result = $pheal->charScope->contactList(array("characterID" => $characterID)); //cronlog("Removing old Character-level standings"); $db->sql_query('DELETE FROM ' . TBL_EVEAPI_STANDINGS . ' WHERE standingsType = ' . EVEAPI_STANDINGSTYPE_CHARACTER); foreach ($result->contactList as $contact) { if ($contact->contactID < 10000000) { continue; } // Filter out NPCs (agents) if ($contact->standing != -10 && $contact->standing != -5 && $contact->standing != 0 && $contact->standing != 5 && $contact->standing != 10) { continue; } $sql = 'INSERT INTO ' . TBL_EVEAPI_STANDINGS . ' ' . $db->sql_build_array('INSERT', array("standingsName" => $contact->contactName, "standingsAmount" => $contact->standing, "standingsType" => EVEAPI_STANDINGSTYPE_CHARACTER)); $db->sql_query($sql); } //cronlog("New Character-level standings successfully imported!", "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealHTTPException $e) { // HTTP error cronlog('EVE API HTTP error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealAPIException $e) { // API error cronlog('EVE API Key error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealConnectionException $e) { // Connection error cronlog('EVE API Connection error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealException $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (Exception $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } } } $characterID = 0; if ($config['eveapi_s_masterswitch'] && ($config['eveapi_s_corporation'] || $config['eveapi_s_alliance']) && $config['eveapi_s_charactername'] != "" && $config['eveapi_s_corp_keyid'] > 0 && $config['eveapi_s_corp_vcode'] != "") { if (empty($standingsCharacterAPI)) { $standingsCharacterAPI = eveapi_getStandingsCharacterAPI(); } $pheal = new \Pheal\Pheal($config['eveapi_s_corp_keyid'], $config['eveapi_s_corp_vcode']); $characterID = 0; try { $result = $pheal->accountScope->APIKeyInfo(); if ($result->key->accessMask & 16 && $result->key->type == "Corporation" && strtolower($result->key->characters[0]->characterName) == strtolower($standingsCharacterAPI['characterName'])) { $characterID = $result->key->characters[0]->characterID; } else { cronlog("Wrong accessMask", "Standings Character -> " . $standingsCharacterAPI['characterName']); } } catch (\Pheal\Exceptions\PhealHTTPException $e) { // HTTP error cronlog('EVE API HTTP error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealAPIException $e) { // API error cronlog('EVE API Key error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealConnectionException $e) { // Connection error cronlog('EVE API Connection error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealException $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (Exception $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } if ($characterID > 0) { try { $result = $pheal->corpScope->contactList(); //cronlog("Removing old Corporation-level standings"); $db->sql_query('DELETE FROM ' . TBL_EVEAPI_STANDINGS . ' WHERE standingsType = ' . EVEAPI_STANDINGSTYPE_CORPORATION); if ($config['eveapi_s_corporation']) { foreach ($result->corporateContactList as $contact) { if ($contact->standing != -10 && $contact->standing != -5 && $contact->standing != 0 && $contact->standing != 5 && $contact->standing != 10) { continue; } $sql = 'INSERT INTO ' . TBL_EVEAPI_STANDINGS . ' ' . $db->sql_build_array('INSERT', array("standingsName" => $contact->contactName, "standingsAmount" => $contact->standing, "standingsType" => EVEAPI_STANDINGSTYPE_CORPORATION)); $db->sql_query($sql); } //cronlog("New Corporation-level standings successfully imported!", "Standings Character -> " . $standingsCharacterAPI['characterName']); } //cronlog("Removing old Alliance-level standings"); $db->sql_query('DELETE FROM ' . TBL_EVEAPI_STANDINGS . ' WHERE standingsType = ' . EVEAPI_STANDINGSTYPE_ALLIANCE); if ($config['eveapi_s_alliance']) { foreach ($result->allianceContactList as $contact) { if ($contact->standing != -10 && $contact->standing != -5 && $contact->standing != 0 && $contact->standing != 5 && $contact->standing != 10) { continue; } $sql = 'INSERT INTO ' . TBL_EVEAPI_STANDINGS . ' ' . $db->sql_build_array('INSERT', array("standingsName" => $contact->contactName, "standingsAmount" => $contact->standing, "standingsType" => EVEAPI_STANDINGSTYPE_ALLIANCE)); $db->sql_query($sql); } //cronlog("New Alliance-level standings successfully imported!", "Standings Character -> " . $standingsCharacterAPI['characterName']); } } catch (\Pheal\Exceptions\PhealHTTPException $e) { // HTTP error cronlog('EVE API HTTP error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealAPIException $e) { // API error cronlog('EVE API Key error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealConnectionException $e) { // Connection error cronlog('EVE API Connection error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (\Pheal\Exceptions\PhealException $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } catch (Exception $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), "Standings Character -> " . $standingsCharacterAPI['characterName']); } } } // ******************************************************************* // ** STANDINGS END ************************************************** // ******************************************************************* // Get rid of old Jabber access //cronlog("Clearing ejabberd accesslist"); $sql = 'DELETE FROM eveapi_jabber WHERE userID > 0 '; $db->sql_query($sql); // ******************************************************************* // ** ACTUAL CRONJOB START ******************************************* // ******************************************************************* if ($config['eveapi_ts_masterswitch']) { $nickname = $config['eveapi_ts_nickname']; if (eveapi_validateMixedalphanumeric($nickname) != 1) { $nickname = "Cyerus"; } try { $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); } catch (TeamSpeak3_Exception $e) { cronlog('TeamSpeak error: ' . $e->getCode() . ' -> ' . $e->getMessage()); $ts3_VirtualServer = false; } } if ($config['eveapi_ts_masterswitch'] && $ts3_VirtualServer || $config['eveapi_jabber_masterswitch']) { $sql = 'SELECT user_id, username, eveapi_keyid, eveapi_vcode, eveapi_ts FROM ' . USERS_TABLE . ' WHERE user_type = 0 ORDER BY username'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { if (!empty($row["eveapi_keyid"]) && !empty($row["eveapi_vcode"])) { try { $characterInfo = eveapi_checkThisCharacter($row['eveapi_keyid'], $row['eveapi_vcode'], $row['username']); if (empty($characterInfo["error"])) { $eveapi_forumGroups = array(); $eveapi_TSGroups = array(); $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET user_character_id = '" . (int) $characterInfo["info"]["characterId"] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE user_id = " . (int) $row['user_id']; $db->sql_query($sql); if (!empty($characterInfo["forumGroups"]) || empty($characterInfo["forumGroups"]) && $config['eveapi_nonmember']) { $eveapi_forumGroups = $characterInfo["forumGroups"]; $eveapi_TSGroups = $characterInfo["TSGroups"]; $extraGroups = eveapi_setForumGroups($row['user_id'], $eveapi_forumGroups, $row['username']); if ($config['eveapi_ts_masterswitch'] && !empty($row['eveapi_ts'])) { eveapi_setTeamSpeakGroups($row['eveapi_ts'], $eveapi_TSGroups, $row['username'], $ts3_VirtualServer, $extraGroups["TS"]); } if ($config['eveapi_jabber_masterswitch']) { if ($config['eveapi_ejabber_switch']) { eveapi_setJabberAccess($row['user_id'], $characterInfo['jabber'], $extraGroups['jabber'], $row['username']); } if ($config['eveapi_openfire_switch']) { eveapi_setOpenFireAccess($row['user_id'], $characterInfo['openfire'], $extraGroups['openfire'], $row['username']); } } } else { // no valid forumgroups found, probably meaning the user isn't part of any entity and should be disabled eveapi_disableForumAccount($row['user_id'], $row['username'], $row['eveapi_ts'], INACTIVE_EVEAPI_NONMEMBER, $ts3_VirtualServer); } } else { // error reported by eveapi_checkThisCharacter(), now use $characterInfo["disable"] to determine whether or not to disable. if ($characterInfo["disable"]) { eveapi_disableForumAccount($row['user_id'], $row['username'], $row['eveapi_ts'], INACTIVE_EVEAPI_INVALID, $ts3_VirtualServer); } } } catch (\Pheal\Exceptions\PhealHTTPException $e) { // HTTP error cronlog('EVE API HTTP error: ' . $e->getCode() . ' -> ' . $e->getMessage(), $row['username']); } catch (\Pheal\Exceptions\PhealAPIException $e) { // API error cronlog('EVE API Key error: ' . $e->getCode() . ' -> ' . $e->getMessage(), $row['username']); } catch (\Pheal\Exceptions\PhealConnectionException $e) { // Connection error cronlog('EVE API Connection error: ' . $e->getCode() . ' -> ' . $e->getMessage(), $row['username']); } catch (\Pheal\Exceptions\PhealException $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), $row['username']); } catch (Exception $e) { // Any other error, in other words "Unknown error" cronlog('EVE API Generic error: ' . $e->getCode() . ' -> ' . $e->getMessage(), $row['username']); } } else { // Disable user, no valid API information found! eveapi_disableForumAccount($row['user_id'], $row['username'], $row['eveapi_ts'], INACTIVE_EVEAPI_INVALID, $ts3_VirtualServer); } } $db->sql_freeresult($result); } else { cronlog("Quiting the cronjob, as no connection to the TeamSpeak 3 server could be made while TeamSpeak 3 Integration is enabled."); } // ******************************************************************* // ** ACTUAL CRONJOB END ********************************************* // ******************************************************************* } cronlog("Finished Successfully"); }
<?php session_start(); $starttime = microtime(true); require_once '../other/config.php'; require_once '../ts3_lib/TeamSpeak3.php'; require_once '../lang.php'; require_once '../other/session.php'; if (!isset($_SESSION['tsuid']) && !isset($_SESSION['tserror'])) { try { $ts3 = TeamSpeak3::factory("serverquery://" . $ts['user'] . ":" . $ts['pass'] . "@" . $ts['host'] . ":" . $ts['query'] . "/?server_port=" . $ts['voice']); if (strlen($queryname) > 27) { $queryname = substr($queryname, 0, -3) . '_st'; } else { $queryname = $queryname . '_st'; } if (strlen($queryname2) > 26) { $queryname2 = substr($queryname2, 0, -4) . '_st2'; } else { $queryname2 = $queryname2 . '_st2'; } if ($slowmode == 1) { sleep(1); } try { $ts3->selfUpdate(array('client_nickname' => $queryname)); } catch (Exception $e) { if ($slowmode == 1) { sleep(1); } try {
<?php $nickdoboot = rand(0, 99); $espaco = rand(0, 99999); //error_reporting(E_ALL); //ini_set('display_errors', 1); require_once("libraries/TeamSpeak3/TeamSpeak3.php"); if($_COOKIE["config90909982930461"]==""){ $ts3_VirtualServer = TeamSpeak3::factory("serverquery://*****:*****@XXXX:XXXX/?server_port=9987&nickname=www.CLANPUTOS.com_Canal$nickdoboot"); $grupo_do_ca = 89; $nome_canal = $_POST['canal']; $pass_canal = $_POST['senha']; $top_cid = $ts3_VirtualServer->channelCreate(array( "channel_name" => "[cspacer]$nome_canal", "channel_topic" => "ESSE CANAL SERÁ APAGADO SE FICAR INATIVO POR MAIS DE 10 DIAS", "channel_codec" => TeamSpeak3::CODEC_SPEEX_ULTRAWIDEBAND, "channel_codec_quality" => 0x08, "channel_flag_permanent" => TRUE, "channel_password" => "$pass_canal", "channel_flag_maxclients_unlimited" => 0, "channel_order" => 4400, )); $sub_cid = $ts3_VirtualServer->channelCreate(array( "channel_name" => "Sala 1", "channel_topic" => "ESSE CANAL SERÁ APAGADO SE FICAR INATIVO POR MAIS DE 10 DIAS", "channel_codec" => TeamSpeak3::CODEC_SPEEX_ULTRAWIDEBAND, "channel_flag_permanent" => TRUE,
// Disabled $twitter = ''; } else { // Enabled $twitter = '<a class="twitter-timeline" data-dnt="true" href="' . htmlspecialchars($twitter_url[0]->value) . '" data-widget-id="' . htmlspecialchars($twitter_feed_query[0]->value) . '">Tweets</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?\'http\':\'https\';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>'; } } $smarty->assign('TWITTER_FEED', $twitter); // Voice server module $viewer = ''; if (isset($voice_server_enabled) && $voice_server_enabled == 'teamspeak') { // Teamspeak module require_once 'core/includes/TeamSpeak3/TeamSpeak3.php'; try { // connect to local server, authenticate and spawn an object for the virtual server on a defined port $ts3_VirtualServer = TeamSpeak3::factory('serverquery://' . $voice_server_username . ':' . $voice_server_password . '@' . $voice_server_ip . ':' . $voice_server_port . '/?server_port=' . $voice_virtual_server_port . '&nickname=Query'); // build and display HTML treeview using custom image paths (remote icons will be embedded using data URI sheme) $viewer = $ts3_VirtualServer->getViewer(new TeamSpeak3_Viewer_Html("core/assets/img/ts3/viewer/", "core/assets/img/ts3/flags/", "data:image")); } catch (Exception $e) { $viewer = '<div class="alert alert-warning">' . $e->getMessage() . '</div>'; } } $smarty->assign('VOICE_VIEWER_TITLE', 'TeamSpeak'); $smarty->assign('VOICE_VIEWER', $viewer); $smarty->display('styles/templates/' . $template . '/index.tpl'); // Footer require 'core/includes/template/footer.php'; $smarty->display('styles/templates/' . $template . '/footer.tpl'); // Scripts require 'core/includes/template/scripts.php'; ?>
/** * Downloads and returns the channel groups icon file content. * * @return TeamSpeak3_Helper_String */ public function iconDownload() { if ($this->iconIsLocal("iconid") || $this["iconid"] == 0) { return; } $download = $this->getParent()->transferInitDownload(rand(0x0, 0xffff), 0, $this->iconGetName("iconid")); $transfer = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"]); return $transfer->download($download["ftkey"], $download["size"]); }
} $tsfilelist = $ts3->channelFileList($cid = "0", $cpw = "", $path = "/"); $fsfilelist = opendir(substr(dirname(__FILE__), 0, -4) . 'other/avatars/'); while (false !== ($fsfile = readdir($fsfilelist))) { if ($fsfile != '.' && $fsfile != '..') { $fsfilelistarray[$fsfile] = filemtime(substr(dirname(__FILE__), 0, -4) . 'other/avatars/' . $fsfile); } } foreach ($tsfilelist as $tsfile) { $fullfilename = '/' . $tsfile['name']; $uuidasbase16 = substr($tsfile['name'], 7); if (!isset($fsfilelistarray[$uuidasbase16]) || $tsfile['datetime'] > $fsfilelistarray[$uuidasbase16]) { if (substr($tsfile['name'], 0, 7) == 'avatar_') { try { $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(dirname(__FILE__), 0, -4) . 'other/avatars/' . $uuidasbase16; echo 'Download avatar: ', $fullfilename, '<br>'; file_put_contents($avatarfilepath, $tsfile); $count++; } catch (Exception $e) { echo $lang['error'] . $e->getCode() . ': ' . $e->getMessage(); $sqlerr++; } } } } if ($count == 0) { echo 'Nothing to do.. All avatars already downloaded and are up to date<br>'; }
/** * Returns the HTML img tags which can be used to display the various icons for a * TeamSpeak_Node_Client object. * * @return string */ protected function getSuffixIconClient() { $html = ""; if ($this->currObj["client_is_priority_speaker"]) { $html .= $this->getImage("client_priority.png", "Priority Speaker"); } if ($this->currObj["client_is_channel_commander"]) { $html .= $this->getImage("client_cc.png", "Channel Commander"); } if ($this->currObj["client_is_talker"]) { $html .= $this->getImage("client_talker.png", "Talk Power granted"); } elseif ($cntp = $this->currObj->getParent()->channelGetById($this->currObj["cid"])->channel_needed_talk_power) { if ($cntp > $this->currObj["client_talk_power"]) { $html .= $this->getImage("client_mic_muted.png", "Insufficient Talk Power"); } } foreach ($this->currObj->memberOf() as $group) { if (!$group["iconid"]) { continue; } $type = $group instanceof TeamSpeak3_Node_Servergroup ? "Server Group" : "Channel Group"; if (!$group->iconIsLocal("iconid") && $this->ftclient) { if (!isset($this->cacheIcon[$group["iconid"]])) { $download = $group->getParent()->transferInitDownload(rand(0x0, 0xffff), 0, $group->iconGetName("iconid")); if ($this->ftclient == "data:image") { $download = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"])->download($download["ftkey"], $download["size"]); } $this->cacheIcon[$group["iconid"]] = $download; } else { $download = $this->cacheIcon[$group["iconid"]]; } if ($this->ftclient == "data:image") { $html .= $this->getImage("data:" . TeamSpeak3_Helper_Convert::imageMimeType($download) . ";base64," . base64_encode($download), $group . " [" . $type . "]", null, FALSE); } else { $html .= $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), $group . " [" . $type . "]", null, FALSE); } } elseif (in_array($group["iconid"], $this->cachedIcons)) { $html .= $this->getImage("group_icon_" . $group["iconid"] . ".png", $group . " [" . $type . "]"); } } if ($this->currObj["client_icon_id"]) { if (!$this->currObj->iconIsLocal("client_icon_id") && $this->ftclient) { if (!isset($this->cacheIcon[$this->currObj["client_icon_id"]])) { $download = $this->currObj->getParent()->transferInitDownload(rand(0x0, 0xffff), 0, $this->currObj->iconGetName("client_icon_id")); if ($this->ftclient == "data:image") { $download = TeamSpeak3::factory("filetransfer://" . $download["host"] . ":" . $download["port"])->download($download["ftkey"], $download["size"]); } $this->cacheIcon[$this->currObj["client_icon_id"]] = $download; } else { $download = $this->cacheIcon[$this->currObj["client_icon_id"]]; } if ($this->ftclient == "data:image") { $html .= $this->getImage("data:" . TeamSpeak3_Helper_Convert::imageMimeType($download) . ";base64," . base64_encode($download), "Client Icon", null, FALSE); } else { $html .= $this->getImage($this->ftclient . "?ftdata=" . base64_encode(serialize($download)), "Client Icon", null, FALSE); } } elseif (in_array($this->currObj["client_icon_id"], $this->cachedIcons)) { $html .= $this->getImage("group_icon_" . $this->currObj["client_icon_id"] . ".png", "Client Icon"); } } return $html; }
<?php //init require_once "libraries/ts3init.php"; $servers = $db->selectList($tbl . "_servers", "ID,name,address,usr,pw,query", "true", "ID"); $boxservers = array(); $vserverindex = -1; foreach ($servers as $server_data) { try { $ts3_ServerInstance = TeamSpeak3::factory("serverquery://" . $server_data["usr"] . ":" . $server_data["pw"] . "@" . $server_data["address"] . ":" . $server_data["query"] . "/?use_offline_as_virtual=1"); $servers_settings = $db->selectList($tbl . "_server_box", "`vserverid`,`join`", "`serverid`=" . $server_data["ID"] . " and `show`=1", "`vserverid`"); foreach ($ts3_ServerInstance as $ts3_VirtualServer) { try { $try = $ts3_VirtualServer["virtualserver_name"]; foreach ($servers_settings as $settings) { if ($ts3_VirtualServer["virtualserver_id"] == $settings["vserverid"]) { $vserverindex += 1; $boxservers[$vserverindex] = array(); $boxservers[$vserverindex]["name"] = $ts3_VirtualServer["virtualserver_name"]; $boxservers[$vserverindex]["maxusers"] = $ts3_VirtualServer["virtualserver_maxclients"]; $boxservers[$vserverindex]["usersonline"] = $ts3_VirtualServer["virtualserver_clientsonline"]; $boxservers[$vserverindex]["join"] = $settings["join"]; $boxservers[$vserverindex]["joinlink"] = "ts3server://" . $server_data["address"] . ":" . $ts3_VirtualServer["virtualserver_port"]; } } } catch (Exception $e) { } } } catch (Exception $e) { } }
/** * Sets character's TeamSpeak permissions */ function eveapi_setTeamSpeakGroups($tsUserUid, $tsGroupsNew, $characterName = "---", $ts3_VirtualServer = false, $extraTSgroups = array()) { global $db, $config; $tsGroups = array(); if (!is_array($tsGroupsNew)) { $tsGroupsNew = array(); } if (!empty($extraTSgroups)) { $tsGroupsNew = array_merge($tsGroupsNew, $extraTSgroups); if (!empty($tsGroupsNew)) { $tsGroupsNew = array_unique($tsGroupsNew); } } try { $nickname = $config['eveapi_ts_nickname']; if (eveapi_validateMixedalphanumeric($nickname) != 1) { $nickname = "Cyerus"; } if (!$ts3_VirtualServer) { $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); } $tsClientDbId = $ts3_VirtualServer->clientFindDb($tsUserUid, true); foreach ($tsClientDbId as $tsCurrentDbId) { $tsClientGroups = $ts3_VirtualServer->clientGetServerGroupsByDbid($tsCurrentDbId); foreach ($tsClientGroups as $tsCurrentClientGroup) { $tsGroups[] = $tsCurrentClientGroup["sgid"]; } foreach ($tsGroups as $currentTSGroup) { if (!in_array($currentTSGroup, $tsGroupsNew)) { if ($currentTSGroup == 0) { continue; } if ($currentTSGroup == $config['eveapi_ts_admin_tsgroup'] && $config['eveapi_ts_admin_switch']) { continue; } $cont = false; for ($i = 1; $i <= $config['eveapi_special_ts']; $i++) { if (!isset($config['eveapi_ts_special_' . $i . '_tsgroup'])) { continue; } if ($currentTSGroup == $config['eveapi_ts_special_' . $i . '_tsgroup'] && $config['eveapi_ts_special_' . $i . '_switch']) { $cont = true; } } if (!$cont) { $groupInfo = $ts3_VirtualServer->serverGroupGetById($currentTSGroup); if (!$groupInfo->savedb) { continue; } cronlog("Removing user from TeamSpeak group -> " . $groupInfo->name, $characterName); $ts3_VirtualServer->serverGroupClientDel($currentTSGroup, $tsCurrentDbId); } } } foreach ($tsGroupsNew as $currentTSGroup) { if ($currentTSGroup == 0) { continue; } $groupInfo = $ts3_VirtualServer->serverGroupGetById($currentTSGroup); if (!$groupInfo->savedb) { continue; } if (!in_array($currentTSGroup, $tsGroups)) { cronlog("Adding user to TeamSpeak group -> " . $groupInfo->name, $characterName); $ts3_VirtualServer->serverGroupClientAdd($currentTSGroup, $tsCurrentDbId); } else { cronlog("User already part of TeamSpeak group -> " . $groupInfo->name, $characterName); } } } } catch (Exception $e) { return $e->getCode() . " -> " . $e->getMessage(); } return true; }
function main($id, $mode) { global $config, $db, $user, $auth, $template, $cache; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; global $phpbb_dispatcher, $request; global $phpbb_container; $user->add_lang(array('posting', 'ucp', 'acp/users')); $this->tpl_name = 'acp_users'; $error = array(); $username = utf8_normalize_nfc(request_var('username', '', true)); $user_id = request_var('u', 0); $submit = isset($_POST['update']) && !isset($_POST['cancel']) ? true : false; $form_name = 'omni/eveapi/user'; add_form_key($form_name); // Show user selection mask if (!$username && !$user_id) { $this->page_title = 'SELECT_USER'; $template->assign_vars(array('U_ACTION' => $this->u_action, 'ANONYMOUS_USER_ID' => ANONYMOUS, 'S_SELECT_USER' => true, 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=searchuser&form=select_user&field=username&select_single=true'))); return; } if (!$user_id) { $sql = 'SELECT user_id FROM ' . USERS_TABLE . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $result = $db->sql_query($sql); $user_id = (int) $db->sql_fetchfield('user_id'); $db->sql_freeresult($result); if (!$user_id) { trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } } // Generate content for all modes $sql = 'SELECT u.*, s.* FROM ' . USERS_TABLE . ' u LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) WHERE u.user_id = ' . $user_id . ' ORDER BY s.session_time DESC'; $result = $db->sql_query_limit($sql, 1); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$user_row) { trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } // Generate overall "header" for user admin $s_form_options = ''; // Build modes dropdown list $sql = 'SELECT module_mode, module_auth FROM ' . MODULES_TABLE . "\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE module_basename = 'acp_eveapi_user'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND module_enabled = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND module_class = 'acp'\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY left_id, module_mode"; $result = $db->sql_query($sql); $dropdown_modes = array(); while ($row = $db->sql_fetchrow($result)) { if (!$this->p_master->module_auth_self($row['module_auth'])) { continue; } $dropdown_modes[$row['module_mode']] = true; } $db->sql_freeresult($result); foreach ($dropdown_modes as $module_mode => $null) { $selected = $mode == $module_mode ? ' selected="selected"' : ''; $s_form_options .= '<option value="' . $module_mode . '"' . $selected . '>' . $user->lang['ACP_USER_' . strtoupper($module_mode)] . '</option>'; } $template->assign_vars(array('U_BACK' => $this->u_action, 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i={$id}&u={$user_id}"), 'U_ACTION' => $this->u_action . '&u=' . $user_id, 'S_FORM_OPTIONS' => $s_form_options, 'MANAGED_USERNAME' => $user_row['username'])); // Prevent normal users/admins change/view founders if they are not a founder by themselves if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) { trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); } $this->page_title = $user_row['username'] . ' :: ' . $user->lang('ACP_USER_' . strtoupper($mode)); switch ($mode) { case 'eveapi_account': include $phpbb_root_path . 'includes/functions_user.' . $phpEx; $user->add_lang('mods/info_acp_eveapi'); $data = array('username' => utf8_normalize_nfc(request_var('user', $user_row['username'], true)), 'eveapi_keyid' => request_var('eveapi_keyid', $user_row['eveapi_keyid'], true), 'eveapi_vcode' => request_var('eveapi_vcode', $user_row['eveapi_vcode'], true)); if ($submit) { $check_ary = array('eveapi_keyid' => array(array('string', false, 1, 15)), 'eveapi_vcode' => array(array('string', false, 64, 64))); $check_ary['username'] = array(array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username')); $error = validate_data($data, $check_ary); if (!sizeof($error) && $config['eveapi_validation']) { $eveapi_teamSpeakGroups = array(); $characterInfo = eveapi_checkThisCharacter($data['eveapi_keyid'], $data['eveapi_vcode'], $data['username']); if (empty($characterInfo["error"])) { if (!empty($characterInfo["forumGroups"]) || empty($characterInfo["forumGroups"]) && $config['eveapi_nonmember']) { $eveapi_forumGroups = $characterInfo["forumGroups"]; $eveapi_teamSpeakGroups = $characterInfo["TSGroups"]; $extraGroups = eveapi_setForumGroups($user->data['user_id'], $eveapi_forumGroups, $data['username']); if ($config['eveapi_jabber_masterswitch']) { if ($config['eveapi_ejabber_switch']) { eveapi_setJabberAccess($user_row['user_id'], $characterInfo['jabber'], $extraGroups['jabber'], $data['username']); } if ($config['eveapi_openfire_switch']) { eveapi_setOpenFireAccess($user_row['user_id'], $characterInfo['openfire'], $extraGroups['openfire'], $data['username']); } } } else { $error[] = 'This character is not permitted to have an account on this forum.'; } } else { $error = array_merge($error, $characterInfo["error"]); } } $sql_ary = array('user_character_id' => isset($characterInfo["info"]["characterId"]) ? (int) $characterInfo["info"]["characterId"] : 0, 'username' => $data['username'], 'username_clean' => utf8_clean_string($data['username']), 'eveapi_keyid' => $data['eveapi_keyid'], 'eveapi_vcode' => $data['eveapi_vcode']); if ($data['username'] != $user_row['username']) { add_log('user', $user_row['user_id'], 'LOG_USER_UPDATE_NAME', $user_row['username'], $data['username']); } if ($data['eveapi_keyid'] != $user_row['eveapi_keyid'] || $data['eveapi_vcode'] != $user_row['eveapi_vcode']) { add_log('user', $user_row['user_id'], 'User has updated his/her EVE API information.', $user_row['username'], $data['eveapi_keyid'] . " -> " . $data['eveapi_vcode']); } $message = 'EVEAPI_UPDATED'; if (sizeof($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_row['user_id']; $db->sql_query($sql); add_log('admin', 'LOG_USER_USER_UPDATE', $data['username']); } } $inactive_reason = ''; if ($user_row['user_type'] == USER_INACTIVE) { $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; switch ($user_row['user_inactive_reason']) { case INACTIVE_REGISTER: $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; break; case INACTIVE_PROFILE: $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; break; case INACTIVE_MANUAL: $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; break; case INACTIVE_REMIND: $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; break; case INACTIVE_EVEAPI_INVALID: $inactive_reason = $user->lang['EVEAPI_INVALID_API_KEY']; break; case INACTIVE_EVEAPI_NONMEMBER: $inactive_reason = $user->lang['EVEAPI_NOT_ALLOWED_ACCOUNT']; break; } } $template->assign_vars(array('S_EVEAPI_REGISTER' => true, 'USER' => $data['username'], 'EVEAPI_KEYID' => $data['eveapi_keyid'], 'EVEAPI_VCODE' => $data['eveapi_vcode'], 'EVEAPI_ACCESSMASK' => eveapi_getAccessMask(), 'L_NAME_CHARS_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), 'L_EVEAPI_ACCOUNT' => $user->lang['UCP_EVEAPI_ACCOUNT'], 'S_USER_INACTIVE' => $user_row['user_type'] == USER_INACTIVE ? true : false, 'USER_INACTIVE_REASON' => $inactive_reason)); break; case 'eveapi_jabber': $user->add_lang('mods/info_acp_eveapi'); if ($submit) { $characterInfo = eveapi_checkThisCharacter($user_row['eveapi_keyid'], $user_row['eveapi_vcode'], $user_row['username']); if (empty($characterInfo["error"]) && (!empty($characterInfo["forumGroups"]) || empty($characterInfo["forumGroups"]) && $config['eveapi_nonmember'])) { $eveapi_forumGroups = $characterInfo["forumGroups"]; $extraGroups = eveapi_setForumGroups($user_row['user_id'], $eveapi_forumGroups, $user_row['username']); $password = eveapi_randomString(8); $result = eveapi_setOpenFireAccess($user_row['user_id'], $characterInfo['openfire'], $extraGroups['openfire'], $user_row['username'], $password); if ($result) { $user_row['user_jabber_password'] = $password; } else { $error[] = $user->lang['JABBER_REGISTRATION_FAILED']; } } } $clean_username = str_replace(array(" ", "'"), array("_", "_"), $user_row['username']); $template->assign_vars(array('S_EVEAPI_JABBER' => true, 'JABBER_USERNAME' => $clean_username, 'JABBER_PASSWORD' => $user_row['user_jabber_password'], 'JABBER_HOST' => $config['eveapi_jabber_hostname'], 'L_EVEAPI_JABBER' => $user->lang['UCP_EVEAPI_JABBER'], 'L_JABBER' => $user->lang['EVEAPI_JABBER_REGISTER'], 'L_JABBER_EXPLAIN' => $user->lang['EVEAPI_JABBER_EXPLAIN'], 'L_JABBER_USERNAME' => $user->lang['EVEAPI_JABBER_USERNAME'], 'L_JABBER_PASSWORD' => $user->lang['EVEAPI_JABBER_PASSWORD'], 'L_JABBER_HOST' => $user->lang['EVEAPI_JABBER_HOST'])); break; case 'eveapi_ts': $user->add_lang('mods/info_acp_eveapi'); if ($submit) { try { $nickname = $config['eveapi_ts_nickname']; if (eveapi_validateMixedalphanumeric($nickname) != 1) { $nickname = "phpBBbot"; } $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); } catch (Exception $e) { $error[] = $user->lang['TEAMSPEAK_CONNECTION_FAILED']; } $eveapi_ts = eveapi_getTeamSpeakUID($user_row['username'], $ts3_VirtualServer); if (empty($eveapi_ts)) { $error[] = $user->lang['TEAMSPEAK_USERNAME_NOT_FOUND']; } else { if (empty($user_row["eveapi_keyid"]) || empty($user_row["eveapi_vcode"])) { $error[] = $user->lang['TEAMSPEAK_NO_API']; } else { $sql_ary = array('eveapi_ts' => $eveapi_ts); $eveapi_teamSpeakGroups = array(); $characterInfo = eveapi_checkThisCharacter($user_row['eveapi_keyid'], $user_row['eveapi_vcode'], $user_row['username']); if (empty($characterInfo["error"]) && (!empty($characterInfo["forumGroups"]) || empty($characterInfo["forumGroups"]) && $config['eveapi_nonmember'])) { $eveapi_forumGroups = $characterInfo["forumGroups"]; $eveapi_teamSpeakGroups = $characterInfo["TSGroups"]; $extraGroups = eveapi_setForumGroups($user_row['user_id'], $eveapi_forumGroups, $user_row['username']); if ($eveapi_ts != $user_row['eveapi_ts'] && !empty($user_row['eveapi_ts'])) { eveapi_setTeamSpeakGroups($user_row['eveapi_ts'], array(), $user_row['username']); } if ($eveapi_ts != "") { $TSverify = eveapi_setTeamSpeakGroups($eveapi_ts, $eveapi_teamSpeakGroups, $user_row['username'], $ts3_VirtualServer, $extraGroups["TS"]); if ($TSverify !== true) { $error[] = $TSverify; $sql_ary['eveapi_ts'] = $eveapi_ts = ""; } } $user_row['eveapi_ts'] = $eveapi_ts; } $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_row['user_id']; $db->sql_query($sql); } } } $username = $user_row['username']; if (strlen($username) > 30) { $username = substr($username, 0, 30); } $template->assign_vars(array('S_EVEAPI_TS' => true, 'USERNAME' => $username, 'EVEAPI_TS' => empty($user_row['eveapi_ts']) ? $user->lang['EVEAPI_TEAMSPEAK_UID_EMPTY'] : $user_row['eveapi_ts'], 'L_EVEAPI_TS' => $user->lang['UCP_EVEAPI_TS'], 'L_TEAMSPEAK' => $user->lang['EVEAPI_TEAMSPEAK_REGISTER'], 'L_TEAMSPEAK_EXPLAIN' => $user->lang['EVEAPI_TEAMSPEAK_EXPLAIN'], 'L_TEAMSPEAK_USERNAME' => $user->lang['EVEAPI_TEAMSPEAK_USERNAME'], 'L_TEAMSPEAK_UID' => $user->lang['EVEAPI_TEAMSPEAK_UID'])); break; } // Assign general variables $template->assign_vars(array('S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : '')); }