Archived
1
0
Fork 0

Prepare for 2.1.3

* Fixed false rendering of forms
* Fixed channel tree view showing the wrong virtual server after selection
* Minor code refactor
This commit is contained in:
Varakh 2019-08-08 19:17:00 +02:00
parent 7cea6110cc
commit 569325fbe9
58 changed files with 152 additions and 191 deletions

View file

@ -1,5 +1,10 @@
# CHANGELOG
## 2.1.3 - 2019/08/08
* Fixed false rendering of forms
* Fixed channel tree view showing the wrong virtual server after selection
* Minor code refactor
## 2.1.2 - 2019/08/07
* Minor refactoring
* Update documentation

View file

@ -5,6 +5,11 @@
*/
class EnvConstants
{
/**
* Example env file
*/
const ENV_FILE_EXAMPLE = "env.example";
/**
* Custom env file
*/

View file

@ -41,7 +41,6 @@ final class AuthLoginAction extends AbstractAction
}
}
// render GET
$this->view->render($response, 'login.twig', [
'title' => $this->translator->trans('login.title'),
]);

View file

@ -11,10 +11,8 @@ final class BanDeleteAction extends AbstractAction
$banId = $args['banId'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$banDeleteResult = $this->ts->getInstance()->banDelete($banId);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->banDelete($banId);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/bans/' . $sid);

View file

@ -11,11 +11,10 @@ final class BansAction extends AbstractAction
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$banListResult = $this->ts->getInstance()->banList();
// render GET
$this->view->render($response, 'bans.twig', [
'title' => $this->translator->trans('bans.title'),
'data' => $this->ts->getInstance()->getElement('data', $banListResult),

View file

@ -13,7 +13,7 @@ final class ChannelCreateAction extends AbstractAction
$inherit = $body['inherit'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
if (!$inherit) {
unset($body['cpid']);

View file

@ -11,10 +11,8 @@ final class ChannelDeleteAction extends AbstractAction
$cid = $args['cid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$channelDeleteResult = $this->ts->getInstance()->channelDelete($cid);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->channelDelete($cid);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/channels/' . $sid);

View file

@ -13,10 +13,8 @@ final class ChannelEditAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$channelResult = $this->ts->getInstance()->channelEdit($cid, $body);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->channelEdit($cid, $body);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/channels/' . $sid . '/' . $cid);

View file

@ -18,10 +18,10 @@ final class ChannelGroupCreateAction extends AbstractAction
$this->logger->debug('Body', $body);
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
if ($copy) $groupCreateResult = $this->ts->getInstance()->channelGroupAdd($name, $type);
else $groupCreateResult = $this->ts->getInstance()->channelGroupCopy($template, 0, $name, $type);
if ($copy) $this->ts->getInstance()->channelGroupAdd($name, $type);
else $this->ts->getInstance()->channelGroupCopy($template, 0, $name, $type);
$this->flash->addMessage('success', $this->translator->trans('done'));

View file

@ -11,10 +11,8 @@ final class ChannelGroupDeleteAction extends AbstractAction
$cgid = $args['cgid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$groupDeleteResult = $this->ts->getInstance()->channelGroupDelete($cgid);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->channelGroupDelete($cgid);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/groups/' . $sid);

View file

@ -11,13 +11,11 @@ final class ChannelGroupInfoAction extends AbstractAction
$cgid = $args['cgid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$clientsResult = $this->ts->getInstance()->channelGroupClientList(null, null, $cgid);
$permissionsResult = $this->ts->getInstance()->channelGroupPermList($cgid, true);
// render GET
$this->view->render($response, 'channelgroup_info.twig', [
'title' => $this->translator->trans('channelgroup_info.title') . ' ' . $cgid,
'clients' => $this->ts->getInstance()->getElement('data', $clientsResult),

View file

@ -14,10 +14,8 @@ final class ChannelGroupRenameAction extends AbstractAction
$name = $body['name'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$groupRenameResult = $this->ts->getInstance()->channelGroupRename($cgid, $name);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->channelGroupRename($cgid, $name);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/groups/' . $sid);

View file

@ -11,16 +11,13 @@ final class ChannelInfoAction extends AbstractAction
$cid = $args['cid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$channelResult = $this->ts->getInstance()->channelInfo($cid);
$clientsResult = $this->ts->getInstance()->channelClientList($cid);
$files = [];
$files['data'] = $this->getAllFilesIn($sid, $cid, '/');
// render GET
$this->view->render($response, 'channel_info.twig', [
'title' => $this->translator->trans('channel_info.title') . ' ' . $cid,
'files' => $this->ts->getInstance()->getElement('data', $files),
@ -36,10 +33,8 @@ final class ChannelInfoAction extends AbstractAction
private function getAllFilesIn($sid, $cid, $path, &$files = [])
{
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$fileResult = $this->ts->getInstance()->ftGetFileList($cid, '', $path);
$foundFiles = $fileResult['data'];
if (!empty($foundFiles)) {

View file

@ -12,11 +12,10 @@ final class ChannelSendAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_CHANNEL, $cid, $body['message']);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_CHANNEL, $cid, $body['message']);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/channels/' . $sid . '/' . $cid);
}
}

View file

@ -10,7 +10,7 @@ final class ChannelsAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->channelList();
$channels = $this->ts->getInstance()->getElement('data', $dataResult);
@ -24,7 +24,6 @@ final class ChannelsAction extends AbstractAction
$channelOrders[$channel['channel_name']] = $channel['cid'];
}
// render GET
$this->view->render($response, 'channels.twig', [
'title' => $this->translator->trans('channels.title'),
'channels' => $channels,

View file

@ -13,11 +13,9 @@ final class ClientBanAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$getResult = $this->ts->getInstance()->clientGetNameFromDbid($cldbid);
$dataResult = $this->ts->getInstance()->banAddByUid(
$this->ts->getInstance()->banAddByUid(
$this->ts->getInstance()->getElement('data', $getResult)['cluid'],
(!empty($body['time']) ? $body['time'] : 0),
$body['reason']

View file

@ -11,7 +11,7 @@ final class ClientDeleteAction extends AbstractAction
$cldbid = $args['cldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$clientDeleteResult = $this->ts->getInstance()->clientDbDelete($cldbid);

View file

@ -11,7 +11,7 @@ final class ClientInfoAction extends AbstractAction
$cldbid = $args['cldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$detailsResult = $this->ts->getInstance()->clientDbInfo($cldbid);
@ -21,7 +21,6 @@ final class ClientInfoAction extends AbstractAction
$permissionsResult = $this->ts->getInstance()->clientPermList($cldbid, true);
// render GET
$this->view->render($response, 'client_info.twig', [
'title' => $this->translator->trans('client_info.title') . ' ' . $cldbid,
'details' => $this->ts->getInstance()->getElement('data', $detailsResult),

View file

@ -13,11 +13,11 @@ final class ClientSendAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$getResult = $this->ts->getInstance()->clientGetNameFromDbid($cldbid);
$dataResult = $this->ts->getInstance()->messageAdd(
$this->ts->getInstance()->messageAdd(
$this->ts->getInstance()->getElement('data', $getResult)['cluid'],
$body['subject'],
$body['message']

View file

@ -10,11 +10,10 @@ final class ClientsAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->clientDbList();
// render GET
$this->view->render($response, 'clients.twig', [
'title' => $this->translator->trans('clients.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -11,7 +11,7 @@ final class ComplainDeleteAction extends AbstractAction
$tcldbid = $args['tcldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
// search fcldbid
$fcldbid = null;

View file

@ -10,11 +10,9 @@ final class ComplainsAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->complainList();
// render GET
$this->view->render($response, 'complains.twig', [
'title' => $this->translator->trans('complains.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -10,7 +10,7 @@ final class GroupsAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$serverGroupsResult = $this->ts->getInstance()->serverGroupList();
$serverGroups = $this->ts->getInstance()->getElement('data', $serverGroupsResult);
@ -28,7 +28,6 @@ final class GroupsAction extends AbstractAction
$channelGroupsTemplate[$channelGroup['name']] = $channelGroup['cgid'];
}
// render GET
$this->view->render($response, 'groups.twig', [
'title' => $this->translator->trans('groups.title'),
'serverGroups' => $serverGroups,

View file

@ -13,7 +13,6 @@ final class InstanceAction extends AbstractAction
$data['data'] = array_merge($hostResult['data'], $instanceResult['data']);
// render GET
$this->view->render($response, 'instance.twig', [
'title' => $this->translator->trans('instance.title'),
'data' => $this->ts->getInstance()->getElement('data', $data)

View file

@ -17,11 +17,10 @@ final class LogsAction extends AbstractAction
$dataResult = $this->ts->getInstance()->logView(getenv(EnvConstants::TEAMSPEAK_LOG_LINES), 1, 1);
$appLog = explode("\n", file_get_contents(BootstrapHelper::getLogFile()));
} else {
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->logView(getenv(EnvConstants::TEAMSPEAK_LOG_LINES), 1, 0);
}
// render GET
$this->view->render($response, 'logs.twig', [
'title' => empty($sid) ? $this->translator->trans('instance_logs.title') : $this->translator->trans('server_logs.title'),
'log' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -10,13 +10,20 @@ final class OnlineAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->clientList('-ip -times -info');
$this->ts->getInstance()->logout(); // avoid showing currently used user twice
$serverInfoResult = $this->ts->getInstance()->serverInfo();
$treeView = null;
$serverPort = $this->session->get("sport");
$serverPort = null;
if ($this->ts->getInstance()->succeeded($serverInfoResult)) {
$serverInfoDataResult = $this->ts->getInstance()->getElement('data', $serverInfoResult);
if (array_key_exists('virtualserver_port', $serverInfoDataResult)) {
$serverPort = $serverInfoDataResult['virtualserver_port'];
}
}
$this->ts->getInstance()->logout(); // avoid showing currently used user twice
if ($serverPort) {
$uri = sprintf('serverquery://%s:%s@%s:%s/?server_port=%s',
@ -31,7 +38,6 @@ final class OnlineAction extends AbstractAction
$treeView = $tsServer->getViewer(new TeamSpeak3_Viewer_Html("/images/viewer/", "/images/flags/", "data:image"));
}
// render GET
$this->view->render($response, 'online.twig', [
'title' => $this->translator->trans('online.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -13,11 +13,10 @@ final class OnlineBanAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->banClient($clid, (!empty($body['time']) ? $body['time'] : 0), $body['reason']);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->banClient($clid, (!empty($body['time']) ? $body['time'] : 0), $body['reason']);
$this->flash->addMessage('success', $this->translator->trans('online.banned.success', ['%clid%' => $clid]));
return $response->withRedirect('/online/' . $sid . '/' . $clid);
}
}

View file

@ -11,7 +11,7 @@ final class OnlineInfoAction extends AbstractAction
$clid = $args['clid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->clientInfo($clid);
@ -23,7 +23,6 @@ final class OnlineInfoAction extends AbstractAction
$channels[$channel['channel_name']] = $channel['cid'];
}
// render GET
$this->view->render($response, 'online_info.twig', [
'title' => $this->translator->trans('online_info.title') . ' ' . $clid,
'data' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -13,11 +13,10 @@ final class OnlineKickAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->clientKick($clid, 'server', $body['reason']);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->clientKick($clid, 'server', $body['reason']);
$this->flash->addMessage('success', $this->translator->trans('online.kicked.success', ['%clid%' => $clid]));
return $response->withRedirect('/online/' . $sid);
}
}

View file

@ -17,10 +17,10 @@ final class OnlineMoveAction extends AbstractAction
if (array_key_exists('channel_password', $body)) $channelPassword = $body['channel_password'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
if (empty($channelPassword)) $dataResult = $this->ts->getInstance()->clientMove($clid, $channel);
else $dataResult = $this->ts->getInstance()->clientMove($clid, $channel, $channelPassword);
if (empty($channelPassword)) $this->ts->getInstance()->clientMove($clid, $channel);
else $this->ts->getInstance()->clientMove($clid, $channel, $channelPassword);
$this->flash->addMessage('success', $this->translator->trans('online.moved.success', ['%clid%' => $clid]));

View file

@ -13,9 +13,8 @@ final class OnlinePokeAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->clientPoke($clid, $body['message']);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->clientPoke($clid, $body['message']);
$this->flash->addMessage('success', $this->translator->trans('online.poked.success', ['%clid%' => $clid]));
return $response->withRedirect('/online/' . $sid . '/' . $clid);

View file

@ -13,9 +13,8 @@ final class OnlineSendAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_CLIENT, $clid, $body['message']);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_CLIENT, $clid, $body['message']);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/online/' . $sid . '/' . $clid);

View file

@ -17,9 +17,9 @@ final class PasswordAddAction extends AbstractAction
$channelPassword = $body['channel_password'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$passwordAddResult = $this->ts->getInstance()->serverTempPasswordAdd(
$this->ts->getInstance()->serverTempPasswordAdd(
$password,
$duration,
$description,

View file

@ -12,7 +12,7 @@ final class PasswordDeleteAction extends AbstractAction
$password = $body['pw_clear'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$passwordDeleteResult = $this->ts->getInstance()->serverTempPasswordDel($password);

View file

@ -10,7 +10,7 @@ final class PasswordsAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->serverTempPasswordList();
$channelsResult = $this->ts->getInstance()->channelList();
@ -22,7 +22,6 @@ final class PasswordsAction extends AbstractAction
$channels[$channel['channel_name']] = $channel['cid'];
}
// render GET
$this->view->render($response, 'passwords.twig', [
'title' => $this->translator->trans('passwords.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -10,12 +10,11 @@ final class ProfileAction extends AbstractAction
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
if ($this->session->exists('sid')) {
$selectResult = $this->ts->getInstance()->selectServer($this->session->get('sid'), 'serverId');
$this->ts->getInstance()->selectServer($this->session->get('sid'), 'serverId');
}
$whoisResult = $this->ts->getInstance()->whoAmI();
// render GET
$this->view->render($response, 'profile.twig', [
'title' => $this->translator->trans('profile.title'),
'whois' => $this->ts->getInstance()->getElement('data', $whoisResult),

View file

@ -11,11 +11,10 @@ final class ServerEditAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->serverEdit($body);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->serverEdit($body);
$this->flash->addMessage('success', $this->translator->trans('server_edit.edited.success', ['%sid%' => $sid]));
return $response->withRedirect('/servers/' . $sid);
}
}

View file

@ -14,9 +14,8 @@ final class ServerGroupAddAction extends AbstractAction
$cldbid = $body['cldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$groupAddResult = $this->ts->getInstance()->serverGroupAddClient($sgid, $cldbid);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->serverGroupAddClient($sgid, $cldbid);
$this->flash->addMessage('success', $this->translator->trans('added'));

View file

@ -18,10 +18,10 @@ final class ServerGroupCreateAction extends AbstractAction
$this->logger->debug('Body', $body);
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
if ($copy) $groupCreateResult = $this->ts->getInstance()->serverGroupAdd($name, $type);
else $groupCreateResult = $this->ts->getInstance()->serverGroupCopy($template, 0, $name, $type);
if ($copy) $this->ts->getInstance()->serverGroupAdd($name, $type);
else $this->ts->getInstance()->serverGroupCopy($template, 0, $name, $type);
$this->flash->addMessage('success', $this->translator->trans('done'));

View file

@ -11,10 +11,8 @@ final class ServerGroupDeleteAction extends AbstractAction
$sgid = $args['sgid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$groupDeleteResult = $this->ts->getInstance()->serverGroupDelete($sgid);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->serverGroupDelete($sgid);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/groups/' . $sid);

View file

@ -11,13 +11,10 @@ final class ServerGroupInfoAction extends AbstractAction
$sgid = $args['sgid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$clientsResult = $this->ts->getInstance()->serverGroupClientList($sgid, true);
$permissionsResult = $this->ts->getInstance()->serverGroupPermList($sgid, true);
// render GET
$this->view->render($response, 'servergroup_info.twig', [
'title' => $this->translator->trans('servergroup_info.title') . ' ' . $sgid,
'clients' => $this->ts->getInstance()->getElement('data', $clientsResult),

View file

@ -12,9 +12,9 @@ final class ServerGroupRemoveAction extends AbstractAction
$cldbid = $args['cldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$groupRemoveResult = $this->ts->getInstance()->serverGroupDeleteClient($sgid, $cldbid);
$this->ts->getInstance()->serverGroupDeleteClient($sgid, $cldbid);
$this->flash->addMessage('success', $this->translator->trans('removed'));

View file

@ -14,10 +14,8 @@ final class ServerGroupRenameAction extends AbstractAction
$name = $body['name'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$groupRenameResult = $this->ts->getInstance()->serverGroupRename($sgid, $name);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->serverGroupRename($sgid, $name);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/groups/' . $sid);

View file

@ -10,13 +10,11 @@ final class ServerInfoAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$infoResult = $this->ts->getInstance()->serverInfo();
$uploadsResult = $this->ts->getInstance()->ftList();
// render GET
$this->view->render($response, 'server_info.twig', [
'title' => $this->translator->trans('server_info.title') . ' ' . $sid,
'info' => $this->ts->getInstance()->getElement('data', $infoResult),

View file

@ -10,7 +10,7 @@ final class ServerSelectAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->serverInfo();
$this->session->set('sid', $sid);

View file

@ -11,9 +11,8 @@ final class ServerSendAction extends AbstractAction
$body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_SERVER, $sid, $body['message']);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_SERVER, $sid, $body['message']);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/servers/' . $sid);

View file

@ -10,7 +10,6 @@ final class ServersAction extends AbstractAction
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$dataResult = $this->ts->getInstance()->serverList();
// render GET
$this->view->render($response, 'servers.twig', [
'title' => $this->translator->trans('servers.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult)

View file

@ -13,7 +13,7 @@ final class SnapshotCreateAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$snapshotCreateResult = $this->ts->getInstance()->serverSnapshotCreate();

View file

@ -14,7 +14,7 @@ final class SnapshotDeleteAction extends AbstractAction
$name = $args['name'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$fileSystem = new Filesystem();
$path = FileHelper::SNAPSHOTS_PATH . DIRECTORY_SEPARATOR . $sid . DIRECTORY_SEPARATOR . $name;

View file

@ -12,7 +12,7 @@ final class SnapshotDeployAction extends AbstractAction
$name = $args['name'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$fileSystem = new Filesystem();
$path = FileHelper::SNAPSHOTS_PATH . DIRECTORY_SEPARATOR . $sid . DIRECTORY_SEPARATOR . $name;

View file

@ -10,11 +10,10 @@ final class SnapshotsAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$snapshots = FileHelper::getFiles(FileHelper::SNAPSHOTS_PATH . DIRECTORY_SEPARATOR . $sid);
// render GET
$this->view->render($response, 'snapshots.twig', [
'title' => $this->translator->trans('snapshots.title'),
'data' => $snapshots,

View file

@ -16,13 +16,9 @@ final class TokenAddAction extends AbstractAction
$channel = $body['channel'];
$description = $body['description'];
$this->logger->debug('Body', $body);
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$tokenAddResult = $this->ts->getInstance()->tokenAdd(
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->tokenAdd(
$type,
($type == ts3admin::TokenServerGroup ? $serverGroup : $channelGroup),
$channel,

View file

@ -11,10 +11,8 @@ final class TokenDeleteAction extends AbstractAction
$token = rawurldecode($args['token']);
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$tokenDeleteResult = $this->ts->getInstance()->tokenDelete($token);
$this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->tokenDelete($token);
$this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/tokens/' . $sid);

View file

@ -10,8 +10,7 @@ final class TokensAction extends AbstractAction
$sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId');
$this->ts->getInstance()->selectServer($sid, 'serverId');
$dataResult = $this->ts->getInstance()->tokenList();
// channels
@ -42,7 +41,6 @@ final class TokensAction extends AbstractAction
}
arsort($channelGroups);
// render GET
$this->view->render($response, 'tokens.twig', [
'title' => $this->translator->trans('tokens.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -23,10 +23,19 @@ class BootstrapHelper
public static function bootEnvironment()
{
$envPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config';
$envFileExample = $envPath . DIRECTORY_SEPARATOR . EnvConstants::ENV_FILE_EXAMPLE;
$envFile = $envPath . DIRECTORY_SEPARATOR . EnvConstants::ENV_FILE;
if (file_exists($envFile)) {
$env = new Dotenv(realpath($envPath), EnvConstants::ENV_FILE);
try {
$fileSystem = new Filesystem();
if (!$fileSystem->exists($envFile)) {
$fileSystem->copy($envFileExample, $envFile);
}
} catch (IOException $e) {
die('Could not copy example env file ' . $envFileExample . ' to ' . $envFile);
}
$env = new Dotenv($envPath, EnvConstants::ENV_FILE);
$res = $env->load();
try {
@ -36,9 +45,6 @@ class BootstrapHelper
}
return $res;
} else {
die('No environment file found in ' . realpath($envFile));
}
}
/**
@ -134,7 +140,8 @@ class BootstrapHelper
*
* @return string
*/
public static function getLogDir() {
public static function getLogDir()
{
return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'log';
}
@ -143,7 +150,8 @@ class BootstrapHelper
*
* @return string
*/
public static function getLogFile() {
public static function getLogFile()
{
return self::getLogDir() . DIRECTORY_SEPARATOR . 'application.log';
}
}

View file

@ -47,7 +47,6 @@
</div>
</div>
{% endif %}
</div>
{% endfor %}
<div class="form-group">

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>{{ getenv('site_title') }} | {{ title }}</title>
<!-- Meta -->
@ -23,8 +23,7 @@
{% include 'menu.twig' %}
<!-- Main content -->
<main role="main" class="container">
<div class="mainContainer">
<div class="mainContainer">
<div class="container">
{% if flash is not empty %}
{% if flash.getMessage('info').0 %}
@ -54,8 +53,7 @@
{% block content %}
{% endblock %}
</div>
</div>
</main><!-- /.container -->
</div>
<!-- Footer -->
<footer class="footer">

View file

@ -12,7 +12,6 @@
<li class="nav-item"><a class="nav-link" href="/instance"><i class="fa fa-info"></i> {% trans %}menu.instance{% endtrans %}</a>
</li>
<li class="nav-item"><a class="nav-link" href="/logs"><i class="fa fa-file"></i> {% trans %}menu.logs{% endtrans %}</a></li>
</li>
<li class="nav-item dropdown">