parent
							
								
									63673b7641
								
							
						
					
					
						commit
						af5334a073
					
				| 
						 | 
				
			
			@ -16,7 +16,7 @@ Features:
 | 
			
		|||
---------
 | 
			
		||||
 | 
			
		||||
* Monitor services and websites (see below).
 | 
			
		||||
* Email, SMS, Pushover, Telegram notifications.
 | 
			
		||||
* Email, SMS, 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.
 | 
			
		||||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ There are two different ways to monitor a server:
 | 
			
		|||
  In both cases the script will return a "status offline", and will start sending out notifications.
 | 
			
		||||
 | 
			
		||||
Each server has its own settings regarding notification.
 | 
			
		||||
You can choose for email, text message (SMS), Pushover.net and Telegram notifications.
 | 
			
		||||
You can choose for email, text message (SMS), Pushover.net, Telegram and Jabber notifications.
 | 
			
		||||
The following SMS gateways are currently available:
 | 
			
		||||
 | 
			
		||||
* Clickatell - <https://www.clickatell.com>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,8 @@
 | 
			
		|||
		"symfony/filesystem": "~3.4",
 | 
			
		||||
		"php-pushover/php-pushover": "dev-master",
 | 
			
		||||
		"paragonie/random_compat": "^2.0",
 | 
			
		||||
		"twig/twig": "~1.35"
 | 
			
		||||
		"twig/twig": "~1.35",
 | 
			
		||||
		"jaxl/jaxl": "^3.1"
 | 
			
		||||
	},
 | 
			
		||||
	"autoload": {
 | 
			
		||||
		"files": [
 | 
			
		||||
| 
						 | 
				
			
			@ -27,4 +28,4 @@
 | 
			
		|||
			"psm\\": "src/psm/"
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,8 +4,81 @@
 | 
			
		|||
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
 | 
			
		||||
        "This file is @generated automatically"
 | 
			
		||||
    ],
 | 
			
		||||
    "content-hash": "b2a2bd93aeb6abf9b4e1905aa7ea4217",
 | 
			
		||||
    "content-hash": "f78e950e2dfef7debe88d7b64e2b4aec",
 | 
			
		||||
    "packages": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "jaxl/jaxl",
 | 
			
		||||
            "version": "v3.1.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/jaxl/JAXL.git",
 | 
			
		||||
                "reference": "27aa43c4600b05809779428843d8d51db6ce6e0d"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/jaxl/JAXL/zipball/27aa43c4600b05809779428843d8d51db6ce6e0d",
 | 
			
		||||
                "reference": "27aa43c4600b05809779428843d8d51db6ce6e0d",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "ext-curl": "*",
 | 
			
		||||
                "ext-hash": "*",
 | 
			
		||||
                "ext-json": "*",
 | 
			
		||||
                "ext-libxml": "*",
 | 
			
		||||
                "ext-openssl": "*",
 | 
			
		||||
                "ext-pcre": "*",
 | 
			
		||||
                "ext-sockets": "*",
 | 
			
		||||
                "php": ">=5.2.4"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "phpunit/phpunit": "^3.7.0",
 | 
			
		||||
                "squizlabs/php_codesniffer": "*"
 | 
			
		||||
            },
 | 
			
		||||
            "suggest": {
 | 
			
		||||
                "ext-pcntl": "Interrupt JAXL with signals"
 | 
			
		||||
            },
 | 
			
		||||
            "bin": [
 | 
			
		||||
                "jaxlctl"
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "extra": {
 | 
			
		||||
                "branch-alias": {
 | 
			
		||||
                    "dev-master": "3.1.x-dev"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "classmap": [
 | 
			
		||||
                    "src/JAXL"
 | 
			
		||||
                ],
 | 
			
		||||
                "exclude-from-classmap": [
 | 
			
		||||
                    "/tests/"
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "BSD-3-Clause"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Abhinavsingh",
 | 
			
		||||
                    "homepage": "https://abhinavsingh.com/"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "Jaxl - Async, Non-Blocking, Event based Networking Library in PHP.",
 | 
			
		||||
            "homepage": "http://jaxl.readthedocs.org/en/latest/index.html",
 | 
			
		||||
            "keywords": [
 | 
			
		||||
                "abhinavsingh",
 | 
			
		||||
                "asynchronous",
 | 
			
		||||
                "event loop",
 | 
			
		||||
                "http",
 | 
			
		||||
                "jabber",
 | 
			
		||||
                "jaxl",
 | 
			
		||||
                "non blocking",
 | 
			
		||||
                "php",
 | 
			
		||||
                "xmpp"
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2016-09-13T01:59:35+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "paragonie/random_compat",
 | 
			
		||||
            "version": "v2.0.18",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								docs/faq.rst
								
								
								
								
							
							
						
						
									
										13
									
								
								docs/faq.rst
								
								
								
								
							| 
						 | 
				
			
			@ -151,3 +151,16 @@ What is the username of my bot?
 | 
			
		|||
1. Go to profile on the monitor.
 | 
			
		||||
2. Press activate.
 | 
			
		||||
3. A button will appear, this will direct you to your Telegram bot.
 | 
			
		||||
 | 
			
		||||
How do I setup Jabber notifications from Google account?
 | 
			
		||||
------------------------
 | 
			
		||||
A few steps are required to get Jabber notifications working for Google account.
 | 
			
		||||
You need to be an administrator for this part.
 | 
			
		||||
 | 
			
		||||
1. Go into you Google Account Security settings (https://myaccount.google.com/security).
 | 
			
		||||
2. Check that you have two factor auth enabled. If not, activate it.
 | 
			
		||||
3. Add new app password - copy it.
 | 
			
		||||
4. Login to PhpServerMonitor dashboard > config > Jabber and use password from step 3 with your Google account in PhpServerMonitor jabber settings.
 | 
			
		||||
5. As host use `talk.google.com`.
 | 
			
		||||
6. As username use your whole Google account (for example `example@google.com`).
 | 
			
		||||
7. As port use `5223` (really, not typo error ...).
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ Features
 | 
			
		|||
++++++++
 | 
			
		||||
 | 
			
		||||
* Monitor services and websites (see below).
 | 
			
		||||
* Email, SMS, Pushover and Telegram notifications.
 | 
			
		||||
* Email, SMS, 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.
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ There are two different ways to monitor a server:
 | 
			
		|||
Notifications
 | 
			
		||||
-------------
 | 
			
		||||
Each server has its own settings regarding notification.
 | 
			
		||||
You can choose for email, text message (SMS), Pushover.net and Telegram notifications.
 | 
			
		||||
You can choose for email, text message (SMS), Pushover.net, Telegram and Jabber notifications.
 | 
			
		||||
The following SMS gateways are currently available:
 | 
			
		||||
 | 
			
		||||
* Clickatell - <https://www.clickatell.com>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
*
 | 
			
		||||
!.gitignore
 | 
			
		||||
| 
						 | 
				
			
			@ -653,6 +653,60 @@ namespace {
 | 
			
		|||
        return $telegram;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Send message via XMPP.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string      $host
 | 
			
		||||
     * @param string      $username
 | 
			
		||||
     * @param string      $password
 | 
			
		||||
     * @param array       $receivers
 | 
			
		||||
     * @param string      $message
 | 
			
		||||
     * @param int|null    $port
 | 
			
		||||
     * @param string|null $domain
 | 
			
		||||
     */
 | 
			
		||||
    function psm_jabber_send_message($host, $username, $password, $receivers, $message, $port = null, $domain = null)
 | 
			
		||||
    {
 | 
			
		||||
        $options = [
 | 
			
		||||
            'jid' => $username, // incl. gmail.com
 | 
			
		||||
            'pass' => $password,
 | 
			
		||||
            'domain' => $domain, // gmail.com or null
 | 
			
		||||
            'host' => $host, // talk.google.com
 | 
			
		||||
            'port' => $port, // talk.google.com needs to have 5223 ... 5222 - CN problem - gmail.com vs talk.google.com
 | 
			
		||||
            'log_path' => __DIR__ . '/../../logs/jaxl.log', // own log
 | 
			
		||||
 | 
			
		||||
            // force tls
 | 
			
		||||
            'force_tls' => PSM_JABBER_FORCE_TLS,
 | 
			
		||||
            // (required) perform X-OAUTH2
 | 
			
		||||
            'auth_type' => PSM_JABBER_AUTH_TYPE, //'X-OAUTH2', // auth failure with this option :( so just PLAIN ...
 | 
			
		||||
 | 
			
		||||
            'log_level' => PSM_JABBER_DEBUG_LEVEL
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            $client = new JAXL($options);
 | 
			
		||||
 | 
			
		||||
            // Add Callbacks
 | 
			
		||||
            $client->add_cb('on_auth_success', function () use ($client, $receivers, $message) {
 | 
			
		||||
                JAXLLogger::info('got on_auth_success cb');
 | 
			
		||||
                foreach ($receivers as $receiver) {
 | 
			
		||||
	                $client->send_chat_msg($receiver, $message);
 | 
			
		||||
                }
 | 
			
		||||
                $client->send_end_stream();
 | 
			
		||||
            });
 | 
			
		||||
            $client->add_cb('on_auth_failure', function ($reason) use ($client) {
 | 
			
		||||
                $client->send_end_stream();
 | 
			
		||||
                JAXLLogger::info('got on_auth_failure cb with reason: ' . $reason);
 | 
			
		||||
            });
 | 
			
		||||
            $client->add_cb('on_disconnect', function () use ($client) {
 | 
			
		||||
                JAXLLogger::info('got on_disconnect cb');
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            $client->start();
 | 
			
		||||
        } catch (Exception $ex) {
 | 
			
		||||
            JAXLLogger::error('Exception: ' . $ex->getMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Prepare a new SMS util.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,7 @@
 | 
			
		|||
/**
 | 
			
		||||
 * Current PSM version
 | 
			
		||||
 */
 | 
			
		||||
define('PSM_VERSION', '3.4.6-beta.2');
 | 
			
		||||
define('PSM_VERSION', '3.4.6-beta.3');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * URL to check for updates. Will not be checked if turned off on config page.
 | 
			
		||||
| 
						 | 
				
			
			@ -130,3 +130,15 @@ if (!defined('PSM_MODULE_DEFAULT')) {
 | 
			
		|||
     */
 | 
			
		||||
    define('PSM_MODULE_DEFAULT', 'server_status');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (defined('PSM_JABBER_FORCE_TLS') === false) {
 | 
			
		||||
    define('PSM_JABBER_FORCE_TLS', true);
 | 
			
		||||
}
 | 
			
		||||
if (defined('PSM_JABBER_AUTH_TYPE') === false) {
 | 
			
		||||
    // possible values: PLAIN, X-OAUTH2, DIGEST-MD5, CRAM-MD5, SCRAM-SHA-1, ANONYMOUS, EXTERNAL
 | 
			
		||||
    define('PSM_JABBER_AUTH_TYPE', 'PLAIN'); // default just plain because of google for example :(
 | 
			
		||||
}
 | 
			
		||||
if (defined('PSM_JABBER_DEBUG_LEVEL') === false) {
 | 
			
		||||
    // possible values: ERROR, WARNING, NOTICE, INFO, DEBUG
 | 
			
		||||
    define('PSM_JABBER_DEBUG_LEVEL', JAXLLogger::WARNING);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,6 +133,9 @@ $sm_lang = array(
 | 
			
		|||
 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',
 | 
			
		||||
        'jabber_label' => 'Jabber',
 | 
			
		||||
        'jabber_description' => 'You Jabber account',
 | 
			
		||||
        'delete_title' => 'Delete User',
 | 
			
		||||
        'delete_message' => 'Are you sure you want to delete user \'%1\'?',
 | 
			
		||||
        'deleted' => 'User deleted.',
 | 
			
		||||
| 
						 | 
				
			
			@ -160,6 +163,7 @@ $sm_lang = array(
 | 
			
		|||
        'sms' => 'SMS',
 | 
			
		||||
        'pushover' => 'Pushover',
 | 
			
		||||
        'telegram' => 'Telegram',
 | 
			
		||||
        'jabber' => 'Jabber',
 | 
			
		||||
        'no_logs' => 'No logs',
 | 
			
		||||
        'clear' => 'Clear log',
 | 
			
		||||
        'delete_title' => 'Delete log',
 | 
			
		||||
| 
						 | 
				
			
			@ -227,6 +231,8 @@ $sm_lang = array(
 | 
			
		|||
        'send_pushover' => 'Send Pushover notification',
 | 
			
		||||
        'telegram' => 'Telegram',
 | 
			
		||||
        'send_telegram' => 'Send Telegram notification',
 | 
			
		||||
        'jabber' => 'Jabber',
 | 
			
		||||
        'send_jabber' => 'Send Jabber notification',
 | 
			
		||||
        'users' => 'Users',
 | 
			
		||||
        'delete_title' => 'Delete server',
 | 
			
		||||
        'delete_message' => 'Are you sure you want to delete server \'%1\'?',
 | 
			
		||||
| 
						 | 
				
			
			@ -262,6 +268,7 @@ $sm_lang = array(
 | 
			
		|||
        'warning_notifications_disabled_email' => 'Email 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.',
 | 
			
		||||
        'error_server_no_match' => 'Server not found.',
 | 
			
		||||
        'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
 | 
			
		||||
        'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',
 | 
			
		||||
| 
						 | 
				
			
			@ -316,6 +323,21 @@ $sm_lang = array(
 | 
			
		|||
        '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.',
 | 
			
		||||
        'jabber_status' => 'Allow sending Jabber (XMPP) messages',
 | 
			
		||||
        'jabber_description' => 'Visit the <a
 | 
			
		||||
 href="http://docs.phpservermonitor.org/">documentation</a> 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',
 | 
			
		||||
        'jabber_port_description' => 'Port of your Jabber provider. Default 5222. For Google Account use 5223.',
 | 
			
		||||
        'jabber_username' => 'Username',
 | 
			
		||||
        'jabber_username_description' => 'For Google Account use incl. domain so for example example@google.com.',
 | 
			
		||||
        'jabber_domain' => 'Domain',
 | 
			
		||||
        'jabber_domain_description' => 'Domain of your Jabber provider. Left empty for Google Account.',
 | 
			
		||||
        'jabber_password' => 'Password',
 | 
			
		||||
        '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' => '<b>Status change:</b> You will receive a notification when a server has a change
 | 
			
		||||
 in status. So from online -> offline or offline -> online.<br><br><b>Offline:</b>
 | 
			
		||||
| 
						 | 
				
			
			@ -339,15 +361,18 @@ $sm_lang = array(
 | 
			
		|||
        'log_sms' => 'Log text 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_pushover' => 'Pushover',
 | 
			
		||||
        'tab_telegram' => 'Telegram',
 | 
			
		||||
        'tab_jabber' => 'Jabber',
 | 
			
		||||
        'settings_email' => 'Email settings',
 | 
			
		||||
        'settings_sms' => 'Text message settings',
 | 
			
		||||
        'settings_pushover' => 'Pushover settings',
 | 
			
		||||
        'settings_telegram' => 'Telegram settings',
 | 
			
		||||
        'settings_jabber' => 'Jabber settings',
 | 
			
		||||
        'settings_notification' => 'Notification settings',
 | 
			
		||||
        'settings_log' => 'Log settings',
 | 
			
		||||
        'settings_proxy' => 'Proxy settings',
 | 
			
		||||
| 
						 | 
				
			
			@ -361,6 +386,7 @@ $sm_lang = array(
 | 
			
		|||
        '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',
 | 
			
		||||
        'test_subject' => 'Test',
 | 
			
		||||
        'test_message' => 'Test message',
 | 
			
		||||
| 
						 | 
				
			
			@ -379,6 +405,11 @@ $sm_lang = array(
 | 
			
		|||
        '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_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.',
 | 
			
		||||
| 
						 | 
				
			
			@ -393,6 +424,8 @@ $sm_lang = array(
 | 
			
		|||
        'off_pushover_message' => 'Failed to connect to the following server:<br><br>Server: %LABEL%<br>IP:
 | 
			
		||||
 %IP%<br>Port: %PORT%<br>Error: %ERROR%<br>Date: %DATE%',
 | 
			
		||||
        'off_telegram_message' => 'Failed to connect to the following server:<br><br>Server: %LABEL%<br>IP:
 | 
			
		||||
 %IP%<br>Port: %PORT%<br>Error: %ERROR%<br>Date: %DATE%',
 | 
			
		||||
        'off_jabber_message' => 'Failed to connect to the following server:<br><br>Server: %LABEL%<br>IP:
 | 
			
		||||
 %IP%<br>Port: %PORT%<br>Error: %ERROR%<br>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',
 | 
			
		||||
| 
						 | 
				
			
			@ -405,12 +438,17 @@ $sm_lang = array(
 | 
			
		|||
 %DATE%',
 | 
			
		||||
        'on_telegram_message' => 'Server \'%LABEL%\' is running again, it was down for:
 | 
			
		||||
 %LAST_OFFLINE_DURATION%<br><br>Server: %LABEL%<br>IP: %IP%<br>Port: %PORT%<br>Date:
 | 
			
		||||
 %DATE%',
 | 
			
		||||
        'on_jabber_message' => 'Server \'%LABEL%\' is running again, it was down for:
 | 
			
		||||
 %LAST_OFFLINE_DURATION%<br><br>Server: %LABEL%<br>IP: %IP%<br>Port: %PORT%<br>Date:
 | 
			
		||||
 %DATE%',
 | 
			
		||||
        'combi_off_email_message' => '<ul><li>Server: %LABEL%</li><li>IP: %IP%</li><li>Port: %PORT%</li><li>Error:
 | 
			
		||||
 %ERROR%</li><li>Date: %DATE%</li></ul>',
 | 
			
		||||
        'combi_off_pushover_message' => '<ul><li>Server: %LABEL%</li><li>IP: %IP%</li><li>Port: %PORT%</li><li>Error:
 | 
			
		||||
 %ERROR%</li><li>Date: %DATE%</li></ul>',
 | 
			
		||||
        'combi_off_telegram_message' => '- Server: %LABEL%<br>- IP: %IP%<br>- Port: %PORT%<br>- Error: %ERROR%<br>-
 | 
			
		||||
 Date: %DATE%<br><br>',
 | 
			
		||||
        'combi_off_jabber_message' => '- Server: %LABEL%<br>- IP: %IP%<br>- Port: %PORT%<br>- Error: %ERROR%<br>-
 | 
			
		||||
 Date: %DATE%<br><br>',
 | 
			
		||||
        'combi_on_email_message' => '<ul><li>Server: %LABEL%</li><li>IP: %IP%</li><li>Port: %PORT%</li><li>Downtime:
 | 
			
		||||
 %LAST_OFFLINE_DURATION%</li><li>Date: %DATE%</li></ul>',
 | 
			
		||||
| 
						 | 
				
			
			@ -418,6 +456,8 @@ $sm_lang = array(
 | 
			
		|||
 %PORT%</li><li>Downtime: %LAST_OFFLINE_DURATION%</li><li>Date:
 | 
			
		||||
 %DATE%</li></ul>',
 | 
			
		||||
        'combi_on_telegram_message' => '- Server: %LABEL%<br>- IP: %IP%<br>- Port: %PORT%<br>- Downtime:
 | 
			
		||||
 %LAST_OFFLINE_DURATION%<br>- Date: %DATE%<br><br>',
 | 
			
		||||
        'combi_on_jabber_message' => '- Server: %LABEL%<br>- IP: %IP%<br>- Port: %PORT%<br>- Downtime:
 | 
			
		||||
 %LAST_OFFLINE_DURATION%<br>- Date: %DATE%<br><br>',
 | 
			
		||||
        'combi_email_subject' => 'IMPORTANT: \'%UP%\' servers UP again, \'%DOWN%\' servers DOWN',
 | 
			
		||||
        'combi_pushover_subject' => '\'%UP%\' servers UP again, \'%DOWN%\' servers DOWN',
 | 
			
		||||
| 
						 | 
				
			
			@ -426,6 +466,8 @@ $sm_lang = array(
 | 
			
		|||
        'combi_pushover_message' => '<b>The following servers went down:</b><br>%DOWN_SERVERS%<br><b>The following
 | 
			
		||||
 servers are up again:</b><br>%UP_SERVERS%',
 | 
			
		||||
        'combi_telegram_message' => '<b>The following servers went down:</b><br>%DOWN_SERVERS%<br><b>The following
 | 
			
		||||
 servers are up again:</b><br>%UP_SERVERS%',
 | 
			
		||||
        'combi_jabber_message' => '<b>The following servers went down:</b><br>%DOWN_SERVERS%<br><b>The following
 | 
			
		||||
 servers are up again:</b><br>%UP_SERVERS%',
 | 
			
		||||
    ),
 | 
			
		||||
    'login' => array(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,11 +45,13 @@ class ConfigController extends AbstractController
 | 
			
		|||
        'sms_status',
 | 
			
		||||
        'pushover_status',
 | 
			
		||||
        'telegram_status',
 | 
			
		||||
        'jabber_status',
 | 
			
		||||
        'log_status',
 | 
			
		||||
        'log_email',
 | 
			
		||||
        'log_sms',
 | 
			
		||||
        'log_pushover',
 | 
			
		||||
        'log_telegram',
 | 
			
		||||
        'log_jabber',
 | 
			
		||||
        'show_update',
 | 
			
		||||
        'combine_notifications',
 | 
			
		||||
    );
 | 
			
		||||
| 
						 | 
				
			
			@ -72,6 +74,10 @@ class ConfigController extends AbstractController
 | 
			
		|||
        'sms_from',
 | 
			
		||||
        'pushover_api_token',
 | 
			
		||||
        'telegram_api_token',
 | 
			
		||||
	    'jabber_host',
 | 
			
		||||
	    'jabber_port',
 | 
			
		||||
	    'jabber_username',
 | 
			
		||||
	    'jabber_domain'
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -79,7 +85,8 @@ class ConfigController extends AbstractController
 | 
			
		|||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    protected $encryptedFields = [
 | 
			
		||||
        'email_smtp_password'
 | 
			
		||||
        'email_smtp_password',
 | 
			
		||||
	    'jabber_password'
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    private $default_tab = 'general';
 | 
			
		||||
| 
						 | 
				
			
			@ -191,7 +198,7 @@ class ConfigController extends AbstractController
 | 
			
		|||
 | 
			
		||||
        $tpl_data[$this->default_tab . '_active'] = 'active';
 | 
			
		||||
 | 
			
		||||
        $testmodals = array('email', 'sms', 'pushover', 'telegram');
 | 
			
		||||
        $testmodals = array('email', 'sms', 'pushover', 'telegram', 'jabber');
 | 
			
		||||
        foreach ($testmodals as $modal_id) {
 | 
			
		||||
            $modal = new \psm\Util\Module\Modal(
 | 
			
		||||
                $this->twig,
 | 
			
		||||
| 
						 | 
				
			
			@ -214,7 +221,7 @@ class ConfigController extends AbstractController
 | 
			
		|||
    protected function executeSave()
 | 
			
		||||
    {
 | 
			
		||||
        if (!empty($_POST)) {
 | 
			
		||||
            // save new config
 | 
			
		||||
        	// save new config
 | 
			
		||||
            $clean = array(
 | 
			
		||||
                'language' => $_POST['language'],
 | 
			
		||||
                'sms_gateway' => $_POST['sms_gateway'],
 | 
			
		||||
| 
						 | 
				
			
			@ -225,9 +232,9 @@ class ConfigController extends AbstractController
 | 
			
		|||
                    : '',
 | 
			
		||||
                'auto_refresh_servers' => intval(psm_POST('auto_refresh_servers', 0)),
 | 
			
		||||
                'log_retention_period' => intval(psm_POST('log_retention_period', 365)),
 | 
			
		||||
                'password_encrypt_key' => psm_POST('password_encrypt_key', sha1(microtime())),
 | 
			
		||||
                'password_encrypt_key' => psm_POST('password_encrypt_key', sha1(microtime()))
 | 
			
		||||
            );
 | 
			
		||||
            foreach ($this->checkboxes as $input_key) {
 | 
			
		||||
	        foreach ($this->checkboxes as $input_key) {
 | 
			
		||||
                $clean[$input_key] = (isset($_POST[$input_key])) ? '1' : '0';
 | 
			
		||||
            }
 | 
			
		||||
            foreach ($this->fields as $input_key) {
 | 
			
		||||
| 
						 | 
				
			
			@ -256,6 +263,8 @@ class ConfigController extends AbstractController
 | 
			
		|||
                $this->testPushover();
 | 
			
		||||
            } elseif (!empty($_POST['test_telegram'])) {
 | 
			
		||||
                $this->testTelegram();
 | 
			
		||||
            } elseif (!empty($_POST['test_jabber'])) {
 | 
			
		||||
	            $this->testJabber();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if ($language_refresh) {
 | 
			
		||||
| 
						 | 
				
			
			@ -273,6 +282,8 @@ class ConfigController extends AbstractController
 | 
			
		|||
                $this->default_tab = 'pushover';
 | 
			
		||||
            } elseif (isset($_POST['telegram_submit']) || !empty($_POST['test_telegram'])) {
 | 
			
		||||
                $this->default_tab = 'telegram';
 | 
			
		||||
            } elseif (isset($_POST['jabber_submit']) || !empty($_POST['test_jabber'])) {
 | 
			
		||||
	            $this->default_tab = 'jabber';
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return $this->runAction('index');
 | 
			
		||||
| 
						 | 
				
			
			@ -397,6 +408,26 @@ class ConfigController extends AbstractController
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Test Jabber.
 | 
			
		||||
	 */
 | 
			
		||||
    protected function testJabber()
 | 
			
		||||
    {
 | 
			
		||||
	    $user = $this->getUser()->getUser();
 | 
			
		||||
	    psm_jabber_send_message(
 | 
			
		||||
		    psm_get_conf('jabber_host'),
 | 
			
		||||
		    psm_get_conf('jabber_username'),
 | 
			
		||||
		    psm_password_decrypt(psm_get_conf('password_encrypt_key'), psm_get_conf('jabber_password')),
 | 
			
		||||
		    [$user->jabber],
 | 
			
		||||
		    psm_get_lang('config', 'test_message'),
 | 
			
		||||
		    (trim(psm_get_conf('jabber_port')) !== '' ? (int)psm_get_conf('jabber_port') : null),
 | 
			
		||||
		    (trim(psm_get_conf('jabber_domain')) !== '' ? psm_get_conf('jabber_domain') : null)
 | 
			
		||||
	    );
 | 
			
		||||
	    // no message - async ... so just info
 | 
			
		||||
	    $this->addMessage(psm_get_lang('config', 'jabber_check'), 'info');
 | 
			
		||||
	    // @todo possible to set message via ajax with callback ...
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function getLabels()
 | 
			
		||||
    {
 | 
			
		||||
        return array(
 | 
			
		||||
| 
						 | 
				
			
			@ -404,10 +435,12 @@ class ConfigController extends AbstractController
 | 
			
		|||
            'label_tab_sms' => psm_get_lang('config', 'tab_sms'),
 | 
			
		||||
            '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_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'),
 | 
			
		||||
            'label_settings_notification' => psm_get_lang('config', 'settings_notification'),
 | 
			
		||||
            'label_settings_log' => psm_get_lang('config', 'settings_log'),
 | 
			
		||||
            'label_settings_proxy' => psm_get_lang('config', 'settings_proxy'),
 | 
			
		||||
| 
						 | 
				
			
			@ -448,6 +481,18 @@ class ConfigController extends AbstractController
 | 
			
		|||
            'label_telegram_status' => psm_get_lang('config', 'telegram_status'),
 | 
			
		||||
            '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'),
 | 
			
		||||
	        'label_jabber_description' => psm_get_lang('config', 'jabber_description'),
 | 
			
		||||
            'label_jabber_host' => psm_get_lang('config', 'jabber_host'),
 | 
			
		||||
	        'label_jabber_host_description' => psm_get_lang('config', 'jabber_host_description'),
 | 
			
		||||
	        'label_jabber_port' => psm_get_lang('config', 'jabber_port'),
 | 
			
		||||
	        'label_jabber_port_description' => psm_get_lang('config', 'jabber_port_description'),
 | 
			
		||||
	        'label_jabber_username' => psm_get_lang('config', 'jabber_username'),
 | 
			
		||||
	        'label_jabber_username_description' => psm_get_lang('config', 'jabber_username_description'),
 | 
			
		||||
	        'label_jabber_domain' => psm_get_lang('config', 'jabber_domain'),
 | 
			
		||||
	        'label_jabber_domain_description' => psm_get_lang('config', 'jabber_domain_description'),
 | 
			
		||||
	        'label_jabber_password' => psm_get_lang('config', 'jabber_password'),
 | 
			
		||||
	        'label_jabber_password_description' => psm_get_lang('config', 'jabber_password_description'),
 | 
			
		||||
            'label_alert_type' => psm_get_lang('config', 'alert_type'),
 | 
			
		||||
            'label_alert_type_description' => psm_get_lang('config', 'alert_type_description'),
 | 
			
		||||
            'label_combine_notifications' => psm_get_lang('config', 'combine_notifications'),
 | 
			
		||||
| 
						 | 
				
			
			@ -458,6 +503,7 @@ class ConfigController extends AbstractController
 | 
			
		|||
            'label_log_sms' => psm_get_lang('config', 'log_sms'),
 | 
			
		||||
            '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'),
 | 
			
		||||
            'label_alert_proxy' => psm_get_lang('config', 'alert_proxy'),
 | 
			
		||||
            'label_alert_proxy_url' => psm_get_lang('config', 'alert_proxy_url'),
 | 
			
		||||
            'label_auto_refresh' => psm_get_lang('config', 'auto_refresh'),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -257,6 +257,7 @@ class InstallController extends AbstractController
 | 
			
		|||
            'pushover_key' => '',
 | 
			
		||||
            'pushover_device' => '',
 | 
			
		||||
            'telegram_id' => '',
 | 
			
		||||
	        'jabber' => ''
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $validator = $this->container->get('util.user.validator');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -83,6 +83,7 @@ abstract class AbstractServerController extends AbstractController
 | 
			
		|||
					`s`.`sms`,
 | 
			
		||||
					`s`.`pushover`,
 | 
			
		||||
					`s`.`telegram`,
 | 
			
		||||
					`s`.`jabber`,
 | 
			
		||||
					`s`.`warning_threshold`,
 | 
			
		||||
					`s`.`warning_threshold_counter`,
 | 
			
		||||
                    `s`.`ssl_cert_expiry_days`,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,6 +57,7 @@ class LogController extends AbstractServerController
 | 
			
		|||
            'label_sms' => psm_get_lang('log', 'sms'),
 | 
			
		||||
            'label_pushover' => psm_get_lang('log', 'pushover'),
 | 
			
		||||
            'label_telegram' => psm_get_lang('log', 'telegram'),
 | 
			
		||||
	        'label_jabber' => psm_get_lang('log', 'jabber'),
 | 
			
		||||
            'label_title' => psm_get_lang('log', 'title'),
 | 
			
		||||
            'label_server' => psm_get_lang('servers', 'server'),
 | 
			
		||||
            'label_type' => psm_get_lang('log', 'type'),
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +89,7 @@ class LogController extends AbstractServerController
 | 
			
		|||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $log_types = array('status', 'email', 'sms', 'pushover', 'telegram');
 | 
			
		||||
        $log_types = array('status', 'email', 'sms', 'pushover', 'telegram', 'jabber');
 | 
			
		||||
 | 
			
		||||
        foreach ($log_types as $key) {
 | 
			
		||||
            $records = $this->getEntries($key);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -97,6 +97,14 @@ class ServerController extends AbstractServerController
 | 
			
		|||
            psm_get_lang('menu', 'server_update')
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $icons = array(
 | 
			
		||||
            'email' => 'icon-envelope',
 | 
			
		||||
            'sms' => 'icon-mobile',
 | 
			
		||||
            'pushover' => 'icon-pushover',
 | 
			
		||||
            'telegram' => 'icon-telegram',
 | 
			
		||||
	        'jabber' => 'icon-jabber'
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $servers = $this->getServers();
 | 
			
		||||
        $server_count = count($servers);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -228,10 +236,11 @@ class ServerController extends AbstractServerController
 | 
			
		|||
                'edit_sms_selected' => $edit_server['sms'],
 | 
			
		||||
                'edit_pushover_selected' => $edit_server['pushover'],
 | 
			
		||||
                'edit_telegram_selected' => $edit_server['telegram'],
 | 
			
		||||
	            'edit_jabber_selected' => $edit_server['jabber'],
 | 
			
		||||
            ));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $notifications = array('email', 'sms', 'pushover', 'telegram');
 | 
			
		||||
        $notifications = array('email', 'sms', 'pushover', 'telegram', 'jabber');
 | 
			
		||||
        foreach ($notifications as $notification) {
 | 
			
		||||
            if (psm_get_conf($notification . '_status') == 0) {
 | 
			
		||||
                $tpl_data['warning_' . $notification] = true;
 | 
			
		||||
| 
						 | 
				
			
			@ -301,6 +310,7 @@ class ServerController extends AbstractServerController
 | 
			
		|||
            'sms' => in_array($_POST['sms'], array('yes', 'no')) ? $_POST['sms'] : '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',
 | 
			
		||||
        );
 | 
			
		||||
        // make sure websites start with http://
 | 
			
		||||
        if (
 | 
			
		||||
| 
						 | 
				
			
			@ -569,8 +579,10 @@ class ServerController extends AbstractServerController
 | 
			
		|||
            'label_send_sms' => psm_get_lang('servers', 'send_sms'),
 | 
			
		||||
            '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_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'),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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');
 | 
			
		||||
        array('name', 'user_name', 'email', 'mobile', 'pushover_key', 'pushover_device', 'telegram_id', 'jabber');
 | 
			
		||||
 | 
			
		||||
    public function __construct(Database $db, \Twig_Environment $twig)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -90,6 +90,8 @@ class ProfileController extends AbstractController
 | 
			
		|||
            'label_activate_telegram' => psm_get_lang('users', 'activate_telegram'),
 | 
			
		||||
            'label_telegram_get_chat_id' => psm_get_lang('users', 'telegram_get_chat_id'),
 | 
			
		||||
            'telegram_get_chat_id_url' => PSM_TELEGRAM_GET_ID_URL,
 | 
			
		||||
	        'label_jabber' => psm_get_lang('users', 'jabber'),
 | 
			
		||||
	        'label_jabber_description' => psm_get_lang('users', 'jabber_description'),
 | 
			
		||||
            'label_email' => psm_get_lang('users', 'email'),
 | 
			
		||||
            'label_save' => psm_get_lang('system', 'save'),
 | 
			
		||||
            'form_action' => psm_build_url(array(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -161,6 +161,7 @@ class UserController extends AbstractController
 | 
			
		|||
            'pushover_key',
 | 
			
		||||
            'pushover_device',
 | 
			
		||||
            'telegram_id',
 | 
			
		||||
            'jabber',
 | 
			
		||||
            'email'
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -257,6 +258,7 @@ class UserController extends AbstractController
 | 
			
		|||
            'pushover_key',
 | 
			
		||||
            'pushover_device',
 | 
			
		||||
            'telegram_id',
 | 
			
		||||
            'jabber',
 | 
			
		||||
            'email'
 | 
			
		||||
        );
 | 
			
		||||
        $clean = array();
 | 
			
		||||
| 
						 | 
				
			
			@ -398,6 +400,8 @@ class UserController extends AbstractController
 | 
			
		|||
            'label_telegram' => psm_get_lang('users', 'telegram'),
 | 
			
		||||
            'label_telegram_id' => psm_get_lang('users', 'telegram_chat_id'),
 | 
			
		||||
            'label_telegram_id_description' => psm_get_lang('users', 'telegram_chat_id_description'),
 | 
			
		||||
            'label_jabber' => psm_get_lang('users', 'jabber'),
 | 
			
		||||
            'label_jabber_description' => psm_get_lang('users', 'jabber_description'),
 | 
			
		||||
            'label_email' => psm_get_lang('users', 'email'),
 | 
			
		||||
            'label_servers' => psm_get_lang('menu', 'server'),
 | 
			
		||||
            'label_save' => psm_get_lang('system', 'save'),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,11 +134,11 @@ class Installer
 | 
			
		|||
        $queries = array();
 | 
			
		||||
        $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (
 | 
			
		||||
            `ip`, `port`, `label`, `type`, `pattern`, `pattern_online`, `redirect_check`,
 | 
			
		||||
            `status`, `rtime`, `active`, `email`, `sms`, `pushover`, `telegram`)
 | 
			
		||||
            `status`, `rtime`, `active`, `email`, `sms`, `pushover`, `telegram`, `jabber`)
 | 
			
		||||
            VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '',
 | 
			
		||||
                'yes', 'bad', 'on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes'),
 | 
			
		||||
                'yes', 'bad', 'on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes'),
 | 
			
		||||
                ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '',
 | 
			
		||||
                'yes', 'bad','on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes')";
 | 
			
		||||
                'yes', 'bad','on', '0.0000000', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes')";
 | 
			
		||||
        $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "users_servers` (`user_id`,`server_id`) VALUES (1, 1), (1, 2);";
 | 
			
		||||
        $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
 | 
			
		||||
					('language', 'en_US'),
 | 
			
		||||
| 
						 | 
				
			
			@ -164,6 +164,12 @@ class Installer
 | 
			
		|||
					('pushover_api_token', ''),
 | 
			
		||||
					('telegram_status', '0'),
 | 
			
		||||
					('telegram_api_token', ''),
 | 
			
		||||
					('jabber_status', '1'),
 | 
			
		||||
					('jabber_host', ''),
 | 
			
		||||
					('jabber_port', ''),
 | 
			
		||||
					('jabber_username', ''),
 | 
			
		||||
					('jabber_domain', ''),
 | 
			
		||||
					('jabber_password', ''),
 | 
			
		||||
					('password_encrypt_key', '" . sha1(microtime()) . "'),
 | 
			
		||||
					('alert_type', 'status'),
 | 
			
		||||
					('log_status', '1'),
 | 
			
		||||
| 
						 | 
				
			
			@ -171,6 +177,7 @@ class Installer
 | 
			
		|||
					('log_sms', '1'),
 | 
			
		||||
					('log_pushover', '1'),
 | 
			
		||||
					('log_telegram', '1'),
 | 
			
		||||
					('log_jabber', '1'),
 | 
			
		||||
					('log_retention_period', '365'),
 | 
			
		||||
					('version', '" . PSM_VERSION . "'),
 | 
			
		||||
					('version_update_check', '" . PSM_VERSION . "'),
 | 
			
		||||
| 
						 | 
				
			
			@ -208,6 +215,7 @@ class Installer
 | 
			
		|||
				`pushover_key` varchar(255) NOT NULL,
 | 
			
		||||
				`pushover_device` varchar(255) NOT NULL,
 | 
			
		||||
				`telegram_id` varchar(255) NOT NULL,
 | 
			
		||||
				`jabber` varchar(255) NOT NULL,
 | 
			
		||||
				`email` varchar(255) NOT NULL,
 | 
			
		||||
                PRIMARY KEY (`user_id`),
 | 
			
		||||
                UNIQUE KEY `unique_username` (`user_name`)
 | 
			
		||||
| 
						 | 
				
			
			@ -227,7 +235,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') NOT NULL,
 | 
			
		||||
				`type` enum('status','email','sms','pushover','telegram', 'jabber') NOT NULL,
 | 
			
		||||
				`message` TEXT NOT NULL,
 | 
			
		||||
				`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP,
 | 
			
		||||
                PRIMARY KEY  (`log_id`)
 | 
			
		||||
| 
						 | 
				
			
			@ -263,6 +271,7 @@ class Installer
 | 
			
		|||
				`sms` enum('yes','no') NOT NULL default 'no',
 | 
			
		||||
				`pushover` enum('yes','no') NOT NULL default 'yes',
 | 
			
		||||
				`telegram` enum('yes','no') NOT NULL default 'yes',
 | 
			
		||||
				`jabber` enum('yes','no') NOT NULL default 'yes',
 | 
			
		||||
			    `warning_threshold` mediumint(1) unsigned NOT NULL DEFAULT '1',
 | 
			
		||||
			    `warning_threshold_counter` mediumint(1) unsigned NOT NULL DEFAULT '0',
 | 
			
		||||
                `ssl_cert_expiry_days` mediumint(1) unsigned NOT NULL DEFAULT '0',
 | 
			
		||||
| 
						 | 
				
			
			@ -345,10 +354,7 @@ class Installer
 | 
			
		|||
        if (version_compare($version_from, '3.4.2', '<')) {
 | 
			
		||||
            $this->upgrade342();
 | 
			
		||||
        }
 | 
			
		||||
        if (version_compare($version_from, '3.4.6-beta.1', '<')) {
 | 
			
		||||
            $this->upgrade346();
 | 
			
		||||
        }
 | 
			
		||||
        if (version_compare($version_from, '3.4.6-beta.2', '<')) {
 | 
			
		||||
        if (version_compare($version_from, '3.4.6-beta.3', '<')) {
 | 
			
		||||
            $this->upgrade346();
 | 
			
		||||
        }
 | 
			
		||||
        psm_update_conf('version', $version_to);
 | 
			
		||||
| 
						 | 
				
			
			@ -676,20 +682,37 @@ class Installer
 | 
			
		|||
            ADD `ssl_cert_expiry_days` MEDIUMINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `warning_threshold_counter`";
 | 
			
		||||
        $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` 
 | 
			
		||||
            ADD `ssl_cert_expired_time` VARCHAR(255) NULL AFTER `ssl_cert_expiry_days`";
 | 
			
		||||
            
 | 
			
		||||
        if (
 | 
			
		||||
            @psm_password_decrypt(
 | 
			
		||||
                psm_get_conf('password_encrypt_key'),
 | 
			
		||||
                psm_get_conf('email_smtp_password')
 | 
			
		||||
            ) === false
 | 
			
		||||
        ) {
 | 
			
		||||
            // Prevents encrypting the password multiple times.
 | 
			
		||||
            $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` 
 | 
			
		||||
 | 
			
		||||
	    if (
 | 
			
		||||
		    @psm_password_decrypt(
 | 
			
		||||
			    psm_get_conf('password_encrypt_key'),
 | 
			
		||||
			    psm_get_conf('email_smtp_password')
 | 
			
		||||
		    ) === false
 | 
			
		||||
	    ) {
 | 
			
		||||
		    // Prevents encrypting the password multiple times.
 | 
			
		||||
		    $queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` 
 | 
			
		||||
                SET `value` = '" .
 | 
			
		||||
                psm_password_encrypt(psm_get_conf('password_encrypt_key'), psm_get_conf('email_smtp_password')) .
 | 
			
		||||
                "' WHERE `key` = 'email_smtp_password'";
 | 
			
		||||
            $this->log('SMTP password is now encrypted.');
 | 
			
		||||
        }
 | 
			
		||||
			    psm_password_encrypt(psm_get_conf('password_encrypt_key'), psm_get_conf('email_smtp_password')) .
 | 
			
		||||
			    "' WHERE `key` = 'email_smtp_password'";
 | 
			
		||||
		    $this->log('SMTP password is now encrypted.');
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
        $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' ) 
 | 
			
		||||
            NOT NULL DEFAULT 'yes' AFTER  `telegram`;";
 | 
			
		||||
        $queries[] = "ALTER TABLE `" . PSM_DB_PREFIX .
 | 
			
		||||
            "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover', 'telegram', 'jabber' )
 | 
			
		||||
            CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
 | 
			
		||||
        $queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
 | 
			
		||||
					('jabber_status', '0'),
 | 
			
		||||
					('log_jabber', '1'),
 | 
			
		||||
					('jabber_host', ''),
 | 
			
		||||
					('jabber_port', ''),
 | 
			
		||||
					('jabber_username', ''),
 | 
			
		||||
					('jabber_domain', ''),
 | 
			
		||||
					('jabber_password', '');";
 | 
			
		||||
 | 
			
		||||
        $this->execSQL($queries);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,8 @@ class UpdateManager implements ContainerAwareInterface
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        $sql = "SELECT `s`.`server_id`,`s`.`ip`,`s`.`port`,`s`.`label`,`s`.`type`,`s`.`pattern`,`s`.`header_name`,
 | 
			
		||||
            `s`.`header_value`,`s`.`status`,`s`.`active`,`s`.`email`,`s`.`sms`,`s`.`pushover`,`s`.`telegram`
 | 
			
		||||
            `s`.`header_value`,`s`.`status`,`s`.`active`,`s`.`email`,`s`.`sms`,`s`.`pushover`,`s`.`telegram`, 
 | 
			
		||||
            `s`.`jabber`
 | 
			
		||||
				FROM `" . PSM_DB_PREFIX . "servers` AS `s`
 | 
			
		||||
				{$sql_join}
 | 
			
		||||
				WHERE `active`='yes' " . ($status !== null ? ' AND `status` = \'' . $status . '\'' : '');
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +82,8 @@ class UpdateManager implements ContainerAwareInterface
 | 
			
		|||
 | 
			
		||||
        foreach ($servers as $server) {
 | 
			
		||||
            $status_old = ($server['status'] == 'on') ? true : false;
 | 
			
		||||
            $status_new = $updater->update($server['server_id']);
 | 
			
		||||
            $status_new = $updater->
 | 
			
		||||
            update($server['server_id']);
 | 
			
		||||
            // notify the nerds if applicable
 | 
			
		||||
            $notifier->notify($server['server_id'], $status_old, $status_new);
 | 
			
		||||
            // clean-up time!! archive all records
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,7 @@
 | 
			
		|||
 * @see \psm\Util\Server\Updater\Autorun
 | 
			
		||||
 */
 | 
			
		||||
namespace psm\Util\Server\Updater;
 | 
			
		||||
use Norgul\Xmpp\Options;
 | 
			
		||||
use psm\Service\Database;
 | 
			
		||||
 | 
			
		||||
class StatusNotifier
 | 
			
		||||
| 
						 | 
				
			
			@ -68,6 +69,12 @@ class StatusNotifier
 | 
			
		|||
     */
 | 
			
		||||
    protected $send_telegram = false;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Send Jabber?
 | 
			
		||||
	 * @var bool
 | 
			
		||||
	 */
 | 
			
		||||
    protected $send_jabber = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Save log records?
 | 
			
		||||
     * @var boolean $save_log
 | 
			
		||||
| 
						 | 
				
			
			@ -119,12 +126,13 @@ class StatusNotifier
 | 
			
		|||
    {
 | 
			
		||||
        $this->db = $db;
 | 
			
		||||
 | 
			
		||||
        $this->send_emails = psm_get_conf('email_status');
 | 
			
		||||
        $this->send_sms = psm_get_conf('sms_status');
 | 
			
		||||
        $this->send_pushover = psm_get_conf('pushover_status');
 | 
			
		||||
        $this->send_telegram = psm_get_conf('telegram_status');
 | 
			
		||||
        $this->save_logs = psm_get_conf('log_status');
 | 
			
		||||
        $this->combine = psm_get_conf('combine_notifications');
 | 
			
		||||
        $this->send_emails = (bool)psm_get_conf('email_status');
 | 
			
		||||
        $this->send_sms = (bool)psm_get_conf('sms_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');
 | 
			
		||||
        $this->save_logs = (bool)psm_get_conf('log_status');
 | 
			
		||||
        $this->combine = (bool)psm_get_conf('combine_notifications');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -143,6 +151,7 @@ class StatusNotifier
 | 
			
		|||
            !$this->send_sms &&
 | 
			
		||||
            !$this->send_pushover &&
 | 
			
		||||
            !$this->send_telegram &&
 | 
			
		||||
            !$this->send_jabber &&
 | 
			
		||||
            !$this->save_logs
 | 
			
		||||
        ) {
 | 
			
		||||
            // seems like we have nothing to do. skip the rest
 | 
			
		||||
| 
						 | 
				
			
			@ -168,6 +177,7 @@ class StatusNotifier
 | 
			
		|||
            'sms',
 | 
			
		||||
            'pushover',
 | 
			
		||||
            'telegram',
 | 
			
		||||
            'jabber',
 | 
			
		||||
            'last_online',
 | 
			
		||||
            'last_offline',
 | 
			
		||||
            'last_offline_duration',
 | 
			
		||||
| 
						 | 
				
			
			@ -247,6 +257,10 @@ class StatusNotifier
 | 
			
		|||
            $this->combine ? $this->setCombi('telegram') : $this->notifyByTelegram($users);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->send_jabber && $this->server['jaber'] == 'yes') {
 | 
			
		||||
	        $this->combine ? $this->setCombi('jabber') : $this->notifyByJabber($users);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $notify;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -548,6 +562,54 @@ class StatusNotifier
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param array $users
 | 
			
		||||
	 * @param array $combi
 | 
			
		||||
	 */
 | 
			
		||||
    protected function notifyByJabber($users, $combi = [])
 | 
			
		||||
    {
 | 
			
		||||
	    // Remove users that have no jabber
 | 
			
		||||
	    foreach ($users as $k => $user) {
 | 
			
		||||
		    if (trim($user['jabber']) === '') {
 | 
			
		||||
			    unset($users[$k]);
 | 
			
		||||
		    }
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    // Validation
 | 
			
		||||
	    if (empty($users)) {
 | 
			
		||||
		    return;
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    // Message
 | 
			
		||||
	    $message = key_exists('message', $combi) ?
 | 
			
		||||
		    $combi['message'] :
 | 
			
		||||
		    psm_parse_msg($this->status_new, 'jabber_message', $this->server);
 | 
			
		||||
 | 
			
		||||
	    // Log
 | 
			
		||||
	    if (psm_get_conf('log_jabber')) {
 | 
			
		||||
		    $log_id = psm_add_log($this->server_id, 'jabber', $message);
 | 
			
		||||
	    }
 | 
			
		||||
 | 
			
		||||
	    $usersJabber = [];
 | 
			
		||||
	    foreach ($users as $user) {
 | 
			
		||||
		    // Log
 | 
			
		||||
		    if (!empty($log_id)) {
 | 
			
		||||
			    psm_add_log_user($log_id, $user['user_id']);
 | 
			
		||||
		    }
 | 
			
		||||
		    $usersJabber[] = $user['jabber'];
 | 
			
		||||
	    }
 | 
			
		||||
	    // Jabber
 | 
			
		||||
	    psm_jabber_send_message(
 | 
			
		||||
		    psm_get_conf('jabber_host'),
 | 
			
		||||
		    psm_get_conf('jabber_username'),
 | 
			
		||||
		    psm_password_decrypt(psm_get_conf('password_encrypt_key'), psm_get_conf('jabber_password')),
 | 
			
		||||
		    $usersJabber,
 | 
			
		||||
		    $message,
 | 
			
		||||
		    (trim(psm_get_conf('jabber_port')) !== '' ? (int)psm_get_conf('jabber_port') : null),
 | 
			
		||||
		    (trim(psm_get_conf('jabber_domain')) !== '' ? psm_get_conf('jabber_domain') : null)
 | 
			
		||||
	    );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get all users for the provided server id
 | 
			
		||||
     * @param int $server_id
 | 
			
		||||
| 
						 | 
				
			
			@ -556,11 +618,12 @@ class StatusNotifier
 | 
			
		|||
    public function getUsers($server_id)
 | 
			
		||||
    {
 | 
			
		||||
        // find all the users with this server listed
 | 
			
		||||
        $users = $this->db->query("
 | 
			
		||||
        $users = $this->db->query('
 | 
			
		||||
            SELECT `u`.`user_id`, `u`.`name`,`u`.`email`, `u`.`mobile`, `u`.`pushover_key`,
 | 
			
		||||
                `u`.`pushover_device`, `u`.`telegram_id`
 | 
			
		||||
			FROM `" . PSM_DB_PREFIX . "users` AS `u`
 | 
			
		||||
			JOIN `" . PSM_DB_PREFIX . "users_servers` AS `us` ON (
 | 
			
		||||
                `u`.`pushover_device`, `u`.`telegram_id`, 
 | 
			
		||||
                `u`.`jabber`
 | 
			
		||||
			FROM `' . PSM_DB_PREFIX . 'users` AS `u`
 | 
			
		||||
			JOIN `' . PSM_DB_PREFIX . "users_servers` AS `us` ON (
 | 
			
		||||
				`us`.`user_id`=`u`.`user_id`
 | 
			
		||||
				AND `us`.`server_id` = {$server_id}
 | 
			
		||||
			)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,11 @@
 | 
			
		|||
                role="tab" aria-controls="config-telegram" aria-selected="{% if telegram_active %}true{% else %}false{% endif %}">{{
 | 
			
		||||
                label_tab_telegram }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li class="nav-item">
 | 
			
		||||
            <a class="nav-link {{ jabber_active }}" id="config-jabber-tab" data-toggle="tab" href="#config-jabber"
 | 
			
		||||
               role="tab" aria-controls="config-jabber" aria-selected="{% if jabber_active %}true{% else %}false{% endif %}">{{
 | 
			
		||||
                label_tab_jabber }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    <!-- Tab panes -->
 | 
			
		||||
    <div class="tab-content">
 | 
			
		||||
| 
						 | 
				
			
			@ -126,7 +131,7 @@
 | 
			
		|||
                {{ macro.button_save("sms_submit", label_save) }}
 | 
			
		||||
            </fieldset>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="tab-pane {{ pushover_active }}" id="config-pushover" role="tabpanel" aria-labelledby="config-telegram-tab">
 | 
			
		||||
        <div class="tab-pane {{ pushover_active }}" id="config-pushover" role="tabpanel" aria-labelledby="config-pushover-tab">
 | 
			
		||||
            <fieldset>
 | 
			
		||||
                <legend>{{ label_settings_pushover }}</legend>
 | 
			
		||||
                <p>{{ label_pushover_description|raw }}</p>
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +146,7 @@
 | 
			
		|||
                {{ macro.button_save("pushover_submit",  label_save) }}
 | 
			
		||||
            </fieldset>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="tab-pane {{ telegram_active }}" id="config-telegram" role="tabpanel" aria-labelledby="config-pushover-tab">
 | 
			
		||||
        <div class="tab-pane {{ telegram_active }}" id="config-telegram" role="tabpanel" aria-labelledby="config-telegram-tab">
 | 
			
		||||
            <fieldset>
 | 
			
		||||
                <legend>{{ label_settings_telegram }}</legend>
 | 
			
		||||
                <p>{{ label_telegram_description|raw }}</p>
 | 
			
		||||
| 
						 | 
				
			
			@ -156,6 +161,24 @@
 | 
			
		|||
                {{ macro.button_save("telegram_submit",  label_save) }}
 | 
			
		||||
            </fieldset>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="tab-pane {{ jabber_active }}" id="config-jabber" role="tabpanel" aria-labelledby="config-jabber-tab">
 | 
			
		||||
            <fieldset>
 | 
			
		||||
                <legend>{{ label_settings_jabber }}</legend>
 | 
			
		||||
                <!-- enable jabber -->
 | 
			
		||||
                {{ macro.input_checkbox("jabber_status", "jabber_status[]", label_jabber_status, jabber_status_checked) }}
 | 
			
		||||
                <!-- enable jabber log -->
 | 
			
		||||
                {{ macro.input_checkbox("log_jabber", "log_jabber[]", label_log_jabber, log_jabber_checked) }}
 | 
			
		||||
                <!-- jabber settings -->
 | 
			
		||||
                {{ macro.input_field("text", "jabber_host", null, "jabber_host", label_jabber_host, jabber_host, label_jabber_host, "255", "jabber_host_help", label_jabber_host_description) }}
 | 
			
		||||
                {{ macro.input_field("number", "jabber_port", null, "jabber_port", label_jabber_port, jabber_port, label_jabber_port, "255", "jabber_port_help", label_jabber_port_description) }}
 | 
			
		||||
                {{ macro.input_field("text", "jabber_username", null, "jabber_username", label_jabber_username, jabber_username, label_jabber_username, "255", 'jabber_username_help', label_jabber_username_description) }}
 | 
			
		||||
                {{ macro.input_field("text", "jabber_domain", null, "jabber_domain", label_jabber_domain, jabber_domain, label_jabber_domain, "255", "jabber_domain_help", label_jabber_domain_description) }}
 | 
			
		||||
                {{ macro.input_field("password", "jabber_password", null, "jabber_password", label_jabber_password, jabber_password, label_jabber_password, "255", "jabber_password_help", label_jabber_password_description) }}
 | 
			
		||||
                {{ macro.button_test("testJabber", label_test) }}
 | 
			
		||||
                {{ macro.input_hidden("test_jabber", "0") }}
 | 
			
		||||
                {{ macro.button_save("jabber_submit",  label_save) }}
 | 
			
		||||
            </fieldset>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    {{ macro.input_csrf() }}
 | 
			
		||||
</form>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,6 +68,12 @@
 | 
			
		|||
							<span class="fa-layers-text fa-inverse" style="font-weight:400; font-size:75%">T</span>
 | 
			
		||||
						</span>
 | 
			
		||||
					{% endif %}
 | 
			
		||||
					{% if server.jabber|lower == 'yes'%}
 | 
			
		||||
					<span class="fa-layers">
 | 
			
		||||
							<i class="fas fa-circle" title="{{ label_jabber }}"></i>
 | 
			
		||||
							<span class="fa-layers-text fa-inverse" style="font-weight:400; font-size:75%">J</span>
 | 
			
		||||
						</span>
 | 
			
		||||
					{% endif %}
 | 
			
		||||
				</td>
 | 
			
		||||
				{% if user_level == 10 %}
 | 
			
		||||
				<td>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -142,6 +142,8 @@
 | 
			
		|||
			{{ macro.input_select_monitoring("pushover", "pushover", label_send_pushover, edit_pushover_selected, label_yes, label_no, warning_pushover, label_warning_pushover) }}
 | 
			
		||||
			<!-- Telegram -->
 | 
			
		||||
			{{ macro.input_select_monitoring("telegram", "telegram", label_send_telegram, edit_telegram_selected, label_yes, label_no, warning_telegram, label_warning_telegram) }}
 | 
			
		||||
			<!-- Jabber -->
 | 
			
		||||
			{{ macro.input_select_monitoring("jabber", "jabber", label_send_jabber, edit_jabber_selected, label_yes, label_no, warning_jabber, label_warning_jabber) }}
 | 
			
		||||
		</div>
 | 
			
		||||
    </fieldset>
 | 
			
		||||
	<fieldset>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -331,6 +331,19 @@
 | 
			
		|||
					<noscript>⁇</noscript>
 | 
			
		||||
					{% endif %}
 | 
			
		||||
				</li>
 | 
			
		||||
				<li class="list-group-item">
 | 
			
		||||
					{{ label_jabber }}:
 | 
			
		||||
					{% if jabber|lower == 'yes' %}
 | 
			
		||||
					<i class="fas fa-bell float-right"></i>
 | 
			
		||||
					<noscript>✓</noscript>
 | 
			
		||||
					{% elseif jabber|lower == 'no' %}
 | 
			
		||||
					<i class="fas fa-bell-slash float-right"></i>
 | 
			
		||||
					<noscript>✕</noscript>
 | 
			
		||||
					{% else %}
 | 
			
		||||
					<i class="fas fa-question-circle float-right" title="Value from database should either be yes or no."></i>
 | 
			
		||||
					<noscript>⁇</noscript>
 | 
			
		||||
					{% endif %}
 | 
			
		||||
				</li>
 | 
			
		||||
			</ul>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,6 +39,12 @@
 | 
			
		|||
		{{ 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) }}
 | 
			
		||||
		<button class="btn btn-primary show-modal" data-toggle="modal" data-modal-id="activateTelegram">{{ label_activate_telegram }}</button>
 | 
			
		||||
		{{ macro.input_hidden("activate_telegram", "0") }}
 | 
			
		||||
		{{ macro.button_save(null, label_save) }}
 | 
			
		||||
	</fieldset>
 | 
			
		||||
	<!-- Jabber settings -->
 | 
			
		||||
	<fieldset>
 | 
			
		||||
		<legend>{{ label_jabber }}</legend>
 | 
			
		||||
		<!-- jabber -->
 | 
			
		||||
		{{ macro.input_field("text", "jabber", null, "jabber", label_jabber, jabber, label_jabber, "255", "jabber_help", jabber_description) }}
 | 
			
		||||
	</fieldset>
 | 
			
		||||
	{{ macro.button_save(null, label_save) }}
 | 
			
		||||
</form>
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +23,8 @@
 | 
			
		|||
			{{ macro.input_field("text", "pushover_device", null, "pushover_device", label_pushover_device, edit_value_pushover_device, null, "255") }}
 | 
			
		||||
			<!-- Telegram_id -->
 | 
			
		||||
			{{ macro.input_field("text", "telegram_id", null, "telegram_id", label_telegram_id, edit_value_telegram_id, null, "255") }}
 | 
			
		||||
			<!-- Jabber -->
 | 
			
		||||
			{{ macro.input_field("text", "jabber", null, "jabber", label_jabber, edit_value_jabber, null, "255") }}
 | 
			
		||||
			<!-- Servers -->
 | 
			
		||||
			{{ macro.input_select_multiple("server_id", "server_id[]", label_servers, label_search, servers, label_please_select) }}
 | 
			
		||||
		</div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue