function delete($configFiles = array(), $matchFiles = array(), $manialiveFiles = array())
 {
     $errors = array();
     $success = array();
     if ($configFiles) {
         try {
             $service = new \DedicatedManager\Services\ConfigFileService();
             $service->deleteList($configFiles);
             $success[] = _('Configuration files successfully deleted');
         } catch (\Exception $e) {
             $errors[] = _('Error while deleting configuration files');
         }
     }
     if ($matchFiles) {
         try {
             $service = new \DedicatedManager\Services\MatchSettingsFileService();
             $service->deleteList($matchFiles);
             $success[] = _('Match settings files successfully deleted');
         } catch (\Exception $e) {
             $errors[] = _('Error while deleting match settings files');
         }
     }
     if ($manialiveFiles) {
         try {
             $service = new \DedicatedManager\Services\ManialiveFileService();
             $service->deleteList($manialiveFiles);
             $success[] = _('ManiaLive configuration files successfully deleted');
         } catch (\Exception $e) {
             $errors[] = _('Error while deleting ManiaLive configuration files');
         }
     }
     if ($errors) {
         $this->session->set('error', $errors);
     }
     if ($success) {
         $this->session->set('success', $success);
     }
     $this->request->redirectArgList('..');
 }
 function start($configFile)
 {
     $config = $this->fetchAndAssertConfig(_('starting it'));
     $server = $this->session->get('server');
     $this->session->set('configFile', $configFile);
     $errors = array();
     if (strpbrk($configFile, '\\/:*?"<>|')) {
         $errors[] = _('The server config filename must not contain any of the following characters: \\ / : * ? " < > |');
     }
     if (!$errors) {
         try {
             $error = _('An error appeared while writing the server configuration file');
             $service = new \DedicatedManager\Services\ManialiveFileService();
             $service->save($configFile, $config);
             $error = _('An error appeared while starting ManiaLive');
             $service = new \DedicatedManager\Services\ManialiveService();
             $service->start($configFile, array('address' => $server->rpcHost, 'rpcport' => $server->rpcPort, 'password' => $server->rpcPassword));
         } catch (\Exception $e) {
             \ManiaLib\Application\ErrorHandling::logException($e);
             $errors[] = $error;
         }
     }
     if ($errors) {
         $this->session->set('error', $errors);
         $this->request->redirectArgList('../preview');
     }
     $this->session->set('success', _('ManiaLive has been successfully started'));
     $this->backToServer();
 }
 function quickStart($configFile = '', $matchFile = '', $isLan = false, $serverName = null, $login = null, $password = null, $title = null, $startManialive = false, $manialiveConfig = '')
 {
     $service = new \DedicatedManager\Services\ConfigFileService();
     $configFileList = $service->getList();
     if ($configFile) {
         list($config, $account, $system, ) = $service->get($configFile);
     } else {
         $config = new \DedicatedManager\Services\ServerOptions();
         $account = new \DedicatedManager\Services\Account();
         $system = new \DedicatedManager\Services\SystemConfig();
     }
     $service = new \DedicatedManager\Services\MatchSettingsFileService();
     $matchSettingsFileList = $service->getList();
     $service = new \DedicatedManager\Services\TitleService();
     $titles = $service->getList();
     $service = new \DedicatedManager\Services\ManialiveFileService();
     $manialiveFileList = $service->getList();
     $this->response->configFileList = $configFileList;
     $this->response->matchSettingsFileList = $matchSettingsFileList;
     $this->response->titles = $titles;
     $this->response->configFile = $configFile;
     $this->response->matchFile = $matchFile ?: $configFile;
     $this->response->isLan = $isLan || $account->login && $account->password ? true : false;
     $this->response->serverName = $config->name && !$serverName ? $config->name : $serverName;
     $this->response->serverLogin = $account->login && !$login ? $account->login : $login;
     $this->response->serverPassword = $account->password && !$password ? $account->password : $password;
     $this->response->title = $system->title && !$title ? $system->title : $title;
     $this->response->startManialive = $startManialive;
     $this->response->manialiveFileList = $manialiveFileList;
     $this->response->manialiveConfig = $manialiveConfig ?: $configFile;
 }