Revert "Add Telegram (not working)"

This reverts commit 97697444d2.
pull/481/head
Timz99 2017-05-19 00:27:29 +02:00
parent 97697444d2
commit 465f71214d
22 changed files with 644 additions and 951 deletions

View File

@ -25,9 +25,6 @@
* @link http://www.phpservermonitor.org/
**/
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require __DIR__ . '/src/bootstrap.php';
psm_no_cache();
@ -38,9 +35,7 @@ if(isset($_GET["logout"])) {
header('Location: ' . psm_build_url());
die();
}
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$mod = psm_GET('mod', PSM_MODULE_DEFAULT);
try {
@ -51,6 +46,3 @@ try {
// and we really have no reason catch it
$router->run(PSM_MODULE_DEFAULT);
}
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

View File

@ -491,18 +491,6 @@ function psm_build_pushover() {
return $pushover;
}
/**
* Prepare a new Telegram util.
*
* @return \Telegram
*/
function psm_build_telegram() {
$telegram = new \Telegram();
$telegram->setToken(psm_get_conf('telegram_api_token'));
return $telegram;
}
/**
* Prepare a new SMS util.
*

View File

@ -107,12 +107,6 @@ define('PSM_CURL_TIMEOUT', 10);
*/
define('PSM_PUSHOVER_CLONE_URL', 'https://pushover.net/apps/clone/php_server_monitor');
/**
* Get telegram chat id.
*/
define('PSM_TELEGRAM_GET_ID', 'https://t.me/ChatIDBot');
/**
* By defining the PSM_BASE_URL, you will force the psm_build_url() to use this.
* Useful for cronjobs if it cannot be auto-detected.

View File

@ -88,9 +88,6 @@ $sm_lang = array(
'pushover_key' => 'Pushover Key',
'pushover_device' => 'Pushover Device',
'pushover_device_description' => 'Apparaat waar de berichten naar toe gaan. Laat leeg voor alle apparaten.',
'telegram' => 'Telegram',
'telegram_description' => 'Telegram is een dienst die het gemakkelijk maakt om real-time notificaties te ontvangen. Zie <a href="https://telegram.org/">hun website</a> voor meer informatie.',
'telegram_key' => 'Telegram Chat ID',
'delete_title' => 'Verwijder gebruiker',
'delete_message' => 'Weet je zeker dat je deze gebruiker wilt verwijderen: \'%1\'?',
'deleted' => 'Gebruiker verwijderd.',
@ -115,7 +112,6 @@ $sm_lang = array(
'email' => 'Email',
'sms' => 'SMS',
'pushover' => 'Pushover',
'telegram' => 'Telegram',
'no_logs' => 'No logs',
),
'servers' => array(
@ -140,7 +136,6 @@ $sm_lang = array(
'sms' => 'SMS',
'send_sms' => 'Stuur SMS',
'pushover' => 'Pushover',
'telegram' => 'Telegram',
'users' => 'Gebruikers',
'delete_title' => 'Verwijder server',
'delete_message' => 'Weet je zeker dat je deze server wilt verwijderen: \'%1\'?',
@ -169,7 +164,6 @@ $sm_lang = array(
'warning_notifications_disabled_sms' => 'SMS notificaties zijn uitgeschakeld.',
'warning_notifications_disabled_email' => 'Email notificaties zijn uitgeschakeld.',
'warning_notifications_disabled_pushover' => 'Pushover notificaties zijn uitgeschakeld.',
'warning_notifications_disabled_telegram' => 'Telegram notificaties zijn uitgeschakeld.',
'error_server_no_match' => 'Server niet gevonden.',
'error_server_label_bad_length' => 'Het label moet tussen de 1 en 255 karakters lang zijn.',
'error_server_ip_bad_length' => 'Het domein / IP moet tussen de 1 en 255 karakters lang zijn.',
@ -214,11 +208,6 @@ $sm_lang = array(
'pushover_clone_app' => 'Klik hier om je Pushover app te maken',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Voordat je Pushover kunt gebruiken moet je een <a href="%1$s" target="_blank">App registreren</a> via hun website, en daarvan de App API Token hier invullen.',
'telegram_get_id_button' => 'Vind je chat id',
'telegram_status' => 'Sta Telegram berichten toe?',
'telegram_description' => 'Telegram is een dienst die het gemakkelijk maakt om real-time notificaties te ontvangen. Zie <a href="https://telegram.org/">hun website</a> voor meer informatie.',
'telegram_api_token' => 'Telegram App API Token',
'telegram_api_token_description' => 'Voordat je Telegram kunt gebruiken moet je een Bot registreren via hun website @Botfather en daarna de API Token hier invullen.',
'alert_type' => 'Selecteer wanneer je een notificatie wilt',
'alert_type_description' => '<b>Status verandert:</b> '.
'Je ontvangt alleen bericht wanneer een server van status verandert. Dus van online -> offline of offline -> online.<br/>'.
@ -236,16 +225,13 @@ $sm_lang = array(
'log_email' => 'Log emails verstuurd bij het script?',
'log_sms' => 'Log sms berichten verstuurd bij het script?',
'log_pushover' => 'Log Pushover berichten verstuurd bij het script?',
'log_telegram' => 'Log Telegram berichten verstuurd bij het script?',
'updated' => 'De configuratie is gewijzigd.',
'tab_email' => 'Email',
'tab_sms' => 'SMS',
'tab_pushover' => 'Pushover',
'tab_telegram' => 'Telegram',
'settings_email' => 'Email instellingen',
'settings_sms' => 'SMS instellingen',
'settings_pushover' => 'Pushover instellingen',
'settings_telegram' => 'Telegram instellingen',
'settings_notification' => 'Notificatie instellingen',
'settings_log' => 'Log instellingen',
'auto_refresh' => 'Auto-refresh',
@ -259,7 +245,6 @@ $sm_lang = array(
'test_email' => 'Er zal een email verstuurd worden naar het email adres in je profiel.',
'test_sms' => 'Er zal een SMS verstuurd worden naar het telefoonnummer in je profiel.',
'test_pushover' => 'Er zal een Pushover notificatie verstuurd worden naar de user key/device in je profiel.',
'test_telegram' => 'Er zal een Telegram notificatie verstuurd worden naar het chat id in je profiel.',
'send' => 'Verstuur',
'test_subject' => 'Test',
'test_message' => 'Test bericht',
@ -272,10 +257,6 @@ $sm_lang = array(
'pushover_error' => 'De volgende fout is opgetreden bij het versturen van de Pushover notificatie: %s',
'pushover_error_noapp' => 'Kan test notificatie niet verzenden: er is geen Pushover App API token gevonden in de algemene configuratie.',
'pushover_error_nokey' => 'Kan test notificatie niet verzenden: er is geen Pushover key gevonden in je profiel.',
'telegram_sent' => 'Telegram notificatie verzonden',
'telegram_error' => 'De volgende fout is opgetreden bij het versturen van de Telegram notificatie: %s',
'telegram_error_noapi' => 'Kan test notificatie niet verzenden: er is geen Telegram Bot API token gevonden in de algemene configuratie.',
'telegram_error_noid' => 'Kan test notificatie niet verzenden: er is geen Telegram chat id gevonden in je profiel.',
'log_retention_period' => 'Log retentie periode',
'log_retention_period_description' => 'Aantal dagen dat logs van notificaties en archieven van server uptime worden bewaard. Vul 0 in om log opruiming uit te zetten.',
'log_retention_days' => 'dagen',
@ -287,13 +268,11 @@ $sm_lang = array(
'off_email_body' => "De server kon niet worden bereikt:<br/><br/>Server: %LABEL%<br/>IP: %IP%<br/>Poort: %PORT%<br/>Fout: %ERROR%<br/>Datum: %DATE%",
'off_pushover_title' => 'Server %LABEL% is DOWN',
'off_pushover_message' => "De server kon niet worden bereikt:<br/><br/>Server: %LABEL%<br/>IP: %IP%<br/>Poort: %PORT%<br/>Fout: %ERROR%<br/>Datum: %DATE%",
'off_telegram_message' => "Server %LABEL% is DOWN \n De server kon niet worden bereikt:\n \n Server: %LABEL% \n IP: %IP% \n Poort: %PORT% \n Fout: %ERROR% \n Datum: %DATE%",
'on_sms' => 'Server %LABEL% is RUNNING: ip=%IP%, poort=%PORT%',
'on_email_subject' => 'BELANGRIJK: Server %LABEL% is RUNNING',
'on_email_body' => "Server %LABEL% is weer online:<br/><br/>Server: %LABEL%<br/>IP: %IP%<br/>Poort: %PORT%<br/>Datum: %DATE%",
'on_pushover_title' => 'Server %LABEL% is RUNNING',
'on_pushover_message' => "Server %LABEL% is weer online:<br/><br/>Server: %LABEL%<br/>IP: %IP%<br/>Poort: %PORT%<br/>Datum: %DATE%",
'on_telegram_message' => "Server %LABEL% is weer online: \n \n Server: %LABEL% \n IP: %IP% \n Poort: %PORT% \n Datum: %DATE%",
),
'login' => array(
'welcome_usermenu' => 'Welkom, %user_name%',

View File

@ -1,60 +1,57 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Pepijn Over <pep@mailbox.org>
* @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
**/
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Pepijn Over <pep@mailbox.org>
* @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
**/
namespace psm\Module\Config\Controller;
use psm\Module\AbstractController;
use psm\Service\Database;
use psm\Telegram;
class ConfigController extends AbstractController {
/**
* Checkboxes
* @var array $checkboxes
*/
* Checkboxes
* @var array $checkboxes
*/
protected $checkboxes = array(
'proxy',
'email_status',
'email_smtp',
'sms_status',
'pushover_status',
'telegram_status',
'log_status',
'log_email',
'log_sms',
'log_pushover',
'log_telegram',
'show_update',
);
/**
* Fields for saving
* @var array $fields
*/
* Fields for saving
* @var array $fields
*/
protected $fields = array(
'proxy_url',
'proxy_user',
@ -69,7 +66,6 @@ class ConfigController extends AbstractController {
'sms_gateway_password',
'sms_from',
'pushover_api_token',
'telegram_api_token',
);
private $default_tab = 'general';
@ -86,10 +82,10 @@ class ConfigController extends AbstractController {
}
/**
* Populate all the config fields with values from the database
*
* @return string
*/
* Populate all the config fields with values from the database
*
* @return string
*/
protected function executeIndex() {
$this->twig->addGlobal('subtitle', psm_get_lang('menu', 'config'));
$tpl_data = $this->getLabels();
@ -108,8 +104,8 @@ class ConfigController extends AbstractController {
// generate language array
$lang_keys = psm_get_langs();
$tpl_data['language_current'] = (isset($config['language']))
? $config['language']
: 'en_US';
? $config['language']
: 'en_US';
$tpl_data['languages'] = array();
foreach($lang_keys as $key => $label) {
$tpl_data['languages'][] = array(
@ -129,9 +125,9 @@ class ConfigController extends AbstractController {
foreach($this->checkboxes as $input_key) {
$tpl_data[$input_key . '_checked'] =
(isset($config[$input_key]) && (int) $config[$input_key] == 1)
? 'checked="checked"'
: '';
(isset($config[$input_key]) && (int) $config[$input_key] == 1)
? 'checked="checked"'
: '';
}
foreach($this->fields as $input_key) {
$tpl_data[$input_key] = (isset($config[$input_key])) ? $config[$input_key] : '';
@ -139,7 +135,7 @@ class ConfigController extends AbstractController {
$tpl_data[$this->default_tab . '_active'] = 'active';
$testmodals = array('email', 'sms', 'pushover', 'telegram');
$testmodals = array('email', 'sms', 'pushover');
foreach($testmodals as $modal_id) {
$modal = new \psm\Util\Module\Modal($this->twig, 'test' . ucfirst($modal_id), \psm\Util\Module\Modal::MODAL_TYPE_OKCANCEL);
$this->addModal($modal);
@ -152,9 +148,9 @@ class ConfigController extends AbstractController {
}
/**
* If a post has been done, gather all the posted data
* and save it to the database
*/
* If a post has been done, gather all the posted data
* and save it to the database
*/
protected function executeSave() {
if(!empty($_POST)) {
// save new config
@ -163,9 +159,9 @@ class ConfigController extends AbstractController {
'sms_gateway' => $_POST['sms_gateway'],
'alert_type' => $_POST['alert_type'],
'email_smtp_security' =>
in_array($_POST['email_smtp_security'], array('', 'ssl', 'tls'))
? $_POST['email_smtp_security']
: '',
in_array($_POST['email_smtp_security'], array('', 'ssl', 'tls'))
? $_POST['email_smtp_security']
: '',
'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())),
@ -190,8 +186,6 @@ class ConfigController extends AbstractController {
$this->testSMS();
} elseif(!empty($_POST['test_pushover'])) {
$this->testPushover();
} elseif(!empty($_POST['test_telegram'])) {
$this->testTelegram();
}
if($language_refresh) {
@ -207,18 +201,16 @@ class ConfigController extends AbstractController {
$this->default_tab = 'sms';
} elseif(isset($_POST['pushover_submit']) || !empty($_POST['test_pushover'])) {
$this->default_tab = 'pushover';
} elseif(isset($_POST['telegram_submit']) || !empty($_POST['test_telegram'])) {
$this->default_tab = 'telegram';
}
}
return $this->runAction('index');
}
/**
* Execute email test
*
* @todo move test to separate class
*/
* Execute email test
*
* @todo move test to separate class
*/
protected function testEmail() {
$mail = psm_build_mail();
$message = psm_get_lang('config', 'test_message');
@ -236,10 +228,10 @@ class ConfigController extends AbstractController {
}
/**
* Execute SMS test
*
* @todo move test to separate class
*/
* Execute SMS test
*
* @todo move test to separate class
*/
protected function testSMS() {
$sms = psm_build_sms();
if($sms) {
@ -258,10 +250,10 @@ class ConfigController extends AbstractController {
}
/**
* Execute pushover test
*
* @todo move test to separate class
*/
* Execute pushover test
*
* @todo move test to separate class
*/
protected function testPushover() {
$pushover = psm_build_pushover();
$pushover->setDebug(true);
@ -295,43 +287,14 @@ class ConfigController extends AbstractController {
}
}
/**
* Execute telegram test
*
* @todo move test to separate class
*/
protected function testTelegram() {
$telegram = psm_build_telegram();
$telegram->setDebug(true);
$user = $this->getUser()->getUser();
$api_token = psm_get_conf('telegram_api_token');
if(!empty($api_token)) {
$this->addMessage(psm_get_lang('config', 'telegram_error_noapi'), 'error');
} elseif(empty($user->telegram_chat_id)) {
$this->addMessage(psm_get_lang('config', 'telegram_error_noid'), 'error');
} else {
$telegram = new Telegram($api_token);
$chat_id = $user['telegram_chat_id'];
$message->setMessage(psm_get_lang('config', 'test_message'));
$content = array('chat_id' => $chat_id, 'text' => $message);
$telegram->sendMessage($content);
}
die($bot_token);
}
protected function getLabels() {
return array(
'label_tab_email' => psm_get_lang('config', 'tab_email'),
'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_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_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'),
@ -383,12 +346,6 @@ class ConfigController extends AbstractController {
psm_get_lang('config', 'pushover_api_token_description'),
PSM_PUSHOVER_CLONE_URL
),
'label_telegram_description' => psm_get_lang('config', 'telegram_description'),
'label_telegram_status' => psm_get_lang('config', 'telegram_status'),
'label_telegram_description' => psm_get_lang('config', 'telegram_description'),
'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_alert_type' => psm_get_lang('config', 'alert_type'),
'label_alert_type_description' => psm_get_lang('config', 'alert_type_description'),
'label_alert_type_status' => psm_get_lang('config', 'alert_type_status'),
@ -399,7 +356,6 @@ class ConfigController extends AbstractController {
'label_log_email' => psm_get_lang('config', 'log_email'),
'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_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'),

View File

@ -214,7 +214,6 @@ class InstallController extends AbstractController {
'level' => PSM_USER_ADMIN,
'pushover_key' => '',
'pushover_device' => '',
'telegram_chat_id' => '',
);
$validator = $this->container->get('util.user.validator');

View File

@ -73,7 +73,6 @@ abstract class AbstractServerController extends AbstractController {
`s`.`email`,
`s`.`sms`,
`s`.`pushover`,
`s`.`telegram`,
`s`.`warning_threshold`,
`s`.`warning_threshold_counter`,
`s`.`timeout`,
@ -105,7 +104,6 @@ abstract class AbstractServerController extends AbstractController {
$server['email'] = psm_get_lang('system', $server['email']);
$server['sms'] = psm_get_lang('system', $server['sms']);
$server['pushover'] = psm_get_lang('system', $server['pushover']);
$server['telegram'] = psm_get_lang('system', $server['telegram']);
if($server['status'] == 'on' && $server['warning_threshold_counter'] > 0) {
$server['status'] = 'warning';

View File

@ -49,7 +49,6 @@ class LogController extends AbstractServerController {
'label_email' => psm_get_lang('log', 'email'),
'label_sms' => psm_get_lang('log', 'sms'),
'label_pushover' => psm_get_lang('log', 'pushover'),
'label_telegram' => psm_get_lang('log', 'telegram'),
'label_title' => psm_get_lang('log', 'title'),
'label_server' => psm_get_lang('servers', 'server'),
'label_type' => psm_get_lang('log', 'type'),
@ -59,7 +58,7 @@ class LogController extends AbstractServerController {
'label_no_logs' => psm_get_lang('log', 'no_logs'),
'tabs' => array(),
);
$log_types = array('status', 'email', 'sms', 'pushover', 'telegram');
$log_types = array('status', 'email', 'sms', 'pushover');
foreach($log_types as $key) {
$records = $this->getEntries($key);

View File

@ -92,7 +92,6 @@ class ServerController extends AbstractServerController {
'email' => 'icon-envelope',
'sms' => 'icon-mobile',
'pushover' => 'icon-pushover',
'telegram' => 'icon-telegram',
);
$servers = $this->getServers();
@ -207,11 +206,10 @@ class ServerController extends AbstractServerController {
'edit_email_selected_' . $edit_server['email'] => 'selected="selected"',
'edit_sms_selected_' . $edit_server['sms'] => 'selected="selected"',
'edit_pushover_selected_' . $edit_server['pushover'] => 'selected="selected"',
'edit_telegram_selected_' . $edit_server['telegram'] => 'selected="selected"',
));
}
$notifications = array('email', 'sms', 'pushover', 'telegram');
$notifications = array('email', 'sms', 'pushover');
foreach($notifications as $notification) {
if(psm_get_conf($notification . '_status') == 0) {
$tpl_data['warning_' . $notification] = true;
@ -270,7 +268,6 @@ class ServerController extends AbstractServerController {
'email' => in_array($_POST['email'], array('yes', 'no')) ? $_POST['email'] : 'no',
'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',
);
// make sure websites start with http://
if($clean['type'] == 'website' && substr($clean['ip'], 0, 4) != 'http') {
@ -475,7 +472,6 @@ class ServerController extends AbstractServerController {
'label_sms' => psm_get_lang('servers', 'sms'),
'label_send_sms' => psm_get_lang('servers', 'send_sms'),
'label_pushover' => psm_get_lang('servers', 'pushover'),
'label_telegram' => psm_get_lang('servers', 'telegram'),
'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'),

View File

@ -35,7 +35,7 @@ class ProfileController extends AbstractController {
* Editable fields for the profile
* @var array $profile_fields
*/
protected $profile_fields = array('name', 'user_name', 'mobile', 'pushover_key', 'pushover_device', 'telegram_chat_id', 'email');
protected $profile_fields = array('name', 'user_name', 'mobile', 'pushover_key', 'pushover_device', 'email');
function __construct(Database $db, \Twig_Environment $twig) {
parent::__construct($db, $twig);
@ -66,10 +66,6 @@ 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_telegram_get_id_button' => psm_get_lang('config', 'telegram_get_id_button'),
'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'),
'label_email' => psm_get_lang('users', 'email'),
'label_save' => psm_get_lang('system', 'save'),
'form_action' => psm_build_url(array(

View File

@ -89,7 +89,7 @@ class UserController extends AbstractController {
$users = $this->db->select(
PSM_DB_PREFIX.'users',
null,
array('user_id', 'user_name', 'level', 'name', 'mobile', 'pushover_key', 'pushover_device', 'telegram_chat_id', 'email'),
array('user_id', 'user_name', 'level', 'name', 'mobile', 'pushover_key', 'pushover_device', 'email'),
null,
array('name')
);
@ -133,7 +133,7 @@ class UserController extends AbstractController {
*/
protected function executeEdit() {
$user_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$fields_prefill = array('name', 'user_name', 'mobile', 'pushover_key', 'pushover_device', 'telegram_chat_id', 'email');
$fields_prefill = array('name', 'user_name', 'mobile', 'pushover_key', 'pushover_device', 'email');
if($user_id == 0) {
// insert mode
@ -215,7 +215,7 @@ class UserController extends AbstractController {
}
$user_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0;
$fields = array('name', 'user_name', 'password', 'password_repeat', 'level', 'mobile', 'pushover_key', 'pushover_device', 'telegram_chat_id', 'email');
$fields = array('name', 'user_name', 'password', 'password_repeat', 'level', 'mobile', 'pushover_key', 'pushover_device', 'email');
$clean = array();
foreach($fields as $field) {
if(isset($_POST[$field])) {
@ -333,9 +333,6 @@ class UserController 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_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'),
'label_email' => psm_get_lang('users', 'email'),
'label_servers' => psm_get_lang('menu', 'server'),
'label_action' => psm_get_lang('system', 'action'),

View File

@ -1,67 +0,0 @@
<?php
namespace psm\Telegram;
class Telegram {
$file = 'text.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "John Smith\n";
// Write the contents back to the file
file_put_contents($file, $current);
private $data = array();
public function __construct($bot_token) {
$this->bot_token = $bot_token;
$this->data = $this->getData();
}
public function endpoint($api, array $content, $post = true) {
$url = 'https://api.telegram.org/bot' . $this->bot_token . '/' . $api;
if ($post)
$reply = $this->sendAPIRequest($url, $content);
else
$reply = $this->sendAPIRequest($url, array(), false);
return json_decode($reply, true);
}
public function sendMessage(array $content) {
return $this->endpoint("sendMessage", $content);
}
public function getData() {
if (empty($this->data)) {
$rawData = file_get_contents("php://input");
return json_decode($rawData, true);
} else {
return $this->data;
}
}
/// Set the data currently used
public function setData(array $data) {
$this->data = $data;
}
private function sendAPIRequest($url, array $content, $post = true) {
if (isset($content['chat_id'])) {
$url = $url . "?chat_id=" . $content['chat_id'];
unset($content['chat_id']);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($post) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
if($result === false) {
$result = json_encode(array('ok'=>false, 'curl_error_code' => curl_errno($ch), 'curl_error' => curl_error($ch)));
}
curl_close($ch);
//return $result;
}
die($url);
}

View File

@ -1,73 +1,73 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Pepijn Over <pep@mailbox.org>
* @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.1.0
**/
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Pepijn Over <pep@mailbox.org>
* @copyright Copyright (c) 2008-2017 Pepijn Over <pep@mailbox.org>
* @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3
* @version Release: @package_version@
* @link http://www.phpservermonitor.org/
* @since phpservermon 2.1.0
**/
namespace psm\Util\Install;
/**
* Installer class.
*
* Executes the queries to install/upgrade phpservermon.
*/
* Installer class.
*
* Executes the queries to install/upgrade phpservermon.
*/
class Installer {
/**
* Database service
* @var \psm\Service\Database $db
*/
* Database service
* @var \psm\Service\Database $db
*/
protected $db;
/**
* Log callback
* @var callable $logger
*/
* Log callback
* @var callable $logger
*/
protected $logger;
/**
* Log of executed queries
* @var array $queries
*/
* Log of executed queries
* @var array $queries
*/
protected $queries = array();
/**
* Open a new installer instance
* @param \psm\Service\Database $db
* @param callable $logger
*/
* Open a new installer instance
* @param \psm\Service\Database $db
* @param callable $logger
*/
function __construct(\psm\Service\Database $db, $logger = null) {
$this->db = $db;
$this->logger = $logger;
}
/**
* Check if an upgrade is required for the current version.
* @return boolean
* @see upgrade()
*/
* Check if an upgrade is required for the current version.
* @return boolean
* @see upgrade()
*/
public function isUpgradeRequired() {
$version_db = psm_get_conf('version');
@ -88,10 +88,10 @@ class Installer {
}
/**
* Log a message to the logger callable (if any)
* @param string|array $msg
* @return \psm\Util\Install\Installer
*/
* Log a message to the logger callable (if any)
* @param string|array $msg
* @return \psm\Util\Install\Installer
*/
protected function log($msg) {
if(is_callable($this->logger)) {
$msg = (!is_array($msg)) ? array($msg) : $msg;
@ -104,10 +104,10 @@ class Installer {
}
/**
* Execute one or more queries. Does no fetching or anything, so execute only.
* @param string|array $query
* @return \psm\Util\Install\Installer
*/
* Execute one or more queries. Does no fetching or anything, so execute only.
* @param string|array $query
* @return \psm\Util\Install\Installer
*/
protected function execSQL($query) {
$query = (!is_array($query)) ? array($query) : $query;
@ -119,153 +119,148 @@ class Installer {
}
/**
* Retrieve table queries for install
*/
* Retrieve table queries for install
*/
public function install() {
$this->installTables();
$this->log('Populating database...');
$queries = array();
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`, `telegram`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes', 'yes')";
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "servers` (`ip`, `port`, `label`, `type`, `pattern`, `status`, `error`, `rtime`, `last_online`, `last_check`, `active`, `email`, `sms`, `pushover`) VALUES ('http://sourceforge.net/index.php', 80, 'SourceForge', 'website', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', 'yes', 'yes', 'yes', 'yes'), ('smtp.gmail.com', 465, 'Gmail SMTP', 'service', '', 'on', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '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'),
('proxy', '0'),
('proxy_url', ''),
('proxy_user', ''),
('proxy_password', ''),
('email_status', '1'),
('email_from_email', 'monitor@example.org'),
('email_from_name', 'Server Monitor'),
('email_smtp', ''),
('email_smtp_host', ''),
('email_smtp_port', ''),
('email_smtp_security', ''),
('email_smtp_username', ''),
('email_smtp_password', ''),
('sms_status', '0'),
('sms_gateway', 'mollie'),
('sms_gateway_username', 'username'),
('sms_gateway_password', 'password'),
('sms_from', '1234567890'),
('pushover_status', '0'),
('pushover_api_token', ''),
('telegram_status', '0'),
('telegram_api_token', ''),
('password_encrypt_key', '" . sha1(microtime()) . "'),
('alert_type', 'status'),
('log_status', '1'),
('log_email', '1'),
('log_sms', '1'),
('log_pushover', '1'),
('log_telegram', '1'),
('log_retention_period', '365'),
('version', '" . PSM_VERSION . "'),
('version_update_check', '" . PSM_VERSION . "'),
('auto_refresh_servers', '0'),
('show_update', '1'),
('last_update_check', '0'),
('cron_running', '0'),
('cron_running_time', '0');";
('language', 'en_US'),
('proxy', '0'),
('proxy_url', ''),
('proxy_user', ''),
('proxy_password', ''),
('email_status', '1'),
('email_from_email', 'monitor@example.org'),
('email_from_name', 'Server Monitor'),
('email_smtp', ''),
('email_smtp_host', ''),
('email_smtp_port', ''),
('email_smtp_security', ''),
('email_smtp_username', ''),
('email_smtp_password', ''),
('sms_status', '0'),
('sms_gateway', 'mollie'),
('sms_gateway_username', 'username'),
('sms_gateway_password', 'password'),
('sms_from', '1234567890'),
('pushover_status', '0'),
('pushover_api_token', ''),
('password_encrypt_key', '" . sha1(microtime()) . "'),
('alert_type', 'status'),
('log_status', '1'),
('log_email', '1'),
('log_sms', '1'),
('log_pushover', '1'),
('log_retention_period', '365'),
('version', '" . PSM_VERSION . "'),
('version_update_check', '" . PSM_VERSION . "'),
('auto_refresh_servers', '0'),
('show_update', '1'),
('last_update_check', '0'),
('cron_running', '0'),
('cron_running_time', '0');";
$this->execSQL($queries);
}
/**
* Install the tables for the monitor
*/
* Install the tables for the monitor
*/
protected function installTables() {
$tables = array(
PSM_DB_PREFIX . 'config' => "CREATE TABLE `" . PSM_DB_PREFIX . "config` (
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'users' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users` (
`user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) NOT NULL COMMENT 'user''s name, unique',
`password` varchar(255) NOT NULL COMMENT 'user''s password in salted and hashed format',
`password_reset_hash` char(40) DEFAULT NULL COMMENT 'user''s password reset code',
`password_reset_timestamp` bigint(20) DEFAULT NULL COMMENT 'timestamp of the password reset request',
`rememberme_token` varchar(64) DEFAULT NULL COMMENT 'user''s remember-me cookie token',
`level` tinyint(2) unsigned NOT NULL DEFAULT '20',
`name` varchar(255) NOT NULL,
`mobile` varchar(15) NOT NULL,
`pushover_key` varchar(255) NOT NULL,
`pushover_device` varchar(255) NOT NULL,
`telegram_chat_id` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `unique_username` (`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
`user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) NOT NULL COMMENT 'user''s name, unique',
`password` varchar(255) NOT NULL COMMENT 'user''s password in salted and hashed format',
`password_reset_hash` char(40) DEFAULT NULL COMMENT 'user''s password reset code',
`password_reset_timestamp` bigint(20) DEFAULT NULL COMMENT 'timestamp of the password reset request',
`rememberme_token` varchar(64) DEFAULT NULL COMMENT 'user''s remember-me cookie token',
`level` tinyint(2) unsigned NOT NULL DEFAULT '20',
`name` varchar(255) NOT NULL,
`mobile` varchar(15) NOT NULL,
`pushover_key` varchar(255) NOT NULL,
`pushover_device` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `unique_username` (`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'users_preferences' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
`user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`, `key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
`user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`, `key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'users_servers' => "CREATE TABLE `" . PSM_DB_PREFIX . "users_servers` (
`user_id` INT( 11 ) UNSIGNED NOT NULL ,
`server_id` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `user_id` , `server_id` )
) ENGINE = MYISAM ;",
`user_id` INT( 11 ) UNSIGNED NOT NULL ,
`server_id` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `user_id` , `server_id` )
) ENGINE = MYISAM ;",
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,
`message` varchar(255) NOT NULL,
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`log_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'log_users' => "CREATE TABLE `" . PSM_DB_PREFIX . "log_users` (
`log_id` int(11) UNSIGNED NOT NULL ,
`user_id` int(11) UNSIGNED NOT NULL ,
PRIMARY KEY (`log_id`, `user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
`log_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`type` enum('status','email','sms','pushover') NOT NULL,
`message` varchar(255) NOT NULL,
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`log_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'log_users' => "CREATE TABLE `" . PSM_DB_PREFIX . "log_users` (
`log_id` int(11) UNSIGNED NOT NULL ,
`user_id` int(11) UNSIGNED NOT NULL ,
PRIMARY KEY (`log_id`, `user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'servers' => "CREATE TABLE `" . PSM_DB_PREFIX . "servers` (
`server_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip` varchar(500) NOT NULL,
`port` int(5) unsigned NOT NULL,
`label` varchar(255) NOT NULL,
`type` enum('ping','service','website') NOT NULL default 'service',
`pattern` varchar(255) NOT NULL,
`status` enum('on','off') NOT NULL default 'on',
`error` varchar(255) NULL,
`rtime` FLOAT(9, 7) NULL,
`last_online` datetime NULL,
`last_check` datetime NULL,
`active` enum('yes','no') NOT NULL default 'yes',
`email` enum('yes','no') NOT NULL default 'yes',
`sms` enum('yes','no') NOT NULL default 'no',
`pushover` enum('yes','no') NOT NULL default 'yes',
`telegram` 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',
`timeout` smallint(1) unsigned NULL DEFAULT NULL,
`website_username` varchar(255) DEFAULT NULL,
`website_password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
`server_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip` varchar(500) NOT NULL,
`port` int(5) unsigned NOT NULL,
`label` varchar(255) NOT NULL,
`type` enum('ping','service','website') NOT NULL default 'service',
`pattern` varchar(255) NOT NULL,
`status` enum('on','off') NOT NULL default 'on',
`error` varchar(255) NULL,
`rtime` FLOAT(9, 7) NULL,
`last_online` datetime NULL,
`last_check` datetime NULL,
`active` enum('yes','no') NOT NULL default 'yes',
`email` enum('yes','no') NOT NULL default 'yes',
`sms` enum('yes','no') NOT NULL default 'no',
`pushover` 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',
`timeout` smallint(1) unsigned NULL DEFAULT NULL,
`website_username` varchar(255) DEFAULT NULL,
`website_password` varchar(255) DEFAULT NULL,
PRIMARY KEY (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'servers_uptime' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_uptime` (
`servers_uptime_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` datetime NOT NULL,
`status` tinyint(1) unsigned NOT NULL,
`latency` float(9,7) DEFAULT NULL,
PRIMARY KEY (`servers_uptime_id`),
KEY `server_id` (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
`servers_uptime_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` datetime NOT NULL,
`status` tinyint(1) unsigned NOT NULL,
`latency` float(9,7) DEFAULT NULL,
PRIMARY KEY (`servers_uptime_id`),
KEY `server_id` (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'servers_history' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_history` (
`servers_history_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` date NOT NULL,
`latency_min` float(9,7) NOT NULL,
`latency_avg` float(9,7) NOT NULL,
`latency_max` float(9,7) NOT NULL,
`checks_total` int(11) unsigned NOT NULL,
`checks_failed` int(11) unsigned NOT NULL,
PRIMARY KEY (`servers_history_id`),
UNIQUE KEY `server_id_date` (`server_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
`servers_history_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` date NOT NULL,
`latency_min` float(9,7) NOT NULL,
`latency_avg` float(9,7) NOT NULL,
`latency_max` float(9,7) NOT NULL,
`checks_total` int(11) unsigned NOT NULL,
`checks_failed` int(11) unsigned NOT NULL,
PRIMARY KEY (`servers_history_id`),
UNIQUE KEY `server_id_date` (`server_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
);
foreach($tables as $name => $sql) {
@ -281,11 +276,11 @@ class Installer {
}
/**
* Populate the tables and perform upgrades if necessary
* @param string $version_from
* @param string $version_to
* @see isUpgradeRequired()
*/
* Populate the tables and perform upgrades if necessary
* @param string $version_from
* @param string $version_to
* @see isUpgradeRequired()
*/
public function upgrade($version_from, $version_to) {
if(version_compare($version_from, '2.1.0', '<')) {
$this->upgrade210();
@ -303,8 +298,8 @@ class Installer {
}
/**
* Upgrade for v2.1.0 release
*/
* Upgrade for v2.1.0 release
*/
protected function upgrade210() {
$queries = array();
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "config` DROP `config_id`;";
@ -323,8 +318,8 @@ class Installer {
}
/**
* Upgrade for v3.0.0 release
*/
* Upgrade for v3.0.0 release
*/
protected function upgrade300() {
$queries = array();
// language is now stored as language code (ISO 639-1) + country code (ISO 3166-1)
@ -352,140 +347,135 @@ class Installer {
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` CHANGE `user_id` `user_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users`
ADD `user_name` varchar(64) COLLATE utf8_general_ci NOT NULL COMMENT 'user\'s name, unique' AFTER `user_id`,
ADD `password` varchar(255) COLLATE utf8_general_ci NOT NULL COMMENT 'user\'s password in salted and hashed format' AFTER `user_name`,
ADD `password_reset_hash` char(40) COLLATE utf8_general_ci DEFAULT NULL COMMENT 'user\'s password reset code' AFTER `password`,
ADD `password_reset_timestamp` bigint(20) DEFAULT NULL COMMENT 'timestamp of the password reset request' AFTER `password_reset_hash`,
ADD `rememberme_token` varchar(64) COLLATE utf8_general_ci DEFAULT NULL COMMENT 'user\'s remember-me cookie token' AFTER `password_reset_timestamp`,
ADD `level` TINYINT( 2 ) UNSIGNED NOT NULL DEFAULT '20' AFTER `rememberme_token`;";
ADD `user_name` varchar(64) COLLATE utf8_general_ci NOT NULL COMMENT 'user\'s name, unique' AFTER `user_id`,
ADD `password` varchar(255) COLLATE utf8_general_ci NOT NULL COMMENT 'user\'s password in salted and hashed format' AFTER `user_name`,
ADD `password_reset_hash` char(40) COLLATE utf8_general_ci DEFAULT NULL COMMENT 'user\'s password reset code' AFTER `password`,
ADD `password_reset_timestamp` bigint(20) DEFAULT NULL COMMENT 'timestamp of the password reset request' AFTER `password_reset_hash`,
ADD `rememberme_token` varchar(64) COLLATE utf8_general_ci DEFAULT NULL COMMENT 'user\'s remember-me cookie token' AFTER `password_reset_timestamp`,
ADD `level` TINYINT( 2 ) UNSIGNED NOT NULL DEFAULT '20' AFTER `rememberme_token`;";
// make sure all current users are admins (previously we didnt have non-admins):
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "users` SET `user_name`=`email`, `level`=10;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD UNIQUE `unique_username` ( `user_name` );";
$queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_uptime` (
`servers_uptime_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` datetime NOT NULL,
`status` tinyint(1) unsigned NOT NULL,
`latency` float(9,7) DEFAULT NULL,
PRIMARY KEY (`servers_uptime_id`),
KEY `server_id` (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
`servers_uptime_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` datetime NOT NULL,
`status` tinyint(1) unsigned NOT NULL,
`latency` float(9,7) DEFAULT NULL,
PRIMARY KEY (`servers_uptime_id`),
KEY `server_id` (`server_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_history` (
`servers_history_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` date NOT NULL,
`latency_min` float(9,7) NOT NULL,
`latency_avg` float(9,7) NOT NULL,
`latency_max` float(9,7) NOT NULL,
`checks_total` int(11) unsigned NOT NULL,
`checks_failed` int(11) unsigned NOT NULL,
PRIMARY KEY (`servers_history_id`),
UNIQUE KEY `server_id_date` (`server_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "servers_history` (
`servers_history_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`server_id` int(11) unsigned NOT NULL,
`date` date NOT NULL,
`latency_min` float(9,7) NOT NULL,
`latency_avg` float(9,7) NOT NULL,
`latency_max` float(9,7) NOT NULL,
`checks_total` int(11) unsigned NOT NULL,
`checks_failed` int(11) unsigned NOT NULL,
PRIMARY KEY (`servers_history_id`),
UNIQUE KEY `server_id_date` (`server_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$queries[] = "CREATE TABLE `" . PSM_DB_PREFIX . "users_servers` (
`user_id` INT( 11 ) UNSIGNED NOT NULL ,
`server_id` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `user_id` , `server_id` )
) ENGINE = MYISAM ;";
$this->execSQL($queries);
$queries[] = "CREATE TABLE `" . PSM_DB_PREFIX . "users_servers` (
`user_id` INT( 11 ) UNSIGNED NOT NULL ,
`server_id` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `user_id` , `server_id` )
) ENGINE = MYISAM ;";
$this->execSQL($queries);
// from 3.0 all user-server relations are in a separate table
$users = $this->db->select(PSM_DB_PREFIX . 'users', null, array('user_id', 'server_id'));
foreach($users as $user) {
$idc = array();
if($user['server_id'] == '') {
continue;
}
if(strpos($user['server_id'], ',') === false) {
$idc[] = $user['server_id'];
} else {
$idc = explode(',', $user['server_id']);
}
foreach($idc as $id) {
$this->db->save(PSM_DB_PREFIX . 'users_servers', array(
'user_id' => $user['user_id'],
'server_id' => $id,
));
}
}
$this->execSQL("ALTER TABLE `".PSM_DB_PREFIX."users` DROP `server_id`;");
}
// from 3.0 all user-server relations are in a separate table
$users = $this->db->select(PSM_DB_PREFIX . 'users', null, array('user_id', 'server_id'));
foreach($users as $user) {
$idc = array();
if($user['server_id'] == '') {
continue;
}
if(strpos($user['server_id'], ',') === false) {
$idc[] = $user['server_id'];
} else {
$idc = explode(',', $user['server_id']);
}
foreach($idc as $id) {
$this->db->save(PSM_DB_PREFIX . 'users_servers', array(
'user_id' => $user['user_id'],
'server_id' => $id,
));
}
}
$this->execSQL("ALTER TABLE `".PSM_DB_PREFIX."users` DROP `server_id`;");
}
/**
* Upgrade for v3.1.0 release
*/
protected function upgrade310() {
$queries = array();
psm_update_conf('log_retention_period', '365');
/**
* Upgrade for v3.1.0 release
*/
protected function upgrade310() {
$queries = array();
psm_update_conf('log_retention_period', '365');
psm_update_conf('pushover_status', 0);
psm_update_conf('log_pushover', 1);
psm_update_conf('pushover_api_token', '');
psm_update_conf('telegram_status', 0);
psm_update_conf('log_telegram', 1);
psm_update_conf('telegram_api_token', '');
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `pushover_key` VARCHAR( 255 ) NOT NULL AFTER `mobile`;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `pushover_device` VARCHAR( 255 ) NOT NULL AFTER `pushover_key`;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `telegram_chat_id` VARCHAR( 255 ) NOT NULL AFTER `pushover_device`;";
psm_update_conf('pushover_status', 0);
psm_update_conf('log_pushover', 1);
psm_update_conf('pushover_api_token', '');
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `pushover_key` VARCHAR( 255 ) NOT NULL AFTER `mobile`;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "users` ADD `pushover_device` VARCHAR( 255 ) NOT NULL AFTER `pushover_key`;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `pushover` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `sms`;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `telegram` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `pushover`;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover', 'telegram' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `pushover` ENUM( 'yes','no' ) NOT NULL DEFAULT 'yes' AFTER `sms`;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `type` `type` ENUM( 'status', 'email', 'sms', 'pushover' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `timeout` smallint(1) unsigned NULL DEFAULT NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `timeout` smallint(1) unsigned NULL DEFAULT NULL;";
$queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
$queries[] = "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
`user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`, `key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$this->execSQL($queries);
}
$this->execSQL($queries);
}
/**
* Upgrade for v3.2.0 release
*/
protected function upgrade320() {
$queries = array();
/**
* Upgrade for v3.2.0 release
*/
protected function upgrade320() {
$queries = array();
psm_update_conf('password_encrypt_key', sha1(microtime()));
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `ip` `ip` VARCHAR(500) NOT NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `website_username` varchar(255) NULL, ADD `website_password` varchar(255) NULL AFTER `website_username`;";
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
('proxy', '0'),
('proxy_url', ''),
('proxy_user', ''),
('proxy_password', '');";
psm_update_conf('password_encrypt_key', sha1(microtime()));
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` CHANGE `ip` `ip` VARCHAR(500) NOT NULL;";
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "servers` ADD `website_username` varchar(255) NULL, ADD `website_password` varchar(255) NULL AFTER `website_username`;";
$queries[] = "INSERT INTO `" . PSM_DB_PREFIX . "config` (`key`, `value`) VALUE
('proxy', '0'),
('proxy_url', ''),
('proxy_user', ''),
('proxy_password', '');";
$this->execSQL($queries);
$this->execSQL($queries);
// Create log_users table
$this->execSQL("CREATE TABLE `" . PSM_DB_PREFIX . "log_users` (
`log_id` int(11) UNSIGNED NOT NULL ,
`user_id` int(11) UNSIGNED NOT NULL ,
PRIMARY KEY (`log_id`, `user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
// Create log_users table
$this->execSQL("CREATE TABLE `" . PSM_DB_PREFIX . "log_users` (
`log_id` int(11) UNSIGNED NOT NULL ,
`user_id` int(11) UNSIGNED NOT NULL ,
PRIMARY KEY (`log_id`, `user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
// Migrate the data
$logs = $this->db->select(PSM_DB_PREFIX . 'log', null, array('log_id', 'user_id'));
foreach ($logs as $log) {
// Validation
if (empty($log['user_id']) || trim($log['user_id']) == '') {
continue;
}
// Migrate the data
$logs = $this->db->select(PSM_DB_PREFIX . 'log', null, array('log_id', 'user_id'));
foreach ($logs as $log) {
// Validation
if (empty($log['user_id']) || trim($log['user_id']) == '') {
continue;
}
// Insert into new table
foreach (explode(',', $log['user_id']) as $user_id) {
psm_add_log_user($log['log_id'], $user_id);
}
}
// Insert into new table
foreach (explode(',', $log['user_id']) as $user_id) {
psm_add_log_user($log['log_id'], $user_id);
}
}
// Drop old user_id('s) column
$this->execSQL("ALTER TABLE `" . PSM_DB_PREFIX . "log` DROP COLUMN `user_id`;");
}
}
// Drop old user_id('s) column
$this->execSQL("ALTER TABLE `" . PSM_DB_PREFIX . "log` DROP COLUMN `user_id`;");
}
}

View File

@ -56,7 +56,7 @@ class UpdateManager extends ContainerAware {
)";
}
$sql = "SELECT `s`.`server_id`,`s`.`ip`,`s`.`port`,`s`.`label`,`s`.`type`,`s`.`pattern`,`s`.`status`,`s`.`active`,`s`.`email`,`s`.`sms`,`s`.`pushover`,`s`.`telegram`
$sql = "SELECT `s`.`server_id`,`s`.`ip`,`s`.`port`,`s`.`label`,`s`.`type`,`s`.`pattern`,`s`.`status`,`s`.`active`,`s`.`email`,`s`.`sms`,`s`.`pushover`
FROM `".PSM_DB_PREFIX."servers` AS `s`
{$sql_join}
WHERE `active`='yes' ";

View File

@ -33,7 +33,6 @@
*/
namespace psm\Util\Server\Updater;
use psm\Service\Database;
use psm\Telegram;
class StatusNotifier {
@ -56,17 +55,11 @@ class StatusNotifier {
protected $send_sms = false;
/**
* Send pushover?
* Send sms?
* @var boolean $send_pushover
*/
protected $send_pushover = false;
/**
* Send telegram?
* @var boolean $send_telegram
*/
protected $send_telegram = false;
/**
* Save log records?
* @var boolean $save_log
@ -103,7 +96,6 @@ class StatusNotifier {
$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');
}
@ -129,7 +121,7 @@ class StatusNotifier {
$this->server = $this->db->selectRow(PSM_DB_PREFIX . 'servers', array(
'server_id' => $server_id,
), array(
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover', 'telegram',
'server_id', 'ip', 'port', 'label', 'type', 'pattern', 'status', 'error', 'active', 'email', 'sms', 'pushover',
));
if(empty($this->server)) {
return false;
@ -196,12 +188,6 @@ class StatusNotifier {
$this->notifyByPushover($users);
}
// check if telegram is enabled for this server
if($this->send_telegram && $this->server['telegram'] == 'yes') {
// yay lets wake those nerds up!
$this->notifyByTelegram($users);
}
return $notify;
}
@ -291,46 +277,6 @@ class StatusNotifier {
$pushover->send();
}
}
/**
* This functions performs the telegram notifications
*
* @param array $users
* @return boolean
*/
protected function notifyByTelegram($users) {
// Remove users that have no telegram_chat_id
foreach($users as $k => $user) {
if (trim($user['telegram_chat_id']) == '') {
unset($users[$k]);
}
}
// Validation
if (empty($users)) {
return;
}
// Telegram
$message = psm_parse_msg($this->status_new, 'telegram_message', $this->server);
$message = str_replace('<br/>', "\n", $message);
// Log
if(psm_get_conf('log_telegram')) {
$log_id = psm_add_log($this->server_id, 'telegram', $message);
}
foreach($users as $user) {
// Log
if(!empty($log_id)) {
psm_add_log_user($log_id, $user['user_id']);
}
$bot_token = psm_get_conf('telegram_api_token');
$telegram = new Telegram($bot_token);
$chat_id = $user['telegram_chat_id'];
$content = array('chat_id' => $chat_id, 'text' => $message);
$telegram->sendMessage($content);
}
}
/**
* This functions performs the text message notifications

View File

@ -1,303 +1,270 @@
{% import 'main/macros.tpl.html' as macro %}
<form class="form-horizontal" name="edit_config" action="index.php?mod=config&amp;action=save" id="edit_config" method="post">
<ul class="nav nav-tabs">
<li class="{{ general_active }}"><a href="#config-general" data-toggle="tab">{{ label_general }}</a></li>
<li class="{{ email_active }}"><a href="#config-email" data-toggle="tab">{{ label_tab_email }}</a></li>
<li class="{{ sms_active }}"><a href="#config-sms" data-toggle="tab">{{ label_tab_sms }}</a></li>
<li class="{{ pushover_active }}"><a href="#config-pushover" data-toggle="tab">{{ label_tab_pushover }}</a></li>
<li class="{{ telegram_active }}"><a href="#config-telegram" data-toggle="tab">{{ label_tab_telegram }}</a></li>
</ul>
<div class="tab-content well">
<div id="config-general" class="tab-pane {{ general_active }}">
<fieldset>
<legend>{{ label_general }}</legend>
<div class="control-group">
<label class="control-label" for="language">{{ label_language }}</label>
<div class="controls">
<select id="language" name="language">
{% for language in languages %}
<option value="{{ language.value }}" {% if language.value == language_current %} selected="selected" {% endif %}>{{ language.label }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="show_update"><input type="checkbox" id="show_update" name="show_update[]" {{ show_update_checked|raw }} /> {{ label_show_update }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="auto_refresh_servers">{{ label_auto_refresh }}</label>
<div class="controls">
<input type="text" class="input-mini" id="auto_refresh_servers" name="auto_refresh_servers" value="{{ auto_refresh_servers }}" maxlength="10" data-toggle="tooltip" title="{{ label_auto_refresh_servers }}" />&nbsp;{{ label_seconds }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_encrypt_key">
{{ label_password_encrypt_key }}
</label>
<div class="controls">
<input type="text" class="input-xxlarge" id="password_encrypt_key" name="password_encrypt_key"
value="{{ password_encrypt_key }}" maxlength="40" data-toggle="tooltip"
title="{{ label_password_encrypt_key_note }}"/>
</div>
</div>
</fieldset>
<fieldset>
<legend>{{ label_settings_notification }}</legend>
<div class="control-group">
<label class="control-label" for="alert_type">{{ label_alert_type }}</label>
<div class="controls">
<select id="alert_type" name="alert_type">
<option value="status" {{ alert_type_selected_status|raw }}>{{ label_alert_type_status }}</option>
<option value="offline" {{ alert_type_selected_offline|raw }}>{{ label_alert_type_offline }}</option>
<option value="always" {{ alert_type_selected_always|raw }}>{{ label_alert_type_always }}</option>
</select>
<p class="help-block">{{ label_alert_type_description|raw }}</p>
</div>
</div>
</fieldset>
<fieldset>
<legend>{{ label_settings_log }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_status" name="log_status[]" {{ log_status_checked|raw }} data-toggle="tooltip" title="{{ label_log_status_description }}" /> {{ label_log_status }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="log_retention_period">{{ label_log_retention_period }}</label>
<div class="controls">
<input type="text" class="input-mini" id="log_retention_period" name="log_retention_period" value="{{ log_retention_period }}" data-toggle="tooltip" title="{{ label_log_retention_period_description }}" />&nbsp;{{ label_log_retention_days }}
</div>
</div>
<legend>{{ label_settings_proxy }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="proxy"><input type="checkbox" id="proxy" name="proxy[]" {{ proxy_checked|raw }} />{{ label_proxy }}</label>
<p class="help-block">{{ label_alert_proxy|raw }}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="proxy_url">{{ label_proxy_url }}</label>
<div class="controls">
<input type="text" id="proxy_url" name="proxy_url" value="{{ proxy_url }}" maxlength="100" placeholder="{{ label_proxy_url }}" />
<p class="help-block">{{ label_alert_proxy_url|raw }}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="proxy_user">{{ label_proxy_user }}</label>
<div class="controls">
<input type="text" id="proxy_user" name="proxy_user" value="{{ proxy_user }}" maxlength="100" placeholder="{{ label_proxy_user }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="proxy_password">{{ label_proxy_password }}</label>
<div class="controls">
<input type="password" id="proxy_password" name="proxy_password" value="{{ proxy_password }}" maxlength="100" placeholder="{{ label_proxy_password }}" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="general_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-email" class="tab-pane {{ email_active }}">
<fieldset>
<legend>{{ label_settings_email }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="email_status"><input type="checkbox" id="email_status" name="email_status[]" {{ email_status_checked|raw }} /> {{ label_email_status }}</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_email" name="log_email[]" {{ log_email_checked|raw }} /> {{ label_log_email }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_from_name">{{ label_email_from_name }}</label>
<div class="controls">
<input type="text" id="email_from_name" name="email_from_name" value="{{ email_from_name }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_from_email">{{ label_email_from_email }}</label>
<div class="controls">
<input type="text" id="email_from_email" name="email_from_email" value="{{ email_from_email }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="email_smtp"><input type="checkbox" id="email_smtp" name="email_smtp[]" {{ email_smtp_checked|raw }} />{{ label_email_smtp }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_host">{{ label_email_smtp_host }}</label>
<div class="controls">
<input type="text" id="email_smtp_host" name="email_smtp_host" value="{{ email_smtp_host }}" maxlength="100" placeholder="{{ label_email_smtp_host }}" />
<input type="text" class="input-small" id="email_smtp_port" name="email_smtp_port" value="{{ email_smtp_port }}" maxlength="10" placeholder="{{ label_email_smtp_port }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_security">{{ label_email_smtp_security }}</label>
<div class="controls">
<select id="email_smtp_security" name="email_smtp_security">
<option value="" {{ email_smtp_security_selected_|raw }}>{{ label_email_smtp_security_none }}</option>
<option value="ssl" {{ email_smtp_security_selected_ssl|raw }}>SSL</option>
<option value="tls" {{ email_smtp_security_selected_tls|raw }}>TLS</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_username">{{ label_email_smtp_username }}</label>
<div class="controls">
<input type="text" id="email_smtp_username" name="email_smtp_username" value="{{ email_smtp_username }}" maxlength="100" placeholder="{{ label_email_smtp_noauth }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_password">{{ label_email_smtp_password }}</label>
<div class="controls">
<input type="password" id="email_smtp_password" name="email_smtp_password" value="{{ email_smtp_password }}" maxlength="100" placeholder="{{ label_email_smtp_noauth }}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testEmail">{{ label_test }}</button>
<input type="hidden" name="test_email" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="email_submit" >{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-sms" class="tab-pane {{ sms_active }}">
<fieldset>
<legend>{{ label_settings_sms }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="sms_status"><input type="checkbox" id="sms_status" name="sms_status[]" {{ sms_status_checked|raw }} /> {{ label_sms_status }}</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_sms" name="log_sms[]" {{ log_sms_checked|raw }} /> {{ label_log_sms }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway">{{ label_sms_gateway }}</label>
<div class="controls">
<select id="sms_gateway" name="sms_gateway">
<option value="mosms" {{ sms_selected_mosms|raw }}>{{ label_sms_gateway_mosms }}</option>
<option value="mollie" {{ sms_selected_mollie|raw }}>{{ label_sms_gateway_mollie }}</option>
<option value="spryng" {{ sms_selected_spryng|raw }}>{{ label_sms_gateway_spryng }}</option>
<option value="inetworx" {{ sms_selected_inetworx|raw }}>{{ label_sms_gateway_inetworx }}</option>
<option value="clickatell" {{ sms_selected_clickatell|raw }}>{{ label_sms_gateway_clickatell }}</option>
<option value="textmarketer" {{ sms_selected_textmarketer|raw }}>{{ label_sms_gateway_textmarketer }}</option>
<option value="smsglobal" {{ sms_selected_smsglobal|raw }}>{{ label_sms_gateway_smsglobal }}</option>
<option value="smsit" {{ sms_selected_smsit|raw }}>{{ label_sms_gateway_smsit }}</option>
<option value="freevoipdeal" {{ sms_selected_freevoipdeal|raw }}>{{ label_sms_gateway_freevoipdeal }}</option>
<option value="octopush" {{ sms_selected_octopush|raw }}>{{ label_sms_gateway_octopush }}</option>
<option value="freemobilesms" {{ sms_selected_freemobilesms|raw }}>{{ label_sms_gateway_freemobilesms }}</option>
<option value="clicksend" {{ sms_selected_clicksend|raw }}>{{ label_sms_gateway_clicksend }}</option>
<option value="smsgw" {{ sms_selected_smsgw|raw }}>{{ label_sms_gateway_smsgw }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway_username">{{ label_sms_gateway_username }}</label>
<div class="controls">
<input type="text" id="sms_gateway_username" name="sms_gateway_username" value="{{ sms_gateway_username }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway_password">{{ label_sms_gateway_password }}</label>
<div class="controls">
<input type="password" id="sms_gateway_password" name="sms_gateway_password" value="{{ sms_gateway_password }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_from">{{ label_sms_from }}</label>
<div class="controls">
<input type="text" id="sms_from" name="sms_from" value="{{ sms_from }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testSms">{{ label_test }}</button>
<input type="hidden" name="test_sms" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="sms_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-pushover" class="tab-pane {{ pushover_active }}">
<fieldset>
<legend>{{ label_settings_pushover }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="pushover_status"><input type="checkbox" id="pushover_status" name="pushover_status[]" {{ pushover_status_checked|raw }} /> {{ label_pushover_status }}</label>
<p class="help-block">{{ label_pushover_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_pushover" name="log_pushover[]" {{ log_pushover_checked|raw }} /> {{ label_log_pushover }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="pushover_api_token">{{ label_pushover_api_token }}</label>
<div class="controls">
<p><button class="btn btn-primary" onclick="window.open('{{ pushover_clone_url }}');return false;">{{ label_pushover_clone_app }}</button></p>
<input type="text" id="pushover_api_token" name="pushover_api_token" value="{{ pushover_api_token }}" maxlength="255" />
<p class="help-block">{{ label_pushover_api_token_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testPushover">{{ label_test }}</button>
<input type="hidden" name="test_pushover" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="pushover_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-telegram" class="tab-pane {{ telegram_active }}">
<fieldset>
<legend>{{ label_settings_telegram }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="telegram_status"><input type="checkbox" id="telegram_status" name="telegram_status[]" {{ telegram_status_checked|raw }} /> {{ label_telegram_status }}</label>
<p class="help-block">{{ label_telegram_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_telegram" name="log_telegram[]" {{ log_telegram_checked|raw }} /> {{ label_log_telegram }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="telegram_api_token">{{ label_telegram_api_token }}</label>
<div class="controls">
<input type="text" id="telegram_api_token" name="telegram_api_token" value="{{ telegram_api_token }}" maxlength="255" />
<p class="help-block">{{ label_telegram_api_token_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testtelegram">{{ label_test }}</button>
<input type="hidden" name="test_telegram" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="telegram_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
</div>
{{ macro.csrf_input() }}
<ul class="nav nav-tabs">
<li class="{{ general_active }}"><a href="#config-general" data-toggle="tab">{{ label_general }}</a></li>
<li class="{{ email_active }}"><a href="#config-email" data-toggle="tab">{{ label_tab_email }}</a></li>
<li class="{{ sms_active }}"><a href="#config-sms" data-toggle="tab">{{ label_tab_sms }}</a></li>
<li class="{{ pushover_active }}"><a href="#config-pushover" data-toggle="tab">{{ label_tab_pushover }}</a></li>
</ul>
<div class="tab-content well">
<div id="config-general" class="tab-pane {{ general_active }}">
<fieldset>
<legend>{{ label_general }}</legend>
<div class="control-group">
<label class="control-label" for="language">{{ label_language }}</label>
<div class="controls">
<select id="language" name="language">
{% for language in languages %}
<option value="{{ language.value }}" {% if language.value == language_current %} selected="selected" {% endif %}>{{ language.label }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="show_update"><input type="checkbox" id="show_update" name="show_update[]" {{ show_update_checked|raw }} /> {{ label_show_update }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="auto_refresh_servers">{{ label_auto_refresh }}</label>
<div class="controls">
<input type="text" class="input-mini" id="auto_refresh_servers" name="auto_refresh_servers" value="{{ auto_refresh_servers }}" maxlength="10" data-toggle="tooltip" title="{{ label_auto_refresh_servers }}" />&nbsp;{{ label_seconds }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="password_encrypt_key">
{{ label_password_encrypt_key }}
</label>
<div class="controls">
<input type="text" class="input-xxlarge" id="password_encrypt_key" name="password_encrypt_key"
value="{{ password_encrypt_key }}" maxlength="40" data-toggle="tooltip"
title="{{ label_password_encrypt_key_note }}"/>
</div>
</div>
</fieldset>
<fieldset>
<legend>{{ label_settings_notification }}</legend>
<div class="control-group">
<label class="control-label" for="alert_type">{{ label_alert_type }}</label>
<div class="controls">
<select id="alert_type" name="alert_type">
<option value="status" {{ alert_type_selected_status|raw }}>{{ label_alert_type_status }}</option>
<option value="offline" {{ alert_type_selected_offline|raw }}>{{ label_alert_type_offline }}</option>
<option value="always" {{ alert_type_selected_always|raw }}>{{ label_alert_type_always }}</option>
</select>
<p class="help-block">{{ label_alert_type_description|raw }}</p>
</div>
</div>
</fieldset>
<fieldset>
<legend>{{ label_settings_log }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_status" name="log_status[]" {{ log_status_checked|raw }} data-toggle="tooltip" title="{{ label_log_status_description }}" /> {{ label_log_status }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="log_retention_period">{{ label_log_retention_period }}</label>
<div class="controls">
<input type="text" class="input-mini" id="log_retention_period" name="log_retention_period" value="{{ log_retention_period }}" data-toggle="tooltip" title="{{ label_log_retention_period_description }}" />&nbsp;{{ label_log_retention_days }}
</div>
</div>
<legend>{{ label_settings_proxy }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="proxy"><input type="checkbox" id="proxy" name="proxy[]" {{ proxy_checked|raw }} />{{ label_proxy }}</label>
<p class="help-block">{{ label_alert_proxy|raw }}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="proxy_url">{{ label_proxy_url }}</label>
<div class="controls">
<input type="text" id="proxy_url" name="proxy_url" value="{{ proxy_url }}" maxlength="100" placeholder="{{ label_proxy_url }}" />
<p class="help-block">{{ label_alert_proxy_url|raw }}</p>
</div>
</div>
<div class="control-group">
<label class="control-label" for="proxy_user">{{ label_proxy_user }}</label>
<div class="controls">
<input type="text" id="proxy_user" name="proxy_user" value="{{ proxy_user }}" maxlength="100" placeholder="{{ label_proxy_user }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="proxy_password">{{ label_proxy_password }}</label>
<div class="controls">
<input type="password" id="proxy_password" name="proxy_password" value="{{ proxy_password }}" maxlength="100" placeholder="{{ label_proxy_password }}" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="general_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-email" class="tab-pane {{ email_active }}">
<fieldset>
<legend>{{ label_settings_email }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="email_status"><input type="checkbox" id="email_status" name="email_status[]" {{ email_status_checked|raw }} /> {{ label_email_status }}</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_email" name="log_email[]" {{ log_email_checked|raw }} /> {{ label_log_email }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_from_name">{{ label_email_from_name }}</label>
<div class="controls">
<input type="text" id="email_from_name" name="email_from_name" value="{{ email_from_name }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_from_email">{{ label_email_from_email }}</label>
<div class="controls">
<input type="text" id="email_from_email" name="email_from_email" value="{{ email_from_email }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="email_smtp"><input type="checkbox" id="email_smtp" name="email_smtp[]" {{ email_smtp_checked|raw }} />{{ label_email_smtp }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_host">{{ label_email_smtp_host }}</label>
<div class="controls">
<input type="text" id="email_smtp_host" name="email_smtp_host" value="{{ email_smtp_host }}" maxlength="100" placeholder="{{ label_email_smtp_host }}" />
<input type="text" class="input-small" id="email_smtp_port" name="email_smtp_port" value="{{ email_smtp_port }}" maxlength="10" placeholder="{{ label_email_smtp_port }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_security">{{ label_email_smtp_security }}</label>
<div class="controls">
<select id="email_smtp_security" name="email_smtp_security">
<option value="" {{ email_smtp_security_selected_|raw }}>{{ label_email_smtp_security_none }}</option>
<option value="ssl" {{ email_smtp_security_selected_ssl|raw }}>SSL</option>
<option value="tls" {{ email_smtp_security_selected_tls|raw }}>TLS</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_username">{{ label_email_smtp_username }}</label>
<div class="controls">
<input type="text" id="email_smtp_username" name="email_smtp_username" value="{{ email_smtp_username }}" maxlength="100" placeholder="{{ label_email_smtp_noauth }}" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="email_smtp_password">{{ label_email_smtp_password }}</label>
<div class="controls">
<input type="password" id="email_smtp_password" name="email_smtp_password" value="{{ email_smtp_password }}" maxlength="100" placeholder="{{ label_email_smtp_noauth }}" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testEmail">{{ label_test }}</button>
<input type="hidden" name="test_email" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="email_submit" >{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-sms" class="tab-pane {{ sms_active }}">
<fieldset>
<legend>{{ label_settings_sms }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="sms_status"><input type="checkbox" id="sms_status" name="sms_status[]" {{ sms_status_checked|raw }} /> {{ label_sms_status }}</label>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_sms" name="log_sms[]" {{ log_sms_checked|raw }} /> {{ label_log_sms }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway">{{ label_sms_gateway }}</label>
<div class="controls">
<select id="sms_gateway" name="sms_gateway">
<option value="mosms" {{ sms_selected_mosms|raw }}>{{ label_sms_gateway_mosms }}</option>
<option value="mollie" {{ sms_selected_mollie|raw }}>{{ label_sms_gateway_mollie }}</option>
<option value="spryng" {{ sms_selected_spryng|raw }}>{{ label_sms_gateway_spryng }}</option>
<option value="inetworx" {{ sms_selected_inetworx|raw }}>{{ label_sms_gateway_inetworx }}</option>
<option value="clickatell" {{ sms_selected_clickatell|raw }}>{{ label_sms_gateway_clickatell }}</option>
<option value="textmarketer" {{ sms_selected_textmarketer|raw }}>{{ label_sms_gateway_textmarketer }}</option>
<option value="smsglobal" {{ sms_selected_smsglobal|raw }}>{{ label_sms_gateway_smsglobal }}</option>
<option value="smsit" {{ sms_selected_smsit|raw }}>{{ label_sms_gateway_smsit }}</option>
<option value="freevoipdeal" {{ sms_selected_freevoipdeal|raw }}>{{ label_sms_gateway_freevoipdeal }}</option>
<option value="octopush" {{ sms_selected_octopush|raw }}>{{ label_sms_gateway_octopush }}</option>
<option value="freemobilesms" {{ sms_selected_freemobilesms|raw }}>{{ label_sms_gateway_freemobilesms }}</option>
<option value="clicksend" {{ sms_selected_clicksend|raw }}>{{ label_sms_gateway_clicksend }}</option>
<option value="smsgw" {{ sms_selected_smsgw|raw }}>{{ label_sms_gateway_smsgw }}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway_username">{{ label_sms_gateway_username }}</label>
<div class="controls">
<input type="text" id="sms_gateway_username" name="sms_gateway_username" value="{{ sms_gateway_username }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_gateway_password">{{ label_sms_gateway_password }}</label>
<div class="controls">
<input type="password" id="sms_gateway_password" name="sms_gateway_password" value="{{ sms_gateway_password }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms_from">{{ label_sms_from }}</label>
<div class="controls">
<input type="text" id="sms_from" name="sms_from" value="{{ sms_from }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testSms">{{ label_test }}</button>
<input type="hidden" name="test_sms" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="sms_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
<div id="config-pushover" class="tab-pane {{ pushover_active }}">
<fieldset>
<legend>{{ label_settings_pushover }}</legend>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="pushover_status"><input type="checkbox" id="pushover_status" name="pushover_status[]" {{ pushover_status_checked|raw }} /> {{ label_pushover_status }}</label>
<p class="help-block">{{ label_pushover_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox"><input type="checkbox" id="log_pushover" name="log_pushover[]" {{ log_pushover_checked|raw }} /> {{ label_log_pushover }}</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="pushover_api_token">{{ label_pushover_api_token }}</label>
<div class="controls">
<p><button class="btn btn-primary" onclick="window.open('{{ pushover_clone_url }}');return false;">{{ label_pushover_clone_app }}</button></p>
<input type="text" id="pushover_api_token" name="pushover_api_token" value="{{ pushover_api_token }}" maxlength="255" />
<p class="help-block">{{ label_pushover_api_token_description|raw }}</p>
</div>
</div>
<div class="control-group">
<div class="controls">
<button class="btn btn-primary show-modal" data-modal-id="testPushover">{{ label_test }}</button>
<input type="hidden" name="test_pushover" value="0" />
</div>
</div>
<div class="form-actions">
<button class="btn btn-success" type="submit" name="pushover_submit">{{ label_save }}</button>
</div>
</fieldset>
</div>
</div>
{{ macro.csrf_input() }}
</form>

View File

@ -4,7 +4,6 @@
<li><a href="#log_email_content" data-toggle="tab">{{ label_email }}</a></li>
<li><a href="#log_sms_content" data-toggle="tab">{{ label_sms }}</a></li>
<li><a href="#log_pushover_content" data-toggle="tab">{{ label_pushover }}</a></li>
<li><a href="#log_telegram_content" data-toggle="tab">{{ label_telegram }}</a></li>
</ul>
<div class="tab-content well">
{% for tab in tabs %}

View File

@ -23,7 +23,7 @@
<td class="nowrap visible-desktop"><div class="table-cell-title">{{ server.type }}</div></td>
<td class="nowrap hidden-phone"><div class="table-cell-title">{{ server.rtime }} s</div></td>
<td class="nowrap hidden-phone"><div class="table-cell-title">{{ server.last_online }}</div></td>
<td class="tight hidden-phone"><div class="table-cell-title"><i class="{{ server.active_icon }}" title="{{ server.active_title }}"></i> <i class="{{ server.email_icon }}" title="{{ label_email }}"></i> <i class="{{ server.sms_icon }}" title="{{ label_sms }}"></i> <i class="{{ server.pushover_icon }}" title="Pushover"></i> <i class="{{ server.telegram_icon }}" title="Telegram"></i> </div></td>
<td class="tight hidden-phone"><div class="table-cell-title"><i class="{{ server.active_icon }}" title="{{ server.active_title }}"></i> <i class="{{ server.email_icon }}" title="{{ label_email }}"></i> <i class="{{ server.sms_icon }}" title="{{ label_sms }}"></i> <i class="{{ server.pushover_icon }}" title="Pushover"></i></div></td>
<td class="tight hidden-phone">
<div class="table-cell-title">
<a class="btn btn-small" href="{{ server.url_view|raw }}"><i class="icon-chart"></i></a>
@ -51,7 +51,7 @@
<div class="table-row">
<div class="table-cell"><i class="{{ server.type_icon }}" title="{{ server.type }}"></i> {{ server.ip_short|raw }}</div>
<div class="table-cell tight">
<i class="{{ server.active_icon }}" title="{{ server.active_title }}"></i> <i class="{{ server.email_icon }}" title="{{ label_email }}"></i> <i class="{{ server.sms_icon }}" title="{{ label_sms }}"></i> <i class="{{ server.pushover_icon }}" title="Pushover"></i> <i class="{{ server.telegram_icon }}" title="Telegram"></i>
<i class="{{ server.active_icon }}" title="{{ server.active_title }}"></i> <i class="{{ server.email_icon }}" title="{{ label_email }}"></i> <i class="{{ server.sms_icon }}" title="{{ label_sms }}"></i> <i class="{{ server.pushover_icon }}" title="Pushover"></i>
</div>
</div>
</div>

View File

@ -139,17 +139,6 @@
</select>
</div>
</div>
<div class="control-group {{ control_class_telegram }}">
<label class="control-label" for="telegram">{{ label_telegram }}
{% if warning_telegram %} <p class="help-inline"><i class="icon-warning-sign" data-toggle="tooltip" title="{{ label_warning_telegram }}"></i></p> {% endif %}
</label>
<div class="controls">
<select id="telegram" name="telegram">
<option value="yes" {{ edit_telegram_selected_yes|raw }}>{{ label_yes }}</option>
<option value="no" {{ edit_telegram_selected_no|raw }}>{{ label_no }}</option>
</select>
</div>
</div>
</fieldset>
<fieldset>

View File

@ -69,10 +69,6 @@
<td>{{ label_pushover }}:</td>
<td>{{ pushover }}</td>
</tr>
<tr>
<td>{{ label_telegram }}:</td>
<td>{{ telegram }}</td>
</tr>
<tr>
<td>{{ label_timeout }}:</td>
<td>{{ timeout }} s</td>

View File

@ -62,17 +62,6 @@
<input type="text" id="pushover_device" name="pushover_device" value="{{ pushover_device }}" maxlength="255" data-toggle="tooltip" title="{{ label_pushover_device_description }}" />
</div>
</div>
<div class="control-group">
<label class="control-label">{{ label_telegram }}</label>
<div class="controls">{{ label_telegram_description|raw }} </div>
</div>
<div class="control-group">
<label class="control-label" for="telegram_chat_id">{{ label_telegram_get_id }}</label>
<div class="controls">
<p><button class="btn btn-primary" onclick="window.open('https://t.me/ChatIDBot');return false;">{{ label_telegram_get_id_button }}</button></p>
<input type="text" id="telegram_chat_id" name="telegram_chat_id" value="{{ telegram_chat_id }}" maxlength="255" />
</div>
</div>
</div>
</div>
<div class="row-fluid">

View File

@ -1,4 +1,4 @@
{% import 'main/macros.tpl.html' as macro %}
{% import 'main/macros.tpl.html' as macro %}
<form class="form-horizontal well" action="{{ url_save|raw }}" method="post">
{{ macro.csrf_input() }}
<fieldset>
@ -55,27 +55,17 @@
<div class="controls">{{ label_pushover_description|raw }} </div>
</div>
<div class="control-group">
<label class="control-label" for="pushover_key">{{ label_pushover_key }}</label>
<label class="control-label" for="mobile">{{ label_pushover_key }}</label>
<div class="controls">
<input type="text" id="pushover_key" name="pushover_key" value="{{ edit_value_pushover_key }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="pushover_device">{{ label_pushover_device }}</label>
<label class="control-label" for="mobile">{{ label_pushover_device }}</label>
<div class="controls">
<input type="text" id="pushover_device" name="pushover_device" value="{{ edit_value_pushover_device }}" maxlength="255" data-toggle="tooltip" title="{{ label_pushover_device_description }}" />
</div>
</div>
<div class="control-group">
<label class="control-label">{{ label_telegram }}</label>
<div class="controls">{{ label_telegram_description|raw }} </div>
</div>
<div class="control-group">
<label class="control-label" for="telegram_chat_id">{{ label_telegram_chat_id }}</label>
<div class="controls">
<input type="text" id="telegram_chat_id" name="telegram_chat_id" value="{{ edit_value_telegram_chat_id }}" maxlength="255" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="server_id">{{ label_servers }}</label>
<div class="controls">