From 14037517838b6fc5799bc664993fb579af01af6d Mon Sep 17 00:00:00 2001 From: MiX-MaN Date: Sun, 4 Jun 2017 21:05:45 -0500 Subject: [PATCH 1/2] Changed Server Validator to allow hostnames or IPs --- src/psm/Util/Server/ServerValidator.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/psm/Util/Server/ServerValidator.php b/src/psm/Util/Server/ServerValidator.php index 819e3e63..278cf0f3 100644 --- a/src/psm/Util/Server/ServerValidator.php +++ b/src/psm/Util/Server/ServerValidator.php @@ -92,7 +92,7 @@ class ServerValidator { throw new \InvalidArgumentException('server_ip_bad_website'); } break; - case 'service': + case 'service' or 'ping': if( !filter_var($value, FILTER_VALIDATE_IP) // domain regex as per http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address : @@ -101,11 +101,6 @@ 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; From 8e4f98c5dadb64bce970b733f24e0787cddbf37e Mon Sep 17 00:00:00 2001 From: "djmixman@gmail.com" Date: Mon, 5 Jun 2017 19:55:37 -0500 Subject: [PATCH 2/2] Chaged the way some messages are displayed when sent to sms/email/pushover --- src/lang/en_US.lang.php | 14 +++++++------- src/psm/Txtmsg/FreeVoipDeal.php | 0 .../default/module/server/status/index.tpl.html | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) mode change 100755 => 100644 src/psm/Txtmsg/FreeVoipDeal.php diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 99012424..a9091040 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -289,15 +289,15 @@ $sm_lang = array( ), // for newlines in the email messages use
'notifications' => array( - 'off_sms' => 'Server \'%LABEL%\' is DOWN: ip=%IP%, port=%PORT%. Error=%ERROR%', - 'off_email_subject' => 'IMPORTANT: Server \'%LABEL%\' is DOWN', + 'off_sms' => '[CNM] Warning: \'%LABEL%\' is Offline!', + 'off_email_subject' => '[CNM] Warning: \'%LABEL%\' is Offline!', 'off_email_body' => "Failed to connect to the following server:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Error: %ERROR%
Date: %DATE%", - 'off_pushover_title' => 'Server \'%LABEL%\' is DOWN', + 'off_pushover_title' => '[CNM] Warning: \'%LABEL%\' is Offline!', 'off_pushover_message' => "Failed to connect to the following server:

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

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%", - 'on_pushover_title' => 'Server \'%LABEL%\' is RUNNING', + 'on_sms' => '[CNM] Notice: \'%LABEL%\' is back online.', + 'on_email_subject' => '[CNM] Notice: \'%LABEL%\' is back online.', + 'on_email_body' => "'%LABEL%' is running again:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%", + 'on_pushover_title' => '[CNM] \'%LABEL%\' is back online.', 'on_pushover_message' => 'Server \'%LABEL%\' is running again:

Server: %LABEL%
IP: %IP%
Port: %PORT%
Date: %DATE%', ), 'login' => array( diff --git a/src/psm/Txtmsg/FreeVoipDeal.php b/src/psm/Txtmsg/FreeVoipDeal.php old mode 100755 new mode 100644 diff --git a/src/templates/default/module/server/status/index.tpl.html b/src/templates/default/module/server/status/index.tpl.html index c66cde78..52a5c2e9 100644 --- a/src/templates/default/module/server/status/index.tpl.html +++ b/src/templates/default/module/server/status/index.tpl.html @@ -71,4 +71,4 @@ setInterval(function(){ }); }, {{ auto_refresh_seconds }} * 1000); -{% endif %} \ No newline at end of file +{% endif %}