#347 Add GS Windows support

This commit is contained in:
Ulrich Block 2014-03-02 10:18:25 +01:00
parent 225bf5d3c4
commit 2de7e87f22
5 changed files with 109 additions and 82 deletions

View File

@ -39,55 +39,47 @@
*/
define('EASYWIDIR', dirname(__FILE__));
if (is_dir(EASYWIDIR . '/install')) die('Please remove the "install" folder');
if (is_dir(EASYWIDIR . '/install')) {
die('Please remove the "install" folder');
}
include(EASYWIDIR . '/stuff/methods/functions.php');
include(EASYWIDIR . '/stuff/methods/class_validator.php');
include(EASYWIDIR . '/stuff/methods/vorlage.php');
include(EASYWIDIR . '/stuff/config.php');
include(EASYWIDIR . '/stuff/settings.php');
if (isset($admin_id)) {
$permissionid=(isset($_SESSION['oldid'])) ? (isset($_SESSION['oldadminid'])) ? $_SESSION['oldadminid'] : $_SESSION['oldid'] : $admin_id;
$userpermissionquery = $sql->prepare("SELECT * FROM `userpermissions` WHERE `userid`=? LIMIT 1");
$userpermissionquery->execute(array($permissionid));
foreach ($userpermissionquery->fetchall() as $userpermissionrow) {
if ($userpermissionrow['root'] == 'Y') {
foreach ($userpermissionrow as $key => $value) {
$pa[$key] = true;
}
} else {
foreach ($userpermissionrow as $key => $value) {
if ($value == 'Y') {
$pa[$key] = true;
} else {
$pa[$key] = false;
}
}
}
}
if (!isset($admin_id) and !isset($user_id)) {
redirect('login.php');
} else if (isset($admin_id)) {
$pa = User_Permissions($admin_id);
} else if (isset($user_id)) {
$pa = User_Permissions($user_id);
}
if (isset($user_id)) {
$userpermissionquery = $sql->prepare("SELECT * FROM `userpermissions` WHERE `userid`=? LIMIT 1");
$userpermissionquery->execute(array($user_id));
foreach ($userpermissionquery->fetchall() as $userpermissionrow) {
if ($userpermissionrow['miniroot'] == 'Y') {
foreach ($userpermissionrow as $key => $value) {
$pau[$key] = true;
}
} else {
foreach ($userpermissionrow as $key => $value) {
if (isset($admin_id)) {
$pau[$key] = true;
} else {
if ($value == 'Y') {
$pau[$key] = true;
} else {
$pau[$key] = false;
}
}
}
}
}
if (isset($admin_id) and $pa['dedicatedServer'] and $ui->smallletters('d', 7, 'get') == 'freeips' and $reseller_id == 0) {
if ($ui->id('userID', 10, 'get')) {
$query = $sql->prepare("SELECT `resellerid` FROM `userdata` WHERE `id`=? LIMIT 1");
$query->execute(array($ui->id('userID', 10, 'get')));
$ipsAvailable = freeips(($query->fetchColumn()));
} else {
$ipsAvailable = array();
}
$template_file = 'ajax_admin_roots_ips.tpl';
}
if (((!isset($admin_id) and !isset($user_id)) or (((!$pa['gserver']) and !$pa['voiceserver'] and !$pa['voicemasterserver'] and !$pa['traffic'] and !$pa['user'] and !rsellerpermisions($admin_id) and !$pa['usertickets']) and (!$pau['restart'] and !$pau['usertickets'])))) {
die('No acces');
if (isset($template_file)) {
require_once IncludeTemplate($template_to_use, $template_file, 'ajax');
} else {
die('No Access');
}

View File

@ -824,12 +824,12 @@ if ($currentStep == 8 and count($systemCheckError) == 0) {
$displayToUser .= "<div class='alert alert-success'>{$languageObject->ok_gameserver_data}</div>";
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=0 LIMIT 1");
$query2 = $sql->prepare("INSERT INTO `servertypes` (`steamgame`,`appID`,`updates`,`shorten`,`description`,`gamebinary`,`binarydir`,`modfolder`,`fps`,`slots`,`map`,`cmd`,`modcmds`,`tic`,`gameq`,`gamemod`,`gamemod2`,`configs`,`configedit`,`portStep`,`portMax`,`portOne`,`portTwo`,`portThree`,`portFour`,`portFive`,`mapGroup`,`protected`,`protectedSaveCFGs`,`ramLimited`,`os`) VALUES (:steamgame,:appID,:updates,:shorten,:description,:gamebinary,:binarydir,:modfolder,:fps,:slots,:map,:cmd,:modcmds,:tic,:gameq,:gamemod,:gamemod2,:configs,:configedit,:portStep,:portMax,:portOne,:portTwo,:portThree,:portFour,:portFive,:mapGroup,:protected,:protectedSaveCFGs,:ramLimited,:os)");
$query3 = $sql->prepare("UPDATE `servertypes` SET `steamgame`=:steamgame,`appID`=:appID,`updates`=:updates,`shorten`=:shorten,`description`=:description,`gamebinary`=:gamebinary,`binarydir`=:binarydir,`modfolder`=:modfolder,`fps`=:fps,`slots`=:slots,`map`=:map,`cmd`=:cmd,`modcmds`=:modcmds,`tic`=:tic,`gameq`=:gameq,`gamemod`=:gamemod,`gamemod2`=:gamemod2,`configs`=:configs,`configedit`=:configedit,`portStep`=:portStep,`portMax`=:portMax,`portOne`=:portOne,`portTwo`=:portTwo,`portThree`=:portThree,`portFour`=:portFour,`portFive`=:portFive,`mapGroup`=:mapGroup,`protected`=:protected,`protectedSaveCFGs`=:protectedSaveCFGs,`ramLimited`=:ramLimited,`os`=:os WHERE `shorten`=:shorten AND `resellerid`=0 LIMIT 1");
$query2 = $sql->prepare("INSERT INTO `servertypes` (`steamgame`,`appID`,`updates`,`shorten`,`description`,`gamebinary`,`gamebinaryWin`,`binarydir`,`modfolder`,`fps`,`slots`,`map`,`cmd`,`modcmds`,`tic`,`gameq`,`gamemod`,`gamemod2`,`configs`,`configedit`,`portStep`,`portMax`,`portOne`,`portTwo`,`portThree`,`portFour`,`portFive`,`mapGroup`,`protected`,`protectedSaveCFGs`,`ramLimited`,`os`) VALUES (:steamgame,:appID,:updates,:shorten,:description,:gamebinary,:gamebinaryWin,:binarydir,:modfolder,:fps,:slots,:map,:cmd,:modcmds,:tic,:gameq,:gamemod,:gamemod2,:configs,:configedit,:portStep,:portMax,:portOne,:portTwo,:portThree,:portFour,:portFive,:mapGroup,:protected,:protectedSaveCFGs,:ramLimited,:os)");
$query3 = $sql->prepare("UPDATE `servertypes` SET `steamgame`=:steamgame,`appID`=:appID,`updates`=:updates,`shorten`=:shorten,`description`=:description,`gamebinary`=:gamebinary,`gamebinaryWin`=:gamebinaryWin,`binarydir`=:binarydir,`modfolder`=:modfolder,`fps`=:fps,`slots`=:slots,`map`=:map,`cmd`=:cmd,`modcmds`=:modcmds,`tic`=:tic,`gameq`=:gameq,`gamemod`=:gamemod,`gamemod2`=:gamemod2,`configs`=:configs,`configedit`=:configedit,`portStep`=:portStep,`portMax`=:portMax,`portOne`=:portOne,`portTwo`=:portTwo,`portThree`=:portThree,`portFour`=:portFour,`portFive`=:portFive,`mapGroup`=:mapGroup,`protected`=:protected,`protectedSaveCFGs`=:protectedSaveCFGs,`ramLimited`=:ramLimited,`os`=:os WHERE `shorten`=:shorten AND `resellerid`=0 LIMIT 1");
foreach ($gameImages as $image) {
if (count($image) == 31) {
if (count($image) == 32) {
$query->execute(array($image[':shorten']));
$imageExists = (int) $query->fetchColumn();

View File

@ -47,9 +47,9 @@ $die = false;
if (!isset($admin_id) and !isset($user_id)) {
redirect('login.php');
} else if (isset($admin_id)) {
$pa=User_Permissions($admin_id);
$pa = User_Permissions($admin_id);
} else if (isset($user_id)) {
$pa=User_Permissions($user_id);
$pa = User_Permissions($user_id);
} else {
$die = true;
}

View File

@ -59,58 +59,92 @@ if ($reseller_id == 0) {
}
if ($ui->w('action', 4, 'post') and !token(true)) {
$template_file = $spracheResponse->token;
} else if ($ui->st('d', 'get') == 'ad') {
if ($ui->smallletters('action',2, 'post') == 'ad'){
$serverid = $ui->id('id', 10, 'get');
$rootServer=new masterServer($serverid,$aeskey);
if ($ui->id('id',19, 'post')) {
$id = $ui->id('id', 10, 'get');
if ($ui->smallletters('action',2, 'post') == 'ad') {
$rootServer = new masterServer($id, $aeskey);
if ($ui->id('id', 10, 'post')) {
$template_file = '';
$query = $sql->prepare("SELECT `id` FROM `rservermasterg` WHERE `serverid`=? AND `servertypeid`=? AND `resellerid`=?");
$query2 = $sql->prepare("SELECT * FROM `servertypes` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query3 = $sql->prepare("INSERT INTO rservermasterg (`serverid`,`servertypeid`,`installing`,`installstarted`,`resellerid`) VALUES (?,?,'Y',NOW(),?)");
foreach($ui->id('id',19, 'post') as $id) {
$query->execute(array($serverid,$id,$resellerLockupID));
if ($query->rowcount()==0) {
$query2->execute(array($id,$resellerLockupID));
foreach($ui->id('id', 10, 'post') as $masterID) {
$query->execute(array($id, $masterID ,$resellerLockupID));
if ($query->rowcount() == 0) {
$query2->execute(array($masterID, $resellerLockupID));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$description = $row2['description'];
$shorten = $row2['shorten'];
$template_file .= '<b>' . $description . '</b> ' . $sprache->root_masterinstall;
$loguseraction = '%add% %master% ' . $shorten;
$insertlog->execute();
}
$query3->execute(array($serverid,$id,$resellerLockupID));
$template_file .="<b>$description</b> ".$sprache->root_masterinstall;
$loguseraction="%add% %master% $shorten";
$insertlog->execute();
$query3->execute(array($id, $masterID, $resellerLockupID));
}
$rootServer->collectData($id,true);
$rootServer->collectData($masterID, true);
}
$sshcmd = $rootServer->returnCmds('install','all');
if ($rootServer->sshcmd!==null) ssh2_execute('gs',$serverid,$rootServer->sshcmd);
if ($rootServer->sshcmd !== null) {
ssh2_execute('gs', $id, $rootServer->sshcmd);
}
} else {
$template_file = $sprache->error_root_noselect;
}
} else {
$id = $ui->id('id',19, 'get');
$query = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id,$resellerLockupID));
$ip = $query->fetchColumn();
$query = $sql->prepare("SELECT `id`,`shorten`,`steamgame`,`description`,`type` FROM `servertypes` WHERE `resellerid`=? ORDER BY `description`");
$query->execute(array($resellerLockupID));
$table = array();
$query = $sql->prepare("SELECT `ip`,`os` FROM `rserverdata` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$gameid = $row['id'];
$shorten = $row['shorten'];
$description = $row['description'];
$type = $row['type'];
$query = $sql->prepare("SELECT r.`id` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND r.`resellerid`=? AND s.`shorten`=?");
$query->execute(array($id,$resellerLockupID,$shorten));
if ($query->rowCount()<1) {
$table[] = array('id' => $gameid,'shorten' => $shorten,'description' => $description);
}
$ip = $row['ip'];
$os = $row['os'];
}
if (isset($ip) and isset($os)) {
$query = $sql->prepare("SELECT `id`,`shorten`,`steamgame`,`description` FROM `servertypes` WHERE `resellerid`=? AND (`os`='B' OR `os`=?) ORDER BY `description`");
$query2 = $sql->prepare("SELECT r.`id` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND r.`resellerid`=? AND s.`shorten`=?");
$query->execute(array($resellerLockupID, $os));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$query2->execute(array($id, $resellerLockupID, $row['shorten']));
if ($query2->rowCount() < 1) {
$table[] = array('id' => $row['id'], 'shorten' => $row['shorten'], 'description' => $row['description']);
}
}
$template_file = 'admin_master_add.tpl';
} else {
$template_file = 'admin_404.tpl';
}
$template_file = "admin_master_add.tpl";
}
} else if ($ui->st('d', 'get') == 'dl' and $ui->id('id',19, 'get')) {
if ($ui->smallletters('action',2, 'post') == 'dl'){
$serverid = $ui->id('id',19, 'get');
$rdata=serverdata('root',$serverid,$aeskey);

View File

@ -103,11 +103,12 @@ if ($ui->st('d', 'get') == 'bu' and $ui->st('action', 'post') == 'bu' and $resel
$array = (array) $ui->pregw('games', 255, 'post');
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
$query2 = $sql->prepare("INSERT INTO `servertypes` (`steamgame`,`appID`,`updates`,`shorten`,`description`,`gamebinary`,`binarydir`,`modfolder`,`fps`,`slots`,`map`,`cmd`,`modcmds`,`tic`,`gameq`,`gamemod`,`gamemod2`,`configs`,`configedit`,`portStep`,`portMax`,`portOne`,`portTwo`,`portThree`,`portFour`,`portFive`,`mapGroup`,`protected`,`protectedSaveCFGs`,`ramLimited`,`os`,`resellerid`) VALUES (:steamgame,:appID,:updates,:shorten,:description,:gamebinary,:binarydir,:modfolder,:fps,:slots,:map,:cmd,:modcmds,:tic,:gameq,:gamemod,:gamemod2,:configs,:configedit,:portStep,:portMax,:portOne,:portTwo,:portThree,:portFour,:portFive,:mapGroup,:protected,:protectedSaveCFGs,:ramLimited,:os,:resellerid)");
$query3 = $sql->prepare("UPDATE `servertypes` SET `steamgame`=:steamgame,`appID`=:appID,`updates`=:updates,`shorten`=:shorten,`description`=:description,`gamebinary`=:gamebinary,`binarydir`=:binarydir,`modfolder`=:modfolder,`fps`=:fps,`slots`=:slots,`map`=:map,`cmd`=:cmd,`modcmds`=:modcmds,`tic`=:tic,`gameq`=:gameq,`gamemod`=:gamemod,`gamemod2`=:gamemod2,`configs`=:configs,`configedit`=:configedit,`portStep`=:portStep,`portMax`=:portMax,`portOne`=:portOne,`portTwo`=:portTwo,`portThree`=:portThree,`portFour`=:portFour,`portFive`=:portFive,`mapGroup`=:mapGroup,`protected`=:protected,`protectedSaveCFGs`=:protectedSaveCFGs,`ramLimited`=:ramLimited,`os`=:os WHERE `shorten`=:shorten AND `resellerid`=:resellerid LIMIT 1");
$query2 = $sql->prepare("INSERT INTO `servertypes` (`steamgame`,`appID`,`updates`,`shorten`,`description`,`gamebinary`,`gamebinaryWin`,`binarydir`,`modfolder`,`fps`,`slots`,`map`,`cmd`,`modcmds`,`tic`,`gameq`,`gamemod`,`gamemod2`,`configs`,`configedit`,`portStep`,`portMax`,`portOne`,`portTwo`,`portThree`,`portFour`,`portFive`,`mapGroup`,`protected`,`protectedSaveCFGs`,`ramLimited`,`os`,`resellerid`) VALUES (:steamgame,:appID,:updates,:shorten,:description,:gamebinary,:gamebinaryWin,:binarydir,:modfolder,:fps,:slots,:map,:cmd,:modcmds,:tic,:gameq,:gamemod,:gamemod2,:configs,:configedit,:portStep,:portMax,:portOne,:portTwo,:portThree,:portFour,:portFive,:mapGroup,:protected,:protectedSaveCFGs,:ramLimited,:os,:resellerid)");
$query3 = $sql->prepare("UPDATE `servertypes` SET `steamgame`=:steamgame,`appID`=:appID,`updates`=:updates,`shorten`=:shorten,`description`=:description,`gamebinary`=:gamebinary,`gamebinaryWin`=:gamebinaryWin,`binarydir`=:binarydir,`modfolder`=:modfolder,`fps`=:fps,`slots`=:slots,`map`=:map,`cmd`=:cmd,`modcmds`=:modcmds,`tic`=:tic,`gameq`=:gameq,`gamemod`=:gamemod,`gamemod2`=:gamemod2,`configs`=:configs,`configedit`=:configedit,`portStep`=:portStep,`portMax`=:portMax,`portOne`=:portOne,`portTwo`=:portTwo,`portThree`=:portThree,`portFour`=:portFour,`portFive`=:portFive,`mapGroup`=:mapGroup,`protected`=:protected,`protectedSaveCFGs`=:protectedSaveCFGs,`ramLimited`=:ramLimited,`os`=:os WHERE `shorten`=:shorten AND `resellerid`=:resellerid LIMIT 1");
foreach ($gameImages as $image) {
if (in_array($image[':shorten'], $array) and count($image) == 31) {
if (in_array($image[':shorten'], $array) and count($image) == 32) {
$image[':resellerid'] = $resellerLockupID;