$templates[] = $row['shorten'] . '-3'; } $appServer->addApp($templates, true); } } $command = $gsprache->add . ' gsswitchID: ' . $row2['affectedID'] . ' name:' . $row2['name'] . ' gsswitchID:' . $row2['affectedID']; } else { $removeGames = property_exists($extraData, 'gamesRemoveArray') ? (array) $extraData->gamesRemoveArray : array(); if (count($removeGames) > 0) { $removeTemplates = array(); foreach ($removeGames as $game) { $removeTemplates[] = $game; $removeTemplates[] = $game . '-2'; $removeTemplates[] = $game . '-3'; } $appServer->removeApp($removeTemplates); } // Send delete request for protected user in case it has been removed from server if ($protectedAllowed == 'N' and isset($extraData->oldProtected) and $extraData->oldProtected == 'Y') { $appServer->userCud('del'); } if ($extraData->newActive == 'N') { $appServer->userCud('add', false, true); } $newPort = (isset($extraData->newPort) and strlen($extraData->newPort) > 0) ? $extraData->newPort : $port; $newIP = (isset($extraData->newIP) and strlen($extraData->newIP) > 0) ? $extraData->newIP : $gsIP; if ($port != $newPort or $gsIP != $newIP) { $query7->execute(array($newIP, $newPort, $row2['affectedID'])); $appServer->moveServerLocal($row3['serverip'], $row3['port']); } $command = $gsprache->mod . ' gsswitchID: ' . $row2['affectedID'] . ' name: ' . $row2['name'] . ' gsswitchID:' . $row2['affectedID'];
$query5->execute(array($row3['anticheat'], $row3['map'], $row3['mapGroup'], $row3['template'], $row3['server_id'], $resellerLockupID)); $appServer->getAppServerDetails($row3['switchID']); if ($row3['restart'] == 'N' and $row3['worldsafe'] == 'Y') { $appServer->mcWorldSave(); echo 'MC worldsave: ' . $row2['server'] . "\r\n"; } if ($row3['restart'] == 'N' and $row3['upload'] == 'Y') { $appServer->demoUpload(); echo 'Demo upload for: ' . $row2['server'] . "\r\n"; } if ($row3['restart'] == 'Y') { if ($row3['protected'] == 'Y' and $row2['protected'] == 'N') { $appServer->stopAppHard(); $query6->execute(array(passwordgenerate(20), $aeskey, $row3['switchID'])); $appServer->getAppServerDetails($row3['switchID']); $appServer->removeApp($row3['template']); $appServer->addApp($row3['template']); } $appServer->startApp(); echo 'Restarting server: ' . $row2['server'] . "\r\n"; } if ($row3['backup'] == 'Y') { $appServer->backupCreate($row2['backup']); echo 'Backup server: ' . $row2['server'] . "\r\n"; } } } $appServer->execute(); if (isset($dbConnect['debug']) and $dbConnect['debug'] == 1) { print implode("\r\n", $appServer->debug()) . "\r\n"; }
$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); } else { $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>'; } } else { $shorten = ''; $selected2 = ''; $selected3 = ''; $query = $sql->prepare("SELECT `serverid` FROM `gsswitch` WHERE `id`=? AND `resellerid`=?");
$query->execute(array($id, $resellerLockupID)); $ftp = new EasyWiFTP($appServer->appMasterServerDetails['ssh2IP'], $appServer->appMasterServerDetails['ftpPort'], $appServer->appServerDetails['userNameExecute'], $appServer->appServerDetails['ftpPasswordExecute']); if ($ftp->loggedIn) { $ftp->downloadToTemp($appServer->appServerDetails['absoluteFTPPath'], 0, $files); } $query = $sql->prepare("UPDATE `gsswitch` SET `protected`=? WHERE `id`=? LIMIT 1"); $query->execute(array($protected, $id)); $appServer->getAppServerDetails($id); if ($ftp->loggedIn) { $ftp->createSecondFTPConnect($appServer->appMasterServerDetails['ssh2IP'], $appServer->appMasterServerDetails['ftpPort'], $appServer->appServerDetails['userNameExecute'], $appServer->appServerDetails['ftpPasswordExecute']); if ($ftp->secondLoggedIn) { $ftp->uploadFileFromTemp($appServer->appServerDetails['absoluteFTPPath']); } } if ($appServer->appServerDetails['protectionModeStarted'] == 'Y') { $query = $sql->prepare("UPDATE `gsswitch` SET `ppassword`=AES_ENCRYPT(?,?),`psince`=NOW() WHERE `id`=? LIMIT 1"); $query->execute(array(passwordgenerate(10), $aeskey, $id)); $appServer->getAppServerDetails($id); $appServer->userCud('add'); $appServer->removeApp(array($appServer->appServerDetails['app']['templateChoosen'])); $appServer->addApp(); } $ftp = null; $appServer->startApp(); $appServer->execute(); $insertlog->execute(); if (isset($dbConnect['debug']) and $dbConnect['debug'] == 1) { $template_file .= '<br><pre>' . implode("\r\n", $appServer->debug()) . '</pre>'; } } }