From 7b3f792f76e8743d4241fb4444372d3635347271 Mon Sep 17 00:00:00 2001 From: Alfredo Esteban Date: Thu, 1 Sep 2016 17:40:18 +0200 Subject: [PATCH 01/40] Add global proxy support --- src/includes/functions.inc.php | 10 +++++++ src/lang/en_US.lang.php | 7 +++++ .../Config/Controller/ConfigController.php | 11 ++++++++ src/psm/Util/Install/Installer.php | 9 +++++++ .../default/module/config/config.tpl.html | 26 +++++++++++++++++++ 5 files changed, 63 insertions(+) diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index ec725f67..7d39f9aa 100755 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -335,6 +335,16 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = null, $ad curl_setopt($ch, CURLOPT_URL, $href); + $proxy_url = psm_get_conf('proxy_url',''); + if (psm_get_conf('proxy','0') === '1') { + curl_setopt($ch, CURLOPT_PROXY, $proxy_url); + $proxy_user = psm_get_conf('proxy_user',''); + $proxy_password = psm_get_conf('proxy_password',''); + if (!empty($proxy_user) && !empty($proxy_password)) { + curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_user . ':' . $proxy_password); + } + } + if($add_agent) { curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; phpservermon/'.PSM_VERSION.'; +http://www.phpservermonitor.org)'); } diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 07c1d5d1..cf200819 100755 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -188,6 +188,10 @@ $sm_lang = array( 'show_update' => 'Check for updates?', 'password_encrypt_key' => 'The encryption key password', 'password_encrypt_key_note' => 'This key is used to encrypt passwords that are stored on servers for access to websites. If the key will change the stored password is invalid!', + 'proxy' => 'Enable proxy', + 'proxy_url' => 'Proxy URL', + 'proxy_user' => 'Proxy username', + 'proxy_password' => 'Proxy password', 'email_status' => 'Allow sending email', 'email_from_email' => 'Email from address', 'email_from_name' => 'Email from name', @@ -234,6 +238,8 @@ $sm_lang = array( 'alert_type_status' => 'Status change', 'alert_type_offline' => 'Offline', 'alert_type_always' => 'Always', + 'alert_proxy' => 'Even if enabled, proxy is never used for services', + 'alert_proxy_url' => 'Format: Host:Port', 'log_status' => 'Log status', 'log_status_description' => 'If log status is set to TRUE, the monitor will log the event whenever the Notification settings are passed.', 'log_email' => 'Log emails sent by the script', @@ -248,6 +254,7 @@ $sm_lang = array( 'settings_pushover' => 'Pushover settings', 'settings_notification' => 'Notification settings', 'settings_log' => 'Log settings', + 'settings_proxy' => 'Proxy settings', 'auto_refresh' => 'Auto-refresh', 'auto_refresh_servers' => 'Auto-refresh servers page.
'. diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index d058de63..6961ce86 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -36,6 +36,7 @@ class ConfigController extends AbstractController { * @var array $checkboxes */ protected $checkboxes = array( + 'proxy', 'email_status', 'email_smtp', 'sms_status', @@ -52,6 +53,9 @@ class ConfigController extends AbstractController { * @var array $fields */ protected $fields = array( + 'proxy_url', + 'proxy_user', + 'proxy_password', 'email_from_name', 'email_from_email', 'email_smtp_host', @@ -293,11 +297,16 @@ class ConfigController extends AbstractController { 'label_settings_pushover' => psm_get_lang('config', 'settings_pushover'), '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'), 'label_general' => psm_get_lang('config', 'general'), 'label_language' => psm_get_lang('config', 'language'), 'label_show_update' => psm_get_lang('config', 'show_update'), 'label_password_encrypt_key' => psm_get_lang('config', 'password_encrypt_key'), 'label_password_encrypt_key_note' => psm_get_lang('config', 'password_encrypt_key_note'), + 'label_proxy' => psm_get_lang('config', 'proxy'), + 'label_proxy_url' => psm_get_lang('config', 'proxy_url'), + 'label_proxy_user' => psm_get_lang('config', 'proxy_user'), + 'label_proxy_password' => psm_get_lang('config', 'proxy_password'), 'label_email_status' => psm_get_lang('config', 'email_status'), 'label_email_from_email' => psm_get_lang('config', 'email_from_email'), 'label_email_from_name' => psm_get_lang('config', 'email_from_name'), @@ -346,6 +355,8 @@ 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_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'), 'label_auto_refresh_servers' => psm_get_lang('config', 'auto_refresh_servers'), 'label_seconds' => psm_get_lang('config', 'seconds'), diff --git a/src/psm/Util/Install/Installer.php b/src/psm/Util/Install/Installer.php index 6c3ee490..aeb414c8 100644 --- a/src/psm/Util/Install/Installer.php +++ b/src/psm/Util/Install/Installer.php @@ -130,6 +130,10 @@ class Installer { $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'), @@ -442,6 +446,11 @@ class Installer { 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); diff --git a/src/templates/default/module/config/config.tpl.html b/src/templates/default/module/config/config.tpl.html index 103c52a8..71617232 100644 --- a/src/templates/default/module/config/config.tpl.html +++ b/src/templates/default/module/config/config.tpl.html @@ -69,6 +69,32 @@  {{ label_log_retention_days }} + {{ label_settings_proxy }} +
+
+ +

{{ label_alert_proxy|raw }}

+
+
+
+ +
+ +

{{ label_alert_proxy_url|raw }}

+
+
+
+ +
+ +
+
+
+ +
+ +
+
From 56ac7e969f7d77b176b9042ac4345de463860f38 Mon Sep 17 00:00:00 2001 From: Quentin Varquet Date: Thu, 8 Sep 2016 14:58:37 +0200 Subject: [PATCH 02/40] Update README.rst --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index 6616e24e..f32f4fde 100755 --- a/README.rst +++ b/README.rst @@ -115,3 +115,8 @@ 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/. + +Docker +------- + +PHPServerMonitor is now available on Docker : https://hub.docker.com/r/quentinv/phpservermonitor/ From 0be8e40c50564ea3486f1b5316faf364bcdce2db Mon Sep 17 00:00:00 2001 From: pieter-groeneweg Date: Tue, 20 Sep 2016 13:37:58 +0200 Subject: [PATCH 03/40] update status.cron.php with added allowed IP check. to allow scheduled status updates over the web the commandline check is extended with a check on allowed IP address(es). In config.php add following line: define('PSM_CRON_ALLOW', array("xxx.xxx.xxx.xxx", "yyy.yyy.yyy.yyy")) Where the xxx's and yyy's represent the IP addresses of course --- cron/status.cron.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cron/status.cron.php b/cron/status.cron.php index 0905d8da..9e533a1a 100644 --- a/cron/status.cron.php +++ b/cron/status.cron.php @@ -29,7 +29,12 @@ require_once __DIR__ . '/../src/bootstrap.php'; if(!psm_is_cli()) { - die('This script can only be run from the command line.'); + // check if it's an allowed host + $allow = PSM_CRON_ALLOW; + if(!in_array($_SERVER['REMOTE_ADDR'], $allow) && !in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) { + header('HTTP/1.0 404 Not Found'); + die('404 Not Found

Not Found

The requested URL /cron/status.cron.php was not found on this server.

'); + } } $cron_timeout = PSM_CRON_TIMEOUT; From ea22e36007928ec9263ee648b25ce59c4df08999 Mon Sep 17 00:00:00 2001 From: Peter Misura Date: Fri, 30 Sep 2016 17:23:19 +0200 Subject: [PATCH 04/40] Add Slovak translation --- src/lang/sk_SK.lang.php | 318 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 318 insertions(+) create mode 100644 src/lang/sk_SK.lang.php diff --git a/src/lang/sk_SK.lang.php b/src/lang/sk_SK.lang.php new file mode 100644 index 00000000..4d720371 --- /dev/null +++ b/src/lang/sk_SK.lang.php @@ -0,0 +1,318 @@ +. + * + * @package phpservermon + * @author Peter Misura + * @copyright Copyright (c) 2008-2015 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + **/ + +$sm_lang = array( + 'name' => 'Slovensky - Slovak', + 'locale' => array('sk_SK.UTF-8', 'sk_SK', 'slovak', 'slovak'), + 'locale_tag' => 'sk', + 'locale_dir' => 'ltr', + 'system' => array( + 'title' => 'Server Monitor', + 'install' => 'Inštalácia', + 'action' => 'Akcia', + 'save' => 'Uložiť', + 'edit' => 'Upraviť', + 'delete' => 'Zmazať', + 'date' => 'Dátum', + 'message' => 'Správa', + 'yes' => 'Áno', + 'no' => 'Nie', + 'insert' => 'Vložiť', + 'add_new' => 'Pridať', + 'update_available' => 'Nová verzia - ({version}) je dostupná na http://www.phpservermonitor.org.', + 'back_to_top' => 'Späť na začiatok', + 'go_back' => 'Späť', + 'ok' => 'OK', + 'cancel' => 'Zrušiť', + // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php + 'short_day_format' => '%B %e', + 'long_day_format' => '%B %e, %Y', + 'yesterday_format' => 'Včera v %k:%M', + 'other_day_format' => '%A v %k:%M', + 'never' => 'Nikdy', + 'hours_ago' => 'pred %d hodinami', + 'an_hour_ago' => 'cca pred hodinou', + 'minutes_ago' => 'pred %d minútami', + 'a_minute_ago' => 'cca pred minútou', + 'seconds_ago' => 'pred %d sekundami', + 'a_second_ago' => 'pred chvíľou', + ), + 'menu' => array( + 'config' => 'Konfigurácia', + 'server' => 'Servery', + 'server_log' => 'Log', + 'server_status' => 'Stav', + 'server_update' => 'Aktualizácia', + 'user' => 'Užívateľ', + 'help' => 'Nápoveda', + ), + 'users' => array( + 'user' => 'Užívateľ', + 'name' => 'Meno', + 'user_name' => 'Užívateľské meno', + 'password' => 'Heslo', + 'password_repeat' => 'Rovnaké heslo (pre kontrolu)', + 'password_leave_blank' => 'Nevyplňujte ak nechcete zmeniť.', + 'level' => 'Oprávnenie', + 'level_10' => 'Administrátor', + 'level_20' => 'Užívateľ', + 'level_description' => 'Administrátor má plný prístup: môže spravovať servery, užívateľov a upraviť globálnu konfiguráciu.
Uživatel má práva len na čítanie a spustiť aktualizáciu serverov, ktoré má priradené.', + 'mobile' => 'Mobil', + 'email' => 'E-mail', + 'pushover' => 'Pushover', + 'pushover_description' => 'Pushover je služba umožňujúca jednoducho zasielať real-time upozornenia. Viac na webe Pushover', + 'pushover_key' => 'Pushover Token', + 'pushover_device' => 'Pushover Zariadenie', + 'pushover_device_description' => 'Název zariadenia, na ktoré má byť správa odoslaná. Ponechajte prázdne pre odoslanie na všetky zariadenia.', + 'delete_title' => 'Zmazať užívateľa', + 'delete_message' => 'Naozaj zmazať užívateľa \'%1\'?', + 'deleted' => 'Užívateľ zmazaný.', + 'updated' => 'Užívateľ aktualizovaný.', + 'inserted' => 'Užívateľ pridaný.', + 'profile' => 'Profil', + 'profile_updated' => 'Váš užívateľský profil bol upravený.', + 'error_user_name_bad_length' => 'Užívateľské meno musí obsahovať 2 až 64 znakov.', + 'error_user_name_invalid' => 'Užívateľské meno môže obsahovať iba písmena (a-z, A-Z), čísla (0-9) a podtržítka (_).', + 'error_user_name_exists' => 'Zadané uživatelské jméno již existuje v databázi.', + 'error_user_email_bad_length' => 'E-mailová adresa musí obsahovat 5 až 255 znaků .', + 'error_user_email_invalid' => 'E-mailová adresa je neplatná', + 'error_user_level_invalid' => 'Zadané oprávnenie je neplatné.', + 'error_user_no_match' => 'Užívateľ nebol najdený.', + 'error_user_password_invalid' => 'Zadané heslo je neplatné.', + 'error_user_password_no_match' => 'Zadaná heslá sa nezhodujú.', + ), + 'log' => array( + 'title' => 'Záznamy logu', + 'type' => 'Typ', + 'status' => 'Stav', + 'email' => 'E-mail', + 'sms' => 'SMS', + 'pushover' => 'Pushover', + 'no_logs' => 'Žiadne záznamy', + ), + 'servers' => array( + 'server' => 'Server', + 'status' => 'Stav', + 'label' => 'Popis', + 'domain' => 'Doména/IP', + 'timeout' => 'Časový limit', + 'timeout_description' => 'Počet sekúnd čakania na odpoveď serveru.', + 'authentication_settings' => 'Nastavenie autentizacie (voliteľný)', + 'website_username' => 'Užívateľské meno', + 'website_username_description' => 'Užívateľské meno pre prístup na stránku. (Len Apache autorizácia je podporovaná.)', + 'website_password' => 'Heslo', + 'website_password_description' => 'Heslo pre prístup na stránku. Heslo je v databázi šifrované.', + 'fieldset_monitoring' => 'Monitoring', + 'fieldset_permissions' => 'Oprávnenie', + 'port' => 'Port', + 'custom_port' => 'Užívateľský Port', + 'popular_ports' => 'Populárne Porty', + 'please_select' => 'Prosím vyberte', + 'type' => 'Typ', + 'type_website' => 'Web', + 'type_service' => 'Služba', + 'pattern' => 'Vyhledat reťazec/vzor', + 'pattern_description' => 'Pokiaľ reťazec nebude na webe nájdený, bude server označený ako offline. Regulárne výrazy sú povolené.', + 'last_check' => 'Posledná kontrola', + 'last_online' => 'Naposledy online', + 'monitoring' => 'Monitoring', + 'no_monitoring' => 'Žiadne monitorované služby', + 'email' => 'E-mail', + 'send_email' => 'Odoslať e-mail', + 'sms' => 'SMS', + 'send_sms' => 'Odoslať SMS', + 'pushover' => 'Pushover', + 'users' => 'Užívatelia', + 'delete_title' => 'Zmazať server', + 'delete_message' => 'Naozaj si prajete zmazať \'%1\'?', + 'deleted' => 'Server zmazaný.', + 'updated' => 'Server aktualizovaný.', + 'inserted' => 'Server pridaný.', + 'latency' => 'Latencia', + 'latency_max' => 'Latencia (maximum)', + 'latency_min' => 'Latencia (minimum)', + 'latency_avg' => 'Latencia (priemer)', + 'uptime' => 'Uptime', + 'year' => 'Rok', + 'month' => 'Mesiac', + 'week' => 'Týždeň', + 'day' => 'Deň', + 'hour' => 'Hodina', + 'warning_threshold' => 'Stropná hranica varovania', + 'warning_threshold_description' => 'Počet neúspešných pokusov pred označením serveru ako offline.', + 'chart_last_week' => 'Minulý týždeň', + 'chart_history' => 'História', + // Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html + 'chart_day_format' => '%Y-%m-%d', + 'chart_long_date_format' => '%Y-%m-%d %H:%M:%S', + 'chart_short_date_format' => '%m/%d %H:%M', + 'chart_short_time_format' => '%H:%M', + 'warning_notifications_disabled_sms' => 'SMS upozornenia sú vypnuté.', + 'warning_notifications_disabled_email' => 'E-mailové upozornenia sú vypnuté.', + 'warning_notifications_disabled_pushover' => 'Pushover upozornenia sú vypnuté.', + 'error_server_no_match' => 'Server nenájdený.', + 'error_server_label_bad_length' => 'Popisok musí obsahovať 1 až 255 znakov.', + 'error_server_ip_bad_length' => 'Doména/IP adresa musí obsahovať 1 až 255 znakov.', + 'error_server_ip_bad_service' => 'IP adresa nie je platná.', + 'error_server_ip_bad_website' => 'URL webu nie je platná.', + 'error_server_type_invalid' => 'Zvolený typ serveru nie je platný', + 'error_server_warning_threshold_invalid' => 'Hranica varovania musí byť číslo väčšie ako 0.', + ), + 'config' => array( + 'general' => 'Všeobecné', + 'language' => 'Jazyk', + 'show_update' => 'Kontrolovať aktualizácie?', + 'password_encrypt_key' => 'Šifrovací kľúč pre heslá', + 'password_encrypt_key_note' => 'Týmto klúčom sa šifrujú heslá, ktoré sa ukladajú na serveroch pre prístup na webové stránky. Ak kľúč zmeníte, budú uložené heslá neplatné!', + 'email_status' => 'Povoliť odosielanie e-mailu', + 'email_from_email' => 'E-mailová adresa odosielateľa', + 'email_from_name' => 'Jméno odosielateľa', + 'email_smtp' => 'Zapnúť SMTP', + 'email_smtp_host' => 'SMTP adresa', + 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP zabezpečenie', + 'email_smtp_security_none' => 'žiadne', + 'email_smtp_username' => 'SMTP užívateľské meno', + 'email_smtp_password' => 'SMTP heslo', + 'email_smtp_noauth' => 'Nechajte prázdne pre použitie SMTP bez hesla', + 'sms_status' => 'Povoliť odosielanie textových správ', + 'sms_gateway' => 'Brána použitá pro odosielanie správ', + 'sms_gateway_mosms' => 'Mosms', + 'sms_gateway_mollie' => 'Mollie', + 'sms_gateway_spryng' => 'Spryng', + 'sms_gateway_inetworx' => 'Inetworx', + 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', + 'sms_gateway_smsit' => 'Smsit', + 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_freemobilesms' => 'FreeMobileSMS', + 'sms_gateway_clicksend' => 'ClickSend', + 'sms_gateway_nexmo' => 'Nexmo', + 'sms_gateway_username' => 'Užívateľské meno brány', + 'sms_gateway_password' => 'Heslo brány', + 'sms_from' => 'Telefónne číslo odosielateľa', + 'pushover_status' => 'Povoliť zasielanie Pushover správ', + 'pushover_description' => 'Pushover je služba umožňujúca jednoducho zasielať real-time upozornenia. Viac na webe Pushover', + 'pushover_clone_app' => 'Kliknite pre vytvorenie Pushover aplikácie', + 'pushover_api_token' => 'Pushover App API Token', + 'pushover_api_token_description' => 'Pred použitím Pushoveru sa musíte registrovať a získať API Token.', + 'alert_type' => 'Zvoľte kedy si prajete byť upozornení.', + 'alert_type_description' => 'Zmena stavu: '. + 'Obdržíte upozornenie pri zmene stavu, teda: online -> offline alebo offline -> online.
'. + '
Offline: '. + 'Obdržíte upozornenie, keď server prejde *PO PRVÝ KRÁT* do offline stavu. Napríklad, '. + 'pokiaľ je cron nastavený na 15 minút a sledovaný server bude offline mezi 01:00 a 06:00, '. + 'tak obdržíte upozornenie iba o 01:00.
'. + '
Vždy: '. + 'Obdržíte upozornenie pri každom spustení kontroly, teda aj pokiaľ bude server offline niekoľko hodín.', + 'alert_type_status' => 'Zmena stavu', + 'alert_type_offline' => 'Offline', + 'alert_type_always' => 'Vždy', + 'log_status' => 'Log', + 'log_status_description' => 'Pokiaľ je Log nastavený na hodnotu TRUE, systém do neho zapíše všetky upozornenia.', + 'log_email' => 'Logovať odoslané e-maily', + 'log_sms' => 'Logovať odoslané textové správy', + 'log_pushover' => 'Logovať odoslané Pushover správy', + 'updated' => 'Nastavenie bolo aktualizované.', + 'tab_email' => 'E-mail', + 'tab_sms' => 'SMS', + 'tab_pushover' => 'Pushover', + 'settings_email' => 'Nastavenie e-mailov', + 'settings_sms' => 'Nastavenie textových správ', + 'settings_pushover' => 'Nastavenie Pushover', + 'settings_notification' => 'Nastavenie upozornení', + 'settings_log' => 'Nastavenie logu', + 'auto_refresh' => 'Automaticky obnoviť', + 'auto_refresh_servers' => + 'Automaticky obnoviť stránku Servery.
'. + ''. + 'Čas v sekundách, 0 pre vypnutie automatického obnovenia.'. + '', + 'seconds' => 'sekúnd', + 'test' => 'Test', + 'test_email' => 'E-mail bude odoslaný na adresu uvedenú v užívateľskom profile.', + 'test_sms' => 'SMS bude odoslaná na telefónne číslo uvedené v užívateľskom profile.', + 'test_pushover' => 'Pushover upozornenie bude odoslané užívateľovi/zariadeniu podľa nastavení v užívateľskom profile.', + 'send' => 'Odoslať', + 'test_subject' => 'Test', + 'test_message' => 'Testovacia správa', + 'email_sent' => 'E-mail odoslaný', + 'email_error' => 'Chyba pri odosielaní e-mailu', + 'sms_sent' => 'SMS odoslaná', + 'sms_error' => 'Chyba pri odosielaní SMS', + 'sms_error_nomobile' => 'Nebolo možné odoslať SMS: v užívateľskom profile nebylo nájdené platné telefónne číslo.', + 'pushover_sent' => 'Pushover upozornenie odoslané.', + 'pushover_error' => 'Nastala chyba pri odosielaní Pushover upozornenia: %s', + 'pushover_error_noapp' => 'Nebolo možné odoslať testovacie upozornenie: v globálnom nastavení nebol nájdený žiaden API token.', + 'pushover_error_nokey' => 'Nebylo možné odoslať testovacie upozornenie: ve vašom profile nie je definovaný Pushover key.', + 'log_retention_period' => 'Rotácia logu', + 'log_retention_period_description' => 'Počet dní po které budú uchované logy upozornení. Vložte 0 pre vypnutie autorotáce.', + 'log_retention_days' => 'dní', + ), + // for newlines in the email messages use
+ 'notifications' => array( + 'off_sms' => 'Server \'%LABEL%\' je offline: ip=%IP%, port=%PORT%. Chyba=%ERROR%', + 'off_email_subject' => 'DÔLEŽITÉ: Server \'%LABEL%\' je offline', + 'off_email_body' => 'Nebolo možné spojiť sa so serverom:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Chyba: %ERROR%
Dátum: %DATE%', + 'off_pushover_title' => 'Server \'%LABEL%\' je offline', + 'off_pushover_message' => 'Nebolo možné spojiť sa so serverom:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Chyba: %ERROR%
Dátum: %DATE%', + 'on_sms' => 'Server \'%LABEL%\' je online: ip=%IP%, port=%PORT%', + 'on_email_subject' => 'DÔLEŽITÉ: Server \'%LABEL%\' je online', + 'on_email_body' => "Server '%LABEL%' je opäť online

Server: %LABEL%
IP: %IP%
Port: %PORT%
Dátum: %DATE%", + 'on_pushover_title' => 'Server \'%LABEL%\' je online', + 'on_pushover_message' => 'Server \'%LABEL%\' je znovu online:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Dátum: %DATE%', + ), + 'login' => array( + 'welcome_usermenu' => 'Vitajte, %user_name%', + 'title_sign_in' => 'Prosím prihláste sa', + 'title_forgot' => 'Zabudnuté heslo?', + 'title_reset' => 'Obnova hesla', + 'submit' => 'Odoslať', + 'remember_me' => 'Zapamätať údaje', + 'login' => 'Prihlásiť', + 'logout' => 'Odhlásiť', + 'username' => 'Užívateľské meno', + 'password' => 'Heslo', + 'password_repeat' => 'Opakujte heslo', + 'password_forgot' => 'Zabudnuté heslo?', + 'password_reset' => 'Obnoviť heslo', + 'password_reset_email_subject' => 'Obnoviť heslo pre PHP Server Monitor', + 'password_reset_email_body' => 'Použite následujúci odkaz pre obnovenie hesla. Odkaz je platný jednu hodinu.

%link%', + 'error_user_incorrect' => 'Zadané užívateľské meno nebolo nájdené.', + 'error_login_incorrect' => 'Prihlásenie nebolo úspešné.', + 'error_login_passwords_nomatch' => 'Zadané heslá sa nezhodujú.', + 'error_reset_invalid_link' => 'Odkaz je neplatný.', + 'success_password_forgot' => 'Na vašu e-mailovú adresu bol zaslaný e-mail s informáciami pre obnovu hesla.', + 'success_password_reset' => 'Vaše heslo bolo úspešne obnovené. Prosím prihláste sa.', + ), + 'error' => array( + '401_unauthorized' => 'Nedostatočné oprávnenia', + '401_unauthorized_description' => 'Nemáte oprávnenie zobraziť túto stránku.', + ), +); From 66ddbdcf1b582c9df9ee99275ca050d50c276709 Mon Sep 17 00:00:00 2001 From: Peter Misura Date: Fri, 30 Sep 2016 17:23:50 +0200 Subject: [PATCH 05/40] Small fixes in Czech translation --- src/lang/cs_CZ.lang.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lang/cs_CZ.lang.php b/src/lang/cs_CZ.lang.php index 09049038..f816f172 100644 --- a/src/lang/cs_CZ.lang.php +++ b/src/lang/cs_CZ.lang.php @@ -54,7 +54,7 @@ $sm_lang = array( 'long_day_format' => '%B %e, %Y', 'yesterday_format' => 'Včera v %k:%M', 'other_day_format' => '%A v %k:%M', - 'never' => 'Never', + 'never' => 'Nikdy', 'hours_ago' => 'před %d hodinami', 'an_hour_ago' => 'cca před hodinou', 'minutes_ago' => 'před %d minutami', @@ -177,7 +177,7 @@ $sm_lang = array( 'warning_notifications_disabled_pushover' => 'Pushover upozornění jsou vypnuta.', 'error_server_no_match' => 'Server nenalezen.', 'error_server_label_bad_length' => 'Popisek musí obsahovat 1 až 255 znaků.', - 'error_server_ip_bad_length' => 'Doména/IP adresa musí obsahovat 1 ař 255 znaků.', + 'error_server_ip_bad_length' => 'Doména/IP adresa musí obsahovat 1 až 255 znaků.', 'error_server_ip_bad_service' => 'IP adresa není platná.', 'error_server_ip_bad_website' => 'URL webu není platná.', 'error_server_type_invalid' => 'Zvolený typ serveru není platný', @@ -209,14 +209,16 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', - 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_freemobilesms' => 'FreeMobileSMS', + 'sms_gateway_clicksend' => 'ClickSend', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Uživatelské jméno brány', 'sms_gateway_password' => 'Heslo brány', 'sms_from' => 'Telefonní číslo odesilatele', - 'pushover_status' => 'Povolit zsílání Pushover zpráv', + 'pushover_status' => 'Povolit zasílání Pushover zpráv', 'pushover_description' => 'Pushover je služba umožňující jednoduše zasílat real-time upozornění. Více na webu Pushover', 'pushover_clone_app' => 'Klikněte pro vytvoření Pushover aplikace', 'pushover_api_token' => 'Pushover App API Token', @@ -225,7 +227,7 @@ $sm_lang = array( 'alert_type_description' => 'Změna stavu: '. 'Obdržíte upozornění při změně stavu, tedy:online -> offline nebo offline -> online.
'. '
Offline: '. - 'Obdržíte upozornění, kdy server přejde poprvé do offline stavu. Například, pokud je cron nastaven na 15 minut a sledovaný server bude offline mezi 01:00 a 06:00.
'. + 'Obdržíte upozornění, kdy server přejde poprvé do offline stavu. Například, pokud je cron nastaven na 15 minut a sledovaný server bude offline mezi 01:00 a 06:00. Obdržíte upozornění pouze v 01:00.
'. '
Vždy: '. 'Obdržíte upozornění při každém spuštění kontroly, tedy i pokud bude server offline několik hodin.', 'alert_type_status' => 'Změna stavu', @@ -277,7 +279,7 @@ $sm_lang = array( 'off_sms' => 'Server \'%LABEL%\' je offline: ip=%IP%, port=%PORT%. Chyba=%ERROR%', 'off_email_subject' => 'DŮLEŽITÉ: Server \'%LABEL%\' je offline', 'off_email_body' => 'Nebylo možné spojit se se serverem:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Chyba: %ERROR%
Datum: %DATE%', - 'off_pushover_title' => 'Server \'%LABEL%\'je offline', + 'off_pushover_title' => 'Server \'%LABEL%\' je offline', 'off_pushover_message' => 'Nebylo možné spojit se se serverem:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Chyba: %ERROR%
Datum: %DATE%', 'on_sms' => 'Server \'%LABEL%\' je online: ip=%IP%, port=%PORT%', 'on_email_subject' => 'DŮLEŽITÉ: Server \'%LABEL%\' je online', From fac784641ad402baaade730e7c6b3f358b49e895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=98=E7=BC=98?= Date: Sun, 9 Oct 2016 13:39:42 +0800 Subject: [PATCH 06/40] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lang/zh_CN.lang.php | 107 ++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index 864b3b01..f9820aca 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -84,13 +84,13 @@ $sm_lang = array( 'mobile' => '手机', 'email' => '邮件', 'pushover' => 'Pushover', - 'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See their website for more info.', + 'pushover_description' => 'Pushover 是第三方用于实时通知的服务(收费). 详情见 Pushover 官网.', 'pushover_key' => 'Pushover Key', 'pushover_device' => 'Pushover Device', - 'pushover_device_description' => 'Device name to send the message to. Leave empty to send it to all devices.', - 'delete_title' => 'Delete User', - 'delete_message' => 'Are you sure you want to delete user \'%1\'?', - 'deleted' => 'User deleted.', + 'pushover_device_description' => '要发送信息的设备名. 留空则发送到所有设备.', + 'delete_title' => '删除用户', + 'delete_message' => '确认删除用户 \'%1\'?', + 'deleted' => '用户已删除.', 'updated' => '用户已更新.', 'inserted' => '用户已添加.', 'profile' => '个人资料', @@ -112,15 +112,15 @@ $sm_lang = array( 'email' => '邮件', 'sms' => '短信', 'pushover' => 'Pushover', - 'no_logs' => 'No logs', + 'no_logs' => '没有日志', ), 'servers' => array( 'server' => '服务器', 'status' => '状态', 'label' => '标签', 'domain' => '域名/IP', - 'timeout' => 'Timeout', - 'timeout_description' => 'Number of seconds to wait for the server to respond.', + 'timeout' => '超时时间', + 'timeout_description' => '等待服务器响应的时间.', 'port' => '端口', 'type' => '类型', 'type_website' => '网站', @@ -130,16 +130,16 @@ $sm_lang = array( 'last_check' => '最后检查', 'last_online' => '最后在线', 'monitoring' => '监控中', - 'no_monitoring' => 'No monitoring', + 'no_monitoring' => '未监控', 'email' => '邮件', 'send_email' => '发送邮件', 'sms' => '短信', 'send_sms' => '发送短信', 'pushover' => 'Pushover', - 'users' => 'Users', - 'delete_title' => 'Delete Server', - 'delete_message' => 'Are you sure you want to delete server \'%1\'?', - 'deleted' => 'Server deleted.', + 'users' => '用户', + 'delete_title' => '删除服务器', + 'delete_message' => '确认删除服务器 \'%1\'?', + 'deleted' => '服务器已删除.', 'updated' => '服务器已更新.', 'inserted' => '服务器已添加.', 'latency' => '延迟', @@ -161,16 +161,16 @@ $sm_lang = array( 'chart_long_date_format' => '%Y-%m-%d %H:%M:%S', 'chart_short_date_format' => '%m/%d %H:%M', 'chart_short_time_format' => '%H:%M', - 'warning_notifications_disabled_sms' => 'SMS notifications are disabled.', - 'warning_notifications_disabled_email' => 'Email notifications are disabled.', - 'warning_notifications_disabled_pushover' => 'Pushover 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.', - 'error_server_ip_bad_service' => 'The IP address is not valid.', - 'error_server_ip_bad_website' => 'The website URL is not valid.', - 'error_server_type_invalid' => 'The selected server type is invalid.', - 'error_server_warning_threshold_invalid' => 'The warning threshold must be a valid integer greater than 0.', + 'warning_notifications_disabled_sms' => 'SMS 通知不可用.', + 'warning_notifications_disabled_email' => 'Email 通知不可用.', + 'warning_notifications_disabled_pushover' => 'Pushover 通知不可用.', + 'error_server_no_match' => '服务器不存在.', + 'error_server_label_bad_length' => '标签 长度要求 1 ~ 255 字符.', + 'error_server_ip_bad_length' => 'domain / IP 长度要求 1 ~ 255 字符.', + 'error_server_ip_bad_service' => '非法 IP.', + 'error_server_ip_bad_website' => '非法 URL.', + 'error_server_type_invalid' => '非法选项.', + 'error_server_warning_threshold_invalid' => '报警阈值为大于 0 的数字.', ), 'config' => array( 'general' => '通用', @@ -182,8 +182,8 @@ $sm_lang = array( 'email_smtp' => '使用SMTP发送', 'email_smtp_host' => 'SMTP主机', 'email_smtp_port' => 'SMTP端口', - 'email_smtp_security' => 'SMTP security', - 'email_smtp_security_none' => 'None', + 'email_smtp_security' => 'SMTP 设置', + 'email_smtp_security_none' => '空', 'email_smtp_username' => 'SMTP用户名', 'email_smtp_password' => 'SMTP密码', 'email_smtp_noauth' => '留空为无验证', @@ -203,11 +203,11 @@ $sm_lang = array( 'sms_gateway_username' => 'SMS网关用户名', 'sms_gateway_password' => 'SMS网关密码', 'sms_from' => '发信人电话号', - 'pushover_status' => 'Allow sending Pushover messages', - 'pushover_description' => 'Pushover is a service that makes it easy to get real-time notifications. See their website for more info.', - 'pushover_clone_app' => 'Click here to create your Pushover app', - 'pushover_api_token' => 'Pushover App API Token', - 'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.', + 'pushover_status' => '允许 Pushover 通知', + 'pushover_description' => 'Pushover 是第三方用于实时通知的服务(收费). 详情见 Pushover 官网.', + 'pushover_clone_app' => '点此创建 Pushover App', + 'pushover_api_token' => 'Pushover API Token', + 'pushover_api_token_description' => '请先 注册Pushover 并获取 Api Token.', 'alert_type' => '如果想要收到提醒请选中此项.', 'alert_type_description' => '状态变化: '. '服务器 online -> offline 或 offline -> online 的状态变化将会收到提醒.
'. @@ -224,17 +224,18 @@ $sm_lang = array( 'log_status_description' => '如果状态记录设置为开, 提醒发送时均会保存记录.', 'log_email' => '记录脚本所发邮件?', 'log_sms' => '记录脚本所发短信SMS?', - 'log_pushover' => 'Log pushover messages sent by the script', + 'log_pushover' => '记录脚本所发pushover消息?', 'updated' => '设置已更新.', 'tab_email' => '邮件发送设置', 'tab_sms' => '短信发送设置', 'tab_pushover' => 'Pushover', 'settings_email' => '邮件发送设置', 'settings_sms' => '短信发送设置', - 'settings_pushover' => 'Pushover settings', + 'settings_pushover' => 'Pushover 设置', 'settings_notification' => '提醒设置', 'settings_log' => '日志设置', - 'auto_refresh' => 'Auto-refresh', + 'auto_refresh' => '自动刷新', + 'password_encrypt_key' => '加密密钥', 'auto_refresh_servers' => '自动刷新服务器页.
'. ''. @@ -242,24 +243,24 @@ $sm_lang = array( '', 'seconds' => 'seconds', 'test' => 'Test', - 'test_email' => 'An email will be sent to the address specified in your user profile.', - 'test_sms' => 'An SMS will be sent to the phone number specified in your user profile.', - 'test_pushover' => 'A Pushover notification will be sent to the user key/device specified in your user profile.', - 'send' => 'Send', - 'test_subject' => 'Test', - 'test_message' => 'Test message', - 'email_sent' => 'Email sent', - 'email_error' => 'Error in email sending', - 'sms_sent' => 'Sms sent', - 'sms_error' => 'Error in sms sending', - 'sms_error_nomobile' => 'Unable to send test SMS: no valid phone number found in your profile.', - 'pushover_sent' => 'Pushover notification sent', - 'pushover_error' => 'An error has occurred while sending the Pushover notification: %s', - 'pushover_error_noapp' => 'Unable to send test notification: no Pushover App API token found in the global configuration.', - 'pushover_error_nokey' => 'Unable to send test notification: no Pushover key found in your profile.', - 'log_retention_period' => 'Log retention period', - 'log_retention_period_description' => 'Number of days to keep logs of notifications and archives of server uptime. Enter 0 to disable log cleanup.', - 'log_retention_days' => 'days', + 'test_email' => '将发送一封邮件到您账户设置的邮件地址.', + 'test_sms' => '将发送一封短信到您账户设置的手机号码.', + 'test_pushover' => '将发送一条 Pushover 通知到您账户设置的 key/device 设备上.', + 'send' => '发送', + 'test_subject' => '测试', + 'test_message' => '测试信息', + 'email_sent' => '发送Email', + 'email_error' => 'Error 发送出错', + 'sms_sent' => '发送Sms', + 'sms_error' => '短信发送出错', + 'sms_error_nomobile' => '无法发送短信: 您的账号未设置有效手机号码.', + 'pushover_sent' => '发送Pushover通知', + 'pushover_error' => 'Pushover通知发送出错: %s', + 'pushover_error_noapp' => 'Pushover通知发送出错: no Pushover App API token found in the global configuration.', + 'pushover_error_nokey' => 'Pushover通知无法发送: no Pushover key found in your profile.', + 'log_retention_period' => '日志保留时长', + 'log_retention_period_description' => '日志存档保留时间,0为禁用日志清理', + 'log_retention_days' => '天', ), // for newlines in the email messages use
'notifications' => array( @@ -298,7 +299,7 @@ $sm_lang = array( 'success_password_reset' => '密码重设成功.请登录.', ), 'error' => array( - '401_unauthorized' => 'Unauthorized', - '401_unauthorized_description' => 'You do not have the privileges to view this page.', + '401_unauthorized' => '未授权的请求', + '401_unauthorized_description' => '未授权的请求.', ), ); From 0b68d4fb89aec9739b193b394bdec4eccbf662d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=98=E7=BC=98?= Date: Sun, 9 Oct 2016 16:06:25 +0800 Subject: [PATCH 07/40] finish chinese language package translation --- src/lang/zh_CN.lang.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index f9820aca..9f87051c 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -40,7 +40,7 @@ $sm_lang = array( 'date' => '日期', 'message' => '消息', 'yes' => '是', - 'no' => '否o', + 'no' => '否', 'insert' => '插入', 'add_new' => '添加', 'update_available' => '发现新版本({version}) http://www.phpservermonitor.org.', @@ -194,7 +194,7 @@ $sm_lang = array( 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', - 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', From 1ac303af8cfda4ca0c3c539849fc2315cf877412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=98=E7=BC=98?= Date: Sun, 9 Oct 2016 17:38:48 +0800 Subject: [PATCH 08/40] finish chinese language package translation --- src/lang/zh_CN.lang.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index 9f87051c..f82ada0d 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -41,7 +41,7 @@ $sm_lang = array( 'message' => '消息', 'yes' => '是', 'no' => '否', - 'insert' => '插入', + 'insert' => '新增', 'add_new' => '添加', 'update_available' => '发现新版本({version}) http://www.phpservermonitor.org.', 'back_to_top' => '返回顶部', @@ -121,7 +121,17 @@ $sm_lang = array( 'domain' => '域名/IP', 'timeout' => '超时时间', 'timeout_description' => '等待服务器响应的时间.', + 'authentication_settings' => '访问权限设置 (可选)', + 'website_username' => '用户名', + 'website_username_description' => '网站分配的用户名.', + 'website_password' => '密码', + 'website_password_description' => '网站分配的密码,密码将会加密存放', + 'fieldset_monitoring' => '通知', + 'fieldset_permissions' => '权限', 'port' => '端口', + 'custom_port' => '指定端口', + 'popular_ports' => '默认端口', + 'please_select' => '请选择', 'type' => '类型', 'type_website' => '网站', 'type_service' => '服务', From 5e0b2ac00b44801f298fffc27f48ef0a7c432e66 Mon Sep 17 00:00:00 2001 From: Egogo Websolutions Date: Sun, 9 Oct 2016 14:49:09 +0200 Subject: [PATCH 09/40] Bugfix: Message needs to be encoded before sending to receive correct SMS message --- src/psm/Txtmsg/Spryng.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/psm/Txtmsg/Spryng.php b/src/psm/Txtmsg/Spryng.php index 2a1a7028..482aafba 100644 --- a/src/psm/Txtmsg/Spryng.php +++ b/src/psm/Txtmsg/Spryng.php @@ -46,6 +46,7 @@ class Spryng extends Core { public function sendSMS($message) { $recipients = implode(',', $this->recipients); + $message = urlencode($message); $result = $this->_auth_https_post('http://www.spryng.nl', '/SyncTextService', '?OPERATION=send' . From a586425c659447638eb1c9529fa561ac72df93d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=98=E7=BC=98?= Date: Mon, 10 Oct 2016 17:22:28 +0800 Subject: [PATCH 10/40] format port from http/s url --- .../Module/Server/Controller/ServerController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/psm/Module/Server/Controller/ServerController.php b/src/psm/Module/Server/Controller/ServerController.php index 0fd9a4d1..c2c61db2 100644 --- a/src/psm/Module/Server/Controller/ServerController.php +++ b/src/psm/Module/Server/Controller/ServerController.php @@ -277,6 +277,18 @@ class ServerController extends AbstractServerController { // validate the lot $server_validator = new \psm\Util\Server\ServerValidator($this->db); + // format port from http/s url + if($clean['type'] == 'website' && empty($clean['port'])) { + $tmp = parse_url($clean["ip"]); + if(isset($tmp["port"])) { + $clean["port"] = $tmp["port"]; + } elseif ($tmp["scheme"] === "https") { + $clean["port"] = 443; + } elseif ($tmp["scheme"] === "http") { + $clean["port"] = 80; + } + } + try { if($this->server_id > 0) { $server_validator->serverId($this->server_id); From 80df5b773527d200fa35cdb29a4c800cc63ebcec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=98=E7=BC=98?= Date: Mon, 10 Oct 2016 20:11:59 +0800 Subject: [PATCH 11/40] use ajax to auto refresh server status page --- .../Module/Server/Controller/StatusController.php | 7 +++++++ src/templates/default/main/body.tpl.html | 3 --- .../default/module/server/status/index.tpl.html | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/psm/Module/Server/Controller/StatusController.php b/src/psm/Module/Server/Controller/StatusController.php index 4ef5aca9..5afde541 100644 --- a/src/psm/Module/Server/Controller/StatusController.php +++ b/src/psm/Module/Server/Controller/StatusController.php @@ -91,6 +91,13 @@ class StatusController extends AbstractServerController { $this->twig->addGlobal('auto_refresh', true); $this->twig->addGlobal('auto_refresh_seconds', $auto_refresh_seconds); } + + if($this->isXHR() || isset($_SERVER["HTTP_X_REQUESTED_WITH"])) { + $this->xhr = true; + //disable auto refresh in ajax return html + $layout_data["auto_refresh"] = 0; + } + return $this->twig->render('module/server/status/index.tpl.html', $layout_data); } diff --git a/src/templates/default/main/body.tpl.html b/src/templates/default/main/body.tpl.html index 2197ac9e..fa7d252a 100644 --- a/src/templates/default/main/body.tpl.html +++ b/src/templates/default/main/body.tpl.html @@ -11,9 +11,6 @@ - {% if auto_refresh %} - - {% endif %} diff --git a/src/templates/default/module/server/status/index.tpl.html b/src/templates/default/module/server/status/index.tpl.html index 4f579206..77fe4c89 100644 --- a/src/templates/default/module/server/status/index.tpl.html +++ b/src/templates/default/module/server/status/index.tpl.html @@ -57,4 +57,17 @@ - \ No newline at end of file + + +{% if auto_refresh %} + +{% endif %} \ No newline at end of file From fe99c1cbec5e2403e731aa2f82bae0c2722535db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=98=E7=BC=98?= Date: Wed, 19 Oct 2016 11:05:26 +0800 Subject: [PATCH 12/40] #367 fixed a csrf bug since 2014 --- src/psm/Module/Server/Controller/StatusController.php | 1 + src/templates/default/module/server/status/index.tpl.html | 1 + static/js/scripts.js | 1 + 3 files changed, 3 insertions(+) diff --git a/src/psm/Module/Server/Controller/StatusController.php b/src/psm/Module/Server/Controller/StatusController.php index 5afde541..600e9be1 100644 --- a/src/psm/Module/Server/Controller/StatusController.php +++ b/src/psm/Module/Server/Controller/StatusController.php @@ -37,6 +37,7 @@ class StatusController extends AbstractServerController { function __construct(Database $db, \Twig_Environment $twig) { parent::__construct($db, $twig); + $this->setCSRFKey('status'); $this->setActions(array('index', 'saveLayout'), 'index'); } diff --git a/src/templates/default/module/server/status/index.tpl.html b/src/templates/default/module/server/status/index.tpl.html index 77fe4c89..c66cde78 100644 --- a/src/templates/default/module/server/status/index.tpl.html +++ b/src/templates/default/module/server/status/index.tpl.html @@ -1,4 +1,5 @@
+
{% for server in servers_offline %} diff --git a/static/js/scripts.js b/static/js/scripts.js index fb29cb63..46669303 100755 --- a/static/js/scripts.js +++ b/static/js/scripts.js @@ -135,6 +135,7 @@ function psm_xhr(mod, params, method, on_complete, options) { function psm_saveLayout(layout) { var params = { action: 'saveLayout', + csrf: $("input[name=saveLayout_csrf]").val(), layout: layout }; psm_xhr('server_status', params, 'POST'); From 43645bf36f64069ab5692cab0b36eec3612a8690 Mon Sep 17 00:00:00 2001 From: Michael van Schaik Date: Fri, 21 Oct 2016 05:47:33 +0200 Subject: [PATCH 13/40] Update Mollie.php with new URL (Fixes #370) Mollie has changed their SMS api to api.messagebird.com They have been redirecting calls to www.mollie.com but will stop doing so from oct 24 2016 The API hasn't changed, this configuration is tested & working --- src/psm/Txtmsg/Mollie.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/psm/Txtmsg/Mollie.php b/src/psm/Txtmsg/Mollie.php index 7c173777..1824c802 100644 --- a/src/psm/Txtmsg/Mollie.php +++ b/src/psm/Txtmsg/Mollie.php @@ -61,7 +61,7 @@ class Mollie extends Core { public function sendSMS($message) { $recipients = implode(',', $this->recipients); - $result = $this->_auth_https_post('www.mollie.nl', '/xml/sms/', + $result = $this->_auth_https_post('api.messagebird.com', '/xml/sms/', 'gateway='.urlencode($this->gateway). '&username='.urlencode($this->username). '&password='.urlencode($this->password). @@ -97,4 +97,4 @@ class Mollie extends Core { } return $buf; } -} \ No newline at end of file +} From fd64fe1ef2e0da657cc0e2b748555480f50adab6 Mon Sep 17 00:00:00 2001 From: Samuel Denis-D'Ortun Date: Mon, 24 Oct 2016 20:48:18 -0400 Subject: [PATCH 14/40] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f32f4fde..29db5b68 100755 --- a/README.rst +++ b/README.rst @@ -119,4 +119,4 @@ along with PHP Server Monitor. If not, see http://www.gnu.org/licenses/. Docker ------- -PHPServerMonitor is now available on Docker : https://hub.docker.com/r/quentinv/phpservermonitor/ +PHPServerMonitor is now available on Docker : https://github.com/phpservermon/docker-phpservermonitor From d712bb7100981ff3113b92e23cd80b26f086c07b Mon Sep 17 00:00:00 2001 From: Daif Alotaibi Date: Wed, 2 Nov 2016 00:40:05 +0300 Subject: [PATCH 15/40] Support for SMSgw provider http://smsgw.net --- src/includes/functions.inc.php | 6 +- src/lang/en_US.lang.php | 3 +- .../Config/Controller/ConfigController.php | 3 +- src/psm/Txtmsg/Smsgw.php | 61 +++++++++++++++++++ .../default/module/config/config.tpl.html | 1 + 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 src/psm/Txtmsg/Smsgw.php diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index ec725f67..93604353 100755 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -531,7 +531,11 @@ function psm_build_sms() { break; case 'octopush': $sms = new \psm\Txtmsg\Octopush(); - break; } + break; + case 'smsgw': + $sms = new \psm\Txtmsg\Smsgw(); + break; + } // copy login information from the config file if($sms) { diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 07c1d5d1..51665f08 100755 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -214,6 +214,7 @@ $sm_lang = array( 'sms_gateway_freemobilesms' => 'FreeMobileSMS', 'sms_gateway_clicksend' => 'ClickSend', 'sms_gateway_nexmo' => 'Nexmo', + 'sms_gateway_smsgw' => 'SMSgw', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', 'sms_from' => 'Sender\'s phone number', @@ -315,4 +316,4 @@ $sm_lang = array( '401_unauthorized' => 'Unauthorized', '401_unauthorized_description' => 'You do not have the privileges to view this page.', ), -); +); \ No newline at end of file diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index d058de63..84d6e80d 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -321,6 +321,7 @@ class ConfigController extends AbstractController { 'label_sms_gateway_freevoipdeal' => psm_get_lang('config', 'sms_gateway_freevoipdeal'), 'label_sms_gateway_smsglobal' => psm_get_lang('config', 'sms_gateway_smsglobal'), 'label_sms_gateway_nexmo' => psm_get_lang('config', 'sms_gateway_nexmo'), + 'label_sms_gateway_smsgw' => psm_get_lang('config', 'sms_gateway_smsgw'), 'label_sms_gateway_octopush' => psm_get_lang('config', 'sms_gateway_octopush'), 'label_sms_gateway_freemobilesms' => psm_get_lang('config', 'sms_gateway_freemobilesms'), 'label_sms_gateway_clicksend' => psm_get_lang('config', 'sms_gateway_clicksend'), @@ -356,4 +357,4 @@ class ConfigController extends AbstractController { 'label_log_retention_days' => psm_get_lang('config', 'log_retention_days'), ); } -} +} \ No newline at end of file diff --git a/src/psm/Txtmsg/Smsgw.php b/src/psm/Txtmsg/Smsgw.php new file mode 100644 index 00000000..5fafb937 --- /dev/null +++ b/src/psm/Txtmsg/Smsgw.php @@ -0,0 +1,61 @@ +. + * + * @package phpservermon + * @author Daif Alotaibi + * @copyright Copyright (c) 2008-2015 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + **/ + +namespace psm\Txtmsg; + +class Smsgw extends Core { + + /** + * Send a text message to one or more recipients + * + * @param string $message + * @return boolean + */ + + public function sendSMS($message) { + $url = 'http://api.smsgw.net/SendBulkSMS'; + $post = array( + 'strUserName' => $this->username, + 'strPassword' => $this->password, + 'strTagName' => $this->originator, + 'strRecepientNumbers' => implode(';', $this->recipients), + 'strMessage' => $message, + ); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ch, CURLOPT_HEADER, FALSE); + curl_setopt($ch, CURLOPT_POST, TRUE); + curl_setopt($ch, CURLOPT_POSTFIELDS, $post); + $data = curl_exec($ch); + if($data == '1') { + $this->success = true; + } + return $this->success; + } + +} diff --git a/src/templates/default/module/config/config.tpl.html b/src/templates/default/module/config/config.tpl.html index 103c52a8..0a80fcba 100644 --- a/src/templates/default/module/config/config.tpl.html +++ b/src/templates/default/module/config/config.tpl.html @@ -173,6 +173,7 @@ +
From f19dc454eefa4f67a185da41e5a7bb60da9ba887 Mon Sep 17 00:00:00 2001 From: Benjy Date: Sat, 5 Nov 2016 19:10:28 +0100 Subject: [PATCH 16/40] Add base URL configuration field in installer and in sample configuration file --- config.php.sample | 2 +- .../Install/Controller/InstallController.php | 27 ++++++++++--------- .../module/install/config_new.tpl.html | 19 ++++++++----- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/config.php.sample b/config.php.sample index 667afe2e..42f6f9ec 100755 --- a/config.php.sample +++ b/config.php.sample @@ -4,4 +4,4 @@ define('PSM_DB_USER', 'db_user'); define('PSM_DB_PASS', 'db_pass'); define('PSM_DB_NAME', 'db_name'); define('PSM_DB_HOST', 'localhost'); - +define('PSM_BASE_URL', ''); diff --git a/src/psm/Module/Install/Controller/InstallController.php b/src/psm/Module/Install/Controller/InstallController.php index dad31b14..582f64aa 100644 --- a/src/psm/Module/Install/Controller/InstallController.php +++ b/src/psm/Module/Install/Controller/InstallController.php @@ -120,11 +120,12 @@ class InstallController extends AbstractController { } $config = array( - 'host' => 'localhost', - 'name' => '', - 'user' => '', - 'pass' => '', - 'prefix' => 'psm_', + 'db_host' => 'localhost', + 'db_name' => '', + 'db_user' => '', + 'db_pass' => '', + 'db_prefix' => 'psm_', + 'base_url' => '', ); $changed = false; @@ -140,10 +141,10 @@ class InstallController extends AbstractController { if($changed) { // test db connection $this->db = new \psm\Service\Database( - $config['host'], - $config['user'], - $config['pass'], - $config['name'] + $config['db_host'], + $config['db_user'], + $config['db_pass'], + $config['db_name'] ); if($this->db->status()) { @@ -275,11 +276,11 @@ class InstallController extends AbstractController { * @param array $db_vars prefix,user,pass,name,host * @return boolean|string TRUE on success, string with config otherwise */ - protected function writeConfigFile($db_vars) { + protected function writeConfigFile($array_config) { $config = " $value) { - $line = "define('PSM_DB_{key}', '{value}');".PHP_EOL; + foreach($array_config as $key => $value) { + $line = "define('PSM_{key}', '{value}');".PHP_EOL; $line = str_replace( array('{key}', '{value}'), array(strtoupper($key), $value), @@ -308,7 +309,7 @@ class InstallController extends AbstractController { 'name' => '', 'host' => '', ); - $pattern = "/define\('SM_DB_{key}', '(.*?)'/u"; + $pattern = "/define\('SM_{key}', '(.*?)'/u"; foreach($vars as $key => $value) { $pattern_key = str_replace('{key}', strtoupper($key), $pattern); diff --git a/src/templates/default/module/install/config_new.tpl.html b/src/templates/default/module/install/config_new.tpl.html index 64fe07ab..84be15c8 100644 --- a/src/templates/default/module/install/config_new.tpl.html +++ b/src/templates/default/module/install/config_new.tpl.html @@ -10,35 +10,42 @@
{{ macro.csrf_input() }} +

Please enter the application url:

+
+ +
+ +
+

Please enter your database info:

- +
- +
- +
- +
- +
@@ -60,4 +67,4 @@
{% endif %}
-{% endblock %} \ No newline at end of file +{% endblock %} From eadc9b145e574a43d4daad132d7de9157d9e2fe6 Mon Sep 17 00:00:00 2001 From: Samuel Denis-D'Ortun Date: Tue, 15 Nov 2016 13:08:21 -0500 Subject: [PATCH 17/40] Update README.rst --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index fdfa4b39..e76cdaab 100755 --- a/README.rst +++ b/README.rst @@ -75,6 +75,7 @@ Requirements * PHP 5.3.7+ * PHP cURL package * PHP PDO mysql driver +* PHP-XML Install From 92069a29a33222ce6c65fa02072d65d963530597 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:12:07 +0100 Subject: [PATCH 18/40] Add RDP port to save method --- src/psm/Module/Server/Controller/ServerController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/psm/Module/Server/Controller/ServerController.php b/src/psm/Module/Server/Controller/ServerController.php index c2c61db2..d2cdbba8 100644 --- a/src/psm/Module/Server/Controller/ServerController.php +++ b/src/psm/Module/Server/Controller/ServerController.php @@ -286,6 +286,8 @@ class ServerController extends AbstractServerController { $clean["port"] = 443; } elseif ($tmp["scheme"] === "http") { $clean["port"] = 80; + } elseif ($tmp["scheme"] === "rdp") { + $clean["port"] = 3389; } } From 2325a6c25f1901088b35ed68f2c47207de0c3edb Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:14:30 +0100 Subject: [PATCH 19/40] Add RDP to port list --- src/templates/default/module/server/server/update.tpl.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/default/module/server/server/update.tpl.html b/src/templates/default/module/server/server/update.tpl.html index 2378d21e..96c4d098 100644 --- a/src/templates/default/module/server/server/update.tpl.html +++ b/src/templates/default/module/server/server/update.tpl.html @@ -47,6 +47,7 @@ +
From 4c7d2bd4f3ad466905358c3755c69cf63f348549 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:29:28 +0100 Subject: [PATCH 20/40] Add updatePing method to check if ip is pingable --- src/psm/Util/Server/Updater/StatusUpdater.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/psm/Util/Server/Updater/StatusUpdater.php b/src/psm/Util/Server/Updater/StatusUpdater.php index 84b147e1..06335127 100644 --- a/src/psm/Util/Server/Updater/StatusUpdater.php +++ b/src/psm/Util/Server/Updater/StatusUpdater.php @@ -90,6 +90,9 @@ class StatusUpdater { } switch($this->server['type']) { + case 'ping': + $this->status_new = $this->updatePing($max_runs); + break; case 'service': $this->status_new = $this->updateService($max_runs); break; @@ -134,6 +137,41 @@ class StatusUpdater { } + /** + * Check the current servers ping status + * @param int $max_runs + * @param int $run + * @return boolean + */ + protected function updatePing($max_runs, $run = 1) { + $errno = 0; + // save response time + $starttime = microtime(true); + // set ping payload + $package = "\x08\x00\x7d\x4b\x00\x00\x00\x00PingHost"; + + $fp = @fsockopen ($this->server['ip'], $this->server['port'], $errno, $this->error, 10); + $socket = socket_create(AF_INET, SOCK_RAW, 1); + socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 0)); + socket_connect($socket, $this->server['ip'], null); + + socket_send($socket, $package, strLen($package), 0); + if (socket_read($socket, 255)) { + $this->rtime = microtime(true) - $starttime; + $status = true; + } else { + $status = false; + } + socket_close($socket); + + // check if server is available and rerun if asked. + if(!$status && $run < $max_runs) { + return $this->updatePing($max_runs, $run + 1); + } + + return $status; + } + /** * Check the current server as a service * @param int $max_runs From 363f67b3355c2b4d319c819cb9060e0efed3503c Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:30:27 +0100 Subject: [PATCH 21/40] Add copyright notice to updatePing method --- src/psm/Util/Server/Updater/StatusUpdater.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/psm/Util/Server/Updater/StatusUpdater.php b/src/psm/Util/Server/Updater/StatusUpdater.php index 06335127..ad787b2f 100644 --- a/src/psm/Util/Server/Updater/StatusUpdater.php +++ b/src/psm/Util/Server/Updater/StatusUpdater.php @@ -138,7 +138,7 @@ class StatusUpdater { } /** - * Check the current servers ping status + * Check the current servers ping status - Code from http://stackoverflow.com/a/20467492 * @param int $max_runs * @param int $run * @return boolean From 3cd90b29aef3f29d677be5240990f11d4893f276 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:33:55 +0100 Subject: [PATCH 22/40] Add server type ping to dropdown --- src/templates/default/module/server/server/update.tpl.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/templates/default/module/server/server/update.tpl.html b/src/templates/default/module/server/server/update.tpl.html index 96c4d098..4f26e357 100644 --- a/src/templates/default/module/server/server/update.tpl.html +++ b/src/templates/default/module/server/server/update.tpl.html @@ -20,6 +20,7 @@
From 5c0e889dd2efc8ca55dab06f0c676148411f7fd9 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:38:47 +0100 Subject: [PATCH 23/40] Add ping validation checks to ServerValidator --- src/psm/Util/Server/ServerValidator.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/psm/Util/Server/ServerValidator.php b/src/psm/Util/Server/ServerValidator.php index 8b23d14f..4c97333f 100644 --- a/src/psm/Util/Server/ServerValidator.php +++ b/src/psm/Util/Server/ServerValidator.php @@ -101,6 +101,11 @@ class ServerValidator { throw new \InvalidArgumentException('server_ip_bad_service'); } break; + case 'ping': + if(!filter_var($value, FILTER_VALIDATE_IP)) { + throw new \InvalidArgumentException('server_ip_bad_service'); + } + break; } return true; @@ -113,7 +118,7 @@ class ServerValidator { * @throws \InvalidArgumentException */ public function type($type) { - if(!in_array($type, array('service', 'website'))) { + if(!in_array($type, array('ping', 'service', 'website'))) { throw new \InvalidArgumentException('server_type_invalid'); } return true; From b6060e793601aa819eadf1fa6e257ea74b86d411 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:44:15 +0100 Subject: [PATCH 24/40] Add ping label to getLabels() --- src/psm/Module/Server/Controller/ServerController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/psm/Module/Server/Controller/ServerController.php b/src/psm/Module/Server/Controller/ServerController.php index d2cdbba8..748f5434 100644 --- a/src/psm/Module/Server/Controller/ServerController.php +++ b/src/psm/Module/Server/Controller/ServerController.php @@ -460,6 +460,7 @@ class ServerController extends AbstractServerController { 'label_type' => psm_get_lang('servers', 'type'), 'label_website' => psm_get_lang('servers', 'type_website'), 'label_service' => psm_get_lang('servers', 'type_service'), + 'label_ping' => psm_get_lang('servers', 'type_ping'), 'label_pattern' => psm_get_lang('servers', 'pattern'), 'label_pattern_description' => psm_get_lang('servers', 'pattern_description'), 'label_last_check' => psm_get_lang('servers', 'last_check'), From 8ee269ceaa4d094408111a08691dbe1d86811d33 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 11:45:27 +0100 Subject: [PATCH 25/40] Add type_ping to lang file --- src/lang/de_DE.lang.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php index fd8aee95..885d6199 100644 --- a/src/lang/de_DE.lang.php +++ b/src/lang/de_DE.lang.php @@ -125,6 +125,7 @@ $sm_lang = array( 'type' => 'Typ', 'type_website' => 'Webseite', 'type_service' => 'Service', + 'type_ping' => 'Ping', 'pattern' => 'Suchstring/-muster', 'pattern_description' => 'Wenn das gesuchte Muster nicht in der Webseite ist, wird die Seite als offline markiert. Reguläre Ausdrücke sind erlaubt.', 'last_check' => 'Letzter Check', From 3c961c8b91068b12adf458728bad3aeed95f7aef Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 14:13:11 +0100 Subject: [PATCH 26/40] Add type ping to lang file --- src/lang/en_US.lang.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 51665f08..058c7919 100755 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -135,6 +135,7 @@ $sm_lang = array( 'type' => 'Type', 'type_website' => 'Website', 'type_service' => 'Service', + 'type_ping' => 'Ping', 'pattern' => 'Search string/pattern', 'pattern_description' => 'If this pattern is not found on the website, the server will be marked offline. Regular expressions are allowed.', 'last_check' => 'Last check', @@ -316,4 +317,4 @@ $sm_lang = array( '401_unauthorized' => 'Unauthorized', '401_unauthorized_description' => 'You do not have the privileges to view this page.', ), -); \ No newline at end of file +); From 6bee28c78ececa309ad76c47ad5c583ac463535c Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 14:29:57 +0100 Subject: [PATCH 27/40] Add ping to enum for type column in servers database table --- src/psm/Util/Install/Installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/psm/Util/Install/Installer.php b/src/psm/Util/Install/Installer.php index 6c3ee490..612f7764 100644 --- a/src/psm/Util/Install/Installer.php +++ b/src/psm/Util/Install/Installer.php @@ -218,7 +218,7 @@ class Installer { `ip` varchar(500) NOT NULL, `port` int(5) unsigned NOT NULL, `label` varchar(255) NOT NULL, - `type` enum('service','website') NOT NULL default 'service', + `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, From ff1013ed7c7a517024ce8c657ccab50ba29bdee6 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:20:02 +0100 Subject: [PATCH 28/40] Add custom port to config options in db class --- src/psm/Service/Database.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/psm/Service/Database.php b/src/psm/Service/Database.php index c5296170..afb022a7 100644 --- a/src/psm/Service/Database.php +++ b/src/psm/Service/Database.php @@ -81,9 +81,10 @@ class Database { * @param string $pass * @param string $db */ - function __construct($host = null, $user = null, $pass = null, $db = null) { + function __construct($host = null, $user = null, $pass = null, $db = null, $port = null) { if($host != null && $user != null && $pass !== null && $db != null) { $this->db_host = $host; + $this->db_port = $port || 3306; $this->db_name = $db; $this->db_user = $user; $this->db_pass = $pass; @@ -498,7 +499,7 @@ class Database { // Initizale connection try { $this->pdo = new \PDO( - 'mysql:host='.$this->db_host.';dbname='.$this->db_name.';charset=utf8', + 'mysql:host='.$this->db_host.';port='.$this->db_port.';dbname='.$this->db_name.';charset=utf8', $this->db_user, $this->db_pass ); From 80a092fa0c82b66232e3a81c42f2ceed8561c85a Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:20:46 +0100 Subject: [PATCH 29/40] Add port static to config file --- config.php.sample | 1 + 1 file changed, 1 insertion(+) diff --git a/config.php.sample b/config.php.sample index 667afe2e..41b09247 100755 --- a/config.php.sample +++ b/config.php.sample @@ -4,4 +4,5 @@ define('PSM_DB_USER', 'db_user'); define('PSM_DB_PASS', 'db_pass'); define('PSM_DB_NAME', 'db_name'); define('PSM_DB_HOST', 'localhost'); +define('PSM_DB_PORT', '3306'); From 4a69f606d3661f034147092f4e96a759c395cdf0 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:22:24 +0100 Subject: [PATCH 30/40] Add port constant to psminstall --- puphpet/files/exec-once/psminstall.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/puphpet/files/exec-once/psminstall.sh b/puphpet/files/exec-once/psminstall.sh index 2ebd8b54..b115800f 100644 --- a/puphpet/files/exec-once/psminstall.sh +++ b/puphpet/files/exec-once/psminstall.sh @@ -6,8 +6,9 @@ define('PSM_DB_USER', 'psm'); \ define('PSM_DB_PASS', 'psm'); \ define('PSM_DB_NAME', 'psm'); \ define('PSM_DB_HOST', 'localhost'); \ +define('PSM_DB_PORT', '3306'); \ ?>" > /var/www/default/psm/config.php echo "" > /var/www/default/index.php \ No newline at end of file +?>" > /var/www/default/index.php From a3853241f806dd4edbf1907b103289381de41ef2 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:23:31 +0100 Subject: [PATCH 31/40] Add port param and argument --- src/config/services.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config/services.xml b/src/config/services.xml index 5d3fbd1b..43446dcd 100644 --- a/src/config/services.xml +++ b/src/config/services.xml @@ -18,6 +18,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/sc %path.src%templates PSM_DB_HOST + PSM_DB_PORT PSM_DB_USER PSM_DB_PASS PSM_DB_NAME @@ -38,6 +39,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/sc %db.user% %db.pass% %db.name% + %db.port% From a9f11fb691972863848324f38dab177d1bce52d5 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:24:25 +0100 Subject: [PATCH 32/40] Add port constant to install readme --- docs/install.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/install.rst b/docs/install.rst index f8e0efa2..627704fb 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -27,6 +27,7 @@ To change these values correctly, only update the second parameter of the functi define('PSM_DB_NAME', 'db_name'); define('PSM_DB_USER', 'db_user'); define('PSM_DB_PASS', 'db_user_password'); + define('PSM_DB_PORT', '3306'); For example: to change your username you should ONLY change the 'db\_user' part. Do NOT remove the quotes around your username as that will result in an error. From b2043b1b654c3808f95ec70a90a481fda53d7aa3 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:28:25 +0100 Subject: [PATCH 33/40] Add protected variable $db_port --- src/psm/Service/Database.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/psm/Service/Database.php b/src/psm/Service/Database.php index afb022a7..c15348e0 100644 --- a/src/psm/Service/Database.php +++ b/src/psm/Service/Database.php @@ -35,6 +35,12 @@ class Database { */ protected $db_host; + /** + * DB port + * @var string $db_port + */ + protected $db_port; + /** * DB name * @var string $db_name From cd977e2e515e7242330742c3856646c5f2b3e94a Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:30:39 +0100 Subject: [PATCH 34/40] Initialize protected variable db_port with value 3306 --- src/psm/Service/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/psm/Service/Database.php b/src/psm/Service/Database.php index c15348e0..16ff69fc 100644 --- a/src/psm/Service/Database.php +++ b/src/psm/Service/Database.php @@ -39,7 +39,7 @@ class Database { * DB port * @var string $db_port */ - protected $db_port; + protected $db_port = 3306; /** * DB name From b780a6237e72b867a4584886eb3329fdcc877f77 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:38:50 +0100 Subject: [PATCH 35/40] Add port input fields to template --- src/templates/default/module/install/config_new.tpl.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/templates/default/module/install/config_new.tpl.html b/src/templates/default/module/install/config_new.tpl.html index 64fe07ab..4a07a4ce 100644 --- a/src/templates/default/module/install/config_new.tpl.html +++ b/src/templates/default/module/install/config_new.tpl.html @@ -17,6 +17,12 @@
+
+ +
+ +
+
@@ -60,4 +66,4 @@
{% endif %}
-{% endblock %} \ No newline at end of file +{% endblock %} From b1df28d4d97d1e006de22fd75fd6348cecafc899 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:41:03 +0100 Subject: [PATCH 36/40] Add port to installer --- src/psm/Module/Install/Controller/InstallController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/psm/Module/Install/Controller/InstallController.php b/src/psm/Module/Install/Controller/InstallController.php index dad31b14..fab71709 100644 --- a/src/psm/Module/Install/Controller/InstallController.php +++ b/src/psm/Module/Install/Controller/InstallController.php @@ -121,6 +121,7 @@ class InstallController extends AbstractController { $config = array( 'host' => 'localhost', + 'port' => '3306', 'name' => '', 'user' => '', 'pass' => '', @@ -143,7 +144,8 @@ class InstallController extends AbstractController { $config['host'], $config['user'], $config['pass'], - $config['name'] + $config['name'], + $config['port'], ); if($this->db->status()) { @@ -307,6 +309,7 @@ class InstallController extends AbstractController { 'pass' => '', 'name' => '', 'host' => '', + 'port' => '3306', ); $pattern = "/define\('SM_DB_{key}', '(.*?)'/u"; From 6805903089e54eab6d4157b98553eff86f95e009 Mon Sep 17 00:00:00 2001 From: Tom Hatzer Date: Fri, 23 Dec 2016 15:42:15 +0100 Subject: [PATCH 37/40] Remove trailing comma --- src/psm/Module/Install/Controller/InstallController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/psm/Module/Install/Controller/InstallController.php b/src/psm/Module/Install/Controller/InstallController.php index fab71709..75a7e94a 100644 --- a/src/psm/Module/Install/Controller/InstallController.php +++ b/src/psm/Module/Install/Controller/InstallController.php @@ -145,7 +145,7 @@ class InstallController extends AbstractController { $config['user'], $config['pass'], $config['name'], - $config['port'], + $config['port'] ); if($this->db->status()) { @@ -309,7 +309,7 @@ class InstallController extends AbstractController { 'pass' => '', 'name' => '', 'host' => '', - 'port' => '3306', + 'port' => '3306' ); $pattern = "/define\('SM_DB_{key}', '(.*?)'/u"; From 479f2119f698f9ab7f142a265bf7a2fa932ead01 Mon Sep 17 00:00:00 2001 From: criwe Date: Sun, 25 Dec 2016 22:44:44 +0100 Subject: [PATCH 38/40] add A monitoring website should not be indexed by google. will prevent that. Removed autor-tag, because not relevant anymore (especially for a page like that) --- src/templates/default/main/body.tpl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/default/main/body.tpl.html b/src/templates/default/main/body.tpl.html index fa7d252a..4ce7dc56 100644 --- a/src/templates/default/main/body.tpl.html +++ b/src/templates/default/main/body.tpl.html @@ -6,7 +6,7 @@ {{ title }} - + From b0add8c2105ea997ab1a49d9e6b612a3c8c60ef3 Mon Sep 17 00:00:00 2001 From: criwe Date: Sun, 25 Dec 2016 23:00:49 +0100 Subject: [PATCH 39/40] Added some basic pagespeed settings Added some basic pagespeed settings to the htaccess --- .htaccess | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.htaccess b/.htaccess index 5a928f6d..1014e510 100644 --- a/.htaccess +++ b/.htaccess @@ -1 +1,20 @@ Options -Indexes + + + + ExpiresActive on + ExpiresDefault "access plus 1 month" + + + + +AddOutputFilterByType DEFLATE text/plain +AddOutputFilterByType DEFLATE text/html +AddOutputFilterByType DEFLATE text/xml +AddOutputFilterByType DEFLATE text/css +AddOutputFilterByType DEFLATE application/xml +AddOutputFilterByType DEFLATE application/xhtml+xml +AddOutputFilterByType DEFLATE application/rss+xml +AddOutputFilterByType DEFLATE application/javascript +AddOutputFilterByType DEFLATE application/x-javascript + From 5b4525102a0732019b7c31dde3ee489d8d51c0ed Mon Sep 17 00:00:00 2001 From: Samuel Denis-D'Ortun Date: Fri, 13 Jan 2017 03:01:15 -0500 Subject: [PATCH 40/40] Update composer.json --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index b307dc44..a1e5c180 100755 --- a/composer.json +++ b/composer.json @@ -3,10 +3,7 @@ "description": "PHP Server Monitor", "homepage": "http://www.phpservermonitor.org", "repositories": [ - { - "type": "vcs", - "url": "https://github.com/phpservermon/php-pushover" - } + ], "require": { "php": ">=5.3.7",