Example #1
0
        $shorten = $row['shorten'];
        $ftppass = $row['dftppass'];
        $username = $row['newlayout'] == 'Y' ? $row['cname'] . '-' . $row['id'] : $row['cname'];
        if ($row['protected'] == 'N' and $row['servertemplate'] > 1) {
            $shorten .= '-' . $row['servertemplate'];
            $pserver = 'server/';
        } else {
            if ($row['protected'] == 'Y') {
                $username .= '-p';
                $ftppass = $row['decryptedftppass'];
                $pserver = '';
            } else {
                $pserver = 'server/';
            }
        }
        $ftpConnect = new EasyWiFTP($row['ftp_ip'], $row['ftpport'], $username, $ftppass);
        $downloadChrooted = $ftpConnect->removeSlashes($pserver . $row['serverip'] . '_' . $row['port'] . '/' . $shorten . '/' . $row['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 ' . $row2['ip'] . ':' . $row2['ftpport'];
        }
    }
}
if ($query->rowCount() < 1) {
    $array['error'] = 'Error: No rootID';
Example #2
0
     }
 }
 if ($shorten == 'css' and $configname == 'server.cfg') {
     $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');
 } else {
     if ($shorten == "dods" and $configname == 'server.cfg') {
         $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 {
         $game_cvars = array();
     }
 }
 $configfile = '';
 $cleanedconfig = '';
 $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();
         }
     }
     $lines = array();
     if (strlen($configfile) > 0) {
         $configfile = str_replace(array("", "\\b", "\r", "\\Z"), '', $configfile);
         $lines = explode("\n", $configfile);
     }
     if (isset($ui->post['update']) and $ui->post['update'] == 1 and isset($lines)) {
Example #3
0
 private function easyAntiCheatSettings($action = 'start')
 {
     global $resellerLockupID;
     if ($this->appServerDetails['eacAllowed'] == 'Y') {
         $gameType = $this->getGameType();
         // On app start we only run commands for supported games
         if ($action == 'start' and in_array($this->appServerDetails['app']['anticheat'], array(3, 4, 5, 6)) and ($gameType == 'hl1' or $gameType == 'hl2')) {
             if ($gameType == 'hl2') {
                 $config = 'cfg/server.cfg';
             } else {
                 if ($gameType == 'hl1') {
                     $config = 'server.cfg';
                 } else {
                     $config = 'main/server.cfg';
                 }
             }
             $ftpObect = new EasyWiFTP($this->appMasterServerDetails['ssh2IP'], $this->appMasterServerDetails['ftpPort'], $this->appServerDetails['userNameExecute'], $this->appServerDetails['ftpPasswordExecute']);
             if ($ftpObect->loggedIn === true) {
                 if (!$ftpObect->downloadToTemp($this->appServerDetails['absoluteFTPPath'] . $config)) {
                     $ftpObect->downloadToTemp($this->appServerDetails['absoluteFTPPathNoChroot'] . $config);
                 }
                 $configFile = $ftpObect->getTempFileContent();
                 $configFile = str_replace(array("", "\\b", "\r", "\\Z"), '', $configFile);
                 $configFile = preg_replace('/\\s+/', ' ', $configFile);
                 $lines = explode("\n", $configFile);
                 foreach ($lines as $singeLine) {
                     // Do a rough check if the line is a comment
                     if (preg_match("/\\w/", substr($singeLine, 0, 1))) {
                         if (preg_match("/\"/", $singeLine)) {
                             $exploded = explode('"', $singeLine);
                             $cvar = str_replace(' ', '', $exploded[0]);
                         } else {
                             $exploded = explode(' ', $singeLine);
                             $cvar = $exploded[0];
                         }
                         if ($cvar == 'rcon_password' and isset($exploded[1])) {
                             $rconPassword = $exploded[1];
                         }
                     }
                 }
                 if (isset($rconPassword)) {
                     eacchange('change', $this->appServerDetails['template']['id'], $rconPassword, $resellerLockupID);
                 }
             }
             // On app stop we run commands in any case to ensure we remove left overs
         } else {
             if ($action == 'stop') {
                 eacchange('remove', $this->appServerDetails['template']['id'], '', $resellerLockupID);
             }
         }
     }
 }
Example #4
0
         if ($protected == 'Y') {
             $username .= '-p';
             $ftppass = $row['decryptedftppass'];
             $pserver = '';
         } else {
             $pserver = 'server/';
         }
     }
 }
 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)) {
                 $error = 'Cannot download screenlog from ' . $downloadChrooted;
             }
         } else {
             $error = 'Cannot connect to FTP Server ' . $ip . ':' . $ftpport;
         }
     }
     if (isset($ip)) {
         $log = isset($error) ? $error : nl2br($ftpConnect->getTempFileContent());
         $ftpConnect->tempHandle = null;
         $ftpConnect = null;
     } else {
         $log = 'Error: wrong rootID';
                 $modFolder = $game['modfolder'];
             }
         }
         if (isset($gameSwitchTemplate)) {
             $thisTemplate = $ui->config('template', 'post', $thisID);
         } else {
             if (!in_array($gsprache->template, $error)) {
                 $error[] = $gsprache->template;
             }
         }
     }
 }
 if ($ui->anyPath('ftpPath', 'post')) {
     $ftpPath = $ui->anyPath('ftpPath', 'post');
 }
 $ftp = new EasyWiFTP($ftpAddress, $ftpPort, $ftpUser, $ftpPassword, $ssl);
 if ($ftp->ftpConnection and $ftp->loggedIn) {
     if (isset($searchFor)) {
         $ftpPath = $ftp->checkPath($ftpPath, $searchFor);
         if (!$ftpPath) {
             $foundPath = $ftp->checkFolders($ui->anyPath('ftpPath', 'post'), $searchFor, 5);
             $ftpPath = is_array($foundPath) ? '' : str_replace('//', '/', $foundPath);
             if (strlen($searchFor) > 0 or strlen($ftpPath) == 0) {
                 $error[] = $sprache->ftp_path . '. ' . $sprache->import_corrected;
             }
         }
     }
 } else {
     if ($ftp->ftpConnection and !$ftp->loggedIn) {
         $error[] = $sprache->ftp_user;
         $error[] = $sprache->ftp_password;
     if ($cfg != '') {
         $files[] = $cfg;
     }
 }
 if ($appServer->appServerDetails['protectionModeStarted'] == 'Y') {
     $protected = 'N';
     $template_file = $sprache->protect . ' ' . $sprache->off2;
     $loguseraction = '%stop% %pmode% ' . $appServer->appServerDetails['serverIP'] . ':' . $appServer->appServerDetails['port'];
 } else {
     $protected = 'Y';
     $template_file = $sprache->protect . ' ' . $sprache->on;
     $loguseraction = '%restart% %pmode% ' . $appServer->appServerDetails['serverIP'] . ':' . $appServer->appServerDetails['port'];
 }
 $query = $sql->prepare("UPDATE `serverlist` SET `anticheat`='1' WHERE `id`=? AND `resellerid`=? LIMIT 1");
 $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));