diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1a285a61..24c0da72 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ Changelog not yet released ---------------------------------- +* #170: Implement Nexmo SMS. * #161: Added Swedish translation. * #185: Added Estonian translation. * #210: Added Finnish translation. diff --git a/README.rst b/README.rst index e6f443cb..aa3493f7 100755 --- a/README.rst +++ b/README.rst @@ -52,6 +52,7 @@ The following SMS gateways are currently available: * Spryng - * Textmarketer - * FreeVoipDeal - +* Nexmo - Please note: for these gateways you will need an account with sufficient credits. diff --git a/docs/credits.rst b/docs/credits.rst index cacefed4..42fe274e 100644 --- a/docs/credits.rst +++ b/docs/credits.rst @@ -68,6 +68,10 @@ The following people have contributed to the development of PHP Server Monitor: * FreeVoipDeal SMS gateway +* Luis Rodriguez - https://github.com/ldrrp + + * Nexmo SMS gateway + Translators +++++++++++ diff --git a/docs/intro.rst b/docs/intro.rst index 92c6d43a..46364c7c 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -56,6 +56,7 @@ The following SMS gateways are currently available: * Spryng - * Textmarketer - * FreeVoipDeal - +* Nexmo - Please note: for these gateways you will need an account with sufficient credits. @@ -63,4 +64,4 @@ Please note: for these gateways you will need an account with sufficient credits Download ++++++++ -The latest version can be downloaded from http://www.phpservermonitor.org/. \ No newline at end of file +The latest version can be downloaded from http://www.phpservermonitor.org/. diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index f4bbf3d3..4fe346c4 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -470,6 +470,9 @@ function psm_build_sms() { case 'freevoipdeal': $sms = new \psm\Txtmsg\FreeVoipDeal(); break; + case 'nexmo': + $sms = new \psm\Txtmsg\Nexmo(); + break; } // copy login information from the config file diff --git a/src/lang/bg_BG.lang.php b/src/lang/bg_BG.lang.php index fc3d0c29..1601d355 100644 --- a/src/lang/bg_BG.lang.php +++ b/src/lang/bg_BG.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Потребител', 'sms_gateway_password' => 'Парола', 'sms_from' => 'Номер на изпращача', diff --git a/src/lang/cs_CZ.lang.php b/src/lang/cs_CZ.lang.php index 08be3b13..eb70b984 100644 --- a/src/lang/cs_CZ.lang.php +++ b/src/lang/cs_CZ.lang.php @@ -195,8 +195,9 @@ $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_nexmo' => 'Nexmo', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_username' => 'Uživatelské jméno brány', diff --git a/src/lang/da_DK.lang.php b/src/lang/da_DK.lang.php index 4342208a..6dc7b27c 100644 --- a/src/lang/da_DK.lang.php +++ b/src/lang/da_DK.lang.php @@ -195,6 +195,7 @@ $sm_lang = array( 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Gateway brugernavn/apikey', 'sms_gateway_password' => 'Gateway adgangskode', 'sms_from' => 'Afsenders navn.', diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php index 240e4d98..e5f34f6b 100644 --- a/src/lang/de_DE.lang.php +++ b/src/lang/de_DE.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Gateway Benutzername', 'sms_gateway_password' => 'Gateway Passwort', 'sms_from' => 'SMS-Sendernummer', diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index ab050657..8359b83f 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -194,10 +194,11 @@ $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_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', 'sms_from' => 'Sender\'s phone number', diff --git a/src/lang/es_ES.lang.php b/src/lang/es_ES.lang.php index fe12feb9..97fe4572 100644 --- a/src/lang/es_ES.lang.php +++ b/src/lang/es_ES.lang.php @@ -196,12 +196,15 @@ $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_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_username' => 'Usuario', 'sms_gateway_password' => 'Contraseña', + 'sms_gateway_nexmo' => 'Nexmo', + 'sms_gateway_username' => 'Gateway username', + 'sms_gateway_password' => 'Gateway password', 'sms_from' => 'Número origen del SMS', 'pushover_status' => '¿Habilitar el envío de mensajes Pushover?', 'pushover_description' => 'Pushover es un servicio que hace que sea fácil de obtener notificaciones en tiempo real. Vea su página web para más información.', diff --git a/src/lang/fr_FR.lang.php b/src/lang/fr_FR.lang.php index cf67b7a5..18d2355c 100644 --- a/src/lang/fr_FR.lang.php +++ b/src/lang/fr_FR.lang.php @@ -199,6 +199,7 @@ $sm_lang = array( 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Nom utilisateur de la passerelle', 'sms_gateway_password' => 'Mot de passe de la passerelle', 'sms_from' => 'SMS de l\'expéditeur', diff --git a/src/lang/it_IT.lang.php b/src/lang/it_IT.lang.php index 985f3a06..9bf9362c 100644 --- a/src/lang/it_IT.lang.php +++ b/src/lang/it_IT.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Nome Utente Gateway', 'sms_gateway_password' => 'Password Gateway', 'sms_from' => 'Numero di telefono del mittente', diff --git a/src/lang/ko_KR.lang.php b/src/lang/ko_KR.lang.php index ec8f5d4a..accfb5f6 100644 --- a/src/lang/ko_KR.lang.php +++ b/src/lang/ko_KR.lang.php @@ -195,6 +195,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_smsit' => 'Smsit', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', diff --git a/src/lang/nl_NL.lang.php b/src/lang/nl_NL.lang.php index 8c9bbf09..45b8fac9 100644 --- a/src/lang/nl_NL.lang.php +++ b/src/lang/nl_NL.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Gateway gebruikersnaam', 'sms_gateway_password' => 'Gateway wachtwoord', 'sms_from' => 'Telefoonnummer afzender', diff --git a/src/lang/pl_PL.lang.php b/src/lang/pl_PL.lang.php index 3d08eae9..40c7ce72 100644 --- a/src/lang/pl_PL.lang.php +++ b/src/lang/pl_PL.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Login do bramki', 'sms_gateway_password' => 'Hasło do bramki', 'sms_from' => 'Numer nadawcy', diff --git a/src/lang/pt_BR.lang.php b/src/lang/pt_BR.lang.php index 495e7e16..9cf1f00b 100644 --- a/src/lang/pt_BR.lang.php +++ b/src/lang/pt_BR.lang.php @@ -187,13 +187,13 @@ $sm_lang = array( 'email_smtp_username' => 'SMTP username', 'email_smtp_password' => 'SMTP password', 'email_smtp_noauth' => 'Deixe em branco para nenhuma autenticação', - 'sms_status' => 'Habilitar o envio de mensagem de texto?', - 'sms_gateway' => 'Gateway para o uso de envio de mensagens', - 'sms_gateway_mosms' => 'Mosms', - 'sms_gateway_mollie' => 'Mollie', - 'sms_gateway_spryng' => 'Spryng', - 'sms_gateway_inetworx' => 'Inetworx', - 'sms_gateway_clickatell' => 'Clickatell', + 'sms_status' => 'Habilitar o envio de mensagem de texto?', + 'sms_gateway' => 'Gateway para o uso de envio de mensagens', + '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_smsit' => 'Smsit', @@ -201,6 +201,10 @@ $sm_lang = array( 'sms_gateway_username' => 'Usuário do Gateway', 'sms_gateway_password' => 'Senha do Gateway', 'sms_from' => 'Número de telefone de envio', + 'sms_gateway_nexmo' => 'Nexmo', + 'sms_gateway_username' => 'Usuário do Gateway', + 'sms_gateway_password' => 'Senha do Gateway', + 'sms_from' => 'Número de telefone de envio', 'pushover_status' => 'Habilitar envio de mensagens Pushover', 'pushover_description' => 'Pushover é um serviço de notificações em tempo real. Veja o website para mais informações.', 'pushover_clone_app' => 'Clique aqui para criar sua app Pushover', diff --git a/src/lang/ru_RU.lang.php b/src/lang/ru_RU.lang.php index 1a5f86d7..6d76e8a3 100644 --- a/src/lang/ru_RU.lang.php +++ b/src/lang/ru_RU.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Пользователь', 'sms_gateway_password' => 'Пароль', 'sms_from' => 'Номер отправителя', diff --git a/src/lang/sv_SE.lang.php b/src/lang/sv_SE.lang.php index 6b190956..2c294514 100644 --- a/src/lang/sv_SE.lang.php +++ b/src/lang/sv_SE.lang.php @@ -194,10 +194,11 @@ $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_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Gateway användarnamn', 'sms_gateway_password' => 'Gateway lösenord', 'sms_from' => 'Avsändarens telefonnummer', diff --git a/src/lang/tr_TR.lang.php b/src/lang/tr_TR.lang.php index 4df35c13..64eab9aa 100644 --- a/src/lang/tr_TR.lang.php +++ b/src/lang/tr_TR.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Servis kullanıcı adı', 'sms_gateway_password' => 'Servis şifresi', 'sms_from' => 'Gönderen numarası', diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index 5083abb6..da06bf56 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -194,10 +194,11 @@ $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_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'SMS网关用户名', 'sms_gateway_password' => 'SMS网关密码', 'sms_from' => '发信人电话号', diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index 9179301b..c2a0ce99 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -316,6 +316,7 @@ class ConfigController extends AbstractController { 'label_sms_gateway_smsit' => psm_get_lang('config', 'sms_gateway_smsit'), '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_username' => psm_get_lang('config', 'sms_gateway_username'), 'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'), 'label_sms_from' => psm_get_lang('config', 'sms_from'), diff --git a/src/psm/Txtmsg/Nexmo.class.php b/src/psm/Txtmsg/Nexmo.class.php new file mode 100644 index 00000000..f2c7aa9f --- /dev/null +++ b/src/psm/Txtmsg/Nexmo.class.php @@ -0,0 +1,58 @@ +. + * + * @package phpservermon + * @author Andreas Ek + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + * @since phpservermon 3.1.1 + **/ + +namespace psm\Txtmsg; + +class Nexmo extends Core { + // ========================================================================= + // [ Fields ] + // ========================================================================= + public $gateway = 1; + public $resultcode = null; + public $resultmessage = null; + public $success = false; + public $successcount = 0; + + public function sendSMS($message) { + $nexmo_url = "https://rest.nexmo.com/sms/json"; + $nexmo_data = rawurlencode( $message ); + + foreach( $this->recipients as $phone ){ + $result = file_get_contents( $nexmo_url . + "?api_key=" . $this->username . + "&api_secret=" . $this->password . + "&from=" . $this->originator . + "&to=" . $phone . + "&type=text" . + "&text=" . $nexmo_data + ); + } + + return $result; + } +}