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 # 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 ## 2.1.2 - 2019/08/07
* Minor refactoring * Minor refactoring
* Update documentation * Update documentation

View file

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

View file

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

View file

@ -11,10 +11,8 @@ final class BanDeleteAction extends AbstractAction
$banId = $args['banId']; $banId = $args['banId'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$this->ts->getInstance()->banDelete($banId);
$banDeleteResult = $this->ts->getInstance()->banDelete($banId);
$this->flash->addMessage('success', $this->translator->trans('done')); $this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/bans/' . $sid); 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']); $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(); $banListResult = $this->ts->getInstance()->banList();
// render GET
$this->view->render($response, 'bans.twig', [ $this->view->render($response, 'bans.twig', [
'title' => $this->translator->trans('bans.title'), 'title' => $this->translator->trans('bans.title'),
'data' => $this->ts->getInstance()->getElement('data', $banListResult), 'data' => $this->ts->getInstance()->getElement('data', $banListResult),

View file

@ -13,7 +13,7 @@ final class ChannelCreateAction extends AbstractAction
$inherit = $body['inherit']; $inherit = $body['inherit'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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 (!$inherit) { if (!$inherit) {
unset($body['cpid']); unset($body['cpid']);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,7 +11,7 @@ final class ClientDeleteAction extends AbstractAction
$cldbid = $args['cldbid']; $cldbid = $args['cldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$clientDeleteResult = $this->ts->getInstance()->clientDbDelete($cldbid); $clientDeleteResult = $this->ts->getInstance()->clientDbDelete($cldbid);

View file

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

View file

@ -13,11 +13,11 @@ final class ClientSendAction extends AbstractAction
$body = $request->getParsedBody(); $body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$getResult = $this->ts->getInstance()->clientGetNameFromDbid($cldbid); $getResult = $this->ts->getInstance()->clientGetNameFromDbid($cldbid);
$dataResult = $this->ts->getInstance()->messageAdd( $this->ts->getInstance()->messageAdd(
$this->ts->getInstance()->getElement('data', $getResult)['cluid'], $this->ts->getInstance()->getElement('data', $getResult)['cluid'],
$body['subject'], $body['subject'],
$body['message'] $body['message']

View file

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

View file

@ -11,7 +11,7 @@ final class ComplainDeleteAction extends AbstractAction
$tcldbid = $args['tcldbid']; $tcldbid = $args['tcldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
// search fcldbid // search fcldbid
$fcldbid = null; $fcldbid = null;

View file

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

View file

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

View file

@ -13,7 +13,6 @@ final class InstanceAction extends AbstractAction
$data['data'] = array_merge($hostResult['data'], $instanceResult['data']); $data['data'] = array_merge($hostResult['data'], $instanceResult['data']);
// render GET
$this->view->render($response, 'instance.twig', [ $this->view->render($response, 'instance.twig', [
'title' => $this->translator->trans('instance.title'), 'title' => $this->translator->trans('instance.title'),
'data' => $this->ts->getInstance()->getElement('data', $data) '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); $dataResult = $this->ts->getInstance()->logView(getenv(EnvConstants::TEAMSPEAK_LOG_LINES), 1, 1);
$appLog = explode("\n", file_get_contents(BootstrapHelper::getLogFile())); $appLog = explode("\n", file_get_contents(BootstrapHelper::getLogFile()));
} else { } 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); $dataResult = $this->ts->getInstance()->logView(getenv(EnvConstants::TEAMSPEAK_LOG_LINES), 1, 0);
} }
// render GET
$this->view->render($response, 'logs.twig', [ $this->view->render($response, 'logs.twig', [
'title' => empty($sid) ? $this->translator->trans('instance_logs.title') : $this->translator->trans('server_logs.title'), 'title' => empty($sid) ? $this->translator->trans('instance_logs.title') : $this->translator->trans('server_logs.title'),
'log' => $this->ts->getInstance()->getElement('data', $dataResult), 'log' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

@ -10,13 +10,20 @@ final class OnlineAction extends AbstractAction
$sid = $args['sid']; $sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$dataResult = $this->ts->getInstance()->clientList('-ip -times -info'); $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; $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) { if ($serverPort) {
$uri = sprintf('serverquery://%s:%s@%s:%s/?server_port=%s', $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")); $treeView = $tsServer->getViewer(new TeamSpeak3_Viewer_Html("/images/viewer/", "/images/flags/", "data:image"));
} }
// render GET
$this->view->render($response, 'online.twig', [ $this->view->render($response, 'online.twig', [
'title' => $this->translator->trans('online.title'), 'title' => $this->translator->trans('online.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult), 'data' => $this->ts->getInstance()->getElement('data', $dataResult),

View file

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

View file

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

View file

@ -13,11 +13,10 @@ final class OnlineKickAction extends AbstractAction
$body = $request->getParsedBody(); $body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$this->ts->getInstance()->clientKick($clid, 'server', $body['reason']);
$dataResult = $this->ts->getInstance()->clientKick($clid, 'server', $body['reason']);
$this->flash->addMessage('success', $this->translator->trans('online.kicked.success', ['%clid%' => $clid])); $this->flash->addMessage('success', $this->translator->trans('online.kicked.success', ['%clid%' => $clid]));
return $response->withRedirect('/online/' . $sid); 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']; if (array_key_exists('channel_password', $body)) $channelPassword = $body['channel_password'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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); if (empty($channelPassword)) $this->ts->getInstance()->clientMove($clid, $channel);
else $dataResult = $this->ts->getInstance()->clientMove($clid, $channel, $channelPassword); else $this->ts->getInstance()->clientMove($clid, $channel, $channelPassword);
$this->flash->addMessage('success', $this->translator->trans('online.moved.success', ['%clid%' => $clid])); $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(); $body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$this->ts->getInstance()->clientPoke($clid, $body['message']);
$dataResult = $this->ts->getInstance()->clientPoke($clid, $body['message']);
$this->flash->addMessage('success', $this->translator->trans('online.poked.success', ['%clid%' => $clid])); $this->flash->addMessage('success', $this->translator->trans('online.poked.success', ['%clid%' => $clid]));
return $response->withRedirect('/online/' . $sid . '/' . $clid); return $response->withRedirect('/online/' . $sid . '/' . $clid);

View file

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

View file

@ -17,9 +17,9 @@ final class PasswordAddAction extends AbstractAction
$channelPassword = $body['channel_password']; $channelPassword = $body['channel_password'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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, $password,
$duration, $duration,
$description, $description,

View file

@ -12,7 +12,7 @@ final class PasswordDeleteAction extends AbstractAction
$password = $body['pw_clear']; $password = $body['pw_clear'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$passwordDeleteResult = $this->ts->getInstance()->serverTempPasswordDel($password); $passwordDeleteResult = $this->ts->getInstance()->serverTempPasswordDel($password);

View file

@ -10,7 +10,7 @@ final class PasswordsAction extends AbstractAction
$sid = $args['sid']; $sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$dataResult = $this->ts->getInstance()->serverTempPasswordList(); $dataResult = $this->ts->getInstance()->serverTempPasswordList();
$channelsResult = $this->ts->getInstance()->channelList(); $channelsResult = $this->ts->getInstance()->channelList();
@ -22,7 +22,6 @@ final class PasswordsAction extends AbstractAction
$channels[$channel['channel_name']] = $channel['cid']; $channels[$channel['channel_name']] = $channel['cid'];
} }
// render GET
$this->view->render($response, 'passwords.twig', [ $this->view->render($response, 'passwords.twig', [
'title' => $this->translator->trans('passwords.title'), 'title' => $this->translator->trans('passwords.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult), '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']); $this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
if ($this->session->exists('sid')) { 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(); $whoisResult = $this->ts->getInstance()->whoAmI();
// render GET
$this->view->render($response, 'profile.twig', [ $this->view->render($response, 'profile.twig', [
'title' => $this->translator->trans('profile.title'), 'title' => $this->translator->trans('profile.title'),
'whois' => $this->ts->getInstance()->getElement('data', $whoisResult), 'whois' => $this->ts->getInstance()->getElement('data', $whoisResult),

View file

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

View file

@ -14,9 +14,8 @@ final class ServerGroupAddAction extends AbstractAction
$cldbid = $body['cldbid']; $cldbid = $body['cldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$this->ts->getInstance()->serverGroupAddClient($sgid, $cldbid);
$groupAddResult = $this->ts->getInstance()->serverGroupAddClient($sgid, $cldbid);
$this->flash->addMessage('success', $this->translator->trans('added')); $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->logger->debug('Body', $body);
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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 ($copy) $groupCreateResult = $this->ts->getInstance()->serverGroupAdd($name, $type); if ($copy) $this->ts->getInstance()->serverGroupAdd($name, $type);
else $groupCreateResult = $this->ts->getInstance()->serverGroupCopy($template, 0, $name, $type); else $this->ts->getInstance()->serverGroupCopy($template, 0, $name, $type);
$this->flash->addMessage('success', $this->translator->trans('done')); $this->flash->addMessage('success', $this->translator->trans('done'));

View file

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

View file

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

View file

@ -12,9 +12,9 @@ final class ServerGroupRemoveAction extends AbstractAction
$cldbid = $args['cldbid']; $cldbid = $args['cldbid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$groupRemoveResult = $this->ts->getInstance()->serverGroupDeleteClient($sgid, $cldbid); $this->ts->getInstance()->serverGroupDeleteClient($sgid, $cldbid);
$this->flash->addMessage('success', $this->translator->trans('removed')); $this->flash->addMessage('success', $this->translator->trans('removed'));

View file

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

View file

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

View file

@ -10,7 +10,7 @@ final class ServerSelectAction extends AbstractAction
$sid = $args['sid']; $sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$dataResult = $this->ts->getInstance()->serverInfo(); $dataResult = $this->ts->getInstance()->serverInfo();
$this->session->set('sid', $sid); $this->session->set('sid', $sid);

View file

@ -11,9 +11,8 @@ final class ServerSendAction extends AbstractAction
$body = $request->getParsedBody(); $body = $request->getParsedBody();
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_SERVER, $sid, $body['message']);
$dataResult = $this->ts->getInstance()->sendMessage(ts3admin::TextMessageTarget_SERVER, $sid, $body['message']);
$this->flash->addMessage('success', $this->translator->trans('done')); $this->flash->addMessage('success', $this->translator->trans('done'));
return $response->withRedirect('/servers/' . $sid); 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']); $this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']);
$dataResult = $this->ts->getInstance()->serverList(); $dataResult = $this->ts->getInstance()->serverList();
// render GET
$this->view->render($response, 'servers.twig', [ $this->view->render($response, 'servers.twig', [
'title' => $this->translator->trans('servers.title'), 'title' => $this->translator->trans('servers.title'),
'data' => $this->ts->getInstance()->getElement('data', $dataResult) 'data' => $this->ts->getInstance()->getElement('data', $dataResult)

View file

@ -13,7 +13,7 @@ final class SnapshotCreateAction extends AbstractAction
$sid = $args['sid']; $sid = $args['sid'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$snapshotCreateResult = $this->ts->getInstance()->serverSnapshotCreate(); $snapshotCreateResult = $this->ts->getInstance()->serverSnapshotCreate();

View file

@ -14,7 +14,7 @@ final class SnapshotDeleteAction extends AbstractAction
$name = $args['name']; $name = $args['name'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$fileSystem = new Filesystem(); $fileSystem = new Filesystem();
$path = FileHelper::SNAPSHOTS_PATH . DIRECTORY_SEPARATOR . $sid . DIRECTORY_SEPARATOR . $name; $path = FileHelper::SNAPSHOTS_PATH . DIRECTORY_SEPARATOR . $sid . DIRECTORY_SEPARATOR . $name;

View file

@ -12,7 +12,7 @@ final class SnapshotDeployAction extends AbstractAction
$name = $args['name']; $name = $args['name'];
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$fileSystem = new Filesystem(); $fileSystem = new Filesystem();
$path = FileHelper::SNAPSHOTS_PATH . DIRECTORY_SEPARATOR . $sid . DIRECTORY_SEPARATOR . $name; $path = FileHelper::SNAPSHOTS_PATH . DIRECTORY_SEPARATOR . $sid . DIRECTORY_SEPARATOR . $name;

View file

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

View file

@ -16,13 +16,9 @@ final class TokenAddAction extends AbstractAction
$channel = $body['channel']; $channel = $body['channel'];
$description = $body['description']; $description = $body['description'];
$this->logger->debug('Body', $body);
$this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['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');
$this->ts->getInstance()->tokenAdd(
$tokenAddResult = $this->ts->getInstance()->tokenAdd(
$type, $type,
($type == ts3admin::TokenServerGroup ? $serverGroup : $channelGroup), ($type == ts3admin::TokenServerGroup ? $serverGroup : $channelGroup),
$channel, $channel,

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>{{ getenv('site_title') }} | {{ title }}</title> <title>{{ getenv('site_title') }} | {{ title }}</title>
<!-- Meta --> <!-- Meta -->
@ -23,8 +23,7 @@
{% include 'menu.twig' %} {% include 'menu.twig' %}
<!-- Main content --> <!-- Main content -->
<main role="main" class="container"> <div class="mainContainer">
<div class="mainContainer">
<div class="container"> <div class="container">
{% if flash is not empty %} {% if flash is not empty %}
{% if flash.getMessage('info').0 %} {% if flash.getMessage('info').0 %}
@ -54,8 +53,7 @@
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
</div> </div>
</main><!-- /.container -->
<!-- Footer --> <!-- Footer -->
<footer class="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 class="nav-item"><a class="nav-link" href="/instance"><i class="fa fa-info"></i> {% trans %}menu.instance{% endtrans %}</a>
</li> </li>
<li class="nav-item"><a class="nav-link" href="/logs"><i class="fa fa-file"></i> {% trans %}menu.logs{% 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"> <li class="nav-item dropdown">