From 7f8459b30e81cd5947ca6bc5afa7ef21ab54bda0 Mon Sep 17 00:00:00 2001 From: First-Coder Date: Fri, 13 Oct 2017 13:55:06 +0200 Subject: [PATCH] Update to 1.3.14 --- checkInterface.php | 2 +- iframeServerBanner.php | 4 +- index.php | 5 + js/webinterface/bot.js | 185 +++++++++++++++++++++ php/functions/functions.php | 2 +- php/functions/functionsBackupPost.php | 6 +- php/functions/functionsTeamspeak.php | 7 +- php/teamspeak/web_teamspeak_serverview.php | 2 +- 8 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 js/webinterface/bot.js diff --git a/checkInterface.php b/checkInterface.php index 546a350..adf339c 100644 --- a/checkInterface.php +++ b/checkInterface.php @@ -79,7 +79,7 @@ */ if(file_exists("install") && $verbindung == "done" && $users) { - rmdir("install"); + @rmdir("install"); }; if($verbindung != 'done' || !$users || !$permissions || file_exists("install") || !extension_loaded("soap")) diff --git a/iframeServerBanner.php b/iframeServerBanner.php index a81ceb9..5abf754 100644 --- a/iframeServerBanner.php +++ b/iframeServerBanner.php @@ -91,11 +91,11 @@ /* Get Teamspeak informations */ - $tsAdmin = new ts3admin($ts3_server[0]['ip'], $ts3_server[0]['queryport']); + $tsAdmin = new ts3admin($ts3_server[$instanz]['ip'], $ts3_server[$instanz]['queryport']); if($tsAdmin->getElement('success', $tsAdmin->connect())) { - $tsAdmin->login($ts3_server[0]['user'], $ts3_server[0]['pw']); + $tsAdmin->login($ts3_server[$instanz]['user'], $ts3_server[$instanz]['pw']); $tsAdmin->selectServer($port, "port"); $serverinfo = $tsAdmin->serverInfo(); $clients = $tsAdmin->clientList("-ip"); diff --git a/index.php b/index.php index c156fe8..97bfe8c 100644 --- a/index.php +++ b/index.php @@ -19,6 +19,11 @@ for help look http://first-coder.de/ */ + /* + Deactivate Errorlog (Just remove NOTICE logs) + */ + error_reporting(E_ALL & ~E_NOTICE); + /* Includes */ diff --git a/js/webinterface/bot.js b/js/webinterface/bot.js new file mode 100644 index 0000000..58c0820 --- /dev/null +++ b/js/webinterface/bot.js @@ -0,0 +1,185 @@ +/* + First-Coder Teamspeak 3 Webinterface for everyone + Copyright (C) 2017 by L.Gmann + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + for help look http://first-coder.de/ +*/ + +/* + Querybot: Save Botsettings +*/ + function saveBotSettings(tablename) + { + switch(tablename) + { + case "bot_settigns_afk": + var postData = { + isAfkMoving: ($('#setAfkModul').is(':checked')) ? "1" : "0", + isMovingMicMuted: ($('#setAfkMicMuted').is(':checked')) ? "1" : "0", + isMovingHeadsetMuted: ($('#setAfkHeadsetMuted').is(':checked')) ? "1" : "0", + isMovingAway: ($('#setAfkAway').is(':checked')) ? "1" : "0", + AfkMovingChannel: $('#afkChannel').val(), + isMovingIdleTime: $('#setAfkIdleTime').val(), + isMovingIdleWarningMessage: ($('#setAfkIdleWarningMessage').is(':checked')) ? "1" : "0", + MovingIdleWarningMessage: $('#setAfkIdleMessage').val(), + afkMoveingImmunSgroups: JSON.stringify($('#setAfkImmunSgroups').tagsinput('items')) + }; + break; + }; + + $.ajax({ + type: "POST", + url: "./php/functions/functionsBotPost.php", + data: { + action: 'saveBotSettings', + botid: botid, + table: tablename, + data: JSON.stringify(postData) + }, + success: function(data){ + /*if(data == "done" && which == "language") + { + setNotifySuccess("Language set! Reload the page to see your site in the new language!"); + } + else if(data == 'done') + { + setNotifySuccess(lang.settigns_saved); + } + else + { + setNotifyFailed("Ups, something Failed :/"); + };*/ + console.log(data); + } + }); + }; + +/* + Querybot: Show Botdetails +*/ + function showQueryBot(id, instanz, port) + { + $("#mainContent").fadeOut("fast", function() + { + $("#mainContent").load('./php/bot/web_bot_query_info.php', { "id" : id, "instanz" : instanz, "port" : port }, function() + { + $("#mainContent").fadeIn("fast"); + }); + }); + }; + +/* + Querybot: Create Querybot +*/ + function createQueryBot() + { + $.ajax({ + type: "POST", + url: "./php/functions/functionsBotPost.php", + data: { + action: 'createQueryBot', + instanz: $('#selectCreateQueryBotInstance').val(), + port: $('#selectCreateQueryBotPort').val(), + name: encodeURIComponent($('#createQueryBotName').val()) + }, + success: function(data){ + console.log(data); + } + }); + }; + +/* + Querybot: Delete Querybot +*/ + function deleteQueryBot(id) + { + $.ajax({ + type: "POST", + url: "./php/functions/functionsBotPost.php", + data: { + action: 'deleteQueryBot', + id: id + }, + success: function(data){ + console.log(data); + } + }); + }; + +/* + Querybot: Change Selectmenu on Querybot Create +*/ + function addQueryBotChangePort() + { + var instanz = $('#selectCreateQueryBotInstance').val(); + + if(instanz != 'nope') + { + $.ajax({ + type: "POST", + url: "./php/functions/functionsTeamspeakPost.php", + data: { + action: 'getTeamspeakPorts', + instanz: instanz + }, + success: function(data){ + var element = document.getElementById('selectCreateQueryBotPort'); + + while ( element.childNodes.length >= 1 ) + { + element.removeChild(element.firstChild); + }; + + if(data != "[]") + { + var ports = JSON.parse(data); + for (i = 0; i < ports.length; i++) + { + port = document.createElement('option'); + port.value = ports[i]; + port.text = ports[i]; + element.appendChild(port); + }; + + $('#bttnCreateQueryBot').prop("disabled", false); + } + else + { + nope = document.createElement('option'); + nope.value = 'nope'; + nope.text = unescape(lang.ts3_no_copy); + element.appendChild(nope); + + $('#bttnCreateQueryBot').prop("disabled", true); + }; + } + }); + } + else + { + var element = document.getElementById('selectCreateQueryBotSid'); + + while ( element.childNodes.length >= 1 ) + { + element.removeChild(element.firstChild); + }; + + nope = document.createElement('option'); + nope.value = 'nope'; + nope.text = unescape(lang.ts3_no_copy); + element.appendChild(nope); + }; + }; \ No newline at end of file diff --git a/php/functions/functions.php b/php/functions/functions.php index 617efd8..544cfee 100644 --- a/php/functions/functions.php +++ b/php/functions/functions.php @@ -34,7 +34,7 @@ /* Installed Webinterface version */ - define("INTERFACE_VERSION", "1.3.13-OPEN-BETA"); + define("INTERFACE_VERSION", "1.3.14-OPEN-BETA"); /* Anti XSS diff --git a/php/functions/functionsBackupPost.php b/php/functions/functionsBackupPost.php index 47a59e9..7316951 100644 --- a/php/functions/functionsBackupPost.php +++ b/php/functions/functionsBackupPost.php @@ -65,7 +65,7 @@ $server = $tsAdmin->serverInfo(); - if(((strpos($user_right['right_web_server_view'][$_POST['instanz']], $server['data']['virtualserver_port']) === false || strpos($user_right['right_web_server_backups'][$_POST['instanz']], $server['data']['virtualserver_port']) === false) + if(((!isPortPermission($user_right, $_POST['instanz'], $server['data']['virtualserver_port'], 'right_web_server_view') || !isPortPermission($user_right, $_POST['instanz'], $server['data']['virtualserver_port'], 'right_web_server_backups')) && $user_right['right_web_global_server']['key'] != $mysql_keys['right_web_global_server']) || $user_right['right_web']['key'] != $mysql_keys['right_web']) { exit(); @@ -79,7 +79,7 @@ /* Create Backup */ - if($_POST['action'] == 'createBackup' && $LoggedIn && (strpos($user_right['right_web_server_backups'][$_POST['instanz']], $_POST['port']) !== false || $user_right['right_web_global_server']['key'] == $mysql_keys['right_web_global_server'])) + if($_POST['action'] == 'createBackup' && $LoggedIn && (isPortPermission($user_right, $_POST['instanz'], $_POST['port'], 'right_web_server_backups') || $user_right['right_web_global_server']['key'] == $mysql_keys['right_web_global_server'])) { echo createBackup($tsAdmin, $_POST['instanz'], $_POST['port'], $_POST['kind'], $_POST['kindChannel']); }; @@ -87,7 +87,7 @@ /* Activate Channel Backup */ - if($_POST['action'] == 'activateBackup' && $LoggedIn && (strpos($user_right['right_web_server_backups'][$_POST['instanz']], $_POST['port']) !== false || $user_right['right_web_global_server']['key'] == $mysql_keys['right_web_global_server'])) + if($_POST['action'] == 'activateBackup' && $LoggedIn && (isPortPermission($user_right, $_POST['instanz'], $_POST['port'], 'right_web_server_backups') || $user_right['right_web_global_server']['key'] == $mysql_keys['right_web_global_server'])) { if($_POST['subaction'] == "channelname") { diff --git a/php/functions/functionsTeamspeak.php b/php/functions/functionsTeamspeak.php index cf7e180..09c6851 100644 --- a/php/functions/functionsTeamspeak.php +++ b/php/functions/functionsTeamspeak.php @@ -631,7 +631,7 @@ function deleteFileFromFilelist($path, $cid, $port, $instanz) $delfiles[] = $path; $file_delete = $tsAdmin->ftDeleteFile($cid, "", $delfiles); - if($file_delete['succes'] !== false) + if($file_delete['success'] !== false) { writeInLog($_SESSION['user']['benutzer'], "Delete File From Server: ChannelId: ".$cid." ; Path: ".$path." ; Instanz: ".$instanz." Port: ".$port, true); @@ -689,8 +689,6 @@ function addToken($type, $tokenid1, $tokenid2, $number, $description, $serverId, if($token_add['success']!==false) { - writeInLog($_SESSION['user']['benutzer'], "Create Token (".$token[$i]['token'].") Instanz: ".$instanz." Sid: ".$serverId, true); - $token['done'] = "true"; $token[$i] = array(); $token[$i]['token'] = $token_add['data']['token']; @@ -705,6 +703,8 @@ function addToken($type, $tokenid1, $tokenid2, $number, $description, $serverId, $token[$i]['type'] = $language['cgroup']; $token[$i]['channel'] = "Channel ID: ".$tokenid2; }; + + writeInLog($_SESSION['user']['benutzer'], "Create Token (".$token[$i]['token'].") Instanz: ".$instanz." Sid: ".$serverId, true); } else { @@ -1060,6 +1060,7 @@ function deleteIcon($id, $instanz, $serverId, $port) function getTeamspeakIcons($tsAdmin, $port, $ip, $queryport, $username, $password) { $ft = $tsAdmin->ftGetFileList(0, '', '/icons'); + $handler = null; if(is_dir('../../images/ts_icons/'.$ip.'-'.$port.'/')) { diff --git a/php/teamspeak/web_teamspeak_serverview.php b/php/teamspeak/web_teamspeak_serverview.php index 92a81e0..3e43262 100644 --- a/php/teamspeak/web_teamspeak_serverview.php +++ b/php/teamspeak/web_teamspeak_serverview.php @@ -115,7 +115,7 @@ /* No Client permission */ - if((strpos($user_right['right_web_server_view'][$linkInformations['instanz']], $server['data']['virtualserver_port']) === false && $user_right['right_web_global_server']['key'] != $mysql_keys['right_web_global_server']) + if((!isPortPermission($user_right, $linkInformations['instanz'], $server['data']['virtualserver_port'], 'right_web_server_view') && $user_right['right_web_global_server']['key'] != $mysql_keys['right_web_global_server']) || $user_right['right_web']['key'] != $mysql_keys['right_web']) { reloadSite();