Revert commit

This commit is contained in:
Tim Zandbergen 2021-06-21 22:39:11 +02:00
parent 0c7ea7cf88
commit 9c81fdab8a
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
9 changed files with 2 additions and 44 deletions

View File

@ -112,7 +112,6 @@ $sm_lang = array(
servers that have been assigned to them.', servers that have been assigned to them.',
'mobile' => 'Mobile', 'mobile' => 'Mobile',
'email' => 'Email', 'email' => 'Email',
'pushover_active' => 'Activate Pushover?',
'pushover' => 'Pushover', 'pushover' => 'Pushover',
'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/" target="_blank">their website</a> for more info.', 'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See <a href="https://pushover.net/" target="_blank">their website</a> for more info.',
'pushover_key' => 'Pushover Key', 'pushover_key' => 'Pushover Key',

View File

@ -97,12 +97,10 @@ $sm_lang = array(
'pushover_description' => 'Pushover är en tjänst som skickar meddelande i realtid. Se <a 'pushover_description' => 'Pushover är en tjänst som skickar meddelande i realtid. Se <a
href="https://pushover.net/" target="_blank">deras webbsida</a> för mer href="https://pushover.net/" target="_blank">deras webbsida</a> för mer
information.', information.',
'pushover_active' => 'Aktivera Pushover',
'pushover_key' => 'Pushover Key', 'pushover_key' => 'Pushover Key',
'pushover_device' => 'Pushover Device', 'pushover_device' => 'Pushover Device',
'pushover_device_description' => 'Enhetsnman att skicka meddelande till. Lämna tomt för att skicka till alla 'pushover_device_description' => 'Enhetsnman att skicka meddelande till. Lämna tomt för att skicka till alla
enheter.', enheter.',
'telegram_active' => 'Aktivera Telegram',
'delete_title' => 'Radera användare', 'delete_title' => 'Radera användare',
'delete_message' => 'Är du säker att du vill radera användare \'%1\'?', 'delete_message' => 'Är du säker att du vill radera användare \'%1\'?',
'deleted' => 'Användare raderad.', 'deleted' => 'Användare raderad.',

View File

@ -229,7 +229,6 @@ class ConfigController extends AbstractController
? 'checked="checked"' ? 'checked="checked"'
: ''; : '';
} }
foreach ($this->fields as $input_key) { foreach ($this->fields as $input_key) {
$tpl_data[$input_key] = (isset($config[$input_key])) ? $config[$input_key] : ''; $tpl_data[$input_key] = (isset($config[$input_key])) ? $config[$input_key] : '';
} }

View File

@ -301,12 +301,10 @@ class InstallController extends AbstractController
'email' => psm_POST('email', ''), 'email' => psm_POST('email', ''),
'mobile' => '', 'mobile' => '',
'level' => PSM_USER_ADMIN, 'level' => PSM_USER_ADMIN,
'pushover_active' => '1',
'pushover_key' => '', 'pushover_key' => '',
'pushover_device' => '', 'pushover_device' => '',
'webhook_url' => '', 'webhook_url' => '',
'webhook_json' => '', 'webhook_json' => '',
'telegram_active' => '1',
'telegram_id' => '', 'telegram_id' => '',
'discord' => '', 'discord' => '',
'jabber' => '' 'jabber' => ''

View File

@ -41,9 +41,6 @@ class ProfileController extends AbstractController
protected $profile_fields = protected $profile_fields =
array('name', 'user_name', 'email', 'mobile', 'pushover_key', 'pushover_device', 'discord', 'webhook_url', 'webhook_json', 'telegram_id', 'jabber'); array('name', 'user_name', 'email', 'mobile', 'pushover_key', 'pushover_device', 'discord', 'webhook_url', 'webhook_json', 'telegram_id', 'jabber');
protected $checkboxes =
array('pushover_active', 'telegram_active');
public function __construct(Database $db, \Twig_Environment $twig) public function __construct(Database $db, \Twig_Environment $twig)
{ {
parent::__construct($db, $twig); parent::__construct($db, $twig);
@ -88,7 +85,6 @@ class ProfileController extends AbstractController
'label_webhook_json' => psm_get_lang('users', 'webhook_json'), 'label_webhook_json' => psm_get_lang('users', 'webhook_json'),
'label_webhook_json_description' => psm_get_lang('users', 'webhook_json_description'), 'label_webhook_json_description' => psm_get_lang('users', 'webhook_json_description'),
'label_pushover' => psm_get_lang('users', 'pushover'), 'label_pushover' => psm_get_lang('users', 'pushover'),
'label_pushover_active' => psm_get_lang('users', 'pushover_active'),
'label_pushover_description' => psm_get_lang('users', 'pushover_description'), 'label_pushover_description' => psm_get_lang('users', 'pushover_description'),
'label_pushover_key' => psm_get_lang('users', 'pushover_key'), 'label_pushover_key' => psm_get_lang('users', 'pushover_key'),
'label_pushover_device' => psm_get_lang('users', 'pushover_device'), 'label_pushover_device' => psm_get_lang('users', 'pushover_device'),
@ -98,7 +94,6 @@ class ProfileController extends AbstractController
'label_discord_description' => psm_get_lang('users', 'discord_description'), 'label_discord_description' => psm_get_lang('users', 'discord_description'),
'label_telegram' => psm_get_lang('users', 'telegram'), 'label_telegram' => psm_get_lang('users', 'telegram'),
'label_telegram_active' => psm_get_lang('users', 'telegram_active'),
'label_telegram_description' => psm_get_lang('users', 'telegram_description'), 'label_telegram_description' => psm_get_lang('users', 'telegram_description'),
'label_telegram_chat_id' => psm_get_lang('users', 'telegram_chat_id'), 'label_telegram_chat_id' => psm_get_lang('users', 'telegram_chat_id'),
'label_telegram_chat_id_description' => psm_get_lang('users', 'telegram_chat_id_description'), 'label_telegram_chat_id_description' => psm_get_lang('users', 'telegram_chat_id_description'),
@ -116,19 +111,9 @@ class ProfileController extends AbstractController
'level' => psm_get_lang('users', 'level_' . $user->level), 'level' => psm_get_lang('users', 'level_' . $user->level),
'placeholder_password' => psm_get_lang('users', 'password_leave_blank'), 'placeholder_password' => psm_get_lang('users', 'password_leave_blank'),
); );
foreach ($this->profile_fields as $field) { foreach ($this->profile_fields as $field) {
$tpl_data[$field] = (isset($user->$field)) ? $user->$field : ''; $tpl_data[$field] = (isset($user->$field)) ? $user->$field : '';
} }
foreach ($this->checkboxes as $input_key) {
$tpl_data[$input_key . '_checked'] =
(isset($user->$input_key) && (int) $user->$input_key == 1)
? 'checked="checked"'
: '';
}
return $this->twig->render('module/user/profile.tpl.html', $tpl_data); return $this->twig->render('module/user/profile.tpl.html', $tpl_data);
} }
@ -175,10 +160,6 @@ class ProfileController extends AbstractController
unset($clean['password']); unset($clean['password']);
unset($clean['password_repeat']); unset($clean['password_repeat']);
foreach ($this->checkboxes as $input_key) {
$clean[$input_key] = (isset($_POST[$input_key])) ? '1' : '0';
}
$this->db->save(PSM_DB_PREFIX . 'users', $clean, array('user_id' => $this->getUser()->getUserId())); $this->db->save(PSM_DB_PREFIX . 'users', $clean, array('user_id' => $this->getUser()->getUserId()));
$this->container->get('event')->dispatch( $this->container->get('event')->dispatch(
\psm\Module\User\UserEvents::USER_EDIT, \psm\Module\User\UserEvents::USER_EDIT,

View File

@ -50,8 +50,6 @@ class UserController extends AbstractController
'index', 'edit', 'delete', 'save', 'index', 'edit', 'delete', 'save',
), 'index'); ), 'index');
$this->twig->addGlobal('subtitle', psm_get_lang('menu', 'user')); $this->twig->addGlobal('subtitle', psm_get_lang('menu', 'user'));
} }
public function run($action = null) public function run($action = null)
@ -163,16 +161,13 @@ class UserController extends AbstractController
'discord', 'discord',
'webhook_url', 'webhook_url',
'webhook_json', 'webhook_json',
'pushover_active',
'pushover_key', 'pushover_key',
'pushover_device', 'pushover_device',
'telegram_active',
'telegram_id', 'telegram_id',
'jabber', 'jabber',
'email' 'email'
); );
if ($user_id == 0) { if ($user_id == 0) {
// insert mode // insert mode
$title = psm_get_lang('system', 'insert'); $title = psm_get_lang('system', 'insert');

View File

@ -219,12 +219,10 @@ class Installer
`name` varchar(255) NOT NULL, `name` varchar(255) NOT NULL,
`mobile` varchar(15) NOT NULL, `mobile` varchar(15) NOT NULL,
`discord` varchar(255) NOT NULL, `discord` varchar(255) NOT NULL,
`pushover_active` varchar(1) NULL,
`pushover_key` varchar(255) NOT NULL, `pushover_key` varchar(255) NOT NULL,
`pushover_device` varchar(255) NOT NULL, `pushover_device` varchar(255) NOT NULL,
`webhook_url` varchar(255) NOT NULL, `webhook_url` varchar(255) NOT NULL,
`webhook_json` varchar(255) NOT NULL DEFAULT '{\"text\":\"servermon: #message\"}', `webhook_json` varchar(255) NOT NULL DEFAULT '{\"text\":\"servermon: #message\"}',
`telegram_active` varchar(1) NULL,
`telegram_id` varchar(255) NOT NULL , `telegram_id` varchar(255) NOT NULL ,
`jabber` varchar(255) NOT NULL, `jabber` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL, `email` varchar(255) NOT NULL,

View File

@ -542,9 +542,6 @@ class StatusNotifier
if (trim($user['pushover_key']) == '') { if (trim($user['pushover_key']) == '') {
unset($users[$k]); unset($users[$k]);
} }
if (!isset($user['pushover_active']) || $user['pushover_active'] != '1') {
unset($users[$k]);
}
} }
// Validation // Validation
@ -695,9 +692,6 @@ class StatusNotifier
if (trim($user['telegram_id']) == '') { if (trim($user['telegram_id']) == '') {
unset($users[$k]); unset($users[$k]);
} }
if (!isset($user['telegram_active']) || $user['telegram_active'] != '1') {
unset($users[$k]);
}
} }
// Validation // Validation
@ -787,7 +781,7 @@ class StatusNotifier
$users = $this->db->query(' $users = $this->db->query('
SELECT `u`.`user_id`, `u`.`name`,`u`.`email`, `u`.`mobile`, `u`.`pushover_key`, `u`.`discord`, `u`.`webhook_url`,`u`.`webhook_json`, SELECT `u`.`user_id`, `u`.`name`,`u`.`email`, `u`.`mobile`, `u`.`pushover_key`, `u`.`discord`, `u`.`webhook_url`,`u`.`webhook_json`,
`u`.`pushover_device`, `u`.`telegram_id`, `u`.`pushover_device`, `u`.`telegram_id`,
`u`.`jabber`, `u`.`telegram_active`, `u`.`pushover_active` `u`.`jabber`
FROM `' . PSM_DB_PREFIX . 'users` AS `u` FROM `' . PSM_DB_PREFIX . 'users` AS `u`
JOIN `' . PSM_DB_PREFIX . "users_servers` AS `us` ON ( JOIN `' . PSM_DB_PREFIX . "users_servers` AS `us` ON (
`us`.`user_id`=`u`.`user_id` `us`.`user_id`=`u`.`user_id`

View File

@ -23,8 +23,6 @@
<fieldset> <fieldset>
<legend>{{ label_pushover }}</legend> <legend>{{ label_pushover }}</legend>
<p>{{ label_pushover_description|raw }}</p> <p>{{ label_pushover_description|raw }}</p>
<!-- pushover active -->
{{ macro.input_checkbox("pushover_active", "pushover_active", label_pushover_active, pushover_active_checked) }}
<!-- pushover key --> <!-- pushover key -->
{{ macro.input_field("text", "pushover_key", null, "pushover_key", label_pushover_key, pushover_key, label_pushover_key, "255", "pushover_key_help", label_pushover_key_description) }} {{ macro.input_field("text", "pushover_key", null, "pushover_key", label_pushover_key, pushover_key, label_pushover_key, "255", "pushover_key_help", label_pushover_key_description) }}
<!-- pushover device --> <!-- pushover device -->
@ -34,8 +32,6 @@
<fieldset> <fieldset>
<legend>{{ label_telegram }}</legend> <legend>{{ label_telegram }}</legend>
<p>{{ label_telegram_description|raw }}</p> <p>{{ label_telegram_description|raw }}</p>
<!-- pushover active -->
{{ macro.input_checkbox("telegram_active", "telegram_active", label_telegram_active, telegram_active_checked) }}
<!-- telegram id --> <!-- telegram id -->
<div class="form-group"> <div class="form-group">
<a class="btn btn-primary mb-2" href="{{ telegram_get_chat_id_url }}">{{ label_telegram_get_chat_id }}</a> <a class="btn btn-primary mb-2" href="{{ telegram_get_chat_id_url }}">{{ label_telegram_get_chat_id }}</a>