2013-08-28 22:47:04 +02:00
< ? php
2014-01-26 22:59:56 +01:00
2013-08-28 22:47:04 +02:00
/**
* File : userpanel_gserver . php .
* Author : Ulrich Block
* 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 />.
*/
2013-10-27 00:16:43 +02:00
if (( ! isset ( $main ) or $main != 1 ) or ( ! isset ( $user_id ) or ( isset ( $user_id ) and ! $pa [ 'restart' ]))) {
2013-08-28 22:47:04 +02:00
header ( 'Location: userpanel.php' );
die ( 'No acces' );
}
2013-09-27 08:22:09 +02:00
2014-11-09 16:50:04 +01:00
include ( EASYWIDIR . '/stuff/keyphrasefile.php' );
2014-02-23 13:13:48 +01:00
include ( EASYWIDIR . '/stuff/methods/class_ftp.php' );
include ( EASYWIDIR . '/stuff/methods/functions_gs.php' );
2014-11-09 16:50:04 +01:00
include ( EASYWIDIR . '/stuff/methods/class_app.php' );
2013-09-27 08:22:09 +02:00
2014-02-15 19:30:19 +01:00
if ( isset ( $resellerLockupID )) {
$reseller_id = $resellerLockupID ;
}
$sprache = getlanguagefile ( 'gserver' , $user_language , $reseller_id );
2013-10-13 11:42:31 +02:00
$loguserid = $user_id ;
2013-10-26 11:59:03 +02:00
$logusername = getusername ( $user_id );
2013-10-26 11:35:51 +02:00
$logusertype = 'user' ;
2013-09-29 15:29:58 +02:00
$logreseller = 0 ;
2013-12-27 19:13:56 +01:00
2013-08-28 22:47:04 +02:00
if ( isset ( $admin_id )) {
2013-10-13 11:42:31 +02:00
$logsubuser = $admin_id ;
2013-08-28 22:47:04 +02:00
} else if ( isset ( $subuser_id )) {
2013-10-13 11:42:31 +02:00
$logsubuser = $subuser_id ;
2013-08-28 22:47:04 +02:00
} else {
2013-09-29 15:29:58 +02:00
$logsubuser = 0 ;
2013-08-28 22:47:04 +02:00
}
2013-10-03 16:48:54 +02:00
if ( $ui -> w ( 'action' , 4 , 'post' ) and ! token ( true )) {
2013-09-29 15:29:58 +02:00
$template_file = $spracheResponse -> token ;
2013-10-26 14:16:08 +02:00
2014-01-01 22:29:28 +01:00
} else if ( in_array ( $ui -> st ( 'd' , 'get' ), array ( 'ri' , 'wf' )) and ! $ui -> id ( 'id' , 10 , 'get' )) {
2013-09-29 15:29:58 +02:00
$template_file = $sprache -> error_id ;
2013-10-26 14:16:08 +02:00
2014-01-01 22:29:28 +01:00
} else if ( $ui -> st ( 'd' , 'get' ) == 'wf' and $ui -> id ( 'id' , 10 , 'get' ) and ( $pa [ 'ftpaccess' ] or $pa [ 'miniroot' ])) {
2015-02-19 23:14:51 +01:00
$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 " );
2014-01-01 22:29:28 +01:00
$query -> execute ( array ( $aeskey , $ui -> id ( 'id' , 10 , 'get' ), $user_id , $reseller_id ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2014-01-01 22:29:28 +01:00
$ftpIP = $row [ 'serverip' ];
$ftpPort = $row [ 'ftpport' ];
$ftpPass = $row [ 'cftppass' ];
$ftpUser = ( $row [ 'newlayout' ] == 'Y' ) ? $row [ 'cname' ] . '-' . $row [ 'id' ] : $row [ 'cname' ];
$gsFolder = '/server/' . $row [ 'serverip' ] . '_' . $row [ 'port' ] . '/' ;
$gsFolder .= ( $row [ 'servertemplate' ] == 1 ) ? $row [ 'shorten' ] : $row [ 'shorten' ] . '-' . $row [ 'servertemplate' ];
$address = $row [ 'serverip' ] . ':' . $row [ 'port' ];
2014-01-03 00:02:24 +01:00
$shorten = $row [ 'shorten' ];
2014-01-01 22:29:28 +01:00
}
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' ;
}
2013-10-13 11:42:31 +02:00
} 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' ]))) {
2013-10-26 14:16:08 +02:00
$id = ( int ) $ui -> id ( 'id' , 10 , 'get' );
2013-10-13 11:42:31 +02:00
if ( $ui -> st ( 'action' , 'post' ) == 'ri' ) {
2013-10-26 14:16:08 +02:00
2014-11-09 16:50:04 +01:00
$query = $sql -> prepare ( " SELECT `rootID` FROM `gsswitch` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1 " );
$query -> execute ( array ( $id , $user_id , $resellerLockupID ));
$rootID = $query -> fetchColumn ();
2013-10-26 14:16:08 +02:00
2014-11-09 16:50:04 +01:00
$appServer = new AppServer ( $rootID );
2014-01-01 22:29:28 +01:00
2014-11-09 16:50:04 +01:00
$appServer -> getAppServerDetails ( $id );
$appServer -> userCud ( 'add' );
$game = $ui -> id ( 'game' , 10 , 'post' );
if ( $ui -> active ( 'type' , 'post' ) == 'Y' ) {
$query = $sql -> prepare ( " DELETE FROM `addons_installed` WHERE `serverid`=? AND `resellerid`=? " );
$query -> execute ( array ( $game , $resellerLockupID ));
2013-08-28 22:47:04 +02:00
}
2013-10-26 14:16:08 +02:00
2014-11-09 16:50:04 +01:00
$query = $sql -> prepare ( " SELECT t.`shorten` FROM `serverlist` s INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`id`=? AND s.`resellerid`=? LIMIT 1 " );
$query -> execute ( array ( $game , $resellerLockupID ));
$shorten = $query -> fetchColumn ();
$template = ( in_array ( $ui -> id ( 'template' , 10 , 'post' ), array ( 1 , 2 , 3 , 4 ))) ? ( int ) $ui -> id ( 'template' , 10 , 'post' ) : 1 ;
if ( $template == 4 ) {
$templates = array ( $shorten , $shorten . '-2' , $shorten . '-3' );
} else if ( $template == 1 ) {
$templates = array ( $shorten );
2013-08-28 22:47:04 +02:00
} else {
2014-11-09 16:50:04 +01:00
$templates = array ( $shorten . '-' . $template );
}
if ( $ui -> active ( 'type' , 'post' ) == 'Y' ) {
$appServer -> stopAppHard ();
$appServer -> removeApp ( $templates );
$loguseraction = " %reinstall% %gserver% { $appServer -> appServerDetails [ 'serverIP' ] } : { $appServer -> appServerDetails [ 'port' ] } " ;
} else {
$loguseraction = " %resync% %gserver% { $appServer -> appServerDetails [ 'serverIP' ] } : { $appServer -> appServerDetails [ 'port' ] } " ;
}
$appServer -> addApp ( $templates );
$appServer -> execute ();
$template_file = $sprache -> server_installed ;
if ( isset ( $dbConnect [ 'debug' ]) and $dbConnect [ 'debug' ] == 1 ) {
$template_file .= '<br><pre>' . implode ( " \r \n " , $appServer -> debug ()) . '</pre>' ;
2013-08-28 22:47:04 +02:00
}
2014-11-09 16:50:04 +01:00
2013-08-28 22:47:04 +02:00
} else {
2014-08-26 20:58:32 +02:00
$shorten = '' ;
$selected2 = '' ;
$selected3 = '' ;
2013-09-29 15:29:58 +02:00
$query = $sql -> prepare ( " SELECT `serverid` FROM `gsswitch` WHERE `id`=? AND `resellerid`=? " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $id , $resellerLockupID ));
2013-10-13 11:42:31 +02:00
$currentID = $query -> fetchColumn ();
2014-08-26 20:58:32 +02:00
2013-09-29 15:29:58 +02:00
$query = $sql -> prepare ( " SELECT s.*,t.`description`,t.`shorten` FROM `serverlist` s INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`switchID`=? AND s.`resellerid`=? " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $id , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2014-08-26 20:58:32 +02:00
if ( $currentID == $row [ 'id' ]) {
$shorten = $row [ 'shorten' ];
if ( $row [ 'servertemplate' ] == 2 ) {
$selected2 = 'selected="selected"' ;
} else if ( $row [ 'servertemplate' ] == 3 ) {
$selected3 = 'selected="selected"' ;
}
}
$table [] = array (
'id' => $row [ 'id' ],
'description' => $row [ 'description' ],
'shorten' => $row [ 'shorten' ]
);
2013-08-28 22:47:04 +02:00
}
2014-08-26 20:58:32 +02:00
$template_file = ( count ( $table ) > 0 ) ? 'userpanel_gserver_reinstall.tpl' : 'userpanel_404.tpl' ;
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
2013-10-13 11:42:31 +02:00
} else if (( $ui -> st ( 'd' , 'get' ) == 'rs' or $ui -> st ( 'd' , 'get' ) == 'st' or $ui -> st ( 'd' , 'get' ) == 'du' ) and $ui -> id ( 'id' , 10 , 'get' ) and ( ! isset ( $_SESSION [ 'sID' ]) or in_array ( $ui -> id ( 'id' , 10 , 'get' ), $substituteAccess [ 'gs' ]))) {
2013-12-27 19:13:56 +01:00
2013-10-13 11:42:31 +02:00
$id = $ui -> id ( 'id' , 10 , 'get' );
2013-12-27 19:13:56 +01:00
2013-09-29 15:29:58 +02:00
$query = $sql -> prepare ( " SELECT `serverip`,`port`,`rootID` FROM `gsswitch` WHERE `id`=? AND `resellerid`=? AND `active`='Y' LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $id , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-12-28 15:54:09 +01:00
2013-10-13 11:42:31 +02:00
$gsip = $row [ 'serverip' ];
$port = $row [ 'port' ];
2013-12-27 19:13:56 +01:00
2014-11-09 16:50:04 +01:00
$appServer = new AppServer ( $row [ 'rootID' ]);
$appServer -> getAppServerDetails ( $id );
2013-10-13 11:42:31 +02:00
if ( $ui -> st ( 'd' , 'get' ) == 'rs' ) {
2013-12-27 19:13:56 +01:00
2014-11-09 16:50:04 +01:00
$appServer -> startApp ();
2013-09-29 15:29:58 +02:00
$template_file = 'Restart done' ;
2013-12-27 22:58:17 +01:00
$loguseraction = " %start% %gserver% $gsip : $port " ;
2013-12-27 19:13:56 +01:00
2013-10-13 11:42:31 +02:00
} else if ( $ui -> st ( 'd' , 'get' ) == 'st' ) {
2013-12-27 19:13:56 +01:00
2014-11-09 16:50:04 +01:00
$appServer -> stopApp ();
2013-09-29 15:29:58 +02:00
$template_file = 'Stop done' ;
2013-12-27 22:58:17 +01:00
$loguseraction = " %stop% %gserver% $gsip : $port " ;
2013-12-27 19:13:56 +01:00
2013-10-13 11:42:31 +02:00
} else if ( $ui -> st ( 'd' , 'get' ) == 'du' ) {
2013-12-27 19:13:56 +01:00
2014-11-09 16:50:04 +01:00
$appServer -> demoUpload ();
2013-09-29 15:29:58 +02:00
$template_file = 'SourceTV upload started' ;
2013-12-27 22:58:17 +01:00
$loguseraction = " %movie% %gserver% $gsip : $port " ;
2013-12-27 19:13:56 +01:00
}
2014-11-09 16:50:04 +01:00
$appServer -> execute ();
2013-12-28 15:54:09 +01:00
2014-11-09 16:50:04 +01:00
if ( isset ( $dbConnect [ 'debug' ]) and $dbConnect [ 'debug' ] == 1 ) {
$template_file .= '<br><pre>' . implode ( " \r \n " , $appServer -> debug ()) . '</pre>' ;
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
2013-08-28 22:47:04 +02:00
$insertlog -> execute ();
}
2013-12-27 19:13:56 +01:00
2013-08-28 22:47:04 +02:00
if ( ! isset ( $gsip )) {
2013-09-29 15:29:58 +02:00
$template_file = 'userpanel_404.tpl' ;
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
2013-10-13 11:42:31 +02:00
} else if ( $ui -> st ( 'd' , 'get' ) == 'md' and $ui -> id ( 'id' , 10 , 'get' ) and ( ! isset ( $_SESSION [ 'sID' ]) or in_array ( $ui -> id ( 'id' , 10 , 'get' ), $substituteAccess [ 'gs' ]))) {
2013-10-30 20:18:22 +01:00
2013-10-13 11:42:31 +02:00
$id = $ui -> id ( 'id' , 10 , 'get' );
2013-10-30 20:18:22 +01:00
$ftpAccess = 'Y' ;
2013-10-13 11:42:31 +02:00
if ( ! $ui -> smallletters ( 'action' , 2 , 'post' )) {
2013-10-30 20:18:22 +01:00
2013-08-28 22:47:04 +02:00
$table = array ();
2013-10-30 20:18:22 +01:00
$i = 0 ;
2013-09-29 15:29:58 +02:00
$query = $sql -> prepare ( " SELECT `id`,`normal_3`,`normal_4`,`hlds_3`,`hlds_4`,`hlds_5`,`hlds_6` FROM `eac` WHERE active='Y' AND `resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $resellerLockupID ));
2013-10-13 11:42:31 +02:00
$rowcount = $query -> rowCount ();
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-10-13 11:42:31 +02:00
$normal_3 = $row [ 'normal_3' ];
$normal_4 = $row [ 'normal_4' ];
$hlds_3 = $row [ 'hlds_3' ];
$hlds_4 = $row [ 'hlds_4' ];
$hlds_5 = $row [ 'hlds_5' ];
$hlds_6 = $row [ 'hlds_6' ];
2013-08-28 22:47:04 +02:00
}
2013-10-30 20:18:22 +01:00
2013-12-18 08:27:11 +01:00
$query = $sql -> prepare ( " SELECT g.`id`,g.`serverip`,g.`port`,g.`eacallowed`,g.`serverid`,g.`newlayout`,g.`protected`,AES_DECRYPT(g.`ftppassword`,?) AS `cftppass`,AES_DECRYPT(g.`ppassword`,?) AS `pftppass`,u.`cname`,r.`ftpport` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` INNER JOIN `rserverdata` r ON g.`rootID`=r.`id` WHERE g.`id`=? AND g.`userid`=? AND g.`resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $aeskey , $aeskey , $id , $user_id , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-12-18 08:27:11 +01:00
$gsIP = $row [ 'serverip' ];
$gsPort = $row [ 'port' ];
2013-10-13 11:42:31 +02:00
$ftppass = $row [ 'cftppass' ];
$eacallowed = $row [ 'eacallowed' ];
$serverID = $row [ 'serverid' ];
$eacallowed = $row [ 'eacallowed' ];
2013-12-18 08:27:11 +01:00
$ftpPort = $row [ 'ftpport' ];
$protected = $row [ 'protected' ];
2013-10-30 20:18:22 +01:00
2013-12-18 08:27:11 +01:00
$address = $row [ 'serverip' ] . ':' . $row [ 'port' ];
$ftpUser = ( $row [ 'newlayout' ] == 'Y' ) ? $row [ 'cname' ] . '-' . $row [ 'id' ] : $row [ 'cname' ];
2013-10-30 20:18:22 +01:00
2013-12-28 15:54:09 +01:00
if ( $row [ 'protected' ] == 'Y' ) {
2013-12-18 08:27:11 +01:00
$ftpUser .= '-p' ;
$pserverFolder = '' ;
$ftpPWD = $row [ 'pftppass' ];
2013-08-28 22:47:04 +02:00
} else {
2013-12-18 08:27:11 +01:00
$pserverFolder = 'server/' ;
$ftpPWD = $row [ 'cftppass' ];
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
}
if ( isset ( $gsIP )) {
$query = $sql -> prepare ( " SELECT 1 FROM `serverlist` s INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`switchID`=? AND s.`resellerid`=? AND (t.`mapGroup` IS NOT NULL OR t.`mapGroup`!='') LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $id , $resellerLockupID ));
2013-12-18 08:27:11 +01:00
if ( $query -> rowCount () > 0 ) {
$ftp = new EasyWiFTP ( $gsIP , $ftpPort , $ftpUser , $ftpPWD );
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
$query = $sql -> prepare ( " SELECT s.*,AES_DECRYPT(s.`uploaddir`,?) AS `decypteduploaddir`,AES_DECRYPT(s.`webapiAuthkey`,?) AS `dwebapiAuthkey`,t.`modfolder`,t.`description`,t.`gamebinary`,t.`shorten`,t.`modcmds`,t.`ftpAccess`,t.`appID`,t.`workShop` AS `workShopAllowed`,t.`map` AS `defaultmap`,t.`mapGroup` AS `defaultMapGroup` FROM `serverlist` s INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`switchID`=? AND s.`resellerid`=? " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $aeskey , $aeskey , $id , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-12-18 08:27:11 +01:00
$eac = array ();
$mods = array ();
$gshorten = $row [ 'shorten' ];
$anticheat = $row [ 'anticheat' ];
if ( $row [ 'ftpAccess' ] == 'N' ) {
$ftpAccess = 'N' ;
}
if ( $row [ 'gamebinary' ] == 'srcds_run' and $row [ 'user_uploaddir' ] == 'Y' and $row [ 'upload' ] > 1 and $row [ 'upload' ] < 4 ) {
$uploaddir = $row [ 'decypteduploaddir' ];
$upload = true ;
2013-08-28 22:47:04 +02:00
} else {
2013-12-18 08:27:11 +01:00
$upload = false ;
$uploaddir = '' ;
}
if ( $row [ 'gamebinary' ] == 'srcds_run' or $row [ 'gamebinary' ] == 'hlds_run' ) {
$anticheatsoft = " Valve Anti Cheat " ;
} else if ( $row [ 'gamebinary' ] == 'cod4_lnxded' ) {
$anticheatsoft = 'Punkbuster' ;
} else {
$anticheatsoft = '' ;
}
if ( $row [ 'id' ] == $serverID ) {
$currentTemplate = $gshorten ;
$displayNone = '' ;
$displayNoneBoot = 'in' ;
$option = '<option value="' . $row [ 'id' ] . '" selected="selected">' . $gshorten . '</option>' ;
} else {
$displayNone = 'display_none' ;
$displayNoneBoot = '' ;
$option = '<option value="' . $row [ 'id' ] . '">' . $gshorten . '</option>' ;
}
2014-01-26 22:59:56 +01:00
if ( $rowcount > 0 and $eacallowed == 'Y' and in_array ( $gshorten , array ( 'css' , 'csgo' , 'cstrike' , 'czero' , 'tf' ))) {
2013-12-18 08:27:11 +01:00
if ( $gshorten == 'cstrike' or $gshorten == 'czero' ) {
2014-01-26 22:59:56 +01:00
if ( $anticheat == 3 and $hlds_3 == 'Y' ) {
2013-12-18 08:27:11 +01:00
$eac [] = '<option value="3" selected="selected">Easy Anti Cheat</option>' ;
} else if ( $hlds_3 == 'Y' ) {
$eac [] = '<option value="3">Easy Anti Cheat</option>' ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 4 and $hlds_4 == 'Y' ) {
2013-12-18 08:27:11 +01:00
$eac [] = '<option value="4" selected="selected">Easy Anti Cheat Public</option>' ;
} else if ( $hlds_4 == 'Y' ) {
$eac [] = '<option value="4">Easy Anti Cheat Public</option>' ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 5 and $hlds_5 == 'Y' ) {
2013-12-18 08:27:11 +01:00
$eac [] = '<option value="5" selected="selected">Easy Anti Cheat 32Bit</option>' ;
} else if ( $hlds_5 == 'Y' ) {
$eac [] = '<option value="5">Easy Anti Cheat 32Bit</option>' ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 6 and $hlds_6 == 'Y' ) {
2013-12-18 08:27:11 +01:00
$eac [] = '<option value="6" selected="selected">Easy Anti Cheat Public 32Bit</option>' ;
} else if ( $hlds_6 == 'Y' ) {
$eac [] = '<option value="6">Easy Anti Cheat Public 32Bit</option>' ;
}
} else {
2014-01-26 22:59:56 +01:00
if ( $anticheat == 3 and $normal_3 == 'Y' ) {
2013-12-18 08:27:11 +01:00
$eac [] = '<option value="3" selected="selected">Easy Anti Cheat</option>' ;
} else if ( $normal_3 == 'Y' ) {
$eac [] = '<option value="3">Easy Anti Cheat</option>' ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 4 and $normal_4 == 'Y' ) {
2013-12-18 08:27:11 +01:00
$eac [] = '<option value="4" selected="selected">Easy Anti Cheat Public</option>' ;
} else if ( $normal_4 == 'Y' ) {
$eac [] = '<option value="4">Easy Anti Cheat Public</option>' ;
}
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
}
$mod = $row [ 'modcmd' ];
foreach ( explode ( " \r \n " , $row [ 'modcmds' ]) as $line ) {
if ( preg_match ( '/^(\[[\w\/\.\-\_\= ]{1,}\])$/' , $line )) {
$name = trim ( $line , '[]' );
$ex = preg_split ( " / \ =/ " , $name , - 1 , PREG_SPLIT_NO_EMPTY );
$mods [] = trim ( $ex [ 0 ]);
2013-08-28 22:47:04 +02:00
}
}
2013-12-18 08:27:11 +01:00
$workshopCollection = false ;
if ( $row [ 'workShopAllowed' ] == 'Y' ) {
$workshopCollection = $row [ 'workshopCollection' ];
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
$mapGroupsAvailable = array ();
if ( ! in_array ( $row [ 'defaultMapGroup' ], array ( '' , null ))) {
if ( $ftp -> loggedIn ) {
2013-12-28 15:54:09 +01:00
2013-12-18 08:27:11 +01:00
$serverTemplate = ( $row [ 'servertemplate' ] == 1 or $protected == 'Y' ) ? $row [ 'shorten' ] : $row [ 'shorten' ] . '-' . $row [ 'servertemplate' ];
2013-12-28 15:54:09 +01:00
2013-12-18 08:27:11 +01:00
$ftp -> downloadToTemp ( $pserverFolder . $gsIP . '_' . $gsPort . '/' . $serverTemplate . '/' . $row [ 'modfolder' ] . '/' , 0 , array ( 'gamemodes.txt' , 'gamemodes_server.txt' ));
2013-12-28 15:54:09 +01:00
2013-12-18 08:27:11 +01:00
$mapGroupsAvailable = $ftp -> getMapGroups ();
$ftp -> removeTempFiles ();
}
}
$map = ( ! in_array ( $row [ 'defaultmap' ], array ( '' , null ))) ? $row [ 'map' ] : null ;
2014-03-01 09:31:53 +01:00
$table [] = array ( 'id' => $row [ 'id' ], 'cmd' => $row [ 'cmd' ], 'fps' => $row [ 'fps' ], 'tic' => $row [ 'tic' ], 'map' => $map , 'workShop' => $row [ 'workShop' ], 'workshopCollection' => $workshopCollection , 'webapiAuthkey' => $row [ 'dwebapiAuthkey' ], 'mapGroup' => $row [ 'mapGroup' ], 'defaultMapGroup' => $row [ 'defaultMapGroup' ], 'mapGroupsAvailable' => $mapGroupsAvailable , 'servertemplate' => $row [ 'servertemplate' ], 'userfps' => $row [ 'userfps' ], 'usertick' => $row [ 'usertick' ], 'usermap' => $row [ 'usermap' ], 'description' => $row [ 'description' ], 'option' => $option , 'gamebinary' => $row [ 'gamebinary' ], 'upload' => $upload , 'uploaddir' => $uploaddir , 'anticheat' => $anticheat , 'anticheatsoft' => $anticheatsoft , 'eac' => $eac , 'shorten' => $gshorten , 'mod' => $mod , 'mods' => $mods , 'displayNone' => $displayNone , 'displayNoneBoot' => $displayNoneBoot );
2013-12-18 08:27:11 +01:00
$i ++ ;
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
$ftp = null ;
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
$template_file = ( $i > 0 ) ? 'userpanel_gserver_md.tpl' : 'userpanel_404.tpl' ;
2013-10-30 20:18:22 +01:00
2013-10-13 11:42:31 +02:00
} else if ( $ui -> smallletters ( 'action' , 2 , 'post' ) == 'md' and $ui -> id ( 'shorten' , 19 , 'post' )) {
2013-12-18 08:27:11 +01:00
2014-11-09 16:50:04 +01:00
$switchID = $ui -> id ( 'shorten' , 19 , 'post' );
$rootID = 0 ;
2013-12-18 08:27:11 +01:00
2013-09-29 15:29:58 +02:00
$query = $sql -> prepare ( " SELECT `active`,`normal_3`,`normal_4`,`hlds_3`,`hlds_4`,`hlds_5`,`hlds_6` FROM `eac` WHERE `resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $resellerLockupID ));
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-10-13 11:42:31 +02:00
$active = $row [ 'active' ];
$normal_3 = $row [ 'normal_3' ];
$normal_4 = $row [ 'normal_4' ];
$hlds_3 = $row [ 'hlds_3' ];
$hlds_4 = $row [ 'hlds_4' ];
$hlds_5 = $row [ 'hlds_5' ];
$hlds_6 = $row [ 'hlds_6' ];
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
2014-11-09 16:50:04 +01:00
$query = $sql -> prepare ( " SELECT g.*,AES_DECRYPT(g.`ftppassword`,?) AS `encrypted`,AES_DECRYPT(g.`ppassword`,?) AS `pencrypted`,u.`cname` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`id`=? AND g.`resellerid`=? LIMIT 1 " );
$query -> execute ( array ( $aeskey , $aeskey , $id , $resellerLockupID ));
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-10-13 11:42:31 +02:00
$oldID = $row [ 'serverid' ];
$serverip = $row [ 'serverip' ];
$port = $row [ 'port' ];
$oldPass = $row [ 'encrypted' ];
$poldPass = $row [ 'pencrypted' ];
$oldProtected = $row [ 'protected' ];
$rootID = $row [ 'rootID' ];
$servercname = $row [ 'cname' ];
$newlayout = $row [ 'newlayout' ];
$server = $serverip . ':' . $port ;
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
2013-10-30 20:18:22 +01:00
$query = $sql -> prepare ( " SELECT s.*,AES_DECRYPT(s.`uploaddir`,?) AS `decypteduploaddir`,t.`shorten`,t.`ftpAccess` FROM `serverlist` s INNER JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`id`=? AND s.`resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $aeskey , $switchID , $resellerLockupID ));
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
$oldServerTemplate = $row [ 'servertemplate' ];
2013-12-18 08:27:11 +01:00
$fps = ( $row [ 'userfps' ] == 'Y' and $ui -> id ( " fps_ ${ switchID } " , 4 , 'post' )) ? $ui -> id ( " fps_ ${ switchID } " , 4 , 'post' ) : $row [ 'fps' ];
$tic = ( $row [ 'usertick' ] == 'Y' and $ui -> id ( " tic_ ${ switchID } " , 4 , 'post' )) ? $ui -> id ( " tic_ ${ switchID } " , 4 , 'post' ) : $row [ 'tic' ];
$map = ( $row [ 'usermap' ] == 'Y' and $ui -> mapname ( " map_ ${ switchID } " , 'post' )) ? $ui -> mapname ( " map_ ${ switchID } " , 'post' ) : $row [ 'map' ];
$mapGroup = ( $row [ 'usermap' ] == 'Y' and $ui -> mapname ( " mapGroup_ ${ switchID } " , 'post' )) ? $ui -> mapname ( " mapGroup_ ${ switchID } " , 'post' ) : $row [ 'mapGroup' ];
$uploaddir = ( $row [ 'user_uploaddir' ] == 'Y' and $row [ 'upload' ] > 1 and $row [ 'upload' ] < 4 ) ? $ui -> url ( " uploaddir_ ${ switchID } " , 'post' ) : $row [ 'decypteduploaddir' ];
2014-11-09 16:50:04 +01:00
$serverTemplate = ( $ui -> id ( " servertemplate_ ${ switchID } " , 1 , 'post' )) ? $ui -> id ( " servertemplate_ ${ switchID } " , 1 , 'post' ) : 1 ;
2013-10-13 11:42:31 +02:00
$modcmd = $ui -> escaped ( " mod_ ${ switchID } " , 'post' );
2013-12-18 08:27:11 +01:00
$workShop = ( $ui -> active ( " workShop_ ${ switchID } " , 'post' )) ? $ui -> active ( " workShop_ ${ switchID } " , 'post' ) : 'Y' ;
$workshopCollection = $ui -> id ( " workshopCollection_ ${ switchID } " , 10 , 'post' );
$webapiAuthkey = $ui -> w ( " webapiAuthkey_ ${ switchID } " , 32 , 'post' );
if ( $ui -> id ( " anticheat_ ${ switchID } " , 1 , 'post' )) {
2014-01-26 22:59:56 +01:00
2013-12-18 08:27:11 +01:00
$anticheat = ( $ui -> id ( " anticheat_ ${ switchID } " , 1 , 'post' ) > 0 ) ? $ui -> id ( " anticheat_ ${ switchID } " , 1 , 'post' ) : 1 ;
if ( $row [ 'shorten' ] == 'cstrike' or $row [ 'shorten' ] == 'czero' ) {
2014-01-26 22:59:56 +01:00
if ( $anticheat == 3 and $hlds_3 == 'N' and $hlds_5 == 'Y' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 5 ;
2014-01-26 22:59:56 +01:00
} else if ( $anticheat == 3 and $hlds_3 == 'N' and $hlds_5 == 'N' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
} else if ( $anticheat > 1 and $active == 'N' ) {
$anticheat = 1 ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 4 and $hlds_4 == 'N' and $hlds_6 == 'Y' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 6 ;
2014-01-26 22:59:56 +01:00
} else if ( $anticheat == 4 and $hlds_4 == 'N' and $hlds_6 == 'N' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
2014-01-26 22:59:56 +01:00
} else if ( $anticheat > 1 and $active == 'N' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 5 and $hlds_5 == 'N' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 6 and $hlds_6 == 'N' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
}
2014-01-26 22:59:56 +01:00
if (( $anticheat > 6 and $active == 'Y' ) or $anticheat > 2 and $active == 'N' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
}
2013-08-28 22:47:04 +02:00
} else {
2014-01-26 22:59:56 +01:00
if ( $anticheat == 3 and $normal_3 == 'N' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
}
2014-01-26 22:59:56 +01:00
if ( $anticheat == 4 and $normal_4 == 'N' and $active == 'Y' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
}
2014-01-26 22:59:56 +01:00
if (( $anticheat > 4 and $active == 'Y' ) or $anticheat > 2 and $active == 'N' ) {
2013-12-18 08:27:11 +01:00
$anticheat = 1 ;
}
2013-08-28 22:47:04 +02:00
}
} else {
2013-09-29 15:29:58 +02:00
$anticheat = 1 ;
2013-08-28 22:47:04 +02:00
}
2014-02-23 13:13:48 +01:00
2013-10-30 20:18:22 +01:00
if ( $row [ 'ftpAccess' ] == 'N' ) {
$ftpAccess = 'N' ;
}
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
2013-08-28 22:47:04 +02:00
if ( isset ( $anticheat )) {
2013-12-18 08:27:11 +01:00
$query = $sql -> prepare ( " UPDATE `serverlist` SET `anticheat`=?,`fps`=?,`tic`=?,`map`=?,`workShop`=?,`workshopCollection`=?,`mapGroup`=?,`modcmd`=?,`servertemplate`=?,`uploaddir`=AES_ENCRYPT(?,?),`webapiAuthkey`=AES_ENCRYPT(?,?) WHERE `id`=? AND `resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $anticheat , $fps , $tic , $map , $workShop , $workshopCollection , $mapGroup , $modcmd , $serverTemplate , $uploaddir , $aeskey , $webapiAuthkey , $aeskey , $switchID , $resellerLockupID ));
2013-10-30 20:18:22 +01:00
$updated = ( $query -> rowCount () > 0 ) ? true : false ;
2013-08-28 22:47:04 +02:00
} else {
2013-10-30 20:18:22 +01:00
$updated = false ;
2013-08-28 22:47:04 +02:00
}
2013-10-30 20:18:22 +01:00
2014-02-23 13:13:48 +01:00
$ftppass = $ui -> password ( 'ftppass' , 100 , 'post' );
2013-10-30 20:18:22 +01:00
if ( $ftpAccess == 'Y' ) {
2014-02-23 13:13:48 +01:00
2013-10-30 20:18:22 +01:00
$query = $sql -> prepare ( " UPDATE `gsswitch` SET `serverid`=?,`ftppassword`=AES_ENCRYPT(?,?) WHERE `id`=? AND `resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $switchID , $ftppass , $aeskey , $id , $resellerLockupID ));
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
$updated = ( $query -> rowCount () > 0 ) ? true : $updated ;
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
if ( isset ( $oldID , $switchID , $oldProtected ) and $oldID != $switchID and $oldProtected == 'Y' ) {
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
$query = $sql -> prepare ( " UPDATE `gsswitch` SET `protected`='N' WHERE `id`=? AND `resellerid`=? LIMIT 1 " );
$query -> execute ( array ( $id , $resellerLockupID ));
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
$updated = ( $query -> rowCount () > 0 ) ? true : $updated ;
}
}
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
if ( $updated ) {
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
$appServer = new AppServer ( $rootID );
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
$appServer -> getAppServerDetails ( $id );
2014-02-23 13:13:48 +01:00
2014-11-09 16:50:04 +01:00
if ( isset ( $oldPass , $ftppass ) and $ftppass != $oldPass ) {
$appServer -> userCud ( 'add' );
2013-08-28 22:47:04 +02:00
}
2013-10-30 20:18:22 +01:00
2014-11-09 16:50:04 +01:00
if ( isset ( $oldID , $switchID , $oldServerTemplate , $serverTemplate ) and ( $oldID != $switchID or $oldServerTemplate != $serverTemplate )) {
$appServer -> startApp ();
2013-10-30 20:18:22 +01:00
}
2014-02-23 13:13:48 +01:00
2013-10-30 20:18:22 +01:00
$loguseraction = '%mod% %gserver% ' . $server ;
$insertlog -> execute ();
2014-11-09 16:50:04 +01:00
2013-10-30 20:18:22 +01:00
$template_file = $spracheResponse -> table_add ;
2014-11-09 16:50:04 +01:00
$appServer -> execute ();
if ( isset ( $dbConnect [ 'debug' ]) and $dbConnect [ 'debug' ] == 1 ) {
$template_file .= '<br><pre>' . implode ( " \r \n " , $appServer -> debug ()) . '</pre>' ;
}
2013-10-30 20:18:22 +01:00
} else {
$template_file = $spracheResponse -> error_table ;
}
2013-08-28 22:47:04 +02:00
} else {
2013-09-29 15:29:58 +02:00
$template_file = 'Error: No such game!' ;
2013-08-28 22:47:04 +02:00
}
2014-01-26 22:59:56 +01:00
2013-10-13 11:42:31 +02:00
} else if ( $ui -> st ( 'd' , 'get' ) == 'cf' and $ui -> id ( 'id' , 10 , 'get' ) and ( ! isset ( $_SESSION [ 'sID' ]) or in_array ( $ui -> id ( 'id' , 10 , 'get' ), $substituteAccess [ 'gs' ]))) {
2013-12-18 08:27:11 +01:00
2013-10-13 11:42:31 +02:00
$id = $ui -> id ( 'id' , 10 , 'get' );
2013-12-18 08:27:11 +01:00
2013-09-29 15:29:58 +02:00
$serverID = 0 ;
2013-12-18 08:27:11 +01:00
$configs = array ();
$configCheck = array ();
$query = $sql -> prepare ( " SELECT g.*,AES_DECRYPT(g.`ftppassword`,?) AS `dftppass`,AES_DECRYPT(g.`ppassword`,?) AS `dpftppass`,s.`anticheat`,s.`servertemplate`,t.`shorten`,t.`gamebinary`,t.`modfolder`,t.`binarydir`,u.`cname` FROM `gsswitch` g INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`id`=? AND g.`userid`=? AND g.`resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $aeskey , $aeskey , $id , $user_id , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2015-01-25 11:09:06 +01:00
2013-10-13 11:42:31 +02:00
$anticheat = $row [ 'anticheat' ];
$eacallowed = $row [ 'eacallowed' ];
$serverip = $row [ 'serverip' ];
$port = $row [ 'port' ];
$rootID = $row [ 'rootID' ];
$shorten = $row [ 'shorten' ];
$binarydir = $row [ 'binarydir' ];
$gamebinary = $row [ 'gamebinary' ];
$modfolder = $row [ 'modfolder' ];
$protected = $row [ 'protected' ];
$servertemplate = $row [ 'servertemplate' ];
$ftppass = $row [ 'dftppass' ];
$pallowed = $row [ 'pallowed' ];
2013-12-18 08:27:11 +01:00
$username = ( $row [ 'newlayout' ] == 'Y' ) ? $row [ 'cname' ] . '-' . $row [ 'id' ] : $row [ 'cname' ];
if ( $protected == 'N' and $servertemplate > 1 ) {
2013-10-13 11:42:31 +02:00
$ftpshorten = $row [ 'shorten' ] . '-' . $servertemplate ;
2013-12-27 19:13:56 +01:00
$pserver = 'server/' ;
2013-10-30 20:18:22 +01:00
} else if ( $protected == 'Y' and $pallowed == 'Y' ) {
2013-10-13 11:42:31 +02:00
$ftpshorten = $row [ 'shorten' ];
2013-12-18 08:27:11 +01:00
$username = $username . '-p' ;
2013-10-13 11:42:31 +02:00
$ftppass = $row [ 'dpftppass' ];
2013-09-29 15:29:58 +02:00
$pserver = '' ;
2013-08-28 22:47:04 +02:00
} else {
2013-10-13 11:42:31 +02:00
$ftpshorten = $row [ 'shorten' ];
2013-12-27 19:13:56 +01:00
$pserver = 'server/' ;
2013-08-28 22:47:04 +02:00
}
}
2013-12-18 08:27:11 +01:00
2015-01-25 11:09:06 +01:00
$query = $sql -> prepare ( " SELECT g.`protected`,g.`homeLabel`,t.`configs`,s.`id` FROM `gsswitch` g 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`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $id , $user_id , $resellerLockupID ));
2013-10-27 00:16:43 +02:00
$customer = getusername ( $user_id );
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2015-01-25 11:09:06 +01:00
2013-10-13 11:42:31 +02:00
$serverID = $row [ 'id' ];
$protected = $row [ 'protected' ];
2015-01-25 11:09:06 +01:00
$homeLabel = $row [ 'homeLabel' ];
2013-12-27 19:13:56 +01:00
$config_rows = explode ( " \r \n " , $row [ 'configs' ]);
2015-01-25 11:09:06 +01:00
2013-08-28 22:47:04 +02:00
foreach ( $config_rows as $configline ) {
2015-01-25 11:09:06 +01:00
2013-08-28 22:47:04 +02:00
$data_explode = explode ( " " , $configline );
$permission = ( isset ( $data_explode [ 1 ])) ? $data_explode [ 1 ] : 'full' ;
2015-01-25 11:09:06 +01:00
2013-10-03 12:49:13 +02:00
if ( $data_explode [ 0 ] != '' ) {
2013-10-10 08:06:37 +02:00
$configs [] = array ( 'permission' => $permission , 'line' => $data_explode [ 0 ]);
2013-10-05 13:39:56 +02:00
$configCheck [] = $data_explode [ 0 ];
2013-08-28 22:47:04 +02:00
}
}
}
2013-12-18 08:27:11 +01:00
2013-09-29 15:29:58 +02:00
$query = $sql -> prepare ( " SELECT a.`configs`,a.`paddon` FROM `addons_installed` i INNER JOIN `addons` a ON i.`addonid`=a.`id` WHERE i.`serverid`=? AND i.`userid`=? AND i.`resellerid`=? " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $serverID , $user_id , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-10-30 20:18:22 +01:00
if ( isset ( $protected ) and ( $protected == 'N' or $row [ 'paddon' ] == 'Y' )) {
2013-08-28 22:47:04 +02:00
$config_rows = explode ( " \r \n " , $row [ 'configs' ]);
foreach ( $config_rows as $configline ) {
$data_explode = explode ( " " , $configline );
$permission = ( isset ( $data_explode [ 1 ])) ? $data_explode [ 1 ] : 'full' ;
2013-10-03 12:49:13 +02:00
if ( $data_explode [ 0 ] != '' ) {
2013-10-10 08:06:37 +02:00
$configs [] = array ( 'permission' => $permission , 'line' => $data_explode [ 0 ]);
2013-10-05 13:39:56 +02:00
$configCheck [] = $data_explode [ 0 ];
2013-08-28 22:47:04 +02:00
}
}
}
}
2013-12-18 08:27:11 +01:00
if ( $ui -> smallletters ( 'type' , 4 , 'get' )) {
2013-10-13 11:42:31 +02:00
if ( $ui -> config ( 'config' , 'get' )) {
$postconfig = $ui -> config ( 'config' , 'get' );
} else if ( $ui -> config ( 'config' , 'post' )) {
$postconfig = $ui -> config ( 'config' , 'post' );
2013-08-28 22:47:04 +02:00
} else {
2013-10-13 11:42:31 +02:00
$postconfig = null ;
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
2013-12-27 19:13:56 +01:00
if ( in_array ( $postconfig , $configCheck ) and $ui -> smallletters ( 'type' , 4 , 'get' ) and ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'easy' or $ui -> smallletters ( 'type' , 4 , 'get' ) == 'full' )) {
2013-12-18 08:27:11 +01:00
$explodeconfig = explode ( '/' , $postconfig );
$configname = $explodeconfig [( count ( $explodeconfig ) - 1 )];
2015-01-25 11:09:06 +01:00
$query = $sql -> prepare ( " SELECT `ip`,`ftpport`,`install_paths` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1 " );
2014-11-09 16:50:04 +01:00
$query -> execute ( array ( $rootID , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2015-01-25 11:09:06 +01:00
2013-10-13 11:42:31 +02:00
$ftpport = $row [ 'ftpport' ];
$ip = $row [ 'ip' ];
2015-01-25 11:09:06 +01:00
$iniVars = @ parse_ini_string ( $row [ 'install_paths' ], true );
$homeDir = ( $iniVars and isset ( $iniVars [ $homeLabel ][ 'path' ])) ? ( string ) $iniVars [ $homeLabel ][ 'path' ] : '/home' ;
$homeDir .= '/' . $username ;
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
2013-10-13 13:11:38 +02:00
if ( $gamebinary == 'srcds_run' ){
2013-10-13 11:42:31 +02:00
$config = $binarydir . '/' . $modfolder . '/' . $postconfig ;
2013-12-27 19:13:56 +01:00
if ( $configname == 'server.cfg' and $gamebinary == 'srcds_run' ) {
2013-08-28 22:47:04 +02:00
$general_cvar = array ( 'hostname' , 'sv_password' , 'sv_contact' , 'sv_tags' , 'motdfile' , 'mapcyclefile' , 'sv_downloadurl' , 'net_maxfilesize' , 'rcon_password' , 'sv_rcon_minfailures' , 'sv_rcon_maxfailures' , 'sv_rcon_banpenalty' , 'sv_rcon_minfailuretime' , 'sv_pure' , 'sv_pure_kick_clients' , 'sv_timeout' , 'sv_voiceenable' , 'sv_allowdownload' , 'sv_allowupload' , 'sv_region' , 'sv_friction' , 'sv_stopspeed' , 'sv_gravity' , 'sv_accelerate' , 'sv_airaccelerate' , 'sv_wateraccelerate' , 'sv_allow_color_correction' , 'sv_allow_wait_command' , 'mp_flashlight' , 'mp_footsteps' , 'mp_falldamage' , 'mp_limitteams' , 'mp_limitteams' , 'mp_friendlyfire' , 'mp_autokick' , 'mp_forcecamera' , 'mp_fadetoblack' , 'mp_allowspectators' , 'mp_chattime' , 'log' , 'sv_log_onefile' , 'sv_logfile' , 'sv_logbans' , 'sv_logecho' , 'mp_logdetail' , 'mp_timelimit' , 'mp_winlimit' , 'sv_minrate' , 'sv_maxrate' , 'sv_minupdaterate' , 'sv_maxupdaterate' , 'sv_mincmdrate' , 'sv_maxcmdrate' , 'sv_client_cmdrate_difference' , 'sv_client_min_interp_ratio' , 'sv_client_max_interp_ratio' , 'mp_fraglimit' , 'mp_maxrounds' );
} else {
2013-09-29 15:29:58 +02:00
$general_cvar = array ();
2013-08-28 22:47:04 +02:00
}
2013-10-13 13:11:38 +02:00
} else if ( $gamebinary == 'hlds_run' ){
2013-10-13 11:42:31 +02:00
$config = $modfolder . '/' . $postconfig ;
2013-09-29 15:29:58 +02:00
$general_cvar = array ();
2013-08-28 22:47:04 +02:00
} else {
2013-09-29 15:29:58 +02:00
$general_cvar = array ();
2013-10-13 11:42:31 +02:00
$config = $postconfig ;
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
if ( $shorten == 'css' and $configname == 'server.cfg' ) {
2013-08-28 22:47:04 +02:00
$game_cvars = array ( 'motdfile_text' , 'sv_disablefreezecam' , 'sv_nonemesis' , 'sv_nomvp' , 'sv_nostats' , 'sv_allowminmodels' , 'sv_hudhint_sound' , 'sv_competitive_minspec' , 'sv_legacy_grenade_damage' , 'sv_enableboost' , 'sv_enablebunnyhopping' , 'mp_forceautoteam' , 'mp_enableroundwaittime' , 'mp_startmoney' , 'mp_roundtime' , 'mp_buytime' , 'mp_c4timer' , 'mp_freezetime' , 'mp_spawnprotectiontime' , 'mp_hostagepenalty' , 'mp_tkpunish' );
2013-12-27 19:13:56 +01:00
} else if ( $shorten == " dods " and $configname == 'server.cfg' ) {
2013-08-28 22:47:04 +02:00
$game_cvars = array ( 'mp_limit_allies_rocket' , 'mp_limit_axis_rocket' , 'mp_limit_axis_mg' , 'mp_limit_axis_sniper' , 'mp_limit_axis_assault' , 'mp_limit_axis_support' , 'mp_limit_axis_rifleman' , 'mp_limit_allies_mg' , 'mp_limit_allies_sniper' , 'mp_limit_allies_assault' , 'mp_limit_allies_support' , 'mp_limit_allies_rifleman' , 'dod_freezecam' , 'dod_enableroundwaittime' , 'dod_bonusroundtime' , 'dod_bonusround' );
} else {
2013-09-29 15:29:58 +02:00
$game_cvars = array ();
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
$configfile = '' ;
2013-09-29 15:29:58 +02:00
$cleanedconfig = '' ;
2013-12-27 19:13:56 +01:00
$newconfig = '' ;
$setarray = array ();
$ftp = new EasyWiFTP ( $ip , $ftpport , $username , $ftppass );
if ( $ftp -> loggedIn === true ) {
if ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'full' and isset ( $ui -> post [ 'update' ]) and $ui -> post [ 'update' ] == 1 ) {
$configfile = stripslashes ( $ui -> post [ 'cleanedconfig' ]);
} else if ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'easy' or ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'full' and ! isset ( $ui -> post [ 'update' ]))) {
$ftp -> downloadToTemp ( $pserver . $serverip . '_' . $port . '/' . $ftpshorten . '/' . $config );
$configfile = $ftp -> getTempFileContent ();
}
2014-01-01 22:29:28 +01:00
$lines = array ();
2013-12-27 19:13:56 +01:00
if ( strlen ( $configfile ) > 0 ) {
$configfile = str_replace ( array ( " \0 " , " \ b " , " \r " , " \ Z " ), '' , $configfile );
$lines = explode ( " \n " , $configfile );
}
if ( isset ( $ui -> post [ 'update' ]) and $ui -> post [ 'update' ] == 1 and isset ( $lines )) {
foreach ( $lines as $singeline ) {
$singeline = preg_replace ( '/\s+/' , ' ' , $singeline );
if ( preg_match ( " / \ w/ " , substr ( $singeline , 0 , 1 ))) {
if ( preg_match ( " / \" / " , $singeline )) {
$split = explode ( '"' , $singeline );
$cvar = str_replace ( ' ' , '' , $split [ 0 ]);
$value = $split [ 1 ];
if ( $cvar != 'exec' ) {
2013-09-08 17:21:34 +02:00
if ( isset ( $ui -> post [ $cvar ])) {
2013-12-27 19:13:56 +01:00
if ( isset ( $ui -> post [ 'oldrcon' ]) and $cvar == 'rcon_password' and $ui -> post [ $cvar ] != $ui -> post [ 'oldrcon' ] and $configname == 'server.cfg' and in_array ( $anticheat , array ( 2 , 3 , 4 , 5 )) and ( $gamebinary == 'srcds_run' or $gamebinary == 'hlds_run' ) and $eacallowed == 'Y' ) {
2014-11-09 16:50:04 +01:00
eacchange ( 'change' , $id , $ui -> post [ $cvar ], $resellerLockupID );
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
$newconfig .= $cvar . ' "' . $ui -> post [ $cvar ] . '"' . " \r \n " ;
} else if ( isset ( $ui -> post [ 'oldrcon' ]) and $cvar == 'rcon_password' and $value != $ui -> post [ 'oldrcon' ] and $configname == 'server.cfg' and in_array ( $anticheat , array ( 2 , 3 , 4 , 5 )) and ( $gamebinary == 'srcds_run' or $gamebinary == 'hlds_run' ) and $eacallowed == 'Y' ) {
2014-11-09 16:50:04 +01:00
eacchange ( 'change' , $id , $value , $resellerLockupID );
2013-12-27 19:13:56 +01:00
2013-08-28 22:47:04 +02:00
} else {
2013-12-27 19:13:56 +01:00
$newconfig .= $singeline . " \r \n " ;
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
2013-08-28 22:47:04 +02:00
array_push ( $setarray , $cvar );
2013-12-27 19:13:56 +01:00
2013-08-28 22:47:04 +02:00
} else {
2013-12-27 19:13:56 +01:00
$newconfig .= $singeline . " \r \n " ;
}
} else {
$split = explode ( ' ' , $singeline );
if ( isset ( $split [ 0 ])) {
$cvar = $split [ 0 ];
$value = ( isset ( $split [ 1 ])) ? $split [ 1 ] : '' ;
if ( $cvar != 'exec' ) {
if ( isset ( $ui -> post [ $cvar ])) {
if ( isset ( $ui -> post [ 'oldrcon' ]) and $cvar == 'rcon_password' and $ui -> post [ $cvar ] != $ui -> post [ 'oldrcon' ] and $configname == 'server.cfg' and in_array ( $anticheat , array ( 2 , 3 , 4 , 5 )) and ( $gamebinary == 'srcds_run' or $gamebinary == 'hlds_run' ) and $eacallowed == 'Y' ) {
2014-11-09 16:50:04 +01:00
eacchange ( 'change' , $id , $ui -> post [ $cvar ], $resellerLockupID );
2013-12-27 19:13:56 +01:00
}
$newconfig .= $cvar . ' "' . $ui -> post [ $cvar ] . '"' . " \r \n " ;
} else if ( isset ( $ui -> post [ 'oldrcon' ]) and $cvar == 'rcon_password' and $value != $ui -> post [ 'oldrcon' ] and $configname == 'server.cfg' and in_array ( $anticheat , array ( 2 , 3 , 4 , 5 )) and ( $gamebinary == 'srcds_run' or $gamebinary == 'hlds_run' ) and $eacallowed == 'Y' ) {
2014-11-09 16:50:04 +01:00
eacchange ( 'change' , $id , $value , $resellerLockupID );
2013-12-27 19:13:56 +01:00
} else {
$newconfig .= $singeline . " \r \n " ;
}
array_push ( $setarray , $cvar );
} else {
$newconfig .= $singeline . " \r \n " ;
}
2013-08-28 22:47:04 +02:00
}
}
2013-12-27 19:13:56 +01:00
} else {
$newconfig .= $singeline . " \r \n " ;
2013-08-28 22:47:04 +02:00
}
}
2013-12-27 19:13:56 +01:00
if ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'easy' ) {
foreach ( $general_cvar as $check_cvar ) {
if ( ! in_array ( $check_cvar , $setarray )) {
$newconfig .= $check_cvar . ' "' . $ui -> post [ $check_cvar ] . '"' . " \r \n " ;
}
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
foreach ( $game_cvars as $check_cvar ) {
if ( ! in_array ( $check_cvar , $setarray )) {
$newconfig .= $check_cvar . ' "' . $ui -> post [ $check_cvar ] . '"' . " \r \n " ;
}
2013-08-28 22:47:04 +02:00
}
}
2013-12-27 19:13:56 +01:00
if ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'easy' ) {
$ftp -> tempHandle = null ;
$ftp -> writeContentToTemp ( $newconfig );
} else if ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'full' ) {
$ftp -> tempHandle = null ;
if ( mb_strlen ( $ui -> post [ 'cleanedconfig' ], 'UTF-8' ) < 16385 ) {
$ftp -> writeContentToTemp ( stripslashes ( $ui -> post [ 'cleanedconfig' ]));
} else {
$post_lines = explode ( '<br />' , nl2br ( stripslashes ( $ui -> post [ 'cleanedconfig' ])));
$post_lines [] = " \r \n " ;
$post_lines [] = " \r \n " ;
$post_lines [] = " \r \n " ;
foreach ( $post_lines as $line ) {
$ftp -> writeContentToTemp (( $line == " \r \n " ) ? $line : $line . " \r \n " );
2013-08-28 22:47:04 +02:00
}
}
}
2015-01-25 11:09:06 +01:00
$uploaded = false ;
if ( $ftp -> uploadFileFromTemp ( $ftp -> removeSlashes ( $pserver . $serverip . '_' . $port . '/' . $ftpshorten . '/' ), $config , false )) {
$uploaded = true ;
}
if ( $uploaded == false and $ftp -> uploadFileFromTemp ( $ftp -> removeSlashes ( $homeDir . '/' . $pserver . $serverip . '_' . $port . '/' . $ftpshorten . '/' ), $config , false )) {
$uploaded = true ;
}
if ( $uploaded ) {
2013-12-27 19:13:56 +01:00
$template_file = 'Success: ' . $config ;
$loguseraction = '%cfg% ' . $configname ;
$insertlog -> execute ();
2013-08-28 22:47:04 +02:00
} else {
2013-12-27 19:13:56 +01:00
$template_file = 'Error writing config: ' . $config ;
2013-08-28 22:47:04 +02:00
}
2013-12-27 19:13:56 +01:00
} else if ( isset ( $lines )) {
$linearray = array ();
$unknownarray = array ();
$cleanedconfig = '' ;
foreach ( $lines as $singeline ) {
$cleanedconfig .= $singeline . " \r \n " ;
if ( preg_match ( " / \ w/ " , substr ( $singeline , 0 , 1 ))) {
if ( preg_match ( " / \" / " , $singeline )) {
$split = explode ( '"' , $singeline );
$cvar = str_replace ( ' ' , '' , $split [ 0 ]);
$value = $split [ 1 ];
if ( $cvar != 'exec' ) {
2013-08-28 22:47:04 +02:00
if ( in_array ( $cvar , $general_cvar ) or in_array ( $cvar , $game_cvars )) {
2013-10-05 13:39:56 +02:00
$linearray [ $cvar ] = $value ;
2013-08-28 22:47:04 +02:00
} else {
2013-10-05 13:39:56 +02:00
$unknownarray [ $cvar ] = $value ;
2013-08-28 22:47:04 +02:00
}
}
2013-12-27 19:13:56 +01:00
} else {
$split = explode ( ' ' , $singeline );
if ( isset ( $split [ 0 ])) {
$cvar = $split [ 0 ];
$value = ( isset ( $split [ 1 ])) ? $split [ 1 ] : '' ;
if ( $cvar != 'exec' ) {
if ( in_array ( $cvar , $general_cvar ) or in_array ( $cvar , $game_cvars )) {
$linearray [ $cvar ] = $value ;
} else {
$unknownarray [ $cvar ] = $value ;
}
}
}
2013-08-28 22:47:04 +02:00
}
}
}
2013-12-27 19:13:56 +01:00
$array_keys = array_keys ( $unknownarray );
if ( $configname == 'server.cfg' and in_array ( $anticheat , array ( 2 , 3 , 4 , 5 )) and ( $gamebinary == 'srcds_run' or $gamebinary == 'hlds_run' ) and $eacallowed == 'Y' ) {
$oldrcon = ( array_key_exists ( 'rcon_password' , $linearray )) ? $linearray [ 'rcon_password' ] : 'unset' ;
}
if ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'easy' ) {
$template_file = 'userpanel_gserver_config_edit_easy.tpl' ;
} else if ( $ui -> smallletters ( 'type' , 4 , 'get' ) == 'full' ) {
$template_file = 'userpanel_gserver_config_edit_full.tpl' ;
}
2013-08-28 22:47:04 +02:00
}
2014-01-01 22:29:28 +01:00
2013-12-27 19:13:56 +01:00
} else {
$template_file = 'Error: FTP Access' ;
2013-08-28 22:47:04 +02:00
}
} else {
2013-09-29 15:29:58 +02:00
$template_file = 'userpanel_404.tpl' ;
2013-08-28 22:47:04 +02:00
}
} else {
2013-10-30 20:18:22 +01:00
$template_file = 'userpanel_gserver_config_edit.tpl' ;
2013-08-28 22:47:04 +02:00
}
2013-12-18 08:27:11 +01:00
2013-08-28 22:47:04 +02:00
} else {
2014-11-09 16:50:04 +01:00
2013-09-29 15:29:58 +02:00
$table = array ();
2013-12-27 19:13:56 +01:00
2013-12-18 08:27:11 +01:00
$query = $sql -> prepare ( " SELECT AES_DECRYPT(`ftppassword`,?) AS `cftppass`,g.*,s.`servertemplate`,s.`upload`,t.`id` AS `tid`,t.`ramLimited`,t.`shorten`,t.`protected` AS `tp`,u.`cname` FROM `gsswitch` g INNER JOIN `serverlist` s ON g.`serverid`=s.`id` INNER JOIN `servertypes` t ON s.`servertype`=t.`id` INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`active`='Y' AND g.`userid`=? AND g.`resellerid`=? ORDER BY g.`serverip`,g.`port` " );
2013-09-29 15:29:58 +02:00
$query2 = $sql -> prepare ( " SELECT `ftpport` FROM `rserverdata` WHERE `id`=? LIMIT 1 " );
2013-10-30 20:18:22 +01:00
$query3 = $sql -> prepare ( " SELECT 1 FROM `servertypes` WHERE `id`=? AND `ftpAccess`='N' LIMIT 1 " );
2014-11-15 12:46:01 +01:00
$query -> execute ( array ( $aeskey , $user_id , $resellerLockupID ));
2014-11-30 12:55:07 +01:00
while ( $row = $query -> fetch ( PDO :: FETCH_ASSOC )) {
2013-08-28 22:47:04 +02:00
if ( ! isset ( $_SESSION [ 'sID' ]) or in_array ( $row [ 'id' ], $substituteAccess [ 'gs' ])) {
2013-10-13 11:42:31 +02:00
$rootid = $row [ 'rootID' ];
$war = $row [ 'war' ];
$brandname = $row [ 'brandname' ];
$protected = $row [ 'protected' ];
$tprotected = $row [ 'tp' ];
$pallowed = $row [ 'pallowed' ];
$cname = $row [ 'cname' ];
$shorten = $row [ 'shorten' ];
$gameserverid = $row [ 'id' ];
$name = $row [ 'queryName' ];
$ip = $row [ 'serverip' ];
$port = $row [ 'port' ];
$numplayers = $row [ 'queryNumplayers' ];
$maxplayers = $row [ 'queryMaxplayers' ];
$password = $row [ 'queryPassword' ];
$stopped = $row [ 'stopped' ];
$notified = $row [ 'notified' ];
$cftppass = $row [ 'cftppass' ];
$servertemplate = $row [ 'servertemplate' ];
2013-10-30 20:18:22 +01:00
$address = $ip . ':' . $port ;
$map = ( in_array ( $row [ 'queryMap' ], array ( false , null , '' ))) ? 'Unknown' : $row [ 'queryMap' ];
$updatetime = ( $user_language == 'de' ) ? ( $row [ 'queryUpdatetime' ] != '' ) ? date ( 'd.m.Y H:m:s' , strtotime ( $row [ 'queryUpdatetime' ])) : $sprache -> never : $row [ 'queryUpdatetime' ];
$upload = ( $row [ 'upload' ] > 1 and $row [ 'upload' ] < 4 ) ? true : false ;
$currentTemplate = (( $protected == 'N' or $tprotected == 'N' ) and $servertemplate > 1 ) ? $row [ 'shorten' ] . '-' . $servertemplate : $row [ 'shorten' ];
$ce = explode ( ',' , $row [ 'cores' ]);
$coreCount = count ( $ce );
$cores = array ();
if ( $row [ 'taskset' ] == 'Y' and $coreCount > 0 ) {
foreach ( $ce as $uc ) {
$cores [] = $uc ;
}
2013-08-28 22:47:04 +02:00
}
2013-10-30 20:18:22 +01:00
$cores = implode ( ', ' , $cores );
if ( $stopped == 'Y' ) {
$name = 'OFFLINE' ;
}
2013-09-29 15:29:58 +02:00
$imgNameP = '' ;
$imgAltP = '' ;
$pro = '' ;
2013-10-30 20:18:22 +01:00
$pserver = '/server/' ;
if ( $protected == 'N' and ( $pallowed == 'Y' and $tprotected == 'Y' )) {
$imgNameP = '16_unprotected' ;
2013-10-13 11:42:31 +02:00
$imgAltP = $sprache -> off2 ;
$pro = $sprache -> off2 ;
2013-10-30 20:18:22 +01:00
} else if ( $protected == 'Y' and $tprotected == 'Y' and $pallowed == 'Y' ) {
$imgNameP = '16_protected' ;
2013-10-13 11:42:31 +02:00
$imgAltP = $sprache -> on ;
2013-10-30 20:18:22 +01:00
$pserver = '/pserver/' ;
2013-10-13 11:42:31 +02:00
$pro = $sprache -> on ;
2013-08-28 22:47:04 +02:00
}
2013-10-30 20:18:22 +01:00
2013-10-13 13:11:38 +02:00
if ( $pa [ 'ftpaccess' ] or $pa [ 'miniroot' ]) {
2013-10-30 20:18:22 +01:00
if ( $row [ 'newlayout' ] == 'Y' ) {
$cname = $cname . '-' . $row [ 'id' ];
}
2013-08-28 22:47:04 +02:00
$query2 -> execute ( array ( $rootid ));
2013-10-13 11:42:31 +02:00
$ftpport = $query2 -> fetchColumn ();
2013-10-30 20:18:22 +01:00
$ftpdata = 'ftp://' . $cname . ':' . $cftppass . '@' . $ip . ':' . $ftpport . $pserver . $ip . '_' . $port . '/' . $currentTemplate ;
2013-08-28 22:47:04 +02:00
} else {
2013-09-29 15:29:58 +02:00
$cftppass = '' ;
$ftpport = '' ;
$ftpdata = '' ;
2013-08-28 22:47:04 +02:00
}
2013-10-30 20:18:22 +01:00
2013-09-29 15:29:58 +02:00
$nameremoved = '' ;
$premoved = '' ;
2013-10-13 17:12:44 +02:00
$imgName = '16_ok' ;
$imgAlt = 'Online' ;
2013-10-30 20:18:22 +01:00
if ( $stopped == 'Y' ) {
2013-09-29 15:29:58 +02:00
$numplayers = 0 ;
$maxplayers = 0 ;
2013-10-13 17:12:44 +02:00
$imgName = '16_bad' ;
$imgAlt = 'Stopped' ;
2014-01-30 19:08:58 +01:00
} else if ( $name == 'OFFLINE' and $stopped == 'N' ) {
2013-09-29 15:29:58 +02:00
$numplayers = 0 ;
$maxplayers = 0 ;
2013-10-13 17:12:44 +02:00
$imgName = '16_error' ;
$imgAlt = 'Crashed' ;
2013-08-28 22:47:04 +02:00
} else {
2014-05-01 19:20:58 +02:00
if ( $war == 'Y' and $password == 'N' ) {
2013-10-13 17:12:44 +02:00
$imgName = '16_error' ;
$imgAlt = 'No Password' ;
2013-10-13 11:42:31 +02:00
$premoved = $sprache -> premoved ;
2013-08-28 22:47:04 +02:00
}
2013-10-03 12:49:13 +02:00
if ( $brandname == 'Y' and $rSA [ 'brandname' ] != null and $rSA [ 'brandname' ] != '' and strpos ( strtolower ( $name ), strtolower ( $rSA [ 'brandname' ])) === false ) {
2013-10-13 17:12:44 +02:00
$imgName = '16_error' ;
$imgAlt = 'No Servertag' ;
2013-10-13 11:42:31 +02:00
$nameremoved = $sprache -> nameremoved ;
2013-08-28 22:47:04 +02:00
}
}
2013-10-30 20:18:22 +01:00
$query3 -> execute ( array ( $row [ 'tid' ]));
$ftpAllowed = ( $query3 -> rowCount () == 0 ) ? true : false ;
2014-08-28 23:42:22 +02:00
$table [] = array (
'id' => $gameserverid ,
'premoved' => $premoved ,
'nameremoved' => $nameremoved ,
'server' => $address ,
'name' => $name ,
'img' => $imgName ,
'alt' => $imgAlt ,
'imgp' => $imgNameP ,
'altp' => $imgAltP ,
'numplayers' => $numplayers ,
'maxplayers' => $maxplayers ,
'map' => $map ,
'cname' => $cname ,
'cftppass' => $cftppass ,
'ip' => $ip ,
'ftpport' => $ftpport ,
'port' => $port ,
'shorten' => $currentTemplate ,
'gameShorten' => $shorten ,
'ftpdata' => $ftpdata ,
'updatetime' => $updatetime ,
'stopped' => $stopped ,
'pro' => $pro ,
'upload' => $upload ,
'minram' => $row [ 'minram' ],
'maxram' => $row [ 'maxram' ],
'taskset' => $row [ 'taskset' ],
'ramLimited' => $row [ 'ramLimited' ],
'coreCount' => $coreCount ,
'cores' => $cores ,
'ftpAllowed' => $ftpAllowed
);
2013-08-28 22:47:04 +02:00
}
}
2014-11-09 19:50:55 +01:00
2013-10-30 20:18:22 +01:00
$template_file = 'userpanel_gserver_list.tpl' ;
2013-08-28 22:47:04 +02:00
}