diff --git a/README.rst b/README.rst index 52c184f7..ce97b04e 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ PHP Server Monitor :alt: Join the chat at https://gitter.im/erickrf/nlpnet :target: https://gitter.im/phpservermon/phpservermon -Version 3.5.0 +Version 3.5.1 PHP Server Monitor is a script that checks whether your websites and servers are up and running. It comes with a web based user interface where you can manage your services and websites, @@ -16,7 +16,7 @@ Features: --------- * Monitor services and websites (see below). -* Email, SMS, Pushover, Telegram and Jabber notifications. +* Email, SMS, Discord, Pushover, Telegram and Jabber notifications. * View history graphs of uptime and latency. * User authentication with 2 levels (administrator and regular user). * Logs of connection errors, outgoing emails and text messages. diff --git a/docs/credits.rst b/docs/credits.rst index e1c89471..83ee5bf7 100644 --- a/docs/credits.rst +++ b/docs/credits.rst @@ -89,6 +89,10 @@ The following people have contributed to the development of PHP Server Monitor: * SMSAPI gateway +* Daniel Krusky - https://github.com/dkrusky + + * Discord webhook support + Translators +++++++++++ @@ -196,4 +200,4 @@ The following libraries are being used by PHP Server Monitor: * PHP-Pushover - https://github.com/kryap/php-pushover * Symfony - https://symfony.com * Random_compat - https://github.com/paragonie/random_compat -* Hammer.js - https://github.com/hammerjs/hammer.js \ No newline at end of file +* Hammer.js - https://github.com/hammerjs/hammer.js diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index fc6cf710..6105221a 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -50,9 +50,7 @@ $sm_lang = array( 'no' => 'No', 'insert' => 'Insert', 'add_new' => 'Add new', - 'update_available' => 'A new version ({version}) is available. Click here to download the update.', + 'update_available' => 'A new version ({version}) is available. Click here to download the update.', 'back_to_top' => 'Back to top', 'go_back' => 'Go back', 'ok' => 'OK', @@ -108,31 +106,25 @@ $sm_lang = array( 'level' => 'Level', 'level_10' => 'Administrator', 'level_20' => 'User', - 'level_description' => 'Administrators have full access: they can manage servers, users and edit the - global configuration.
Users can only view and run the updater for the - servers that have been assigned to them.', + 'level_description' => 'Administrators have full access: they can manage servers, users and edit the global configuration.
Users can only view and run the updater for the servers that have been assigned to them.', 'mobile' => 'Mobile', 'email' => 'Email', 'pushover' => 'Pushover', - 'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See their website for more info.', + 'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See their website for more info.', 'pushover_key' => 'Pushover Key', 'pushover_device' => 'Pushover Device', 'pushover_device_description' => 'Device name to send the message to. Leave empty to send it to all devices.', + 'discord' => 'Discord', + 'discord_label' => 'Discord', + 'discord_description' => 'Put your webhook here', 'telegram' => 'Telegram', - 'telegram_description' => 'Telegram is a chat app that - makes it easy to get real-time notifications. Visit the documentation for more - info and an install guide.', + 'telegram_description' => 'Telegram is a chat app that makes it easy to get real-time notifications. Visit the documentation for more info and an install guide.', 'telegram_chat_id' => 'Telegram chat id', 'telegram_chat_id_description' => 'The message will be send to the corresponding chat.', 'telegram_get_chat_id' => 'Click here to get your chat id', 'activate_telegram' => 'Activate Telegram notifications', - 'activate_telegram_description' => 'Allow Telegram notifications to be sent to the specified chat id. Without - this permission, Telegram doesn\'t allow us to send notifications to you.', - 'telegram_bot_username_found' => 'The bot was found!

This will open a chat - with the bot. Here you need to press start or type /start.', + 'activate_telegram_description' => 'Allow Telegram notifications to be sent to the specified chat id. Without this permission, Telegram doesn\'t allow us to send notifications to you.', + 'telegram_bot_username_found' => 'The bot was found!

This will open a chat with the bot. Here you need to press start or type /start.', 'telegram_bot_username_error_token' => '401 - Unauthorized. Please make sure that the API token is valid.', 'telegram_bot_error' => 'An error has occurred while activating Telegram notification: %s', 'jabber' => 'Jabber', @@ -146,8 +138,7 @@ $sm_lang = array( 'profile' => 'Profile', 'profile_updated' => 'Your profile has been updated.', 'error_user_name_bad_length' => 'Usernames must be between 2 and 64 characters.', - 'error_user_name_invalid' => 'The username may only contain alphabetic characters (a-z, A-Z), digits (0-9), - dots (.) and underscores (_).', + 'error_user_name_invalid' => 'The username may only contain alphabetic characters (a-z, A-Z), digits (0-9), dots (.) and underscores (_).', 'error_user_name_exists' => 'The given username already exists in the database.', 'error_user_email_bad_length' => 'Email addresses must be between 5 and 255 characters.', 'error_user_email_invalid' => 'The email address is invalid.', @@ -163,6 +154,7 @@ $sm_lang = array( 'status' => 'Status', 'email' => 'Email', 'sms' => 'SMS', + 'discord' => 'Discord', 'pushover' => 'Pushover', 'telegram' => 'Telegram', 'jabber' => 'Jabber', @@ -201,17 +193,13 @@ $sm_lang = array( 'type_service' => 'Service', 'type_ping' => 'Ping', 'pattern' => 'Search string/pattern', - 'pattern_description' => 'If this pattern is not found on the website, the server will be marked - online/offline. Regular expressions are allowed.', + 'pattern_description' => 'If this pattern is not found on the website, the server will be marked online/offline. Regular expressions are allowed.', 'pattern_online' => 'Pattern indicates website is', - 'pattern_online_description' => 'Online: If this pattern was found on the website, the server will be marked - online. Offline: If this pattern was not found on the website, the server - will be marked offline.', + 'pattern_online_description' => 'Online: If this pattern was found on the website, the server will be marked online. Offline: If this pattern was not found on the website, the server will be marked offline.', 'redirect_check' => 'Redirecting to another domain is', 'redirect_check_description' => 'Redirect to another domain is usually a bad sign.', 'allow_http_status' => 'Allow HTTP status code', - 'allow_http_status_description' => 'Mark website as online. HTTP Status codes lower then 400 are marked as - online by default. Seperate with |.', + 'allow_http_status_description' => 'Mark website as online. HTTP Status codes lower then 400 are marked as online by default. Seperate with |.', 'header_name' => 'Header name', 'header_value' => 'Header value', 'header_name_description' => 'Case-sensitive.', @@ -229,6 +217,8 @@ $sm_lang = array( 'send_email' => 'Send Email', 'sms' => 'SMS', 'send_sms' => 'Send SMS', + 'discord' => 'Discord', + 'send_discord' => 'Send Discord notificationn', 'pushover' => 'Pushover', 'send_pushover' => 'Send Pushover notification', 'telegram' => 'Telegram', @@ -256,8 +246,7 @@ $sm_lang = array( 'warning_threshold' => 'Warning threshold', 'warning_threshold_description' => 'Number of failed checks required before it is marked offline.', 'ssl_cert_expiry_days' => 'SSL Certificate Validity', - 'ssl_cert_expiry_days_description' => 'The minimum remaining days the SSL certificate is still valid. Use 0 to - disable check.', + 'ssl_cert_expiry_days_description' => 'The minimum remaining days the SSL certificate is still valid. Use 0 to disable check.', 'ssl_cert_expired' => 'SSL certificate expired since', 'ssl_cert_expiring' => 'SSL certificate expiring:', 'chart_last_week' => 'Last week', @@ -268,6 +257,7 @@ $sm_lang = array( 'chart_short_time_format' => '%H:%M', 'warning_notifications_disabled_sms' => 'SMS notifications are disabled.', 'warning_notifications_disabled_email' => 'Email notifications are disabled.', + 'warning_notifications_disabled_discord' => 'Discord notifications are disabled.', 'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.', 'warning_notifications_disabled_telegram' => 'Telegram notifications are disabled.', 'warning_notifications_disabled_jabber' => 'Jabber notifications are disabled.', @@ -278,8 +268,7 @@ $sm_lang = array( 'error_server_ip_bad_website' => 'The website URL is not valid.', 'error_server_type_invalid' => 'The selected server type is invalid.', 'error_server_warning_threshold_invalid' => 'The warning threshold must be a valid integer greater than 0.', - 'error_server_ssl_cert_expiry_days' => 'The remaining days for SSL certificate validity must be a valid - integer greater than or equal to 0.', + 'error_server_ssl_cert_expiry_days' => 'The remaining days for SSL certificate validity must be a valid integer greater than or equal to 0.', ), 'config' => array( 'general' => 'General', @@ -287,8 +276,7 @@ $sm_lang = array( 'language' => 'Language', 'show_update' => 'Check for updates?', 'password_encrypt_key' => 'The encryption key password', - 'password_encrypt_key_note' => 'This key is used to encrypt passwords that are stored on servers for access to - websites. If the key will change the stored password is invalid!', + 'password_encrypt_key_note' => 'This key is used to encrypt passwords that are stored on servers for access to websites. If the key will change the stored password is invalid!', 'proxy' => 'Enable proxy', 'proxy_url' => 'Proxy URL', 'proxy_user' => 'Proxy username', @@ -309,27 +297,18 @@ $sm_lang = array( 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', 'sms_from' => 'Sender\'s phone number', + 'discord_status' => 'Allow sending Discord messages', 'pushover_status' => 'Allow sending Pushover messages', - 'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See their website for more info.', + 'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See their website for more info.', 'pushover_clone_app' => 'Click here to create your Pushover app', 'pushover_api_token' => 'Pushover App API Token', - 'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API - Token here.', + 'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.', 'telegram_status' => 'Allow sending Telegram messages', - 'telegram_description' => 'Telegram is a chat app that - makes it easy to get real-time notifications. Visit the documentation for more - info and an install guide.', + 'telegram_description' => 'Telegram is a chat app that makes it easy to get real-time notifications. Visit the documentation 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 documentation for help.', + 'telegram_api_token_description' => 'Before you can use Telegram, you need to get a API token. Visit the documentation for help.', 'jabber_status' => 'Allow sending Jabber (XMPP) messages', - 'jabber_description' => 'Visit the documentation for more info and an - install guide.', + 'jabber_description' => 'Visit the documentation for more info and an install guide.', 'jabber_host' => 'Host', 'jabber_host_description' => 'Host of your Jabber account provider. For Google Account use talk.google.com.', 'jabber_port' => 'Port', @@ -342,37 +321,32 @@ $sm_lang = array( 'jabber_password_description' => 'Fill only to set or change.', 'jabber_check' => 'Check your Jabber account if message was received.', 'alert_type' => 'Select when you\'d like to be notified.', - 'alert_type_description' => 'Status change: You will receive a notification when a server has a change - in status. So from online -> offline or offline -> online.

Offline: - You will receive a notification when a server goes offline for the *FIRST TIME - ONLY*. For example, your cronjob is every 15 minutes and your server goes down at - 1 am and stays down till 6 am. You will get 1 notification at 1 am and that\'s - it.

Always: You will receive a notification every time the script - runs and a site is down, even if the site has been offline for hours.', + 'alert_type_description' => 'Status change: You will receive a notification when a server has a change in status. So from online -> offline or offline -> online.

Offline: You will receive a notification when a server goes offline for the *FIRST TIME ONLY*. For example, your cronjob is every 15 minutes and your server goes down at 1 am and stays down till 6 am. You will get 1 notification at 1 am and that\'s it.

Always: You will receive a notification every time the script runs and a site is down, even if the site has been offline for hours.', 'alert_type_status' => 'Status change', 'alert_type_offline' => 'Offline', 'alert_type_always' => 'Always', 'combine_notifications' => 'Combine notifications', - 'combine_notifications_description' => 'Reduces the amount of notification by combining the notifications into - 1 single notification. (This does not affect SMS notifications.)', + 'combine_notifications_description' => 'Reduces the amount of notification by combining the notifications into 1 single notification. (This does not affect SMS notifications.)', 'alert_proxy' => 'Even if enabled, proxy is never used for services', 'alert_proxy_url' => 'Format: host:port', 'log_status' => 'Log status', - 'log_status_description' => 'If log status is set to TRUE, the monitor will log the event whenever the - notification settings are passed.', + 'log_status_description' => 'If log status is set to TRUE, the monitor will log the event whenever the notification settings are passed.', 'log_email' => 'Log emails sent by the script', 'log_sms' => 'Log text messages sent by the script', + 'log_discord' => 'Log Discord messages sent by the script', 'log_pushover' => 'Log pushover messages sent by the script', 'log_telegram' => 'Log Telegram messages sent by the script', 'log_jabber' => 'Log Jabber messages sent by the script', 'updated' => 'The configuration has been updated.', 'tab_email' => 'Email', 'tab_sms' => 'SMS', + 'tab_discord' => 'Discord', 'tab_pushover' => 'Pushover', 'tab_telegram' => 'Telegram', 'tab_jabber' => 'Jabber', 'settings_email' => 'Email settings', 'settings_sms' => 'Text message settings', + 'settings_discord' => 'Discord settings', 'settings_pushover' => 'Pushover settings', 'settings_telegram' => 'Telegram settings', 'settings_jabber' => 'Jabber settings', @@ -380,13 +354,12 @@ $sm_lang = array( 'settings_log' => 'Log settings', 'settings_proxy' => 'Proxy settings', 'auto_refresh' => 'Auto-refresh', - 'auto_refresh_description' => 'Auto-refresh servers page.
Time in seconds, if 0 the - page won\'t refresh.', + 'auto_refresh_description' => 'Auto-refresh servers page.
Time in seconds, if 0 the page won\'t refresh.', 'test' => 'Test', 'test_email' => 'An email will be sent to the address specified in your user profile.', 'test_sms' => 'An SMS will be sent to the phone number specified in your user profile.', - 'test_pushover' => 'A Pushover notification will be sent to the user key/device specified in your user - profile.', + 'test_discord' => 'A Discord notification will be sent to the webhook specified in your user profile.', + 'test_pushover' => 'A Pushover notification will be sent to the user key/device specified in your user profile.', 'test_telegram' => 'A Telegram notification will be sent to the chat id specified in your user profile.', 'test_jabber' => 'A Jabber notification will be sent to the jabber account specified in your user profile.', 'send' => 'Send', @@ -397,24 +370,23 @@ $sm_lang = array( 'sms_sent' => 'SMS sent', 'sms_error' => 'An error has occurred while sending the SMS: %s', 'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.', + 'discord_sent' => 'Discord notification sent', + 'discord_error' => 'An error has occurred while sending the Discord notification: %s', + 'discord_error_nowebhook' => 'Unable to send test Discord notification: no valid Discord webhook found in your user profile.', 'pushover_sent' => 'Pushover notification sent', 'pushover_error' => 'An error has occurred while sending the Pushover notification: %s', - 'pushover_error_noapp' => 'Unable to send test notification: no Pushover App API token found in the global - configuration.', + 'pushover_error_noapp' => 'Unable to send test notification: no Pushover App API token found in the global configuration.', 'pushover_error_nokey' => 'Unable to send test notification: no Pushover key found in your profile.', 'telegram_sent' => 'Telegram notification sent', 'telegram_error' => 'An error has occurred while sending the Telegram notification: %s', - 'telegram_error_notoken' => 'Unable to send test notification: no Telegram API token found in the global - configuration.', + 'telegram_error_notoken' => 'Unable to send test notification: no Telegram API token found in the global configuration.', 'telegram_error_noid' => 'Unable to send test notification: no chat id found in your profile.', 'jabber_sent' => 'Telegram notification sent', 'jabber_error' => 'An error has occurred while sending the Telegram notification: %s', - 'jabber_error_noconfig' => 'Unable to send test notification: no Jabber account set in the global - configuration.', + 'jabber_error_noconfig' => 'Unable to send test notification: no Jabber account set in the global configuration.', 'jabber_error_noaccount' => 'Unable to send test notification: no Jabber account found in your profile.', 'log_retention_period' => 'Log retention period', - 'log_retention_period_description' => 'Number of days to keep logs of notifications and archives of server - uptime. Enter 0 to disable log cleanup.', + 'log_retention_period_description' => 'Number of days to keep logs of notifications and archives of server uptime. Enter 0 to disable log cleanup.', 'log_retention_days' => 'days', 'user_agent' => 'User Agent', 'user_agent_key_note' => 'Custom user agent used by monitor within communication with external services.', @@ -422,57 +394,37 @@ $sm_lang = array( 'notifications' => array( 'off_sms' => 'Server \'%LABEL%\' is DOWN: ip=%IP%, port=%PORT%. Error=%ERROR%', 'off_email_subject' => 'IMPORTANT: Server \'%LABEL%\' is DOWN', - 'off_email_body' => 'Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: - %PORT%
Error: %ERROR%
Date: %DATE%', + 'off_email_body' => 'Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', + 'off_discord_message' => 'Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', 'off_pushover_title' => 'Server \'%LABEL%\' is DOWN', - 'off_pushover_message' => 'Failed to connect to the following server:

Server: %LABEL%
IP: - %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', - 'off_telegram_message' => 'Failed to connect to the following server:

Server: %LABEL%
IP: - %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', - 'off_jabber_message' => 'Failed to connect to the following server:

Server: %LABEL%
IP: - %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', + 'off_pushover_message' => 'Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', + 'off_telegram_message' => 'Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', + 'off_jabber_message' => 'Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%', 'on_sms' => 'Server \'%LABEL%\' is RUNNING: ip=%IP%, port=%PORT%, it was down for %LAST_OFFLINE_DURATION%', 'on_email_subject' => 'IMPORTANT: Server \'%LABEL%\' is RUNNING', - 'on_email_body' => 'Server \'%LABEL%\' is running again, it was down for - %LAST_OFFLINE_DURATION%:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: - %DATE%', + 'on_email_body' => 'Server \'%LABEL%\' is running again, it was down for %LAST_OFFLINE_DURATION%:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', + 'on_discord_message' => 'Server \'%LABEL%\' is running again, it was down for: %LAST_OFFLINE_DURATION%

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', 'on_pushover_title' => 'Server \'%LABEL%\' is RUNNING', - 'on_pushover_message' => 'Server \'%LABEL%\' is running again, it was down for - %LAST_OFFLINE_DURATION%:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: - %DATE%', - 'on_telegram_message' => 'Server \'%LABEL%\' is running again, it was down for: - %LAST_OFFLINE_DURATION%

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: - %DATE%', - 'on_jabber_message' => 'Server \'%LABEL%\' is running again, it was down for: - %LAST_OFFLINE_DURATION%

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: - %DATE%', - 'combi_off_email_message' => '', - 'combi_off_pushover_message' => '', - 'combi_off_telegram_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Error: %ERROR%
- - Date: %DATE%

', - 'combi_off_jabber_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Error: %ERROR%
- - Date: %DATE%

', - 'combi_on_email_message' => '', - 'combi_on_pushover_message' => '', - 'combi_on_telegram_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Downtime: - %LAST_OFFLINE_DURATION%
- Date: %DATE%

', - 'combi_on_jabber_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Downtime: - %LAST_OFFLINE_DURATION%
- Date: %DATE%

', + 'on_pushover_message' => 'Server \'%LABEL%\' is running again, it was down for %LAST_OFFLINE_DURATION%:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', + 'on_telegram_message' => 'Server \'%LABEL%\' is running again, it was down for: %LAST_OFFLINE_DURATION%

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', + 'on_jabber_message' => 'Server \'%LABEL%\' is running again, it was down for: %LAST_OFFLINE_DURATION%

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', + 'combi_off_email_message' => '', + 'combi_off_discord_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Error: %ERROR%
- Date: %DATE%

', + 'combi_off_pushover_message' => '', + 'combi_off_telegram_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Error: %ERROR%
- Date: %DATE%

', + 'combi_off_jabber_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Error: %ERROR%
- Date: %DATE%

', + 'combi_on_email_message' => '', + 'combi_on_discord_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Downtime: %LAST_OFFLINE_DURATION%
- Date: %DATE%

', + 'combi_on_pushover_message' => '', + 'combi_on_telegram_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Downtime: %LAST_OFFLINE_DURATION%
- Date: %DATE%

', + 'combi_on_jabber_message' => '- Server: %LABEL%
- IP: %IP%
- Port: %PORT%
- Downtime: %LAST_OFFLINE_DURATION%
- Date: %DATE%

', 'combi_email_subject' => 'IMPORTANT: \'%UP%\' servers UP again, \'%DOWN%\' servers DOWN', 'combi_pushover_subject' => '\'%UP%\' servers UP again, \'%DOWN%\' servers DOWN', - 'combi_email_message' => 'The following servers went down:
%DOWN_SERVERS%
The following - servers are up again:
%UP_SERVERS%', - 'combi_pushover_message' => 'The following servers went down:
%DOWN_SERVERS%
The following - servers are up again:
%UP_SERVERS%', - 'combi_telegram_message' => 'The following servers went down:
%DOWN_SERVERS%
The following - servers are up again:
%UP_SERVERS%', - 'combi_jabber_message' => 'The following servers went down:
%DOWN_SERVERS%
The following - servers are up again:
%UP_SERVERS%', + 'combi_email_message' => 'The following servers went down:
%DOWN_SERVERS%
The following servers are up again:
%UP_SERVERS%', + 'combi_discord_message' => 'The following servers went down:
%DOWN_SERVERS%
The following servers are up again:
%UP_SERVERS%', + 'combi_pushover_message' => 'The following servers went down:
%DOWN_SERVERS%
The following servers are up again:
%UP_SERVERS%', + 'combi_telegram_message' => 'The following servers went down:
%DOWN_SERVERS%
The following servers are up again:
%UP_SERVERS%', + 'combi_jabber_message' => 'The following servers went down:
%DOWN_SERVERS%
The following servers are up again:
%UP_SERVERS%', ), 'login' => array( 'welcome_usermenu' => 'Welcome, %user_name%', @@ -489,8 +441,7 @@ $sm_lang = array( 'password_forgot' => 'Forgot password?', 'password_reset' => 'Reset password', 'password_reset_email_subject' => 'Reset your password for PHP Server Monitor', - 'password_reset_email_body' => 'Please use the following link to reset your password. Please note it expires - in 1 hour.

%link%', + 'password_reset_email_body' => 'Please use the following link to reset your password. Please note it expires in 1 hour.

%link%', 'error_user_incorrect' => 'The provided username could not be found.', 'error_login_incorrect' => 'The information is incorrect.', 'error_login_passwords_nomatch' => 'The provided passwords do not match.', diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index 7bb78e65..5dd57c95 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -43,12 +43,14 @@ class ConfigController extends AbstractController 'email_status', 'email_smtp', 'sms_status', + 'discord_status', 'pushover_status', 'telegram_status', 'jabber_status', 'log_status', 'log_email', 'log_sms', + 'log_discord', 'log_pushover', 'log_telegram', 'log_jabber', @@ -208,7 +210,7 @@ class ConfigController extends AbstractController $tpl_data[$this->default_tab . '_active'] = 'active'; - $testmodals = array('email', 'sms', 'pushover', 'telegram', 'jabber'); + $testmodals = array('email', 'sms', 'discord', 'pushover', 'telegram', 'jabber'); foreach ($testmodals as $modal_id) { $modal = new \psm\Util\Module\Modal( $this->twig, @@ -270,6 +272,8 @@ class ConfigController extends AbstractController $this->testEmail(); } elseif (!empty($_POST['test_sms'])) { $this->testSMS(); + } elseif (!empty($_POST['test_discord'])) { + $this->testDiscord(); } elseif (!empty($_POST['test_pushover'])) { $this->testPushover(); } elseif (!empty($_POST['test_telegram'])) { @@ -289,6 +293,8 @@ class ConfigController extends AbstractController $this->default_tab = 'email'; } elseif (isset($_POST['sms_submit']) || !empty($_POST['test_sms'])) { $this->default_tab = 'sms'; + } elseif (isset($_POST['discord_submit']) || !empty($_POST['test_discord'])) { + $this->default_tab = 'discord'; } elseif (isset($_POST['pushover_submit']) || !empty($_POST['test_pushover'])) { $this->default_tab = 'pushover'; } elseif (isset($_POST['telegram_submit']) || !empty($_POST['test_telegram'])) { @@ -346,6 +352,60 @@ class ConfigController extends AbstractController } } + /** + * Execute SMS test + * + * @todo move test to separate class + */ + protected function testDiscord() + { + $user = $this->getUser()->getUser(); + if (empty($user->discord)) { + $this->addMessage(psm_get_lang('config', 'discord_error_nowebhook'), 'error'); + } else { + $success = 0; + $result = 'An unknown error has occurred.'; + try { + $curl = curl_init($user->discord); + $json = json_decode( + '{"content":""}', + true + ); + $json['content'] = psm_get_lang('config', 'test_message'); + $msg = "payload_json=" . urlencode(json_encode($json)); + if(isset($curl)) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_POSTFIELDS, $msg); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($curl); + $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + $err = curl_errno($curl); + + if ($err != 0 || $httpcode != 204) { + $success = 0; + // $result = ($result == '') ? 'Wrong input, please check if all values are correct!' : $result; + $error = "HTTP_code: " . $httpcode . ".\ncURL error (" . $err . "): " . + curl_strerror($err) . ". \nResult: " . $result; + $result = $error; + } else { + $success = 1; + } + curl_close($curl); + } + } catch (Exception $e) { + $success = 0; + $result = $e->getMessage(); + } + + if ($success === 1) { + $this->addMessage(psm_get_lang('config', 'discord_sent'), 'success'); + } else { + $this->addMessage(sprintf(psm_get_lang('config', 'discord_error'), $result), 'error'); + } + } + } + /** * Execute pushover test * @@ -444,11 +504,13 @@ class ConfigController extends AbstractController return array( 'label_tab_email' => psm_get_lang('config', 'tab_email'), 'label_tab_sms' => psm_get_lang('config', 'tab_sms'), + 'label_tab_discord' => psm_get_lang('config', 'tab_discord'), 'label_tab_pushover' => psm_get_lang('config', 'tab_pushover'), 'label_tab_telegram' => psm_get_lang('config', 'tab_telegram'), 'label_tab_jabber' => psm_get_lang('config', 'tab_jabber'), 'label_settings_email' => psm_get_lang('config', 'settings_email'), 'label_settings_sms' => psm_get_lang('config', 'settings_sms'), + 'label_settings_discord' => psm_get_lang('config', 'settings_discord'), 'label_settings_pushover' => psm_get_lang('config', 'settings_pushover'), 'label_settings_telegram' => psm_get_lang('config', 'settings_telegram'), 'label_settings_jabber' => psm_get_lang('config', 'settings_jabber'), @@ -479,6 +541,8 @@ class ConfigController extends AbstractController 'label_sms_gateway_username' => psm_get_lang('config', 'sms_gateway_username'), 'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'), 'label_sms_from' => psm_get_lang('config', 'sms_from'), + 'label_discord_status' => psm_get_lang('config', 'discord_status'), + 'label_discord_description' => psm_get_lang('config', 'discord_description'), 'label_pushover_description' => psm_get_lang('config', 'pushover_description'), 'label_pushover_status' => psm_get_lang('config', 'pushover_status'), 'label_pushover_clone_app' => psm_get_lang('config', 'pushover_clone_app'), @@ -512,6 +576,7 @@ class ConfigController extends AbstractController 'label_log_status_description' => psm_get_lang('config', 'log_status_description'), 'label_log_email' => psm_get_lang('config', 'log_email'), 'label_log_sms' => psm_get_lang('config', 'log_sms'), + 'label_log_discord' => psm_get_lang('config', 'log_discord'), 'label_log_pushover' => psm_get_lang('config', 'log_pushover'), 'label_log_telegram' => psm_get_lang('config', 'log_telegram'), 'label_log_jabber' => psm_get_lang('config', 'log_jabber'), diff --git a/src/psm/Module/Server/Controller/AbstractServerController.php b/src/psm/Module/Server/Controller/AbstractServerController.php index 26ed2c9d..95a671fe 100644 --- a/src/psm/Module/Server/Controller/AbstractServerController.php +++ b/src/psm/Module/Server/Controller/AbstractServerController.php @@ -81,6 +81,7 @@ abstract class AbstractServerController extends AbstractController `s`.`active`, `s`.`email`, `s`.`sms`, + `s`.`discord`, `s`.`pushover`, `s`.`telegram`, `s`.`jabber`, diff --git a/src/psm/Module/Server/Controller/LogController.php b/src/psm/Module/Server/Controller/LogController.php index 8046af99..dd5cb1b3 100644 --- a/src/psm/Module/Server/Controller/LogController.php +++ b/src/psm/Module/Server/Controller/LogController.php @@ -55,6 +55,7 @@ class LogController extends AbstractServerController 'label_status' => psm_get_lang('log', 'status'), 'label_email' => psm_get_lang('log', 'email'), 'label_sms' => psm_get_lang('log', 'sms'), + 'label_discord' => psm_get_lang('log', 'discord'), 'label_pushover' => psm_get_lang('log', 'pushover'), 'label_telegram' => psm_get_lang('log', 'telegram'), 'label_jabber' => psm_get_lang('log', 'jabber'), @@ -77,7 +78,7 @@ class LogController extends AbstractServerController $modal->setTitle(psm_get_lang('log', 'delete_title')); $modal->setMessage(psm_get_lang('log', 'delete_message')); $modal->setOKButtonLabel(psm_get_lang('system', 'delete')); - + $sidebar->addButton( 'clear_logn', psm_get_lang('log', 'clear'), @@ -89,7 +90,7 @@ class LogController extends AbstractServerController ); } - $log_types = array('status', 'email', 'sms', 'pushover', 'telegram', 'jabber'); + $log_types = array('status', 'email', 'sms', 'discord', 'pushover', 'telegram', 'jabber'); foreach ($log_types as $key) { $records = $this->getEntries($key); diff --git a/src/psm/Module/Server/Controller/ServerController.php b/src/psm/Module/Server/Controller/ServerController.php index 47e24d9e..e7613f6e 100644 --- a/src/psm/Module/Server/Controller/ServerController.php +++ b/src/psm/Module/Server/Controller/ServerController.php @@ -100,6 +100,7 @@ class ServerController extends AbstractServerController $icons = array( 'email' => 'icon-envelope', 'sms' => 'icon-mobile', + 'discord' => 'icon-discord', 'pushover' => 'icon-pushover', 'telegram' => 'icon-telegram', 'jabber' => 'icon-jabber' @@ -130,6 +131,7 @@ class ServerController extends AbstractServerController $tpl_data['config']['email'] = psm_get_conf('email_status'); $tpl_data['config']['sms'] = psm_get_conf('sms_status'); + $tpl_data['config']['discord'] = psm_get_conf('discord_status'); $tpl_data['config']['pushover'] = psm_get_conf('pushover_status'); $tpl_data['config']['telegram'] = psm_get_conf('telegram_status'); @@ -237,13 +239,14 @@ class ServerController extends AbstractServerController 'edit_active_selected' => $edit_server['active'], 'edit_email_selected' => $edit_server['email'], 'edit_sms_selected' => $edit_server['sms'], + 'edit_discord_selected' => $edit_server['discord'], 'edit_pushover_selected' => $edit_server['pushover'], 'edit_telegram_selected' => $edit_server['telegram'], 'edit_jabber_selected' => $edit_server['jabber'], )); } - $notifications = array('email', 'sms', 'pushover', 'telegram', 'jabber'); + $notifications = array('email', 'sms', 'discord', 'pushover', 'telegram', 'jabber'); foreach ($notifications as $notification) { if (psm_get_conf($notification . '_status') == 0) { $tpl_data['warning_' . $notification] = true; @@ -271,7 +274,7 @@ class ServerController extends AbstractServerController // We need the server id to encrypt the password. Encryption will be done after the server is added $encrypted_password = ''; - + if (!empty($_POST['website_password'])) { $new_password = psm_POST('website_password'); @@ -311,6 +314,7 @@ class ServerController extends AbstractServerController 'active' => in_array($_POST['active'], array('yes', 'no')) ? $_POST['active'] : 'no', 'email' => in_array($_POST['email'], array('yes', 'no')) ? $_POST['email'] : 'no', 'sms' => in_array($_POST['sms'], array('yes', 'no')) ? $_POST['sms'] : 'no', + 'discord' => in_array($_POST['discord'], array('yes', 'no')) ? $_POST['discord'] : 'no', 'pushover' => in_array($_POST['pushover'], array('yes', 'no')) ? $_POST['pushover'] : 'no', 'telegram' => in_array($_POST['telegram'], array('yes', 'no')) ? $_POST['telegram'] : 'no', 'jabber' => in_array($_POST['jabber'], array('yes', 'no')) ? $_POST['jabber'] : 'no', @@ -589,12 +593,14 @@ class ServerController extends AbstractServerController 'label_send_email' => psm_get_lang('servers', 'send_email'), 'label_sms' => psm_get_lang('servers', 'sms'), 'label_send_sms' => psm_get_lang('servers', 'send_sms'), + 'label_discord' => psm_get_lang('servers', 'discord'), + 'label_send_discord' => psm_get_lang('servers', 'send_discord'), + 'label_pushover' => psm_get_lang('servers', 'pushover'), 'label_send_pushover' => psm_get_lang('servers', 'send_pushover'), 'label_telegram' => psm_get_lang('servers', 'telegram'), - 'label_jabber' => psm_get_lang('servers', 'jabber'), - 'label_pushover' => psm_get_lang('servers', 'pushover'), + 'label_jabber' => psm_get_lang('servers', 'jabber'), + 'label_send_jabber' => psm_get_lang('servers', 'send_jabber'), 'label_send_telegram' => psm_get_lang('servers', 'send_telegram'), - 'label_send_jabber' => psm_get_lang('servers', 'send_jabber'), 'label_users' => psm_get_lang('servers', 'users'), 'label_warning_threshold' => psm_get_lang('servers', 'warning_threshold'), 'label_warning_threshold_description' => psm_get_lang('servers', 'warning_threshold_description'), diff --git a/src/psm/Module/User/Controller/ProfileController.php b/src/psm/Module/User/Controller/ProfileController.php index 47efc335..d069f7fc 100644 --- a/src/psm/Module/User/Controller/ProfileController.php +++ b/src/psm/Module/User/Controller/ProfileController.php @@ -39,7 +39,7 @@ class ProfileController extends AbstractController * @var array $profile_fields */ protected $profile_fields = - array('name', 'user_name', 'email', 'mobile', 'pushover_key', 'pushover_device', 'telegram_id', 'jabber'); + array('name', 'user_name', 'email', 'mobile', 'discord', 'pushover_key', 'pushover_device', 'telegram_id', 'jabber'); public function __construct(Database $db, \Twig_Environment $twig) { @@ -83,6 +83,10 @@ class ProfileController extends AbstractController 'label_pushover_key' => psm_get_lang('users', 'pushover_key'), 'label_pushover_device' => psm_get_lang('users', 'pushover_device'), 'label_pushover_device_description' => psm_get_lang('users', 'pushover_device_description'), + + 'label_discord' => psm_get_lang('users', 'discord'), + 'label_discord_description' => psm_get_lang('users', 'discord_description'), + 'label_telegram' => psm_get_lang('users', 'telegram'), 'label_telegram_description' => psm_get_lang('users', 'telegram_description'), 'label_telegram_chat_id' => psm_get_lang('users', 'telegram_chat_id'), diff --git a/src/psm/Module/User/Controller/UserController.php b/src/psm/Module/User/Controller/UserController.php index 1104a4d0..3803c81f 100644 --- a/src/psm/Module/User/Controller/UserController.php +++ b/src/psm/Module/User/Controller/UserController.php @@ -158,6 +158,7 @@ class UserController extends AbstractController 'name', 'user_name', 'mobile', + 'discord', 'pushover_key', 'pushover_device', 'telegram_id', @@ -255,6 +256,7 @@ class UserController extends AbstractController 'password_repeat', 'level', 'mobile', + 'discord', 'pushover_key', 'pushover_device', 'telegram_id', @@ -392,6 +394,8 @@ class UserController extends AbstractController 'label_level' => psm_get_lang('users', 'level'), 'label_level_description' => psm_get_lang('users', 'level_description'), 'label_mobile' => psm_get_lang('users', 'mobile'), + 'label_discord' => psm_get_lang('users', 'discord'), + 'label_discord_description' => psm_get_lang('users', 'discord_description'), 'label_pushover' => psm_get_lang('users', 'pushover'), 'label_pushover_description' => psm_get_lang('users', 'pushover_description'), 'label_pushover_key' => psm_get_lang('users', 'pushover_key'), diff --git a/src/psm/Util/Install/Installer.php b/src/psm/Util/Install/Installer.php index 888af309..182dd5fc 100644 --- a/src/psm/Util/Install/Installer.php +++ b/src/psm/Util/Install/Installer.php @@ -178,6 +178,8 @@ class Installer ('log_pushover', '1'), ('log_telegram', '1'), ('log_jabber', '1'), + ('discord_status', '0'), + ('log_jdiscord', '1'), ('log_retention_period', '365'), ('version', '" . PSM_VERSION . "'), ('version_update_check', '" . PSM_VERSION . "'), @@ -185,7 +187,7 @@ class Installer ('show_update', '1'), ('last_update_check', '0'), ('cron_running', '0'), - ('cron_running_time', '0'), + ('cron_running_time', '0'), ('cron_off_running', '0'), ('cron_off_running_time', '0');"; $this->execSQL($queries); @@ -212,6 +214,7 @@ class Installer `level` tinyint(2) unsigned NOT NULL DEFAULT '20', `name` varchar(255) NOT NULL, `mobile` varchar(15) NOT NULL, + `discord` varchar(255) NOT NULL, `pushover_key` varchar(255) NOT NULL, `pushover_device` varchar(255) NOT NULL, `telegram_id` varchar(255) NOT NULL, @@ -235,7 +238,7 @@ class Installer PSM_DB_PREFIX . 'log' => "CREATE TABLE `" . PSM_DB_PREFIX . "log` ( `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `server_id` int(11) unsigned NOT NULL, - `type` enum('status','email','sms','pushover','telegram', 'jabber') NOT NULL, + `type` enum('status','email','sms','discord','pushover','telegram', 'jabber') NOT NULL, `message` TEXT NOT NULL, `datetime` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`log_id`) @@ -269,6 +272,7 @@ class Installer `active` enum('yes','no') NOT NULL default 'yes', `email` enum('yes','no') NOT NULL default 'yes', `sms` enum('yes','no') NOT NULL default 'no', + `discord` enum('yes','no') NOT NULL default 'yes', `pushover` enum('yes','no') NOT NULL default 'yes', `telegram` enum('yes','no') NOT NULL default 'yes', `jabber` enum('yes','no') NOT NULL default 'yes', @@ -697,9 +701,9 @@ class Installer $this->log('SMTP password is now encrypted.'); } - $queries[] = 'ALTER TABLE `' . PSM_DB_PREFIX . 'users` ADD `jabber` VARCHAR( 255 ) + $queries[] = 'ALTER TABLE `' . PSM_DB_PREFIX . 'users` ADD `jabber` VARCHAR( 255 ) NOT NULL AFTER `telegram_id`;'; - $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `jabber` ENUM( 'yes','no' ) + $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `jabber` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `telegram`;"; $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover', 'telegram', 'jabber' ) @@ -715,4 +719,24 @@ class Installer $this->execSQL($queries); } + + /** + * Patch for v3.5.1 release + * Added support for Discord webhooks + */ + protected function upgrade351() + { + $queries = array(); + $queries[] = 'ALTER TABLE `' . PSM_DB_PREFIX . 'users` ADD `discord` VARCHAR( 255 ) + NOT NULL AFTER `mobile`;'; + $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `discord` ENUM( 'yes','no' ) + NOT NULL DEFAULT 'yes' AFTER `sms`;"; + $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . + "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'discord', 'pushover', 'telegram', 'jabber' ) + CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;"; + $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE + ('discord_status', '0'), + ('log_discord', '1');"; + $this->execSQL($queries); + } } diff --git a/src/psm/Util/Server/Updater/StatusNotifier.php b/src/psm/Util/Server/Updater/StatusNotifier.php index 080f0fbc..b8bfb48f 100644 --- a/src/psm/Util/Server/Updater/StatusNotifier.php +++ b/src/psm/Util/Server/Updater/StatusNotifier.php @@ -57,6 +57,12 @@ class StatusNotifier */ protected $send_sms = false; + /** + * Send Discord notification? + * @var boolean $send_discord + */ + protected $send_discord = false; + /** * Send Pushover notification? * @var boolean $send_pushover @@ -128,6 +134,7 @@ class StatusNotifier $this->send_emails = (bool)psm_get_conf('email_status'); $this->send_sms = (bool)psm_get_conf('sms_status'); + $this->send_discord = (bool)psm_get_conf('discord_status'); $this->send_pushover = (bool)psm_get_conf('pushover_status'); $this->send_telegram = (bool)psm_get_conf('telegram_status'); $this->send_jabber = (bool)psm_get_conf('jabber_status'); @@ -149,6 +156,7 @@ class StatusNotifier if ( !$this->send_emails && !$this->send_sms && + !$this->send_discord && !$this->send_pushover && !$this->send_telegram && !$this->send_jabber && @@ -175,6 +183,7 @@ class StatusNotifier 'error', 'email', 'sms', + 'discord', 'pushover', 'telegram', 'jabber', @@ -246,6 +255,12 @@ class StatusNotifier $this->notifyByTxtMsg($users); } + // check if discord is enabled for this server + if ($this->send_discord && $this->server['discord'] == 'yes') { + // yay lets wake those nerds up! + $this->combine ? $this->setCombi('discord') : $this->notifyByDiscord($users); + } + // check if pushover is enabled for this server if ($this->send_pushover && $this->server['pushover'] == 'yes') { // yay lets wake those nerds up! @@ -417,6 +432,86 @@ class StatusNotifier } } + + /** + * This functions performs the discord notifications + * + * @param \PDOStatement $users + * @param array $combi contains message and subject (optional) + * @return void + */ + protected function notifyByDiscord($users, $combi = array()) + { + + $message_log = key_exists('message', $combi) ? + $combi['message'] : + psm_parse_msg($this->status_new, 'discord_message', $this->server); + + + // Remove users that have no Discord webhook + foreach ($users as $k => $user) { + if (trim($user['discord']) == '') { + unset($users[$k]); + } + } + + // Validation + if (empty($users)) { + return; + } + + // fix message for Discord viewing + $message = str_replace(array('', ''), array('**', '**'), $message_log); + $message = str_replace(array(''), array('', ''), $message); + $message = str_replace(array('
', ''), array("\n", "\n"), $message); + $message = str_replace('
  • ', " * ", $message); + + + $json = json_decode( + '{"content":""}', + true + ); + $json['content'] = $message; + + // Log + if (psm_get_conf('log_discord')) { + $log_id = psm_add_log($this->server_id, 'discord', $message_log); + } + + foreach ($users as $user) { + // Log + if (!empty($log_id)) { + psm_add_log_user($log_id, $user['user_id']); + } + + // set discord webhook and send + try { + $msg = "payload_json=" . urlencode(json_encode($json)); + $curl = curl_init(trim($user['discord'])); + if(isset($curl)) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); + curl_setopt($curl, CURLOPT_TIMEOUT, 30); + curl_setopt($curl, CURLOPT_POSTFIELDS, $msg); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + $result = curl_exec($curl); + $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + $err = curl_errno($curl); + + if ($err != 0 || $httpcode != 204) { + // $result = ($result == '') ? 'Wrong input, please check if all values are correct!' : $result; + $error = "HTTP_code: " . $httpcode . ".\ncURL error (" . $err . "): " . + curl_strerror($err) . ". \nResult: " . $result; + $log_id = psm_add_log($this->server_id, 'discord', $error); + } + curl_close($curl); + } + } catch (Exception $e) { + $log_id = psm_add_log($this->server_id, 'discord', $e->getMessage()); + } + } + } + + /** * This functions performs the pushover notifications * @@ -619,8 +714,8 @@ class StatusNotifier { // find all the users with this server listed $users = $this->db->query(' - SELECT `u`.`user_id`, `u`.`name`,`u`.`email`, `u`.`mobile`, `u`.`pushover_key`, - `u`.`pushover_device`, `u`.`telegram_id`, + SELECT `u`.`user_id`, `u`.`name`,`u`.`email`, `u`.`mobile`, `u`.`discord`, `u`.`pushover_key`, + `u`.`pushover_device`, `u`.`telegram_id`, `u`.`jabber` FROM `' . PSM_DB_PREFIX . 'users` AS `u` JOIN `' . PSM_DB_PREFIX . "users_servers` AS `us` ON ( diff --git a/src/templates/default/module/config/config.tpl.html b/src/templates/default/module/config/config.tpl.html index 1472bc61..61506b65 100644 --- a/src/templates/default/module/config/config.tpl.html +++ b/src/templates/default/module/config/config.tpl.html @@ -17,6 +17,11 @@ aria-controls="config-sms" aria-selected="{% if sms_active %}true{% else %}false{% endif %}">{{ label_tab_sms }}
  • + +
  • + {{ label_discord }}: + {% if discord|lower == 'yes' %} + + + {% elseif discord|lower == 'no' %} + + + {% else %} + + + {% endif %} +
  • {{ label_pushover }}: {% if pushover|lower == 'yes' %} diff --git a/src/templates/default/module/user/profile.tpl.html b/src/templates/default/module/user/profile.tpl.html index 93caa951..45f32da7 100644 --- a/src/templates/default/module/user/profile.tpl.html +++ b/src/templates/default/module/user/profile.tpl.html @@ -28,13 +28,19 @@ {{ macro.input_field("text", "pushover_device", null, "pushover_device", label_pushover_device, pushover_device, label_pushover_device, "255", "pushover_device_help", pushover_device_description) }} + +
    + {{ label_discord }} +

    {{ label_discord_description|raw }}

    + {{ macro.input_field("text", "discord", null, "discord", label_discord, discord, label_discord, "255", "discord_help", discord_description) }} +
    {{ label_telegram }}

    {{ label_telegram_description|raw }}

    {{ macro.input_field("text", "telegram_id", null, "telegram_id", label_telegram_chat_id, telegram_id, label_telegram_chat_id, "255", "telegram_id_help", telegram_id_description) }} @@ -47,4 +53,4 @@ {{ macro.input_field("text", "jabber", null, "jabber", label_jabber, jabber, label_jabber, "255", "jabber_help", jabber_description) }}
    {{ macro.button_save(null, label_save) }} - \ No newline at end of file + diff --git a/src/templates/default/module/user/user/update.tpl.html b/src/templates/default/module/user/user/update.tpl.html index 0e86d617..23687852 100644 --- a/src/templates/default/module/user/user/update.tpl.html +++ b/src/templates/default/module/user/user/update.tpl.html @@ -17,6 +17,8 @@ {{ macro.input_field("email", "email", null, "email", label_email, edit_value_email, null, "255") }} {{ macro.input_field("tel", "mobile", null, "mobile", label_mobile, edit_value_mobile, null, "20") }} + + {{ macro.input_field("text", "discord", null, "discord", label_discord, edit_value_discord, null, "255") }} {{ macro.input_field("text", "pushover_key", null, "pushover_key", label_pushover_key, edit_value_pushover_key, null, "255") }}