add feature "add url" to email and telegram (#1085)
Resolved #967. * add feature "add url" to email and telegram * Added missing brackets * Changed $body to correct var $message And changed PHP_EOL to <br>. * Changed text a little * Add dutch translation Co-authored-by: TimZ99 <TimZ99@users.noreply.github.com>pull/1119/head
parent
dbd0217053
commit
e5b76ca49e
|
@ -196,6 +196,7 @@ $sm_lang = array(
|
|||
'general' => 'Allgemein',
|
||||
'language' => 'Sprache',
|
||||
'show_update' => 'Wöchentlich auf Aktualisierungen prüfen?',
|
||||
'email_add_url' => 'Server URL an E-Mail anhängen?',
|
||||
'email_status' => 'E-Mail-Versand erlauben?',
|
||||
'email_from_email' => 'Absenderadresse',
|
||||
'email_from_name' => 'Name des Absenders',
|
||||
|
@ -221,6 +222,9 @@ $sm_lang = array(
|
|||
'pushover_api_token_description' => 'Bevor Sie Pushover verwenden können, müssen Sie Ihre <a href="%1$s"
|
||||
target="_blank" rel="noopener">Anwendung hier registrieren</a> und Ihren
|
||||
Anwendungs-API-Token hier eingeben.',
|
||||
'telegram_status' => 'Telegram Nachrichten erlauben?',
|
||||
'telegram_add_url' => 'Server URL an Nachricht anhängen?',
|
||||
'jabber_status' => 'Allow sending Jabber (XMPP) messages',
|
||||
'alert_type' => 'Wann möchten Sie benachrichtigt werden?',
|
||||
'alert_type_description' => '<b>Status geändert:</b> ... wenn sich der Status ändert<br>z. B. online ->
|
||||
offline oder offline -> online.<br><br><b>Offline: </b>Sie bekommen eine
|
||||
|
@ -237,6 +241,7 @@ $sm_lang = array(
|
|||
'log_email' => 'E-Mail-Versand protokollieren?',
|
||||
'log_sms' => 'SMS-Versand protokollieren?',
|
||||
'log_pushover' => 'Pushover-Versand protokollieren?',
|
||||
'log_telegram' => 'Telegram-Versand protokollieren?',
|
||||
'updated' => 'Die Einstellungen wurden gespeichert.',
|
||||
'tab_email' => 'E-Mail',
|
||||
'tab_sms' => 'SMS',
|
||||
|
|
|
@ -297,6 +297,7 @@ $sm_lang = array(
|
|||
'proxy_user' => 'Proxy username',
|
||||
'proxy_password' => 'Proxy password',
|
||||
'email_status' => 'Allow sending email',
|
||||
'email_add_url' => 'Add url to the monitor in email',
|
||||
'email_from_email' => 'Email from address',
|
||||
'email_from_name' => 'Email from name',
|
||||
'email_smtp' => 'Enable SMTP',
|
||||
|
@ -326,6 +327,7 @@ $sm_lang = array(
|
|||
'pushover_api_token' => 'Pushover App API Token',
|
||||
'pushover_api_token_description' => 'Before you can use Pushover, you need to <a href="%1$s" target="_blank" rel="noopener">register an App</a> at their website and enter the App API Token here.',
|
||||
'telegram_status' => 'Allow sending Telegram messages',
|
||||
'telegram_add_url' => 'Add url to the monitor in the message',
|
||||
'telegram_description' => '<a href="https://telegram.org/" target="_blank">Telegram</a> is a chat app that makes it easy to get real-time notifications. Visit the <a href="http://docs.phpservermonitor.org/" target="_blank">documentation</a> for more info and an install guide.',
|
||||
'telegram_api_token' => 'Telegram API Token',
|
||||
'telegram_api_token_description' => 'Before you can use Telegram, you need to get a API token. Visit the <a href="http://docs.phpservermonitor.org/" target="_blank">documentation</a> for help.',
|
||||
|
|
|
@ -250,6 +250,7 @@ $sm_lang = array(
|
|||
'language' => 'Taal',
|
||||
'show_update' => 'Controleer wekelijks voor updates?',
|
||||
'email_status' => 'Sta email berichten toe?',
|
||||
'email_add_url' => 'Voeg url van de monitor toe aan de email',
|
||||
'email_from_email' => 'Email van adres',
|
||||
'email_from_name' => 'Email van naam',
|
||||
'email_smtp' => 'SMTP gebruiken',
|
||||
|
@ -275,6 +276,7 @@ $sm_lang = array(
|
|||
target="_blank" rel="noopener">App registreren</a> via hun website, en
|
||||
daarvan de App API Token hier invullen.',
|
||||
'telegram_status' => 'Sta Telegram berichten toe?',
|
||||
'telegram_add_url' => 'voeg url van de monitor toe aan het bericht',
|
||||
'telegram_api_token' => 'Telegram API Token',
|
||||
'alert_type' => 'Selecteer wanneer je een notificatie wilt',
|
||||
'alert_type_description' => '<b>Status verandert:</b> Je ontvangt alleen bericht wanneer een server van status
|
||||
|
|
|
@ -41,12 +41,14 @@ class ConfigController extends AbstractController
|
|||
protected $checkboxes = array(
|
||||
'proxy',
|
||||
'email_status',
|
||||
'email_add_url',
|
||||
'email_smtp',
|
||||
'sms_status',
|
||||
'discord_status',
|
||||
'pushover_status',
|
||||
'webhook_status',
|
||||
'telegram_status',
|
||||
'telegram_add_url',
|
||||
'jabber_status',
|
||||
'log_status',
|
||||
'log_email',
|
||||
|
@ -602,6 +604,7 @@ class ConfigController extends AbstractController
|
|||
'label_proxy_url' => psm_get_lang('config', 'proxy_url'),
|
||||
'label_proxy_user' => psm_get_lang('config', 'proxy_user'),
|
||||
'label_proxy_password' => psm_get_lang('config', 'proxy_password'),
|
||||
'label_email_add_url' => psm_get_lang('config', 'email_add_url'),
|
||||
'label_email_status' => psm_get_lang('config', 'email_status'),
|
||||
'label_email_from_email' => psm_get_lang('config', 'email_from_email'),
|
||||
'label_email_from_name' => psm_get_lang('config', 'email_from_name'),
|
||||
|
@ -636,6 +639,7 @@ class ConfigController extends AbstractController
|
|||
),
|
||||
'label_telegram_description' => psm_get_lang('config', 'telegram_description'),
|
||||
'label_telegram_status' => psm_get_lang('config', 'telegram_status'),
|
||||
'label_telegram_add_url' => psm_get_lang('config', 'telegram_add_url'),
|
||||
'label_telegram_api_token' => psm_get_lang('config', 'telegram_api_token'),
|
||||
'label_telegram_api_token_description' => psm_get_lang('config', 'telegram_api_token_description'),
|
||||
'label_jabber_status' => psm_get_lang('config', 'jabber_status'),
|
||||
|
|
|
@ -147,6 +147,7 @@ class Installer
|
|||
('proxy_user', ''),
|
||||
('proxy_password', ''),
|
||||
('email_status', '1'),
|
||||
('email_add_url', '0'),
|
||||
('email_from_email', 'monitor@example.org'),
|
||||
('email_from_name', 'Server Monitor'),
|
||||
('email_smtp', ''),
|
||||
|
@ -164,6 +165,7 @@ class Installer
|
|||
('pushover_status', '0'),
|
||||
('pushover_api_token', ''),
|
||||
('telegram_status', '0'),
|
||||
('telegram_add_url', '0'),
|
||||
('telegram_api_token', ''),
|
||||
('jabber_status', '1'),
|
||||
('jabber_host', ''),
|
||||
|
|
|
@ -427,6 +427,7 @@ class StatusNotifier
|
|||
$body = key_exists('message', $combi) ?
|
||||
$combi['message'] :
|
||||
psm_parse_msg($this->status_new, 'email_body', $this->server);
|
||||
if ((bool)psm_get_conf('email_add_url')) $body .= PHP_EOL.PHP_EOL.'<a href="'.PSM_BASE_URL.'">'.PSM_BASE_URL.'</a>';
|
||||
$mail->Body = $body;
|
||||
$mail->AltBody = str_replace('<br/>', "\n", $body);
|
||||
|
||||
|
@ -695,6 +696,7 @@ class StatusNotifier
|
|||
$message = key_exists('message', $combi) ?
|
||||
$combi['message'] :
|
||||
psm_parse_msg($this->status_new, 'telegram_message', $this->server);
|
||||
if ((bool)psm_get_conf('telegram_add_url')) $message .= '<br>'.PSM_BASE_URL;
|
||||
$telegram = psm_build_telegram();
|
||||
$telegram->setMessage($message);
|
||||
|
||||
|
|
|
@ -142,6 +142,8 @@
|
|||
{{ macro.input_checkbox("email_status", "email_status[]", label_email_status, email_status_checked) }}
|
||||
<!-- enable email log -->
|
||||
{{ macro.input_checkbox("log_email", "log_email[]", label_log_email, log_email_checked) }}
|
||||
<!-- enable adding url to email -->
|
||||
{{ macro.input_checkbox("email_add_url", "email_add_url[]", label_email_add_url, email_add_url_checked) }}
|
||||
<!-- email name -->
|
||||
{{ macro.input_field("text", "email_from_name", null, "email_from_name", label_email_from_name, email_from_name, label_email_from_name, "255") }}
|
||||
<!-- email address -->
|
||||
|
@ -222,6 +224,8 @@
|
|||
{{ macro.input_checkbox("telegram_status", "telegram_status[]", label_telegram_status, telegram_status_checked) }}
|
||||
<!-- enable telegram log -->
|
||||
{{ macro.input_checkbox("log_telegram", "log_telegram[]", label_log_telegram, log_telegram_checked) }}
|
||||
<!-- enable adding url to telegram -->
|
||||
{{ macro.input_checkbox("telegram_add_url", "telegram_add_url[]", label_telegram_add_url, telegram_add_url_checked) }}
|
||||
<!-- telegram key -->
|
||||
{{ macro.input_field("text", "telegram_api_token", null, "telegram_api_token", label_telegram_api_token, telegram_api_token, label_telegram_api_token, "255", "telegram_api_token_help", label_telegram_api_token_description) }}
|
||||
{{ macro.button_test("testTelegram", label_test) }}
|
||||
|
|
Loading…
Reference in New Issue