$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') { eacchange('change', $id, $ui->post[$cvar], $resellerLockupID); } $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') { eacchange('change', $id, $value, $resellerLockupID); } else { $newconfig .= $singeline . "\r\n"; } } array_push($setarray, $cvar); } else { $newconfig .= $singeline . "\r\n"; } } } } else { $newconfig .= $singeline . "\r\n"; } } if ($ui->smallletters('type', 4, 'get') == 'easy') {
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); } } } }