mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
#331 Add server console
This commit is contained in:
parent
3a7db16e7f
commit
1dd50a529f
@ -51,6 +51,7 @@ include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
include(EASYWIDIR . '/stuff/methods/functions.php');
|
||||
include(EASYWIDIR . '/stuff/methods/class_validator.php');
|
||||
include(EASYWIDIR . '/stuff/methods/class_ts3.php');
|
||||
include(EASYWIDIR . '/stuff/methods/class_ftp.php');
|
||||
include(EASYWIDIR . '/stuff/methods/functions_ts3.php');
|
||||
include(EASYWIDIR . '/stuff/methods/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/settings.php');
|
||||
@ -203,7 +204,6 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
die(json_encode($array));
|
||||
|
||||
// App master server updates. Triggered asyncronous with ajax to avoid 5xx errors
|
||||
@ -309,6 +309,11 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
|
||||
require_once(EASYWIDIR . '/stuff/ajax/stats_voicestats.php');
|
||||
die;
|
||||
|
||||
} else if (($pa['gserver'] or $pa['restart']) and (isset($user_id) or isset($admin_id)) and $ui->w('d', 9, 'get') == 'serverLog' and $ui->id('id', 10, 'get')) {
|
||||
|
||||
require_once(EASYWIDIR . '/stuff/ajax/server_log.php');
|
||||
die;
|
||||
|
||||
} else if (isset($user_id) and ($pa['gserver'] or $pa['restart']) and $ui->username('mapgroup', 50, 'get')) {
|
||||
|
||||
require_once(EASYWIDIR . '/stuff/ajax/userpanel_mapgroup.php');
|
||||
|
@ -35,6 +35,7 @@
|
||||
<help_addons>Über unser Webinterface können Sie jederzeit die aktuellsten Plugins, Addons, Configs und Mappackages zu Ihrem Gameserver hinzufügen. Diese werden von uns immer aktuell gehalten, um Ihren Administrationsaufwand möglichst gering zu halten.</help_addons>
|
||||
<ip>Gameserver IP Adresse</ip>
|
||||
<iptables>IP Tables</iptables>
|
||||
<liveConsole>Live Konsole</liveConsole>
|
||||
<map>Mappackage</map>
|
||||
<maps>Mappackages</maps>
|
||||
<mod>Modverzeichnis (z.B. cstrike und dod)</mod>
|
||||
|
@ -34,6 +34,7 @@
|
||||
<heading_template>Spilserver skabeloner</heading_template>
|
||||
<ip>SpilServer IP-adresse</ip>
|
||||
<iptables>IP Tabeller</iptables>
|
||||
<liveConsole>Live Console</liveConsole>
|
||||
<map>Kort Pakke</map>
|
||||
<maps>Kort Pakker</maps>
|
||||
<mod>Modmappe (for eksempel cstrike and dod)</mod>
|
||||
|
@ -35,6 +35,7 @@
|
||||
<help_addons>With our web interface you can easily manage plugins, addons, configs, and map packages for your game server. We will keep everything up-to-date, thus, your administration effort is reduced to a minimum.</help_addons>
|
||||
<ip>Game server IP address</ip>
|
||||
<iptables>IP tables</iptables>
|
||||
<liveConsole>Live Console</liveConsole>
|
||||
<map>Map package</map>
|
||||
<maps>Map packages</maps>
|
||||
<mod>Mod folder (e.g. cstrike or dod)</mod>
|
||||
|
@ -95,7 +95,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
||||
|
||||
echo 'Retrieving Version for ' . $row['shorten'] . "\r\n";
|
||||
|
||||
$reply = ($row['shorten'] == 'bukkit') ? getCraftBukkitVersion () : getMinecraftVersion();
|
||||
$reply = ($row['shorten'] == 'bukkit') ? getCraftBukkitVersion() : getMinecraftVersion();
|
||||
|
||||
if (is_array($reply)) {
|
||||
|
||||
|
@ -140,6 +140,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$ramLimited = ($ui->active('ramLimited', 'post')) ? $ui->active('ramLimited', 'post') : 'N';
|
||||
$workShop = ($ui->active('workShop', 'post')) ? $ui->active('workShop', 'post') : 'N';
|
||||
$ftpAccess = ($ui->active('ftpAccess', 'post')) ? $ui->active('ftpAccess', 'post') : 'Y';
|
||||
$liveConsole = ($ui->active('liveConsole', 'post')) ? $ui->active('liveConsole', 'post') : 'Y';
|
||||
$os = ($ui->w('os', 1, 'post')) ? $ui->w('os', 1, 'post') : 'L';
|
||||
$iptables = $ui->startparameter('iptables', 'post');
|
||||
$protectedSaveCFGs = $ui->startparameter('protectedSaveCFGs', 'post');
|
||||
@ -327,6 +328,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($node->nodeName == 'useQueryPort') {
|
||||
$useQueryPort = $node->nodeValue;
|
||||
}
|
||||
if ($node->nodeName == 'liveConsole') {
|
||||
$liveConsole = $node->nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(Exception $error) {
|
||||
@ -378,6 +382,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$ramLimited = $row['ramLimited'];
|
||||
$steamAccount = $row['steamAcc'];
|
||||
$steamPassword = $row['steamPwd'];
|
||||
$liveConsole = $row['liveConsole'];
|
||||
}
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
@ -469,14 +474,14 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
|
||||
$query = $sql->prepare("SELECT `id` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2 = $sql->prepare("INSERT INTO `servertypes` (`iptables`,`protectedSaveCFGs`,`steamgame`,`updates`,`shorten`,`description`,`type`,`gamebinary`,`gamebinaryWin`,`binarydir`,`modfolder`,`map`,`mapGroup`,`workShop`,`cmd`,`modcmds`,`gameq`,`gamemod`,`gamemod2`,`configs`,`configedit`,`appID`,`portMax`,`portStep`,`portOne`,`portTwo`,`portThree`,`portFour`,`portFive`,`useQueryPort`,`protected`,`ramLimited`,`ftpAccess`,`os`,`steam_account`,`steam_password`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,AES_ENCRYPT(?,?),AES_ENCRYPT(?,?),?)");
|
||||
$query2 = $sql->prepare("INSERT INTO `servertypes` (`iptables`,`protectedSaveCFGs`,`steamgame`,`updates`,`shorten`,`description`,`type`,`gamebinary`,`gamebinaryWin`,`binarydir`,`modfolder`,`map`,`mapGroup`,`workShop`,`cmd`,`modcmds`,`gameq`,`gamemod`,`gamemod2`,`configs`,`configedit`,`appID`,`portMax`,`portStep`,`portOne`,`portTwo`,`portThree`,`portFour`,`portFive`,`useQueryPort`,`protected`,`ramLimited`,`ftpAccess`,`os`,`steam_account`,`steam_password`,`liveConsole`,`resellerid`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,AES_ENCRYPT(?,?),AES_ENCRYPT(?,?),?,?)");
|
||||
|
||||
foreach ($resellerInsertIDs as $rID) {
|
||||
|
||||
$query->execute(array($shorten, $rID));
|
||||
|
||||
if ($query->rowCount() == 0) {
|
||||
$query2->execute(array($iptables, $protectedSaveCFGs, $steamgame, $updates, $shorten, $description, 'gserver', $gamebinary, $gamebinaryWin, $binarydir, $modfolder, $map, $mapGroup, $workShop, $cmd, $modcmds, $gameq, $gamemod, $gamemod2, $configs, $configedit, $appID, $portMax, $portStep, $portOne, $portTwo, $portThree, $portFour, $portFive, $useQueryPort, $protected, $ramLimited, $ftpAccess, $os, $steamAccount, $aeskey, $steamPassword, $aeskey, $rID));
|
||||
$query2->execute(array($iptables, $protectedSaveCFGs, $steamgame, $updates, $shorten, $description, 'gserver', $gamebinary, $gamebinaryWin, $binarydir, $modfolder, $map, $mapGroup, $workShop, $cmd, $modcmds, $gameq, $gamemod, $gamemod2, $configs, $configedit, $appID, $portMax, $portStep, $portOne, $portTwo, $portThree, $portFour, $portFive, $useQueryPort, $protected, $ramLimited, $ftpAccess, $os, $steamAccount, $aeskey, $steamPassword, $aeskey, $liveConsole, $rID));
|
||||
$rowCount += $query2->rowCount();
|
||||
}
|
||||
|
||||
@ -487,8 +492,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
|
||||
} else if ($ui->st('action', 'post') == 'md') {
|
||||
|
||||
$query = $sql->prepare("UPDATE `servertypes` SET `iptables`=?,`protectedSaveCFGs`=?,`steamgame`=?,`updates`=?,`shorten`=?,`description`=?,`gamebinary`=?,`gamebinaryWin`=?,`binarydir`=?,`modfolder`=?,`map`=?,`mapGroup`=?,`workShop`=?,`cmd`=?,`modcmds`=?,`gameq`=?,`gamemod`=?,`gamemod2`=?,`configs`=?,`configedit`=?,`appID`=?,`portMax`=?,`portStep`=?,`portOne`=?,`portTwo`=?,`portThree`=?,`portFour`=?,`portFive`=?,`useQueryPort`=?,`protected`=?,`ramLimited`=?,`ftpAccess`=?,`os`=?,`steam_account`=AES_ENCRYPT(?,?),`steam_password`=AES_ENCRYPT(?,?) WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($iptables, $protectedSaveCFGs, $steamgame, $updates, $shorten, $description, $gamebinary, $gamebinaryWin, $binarydir, $modfolder, $map, $mapGroup, $workShop, $cmd, $modcmds, $gameq, $gamemod, $gamemod2, $configs, $configedit, $appID, $portMax, $portStep, $portOne, $portTwo, $portThree, $portFour, $portFive, $useQueryPort, $protected, $ramLimited, $ftpAccess, $os, $steamAccount, $aeskey, $steamPassword, $aeskey, $ui->id('id', 10, 'get'), $resellerLockupID));
|
||||
$query = $sql->prepare("UPDATE `servertypes` SET `iptables`=?,`protectedSaveCFGs`=?,`steamgame`=?,`updates`=?,`shorten`=?,`description`=?,`gamebinary`=?,`gamebinaryWin`=?,`binarydir`=?,`modfolder`=?,`map`=?,`mapGroup`=?,`workShop`=?,`cmd`=?,`modcmds`=?,`gameq`=?,`gamemod`=?,`gamemod2`=?,`configs`=?,`configedit`=?,`appID`=?,`portMax`=?,`portStep`=?,`portOne`=?,`portTwo`=?,`portThree`=?,`portFour`=?,`portFive`=?,`useQueryPort`=?,`protected`=?,`ramLimited`=?,`ftpAccess`=?,`os`=?,`steam_account`=AES_ENCRYPT(?,?),`steam_password`=AES_ENCRYPT(?,?),`liveConsole`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($iptables, $protectedSaveCFGs, $steamgame, $updates, $shorten, $description, $gamebinary, $gamebinaryWin, $binarydir, $modfolder, $map, $mapGroup, $workShop, $cmd, $modcmds, $gameq, $gamemod, $gamemod2, $configs, $configedit, $appID, $portMax, $portStep, $portOne, $portTwo, $portThree, $portFour, $portFive, $useQueryPort, $protected, $ramLimited, $ftpAccess, $os, $steamAccount, $aeskey, $steamPassword, $aeskey, $liveConsole, $ui->id('id', 10, 'get'), $resellerLockupID));
|
||||
$rowCount = $query->rowCount();
|
||||
$loguseraction = '%mod% %template% ' . $shorten;
|
||||
|
||||
|
133
web/stuff/ajax/server_log.php
Normal file
133
web/stuff/ajax/server_log.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: server_log.php.
|
||||
* Author: Ulrich Block
|
||||
* Date: 02.09.15
|
||||
* Contact: <ulrich.block@easy-wi.com>
|
||||
*
|
||||
* This file is part of Easy-WI.
|
||||
*
|
||||
* Easy-WI 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
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Easy-WI 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 Easy-WI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Diese Datei ist Teil von Easy-WI.
|
||||
*
|
||||
* Easy-WI ist Freie Software: Sie koennen es unter den Bedingungen
|
||||
* der GNU General Public License, wie von der Free Software Foundation,
|
||||
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder spaeteren
|
||||
* veroeffentlichten Version, weiterverbreiten und/oder modifizieren.
|
||||
*
|
||||
* Easy-WI wird in der Hoffnung, dass es nuetzlich sein wird, aber
|
||||
* OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
|
||||
* Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
|
||||
* Siehe die GNU General Public License fuer weitere Details.
|
||||
*
|
||||
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
||||
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined('AJAXINCLUDED')) {
|
||||
die('Do not access directly!');
|
||||
}
|
||||
|
||||
if (!isset($resellerLockupID)) {
|
||||
$resellerLockupID = $reseller_id;
|
||||
}
|
||||
|
||||
|
||||
if (isset($admin_id)) {
|
||||
|
||||
$query = $sql->prepare("SELECT u.`id`,u.`cname` FROM `gsswitch` g LEFT JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`id`=? AND g.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('id', 10, 'get'), $resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$username = $row['cname'];
|
||||
$user_id = $row['id'];
|
||||
}
|
||||
|
||||
} else {
|
||||
$username = getusername($user_id);
|
||||
}
|
||||
|
||||
$query = $sql->prepare("SELECT g.`id`,g.`newlayout`,g.`rootID`,g.`serverip`,g.`port`,g.`protected`,AES_DECRYPT(g.`ftppassword`,?) AS `dftppass`,AES_DECRYPT(g.`ppassword`,?) AS `decryptedftppass`,s.`servertemplate`,t.`binarydir`,t.`shorten` FROM `gsswitch` g LEFT JOIN `serverlist` s ON g.`serverid`=s.`id` LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE g.`id`=? AND g.`userid`=? AND g.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($aeskey, $aeskey, $ui->id('id', 10, 'get'), $user_id, $resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$protected = $row['protected'];
|
||||
$servertemplate = $row['servertemplate'];
|
||||
$rootID = $row['rootID'];
|
||||
$serverip = $row['serverip'];
|
||||
$port = $row['port'];
|
||||
$shorten = $row['shorten'];
|
||||
$binarydir = $row['binarydir'];
|
||||
$ftppass = $row['dftppass'];
|
||||
|
||||
if ($row['newlayout'] == 'Y') {
|
||||
$username .= '-' . $row['id'];
|
||||
}
|
||||
|
||||
if ($protected == 'N' and $servertemplate > 1) {
|
||||
$shorten .= '-' . $servertemplate;
|
||||
$pserver = 'server/';
|
||||
} else if ($protected == 'Y') {
|
||||
$username .= '-p';
|
||||
$ftppass = $row['decryptedftppass'];
|
||||
$pserver = '';
|
||||
} else {
|
||||
$pserver = 'server/';
|
||||
}
|
||||
}
|
||||
|
||||
$array = array('lastLog' => 0, 'log' => '');
|
||||
|
||||
if (isset($rootID)) {
|
||||
|
||||
$query = $sql->prepare("SELECT `ip`,`ftpport` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($rootID, $resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$ftpport = $row['ftpport'];
|
||||
$ip = $row['ip'];
|
||||
|
||||
$ftpConnect = new EasyWiFTP($ip, $ftpport, $username, $ftppass);
|
||||
|
||||
$downloadChrooted = $ftpConnect->removeSlashes($pserver . $serverip . '_' . $port . '/' . $shorten . '/' . $binarydir . '/screenlog.0');
|
||||
|
||||
if ($ftpConnect->ftpConnection) {
|
||||
|
||||
if (!$ftpConnect->downloadToTemp($downloadChrooted, 32768, false, $ui->isinteger('lastLog', 'get'))) {
|
||||
$array['error'] = 'Cannot download screenlog from ' . $downloadChrooted;
|
||||
} else {
|
||||
$array['lastLog'] = $ftpConnect->getLastFileSize();
|
||||
$array['log'] = nl2br($ftpConnect->getTempFileContent());
|
||||
}
|
||||
|
||||
} else {
|
||||
$array['error'] = 'Cannot connect to FTP Server ' . $ip . ':' . $ftpport;
|
||||
}
|
||||
}
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
|
||||
$ftpConnect->tempHandle = null;
|
||||
$ftpConnect = null;
|
||||
|
||||
} else {
|
||||
$array['error'] = 'Error: wrong rootID';
|
||||
}
|
||||
|
||||
} else {
|
||||
$array['error'] = 'Error: No rootID';
|
||||
}
|
||||
|
||||
die(json_encode($array));
|
@ -104,7 +104,6 @@ class AppServer {
|
||||
$this->appMasterServerDetails['configUserID'] = ($row['config_user_id'] > 0) ? (int) $row['config_user_id'] : 1000;
|
||||
$this->appMasterServerDetails['configZtmpTime'] = (int) $row['config_ztmp_time'];
|
||||
|
||||
|
||||
if ($this->appMasterServerDetails['os'] == 'L') {
|
||||
$this->shellScriptHeader = "#!/bin/bash\n";
|
||||
$this->shellScriptHeader .= "if ionice -c3 true 2>/dev/null; then IONICE='ionice -n 7 '; fi\n";
|
||||
|
@ -40,7 +40,7 @@
|
||||
class EasyWiFTP {
|
||||
|
||||
// define vars
|
||||
public $ftpConnection = false, $ftpSecondConnection = false, $loggedIn = false, $secondLoggedIn = false, $tempHandle = null;
|
||||
public $ftpConnection = false, $ftpSecondConnection = false, $loggedIn = false, $secondLoggedIn = false, $tempHandle = null, $lastFileSize = 0;
|
||||
|
||||
function __construct($ip, $port, $user, $pwd, $ssl = 'N') {
|
||||
|
||||
@ -82,7 +82,7 @@ class EasyWiFTP {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function downloadToTemp ($pathAndFile, $startAt = 0, $files = false) {
|
||||
public function downloadToTemp ($pathAndFile, $lastBytes = 0, $files = false, $startAt = false) {
|
||||
|
||||
$pathAndFile = $this->removeSlashes($pathAndFile);
|
||||
|
||||
@ -95,6 +95,7 @@ class EasyWiFTP {
|
||||
$arrayCombined = $this->removeSlashes($pathAndFile . '/' . $file);
|
||||
|
||||
$fileSize = @ftp_size($this->ftpConnection, $arrayCombined);
|
||||
$this->lastFileSize = $fileSize;
|
||||
|
||||
if ($fileSize != -1) {
|
||||
$this->tempHandle[$file] = tmpfile();
|
||||
@ -107,10 +108,20 @@ class EasyWiFTP {
|
||||
} else {
|
||||
|
||||
$fileSize = @ftp_size($this->ftpConnection, $pathAndFile);
|
||||
$this->lastFileSize = $fileSize;
|
||||
|
||||
if ($fileSize != -1) {
|
||||
|
||||
$startAtSize = ($startAt != 0 and $fileSize > $startAt) ? ($fileSize - $startAt) : 0;
|
||||
if ($fileSize === $startAt) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$startAtSize = ($lastBytes != 0 and $fileSize > $lastBytes) ? ($fileSize - $lastBytes) : 0;
|
||||
|
||||
if ($startAt !== false and $startAt !== null and $fileSize > $startAt and ($fileSize - $startAt) > 0 and ($fileSize - $startAt) <= $lastBytes) {
|
||||
$startAtSize = $startAt;
|
||||
}
|
||||
|
||||
$this->tempHandle = tmpfile();
|
||||
|
||||
$download = @ftp_fget($this->ftpConnection, $this->tempHandle, $pathAndFile, FTP_BINARY, $startAtSize);
|
||||
@ -120,13 +131,16 @@ class EasyWiFTP {
|
||||
if ($download) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getLastFileSize() {
|
||||
return $this->lastFileSize;
|
||||
}
|
||||
|
||||
public function getTempFileContent () {
|
||||
|
||||
if (is_array($this->tempHandle)) {
|
||||
|
@ -1120,6 +1120,7 @@ $query = "CREATE TABLE IF NOT EXISTS `servertypes` (
|
||||
`workShop` enum('Y','N') DEFAULT 'N',
|
||||
`os` enum('B','L','W') DEFAULT 'L',
|
||||
`downloadPath` text,
|
||||
`liveConsole` enum('Y','N') NOT NULL DEFAULT 'Y',
|
||||
`resellerid` int(10) unsigned DEFAULT 0,
|
||||
PRIMARY KEY (`id`),KEY(`appID`),KEY(`resellerid`)
|
||||
) ENGINE=InnoDB";
|
||||
|
@ -968,6 +968,7 @@ $defined['servertypes'] = array(
|
||||
'workShop' => array("Type"=>"enum('Y','N')","Null"=>"NO","Key"=>"","Default"=>"N","Extra"=>""),
|
||||
'os' => array("Type"=>"enum('B','L','W')","Null"=>"YES","Key"=>"","Default"=>"L","Extra"=>""),
|
||||
'downloadPath' => array("Type"=>"text","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'liveConsole' => array("Type"=>"enum('Y','N')","Null"=>"NO","Key"=>"","Default"=>"Y","Extra"=>""),
|
||||
'resellerid' => array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"0","Extra"=>"")
|
||||
);
|
||||
|
||||
|
@ -50,6 +50,7 @@ if (isset($resellerLockupID)) {
|
||||
}
|
||||
|
||||
$sprache = getlanguagefile('gserver', $user_language, $reseller_id);
|
||||
$imageSprache = getlanguagefile('images', $user_language, $reseller_id);
|
||||
$loguserid = $user_id;
|
||||
$logusername = getusername($user_id);
|
||||
$logusertype = 'user';
|
||||
@ -72,7 +73,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else if ($ui->st('d', 'get') == 'wf' and $ui->id('id', 10, 'get') and ($pa['ftpaccess'] or $pa['miniroot'])) {
|
||||
|
||||
$query = $sql->prepare("SELECT g.*,AES_DECRYPT(g.`ftppassword`,?) AS `cftppass`,u.`cname`,r.`ftpport`,s.`servertemplate`,t.`shorten` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` INNER JOIN `rserverdata` r ON g.`rootID`=r.`id` INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE g.`id`=? AND g.`userid`=? AND g.`resellerid`=? AND t.`ftpAccess`='Y' LIMIT 1");
|
||||
$query->execute(array($aeskey, $ui->id('id', 10, 'get'), $user_id, $reseller_id));
|
||||
$query->execute(array($aeskey, $ui->id('id', 10, 'get'), $user_id, $resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ftpIP = $row['serverip'];
|
||||
$ftpPort = $row['ftpport'];
|
||||
@ -85,14 +86,35 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
|
||||
$userPanelInclude = true;
|
||||
|
||||
include(EASYWIDIR . '/third_party/monstaftp/class_monstaftp.php');
|
||||
include(EASYWIDIR . '/third_party/monstaftp/monstaftp.php');
|
||||
|
||||
} else {
|
||||
$template_file = 'userpanel_404.tpl';
|
||||
}
|
||||
|
||||
} else if ($ui->st('d', 'get') == 'ri' and $ui->id('id', 10, 'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id', 10, 'get'),$substituteAccess['gs']))) {
|
||||
} else if ($ui->st('d', 'get') == 'sl' and $ui->id('id', 10, 'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id', 10, 'get'), $substituteAccess['gs']))) {
|
||||
|
||||
$id = $ui->id('id', 10, 'get');
|
||||
|
||||
$query = $sql->prepare("SELECT g.`serverip`,g.`port`,t.`liveConsole` FROM `gsswitch` AS g INNER JOIN `serverlist` AS s ON g.`serverid`=s.`id` INNER JOIN `servertypes` AS t ON s.`servertype`=t.`id` WHERE g.`id`=? AND g.`userid`=? AND g.`resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id, $user_id, $resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$serverIp = $row['serverip'];
|
||||
$port = $row['port'];
|
||||
$liveConsole = $row['liveConsole'];
|
||||
}
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
$template_file = 'userpanel_gserver_log.tpl';
|
||||
} else {
|
||||
$template_file = 'userpanel_404.tpl';
|
||||
}
|
||||
|
||||
} else if ($ui->st('d', 'get') == 'ri' and $ui->id('id', 10, 'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id', 10, 'get'), $substituteAccess['gs']))) {
|
||||
|
||||
$id = (int) $ui->id('id', 10, 'get');
|
||||
|
||||
|
@ -162,6 +162,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="inputLiveConsole"><?php echo $sprache->liveConsole;?></label>
|
||||
<div class="controls">
|
||||
<select class="form-control" id="inputLiveConsole" name="liveConsole">
|
||||
<option value="Y"><?php echo $gsprache->yes;?></option>
|
||||
<option value="N" <?php if($liveConsole=='N') echo 'selected="selected"';?>><?php echo $gsprache->no;?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="inputOS"><?php echo $rsprache->os;?></label>
|
||||
<div class="controls">
|
||||
|
@ -132,6 +132,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="inputLiveConsole"><?php echo $sprache->liveConsole;?></label>
|
||||
<div class="controls">
|
||||
<select class="form-control" id="inputLiveConsole" name="liveConsole">
|
||||
<option value="Y"><?php echo $gsprache->yes;?></option>
|
||||
<option value="N" <?php if($liveConsole=='N') echo 'selected="selected"';?>><?php echo $gsprache->no;?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="inputOS"><?php echo $rsprache->os;?></label>
|
||||
<div class="controls">
|
||||
|
@ -8,7 +8,6 @@
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="content">
|
||||
|
||||
<?php if($userWantsHelpText=='Y'){ ?>
|
||||
|
@ -50,15 +50,7 @@
|
||||
<li><a href="userpanel.php?w=bu&id=<?php echo $table_row['id'];?>&action=md"><i class="fa fa-cog fa-fw"></i> <?php echo $gsprache->settings;?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<a class="btn btn-sm btn-primary" data-toggle="modal" data-target="#compose-modal-<?php echo $table_row['id'];?>"><i class="fa fa-terminal"></i> <?php echo $gsprache->logs;?></a>
|
||||
|
||||
<div class="modal fade" id="compose-modal-<?php echo $table_row['id'];?>" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content" id="modal-content-<?php echo $table_row['id'];?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="userpanel.php?w=gs&d=sl&id=<?php echo $table_row['id'];?>"><button class="btn btn-sm btn-primary"><i class="fa fa-terminal"></i> <?php echo $imageSprache->liveConsole;?></button></a>
|
||||
<a href="userpanel.php?w=gs&d=md&id=<?php echo $table_row['id'];?>"><button class="btn btn-sm btn-primary"><i class="fa fa-cog"></i> <?php echo $gsprache->settings;?></button></a>
|
||||
<a href="userpanel.php?w=gs&d=ri&id=<?php echo $table_row['id'];?>"><button class="btn btn-sm btn-warning"><i class="fa fa-refresh"></i> <?php echo $sprache->reinstall;?></button></a>
|
||||
<?php if($table_row['upload']==true){ ?><a href="userpanel.php?w=gs&d=du&id=<?php echo $table_row['id'];?>&r=gs" onsubmit="return confirm('<?php echo $gsprache->sure;?>');"><button class="btn btn-sm btn-info"><i class="icon-white icon-film"></i> SourceTV</button></a><?php } ?>
|
||||
@ -96,6 +88,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type='text/javascript'>$('#compose-modal-<?php echo $table_row['id'];?>').on('show.bs.modal',function(){ $('#modal-content-<?php echo $table_row['id'];?>').load('serverlog.php?id=<?php echo $table_row['id'];?>');});</script>
|
||||
<?php }?>
|
||||
</section>
|
81
web/template/default/user/userpanel_gserver_log.tpl
Normal file
81
web/template/default/user/userpanel_gserver_log.tpl
Normal file
@ -0,0 +1,81 @@
|
||||
<section class="content-header">
|
||||
<h1><?php echo $imageSprache->liveConsole;?></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="userpanel.php"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="userpanel.php?w=gs"><i class="fa fa-gamepad"></i> <?php echo $gsprache->gameserver;?></a></li>
|
||||
<li><i class="fa fa-terminal"></i> <?php echo $imageSprache->liveConsole;?></li>
|
||||
<li class="active"><?php echo $serverIp.':'.$port;?></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-primary">
|
||||
|
||||
<div class="box-body" id="boxBody" style="overflow-y:auto;">
|
||||
</div>
|
||||
|
||||
<div class="box-footer">
|
||||
<?php if ($liveConsole=='Z') { ?>
|
||||
<div class="input-group">
|
||||
<input id="inputCommand" type="text" class="form-control" name="command" value="">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary btn-flat" type="button" onclick="submitForm();"><i class="fa fa-play-circle"></i></button>
|
||||
</span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type='text/javascript'>
|
||||
|
||||
var lastLog = 0;
|
||||
|
||||
function submitForm() {
|
||||
|
||||
$('#inputCommand').val('');
|
||||
|
||||
$.ajax({
|
||||
url: 'ajax.php?d=serverLog&id=<?php echo $id;?>&lastLog=' + lastLog,
|
||||
cache: false
|
||||
}).done(function(jsonReturn) {
|
||||
|
||||
var jsonParsed = JSON.parse(jsonReturn);
|
||||
|
||||
if (jsonParsed.error) {
|
||||
|
||||
alert(jsonParsed.error);
|
||||
|
||||
} else {
|
||||
|
||||
lastLog = jsonParsed.lastLog;
|
||||
|
||||
if (jsonParsed.log.length > 0) {
|
||||
var boxBody = $('#boxBody');
|
||||
boxBody.append(jsonParsed.log);
|
||||
boxBody.scrollTop(boxBody.prop("scrollHeight"));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resizeHeigth() {
|
||||
var logHeight = window.innerHeight - $('.content-header').height() - $('.box-footer').height() - $('.main-header').height();
|
||||
$('#boxBody').height(logHeight * 0.6);
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
resizeHeigth();
|
||||
});
|
||||
|
||||
$(function(){
|
||||
resizeHeigth();
|
||||
submitForm();
|
||||
|
||||
setInterval(function(){submitForm()},3000);
|
||||
});
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user