Ejemplo n.º 1
0
 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('..');
 }
Ejemplo n.º 2
0
 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;
 }