diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 021c7df9..b19d80a1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,7 @@ not yet released * #105: Fixing check for websites with unverified SSL certificates. * #107: Fixing update job for Synology DSM Task Scheduler. * #111: Generated urls for non-default ports included the port twice. +* #110: Support for SMSGlobal SMS gateway . * Support for Danish SMS provider Smsit * Composer added for dependencies. diff --git a/docs/credits.rst b/docs/credits.rst index eb1d5f12..9f557578 100644 --- a/docs/credits.rst +++ b/docs/credits.rst @@ -46,6 +46,10 @@ The following people have contributed to the development of PHP Server Monitor: * Smsit SMS gateway +* Victor Macko + + * SMSGlobal SMS gateway + Translators +++++++++++ diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 788e9d24..7caf85ae 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -444,6 +444,9 @@ function psm_build_sms() { case 'textmarketer': $sms = new \psm\Txtmsg\Textmarketer(); break; + case 'smsglobal': + $sms = new \psm\Txtmsg\Smsglobal(); + 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 ef5cbbde..881c56b3 100644 --- a/src/lang/bg_BG.lang.php +++ b/src/lang/bg_BG.lang.php @@ -179,6 +179,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_username' => 'Потребител', 'sms_gateway_password' => 'Парола', 'sms_from' => 'Номер на изпращача', diff --git a/src/lang/da_DK.lang.php b/src/lang/da_DK.lang.php index e3246f5d..fdb91614 100644 --- a/src/lang/da_DK.lang.php +++ b/src/lang/da_DK.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Gateway brugernavn/apikey', 'sms_gateway_password' => 'Gateway adgangskode', diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php index 84e35909..90eb0d97 100644 --- a/src/lang/de_DE.lang.php +++ b/src/lang/de_DE.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Gateway Benutzername', 'sms_gateway_password' => 'Gateway Passwort', diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 919a9377..5eb63be9 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', diff --git a/src/lang/es_ES.lang.php b/src/lang/es_ES.lang.php index 786433f7..29e27105 100644 --- a/src/lang/es_ES.lang.php +++ b/src/lang/es_ES.lang.php @@ -177,6 +177,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', diff --git a/src/lang/fr_FR.lang.php b/src/lang/fr_FR.lang.php index 7c64447b..4de4f9f8 100644 --- a/src/lang/fr_FR.lang.php +++ b/src/lang/fr_FR.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Nom utilisateur de la passerelle', 'sms_gateway_password' => 'Mot de passe de la passerelle', diff --git a/src/lang/it_IT.lang.php b/src/lang/it_IT.lang.php index 76f965fe..7721365f 100644 --- a/src/lang/it_IT.lang.php +++ b/src/lang/it_IT.lang.php @@ -177,6 +177,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Nome Utente Gateway', 'sms_gateway_password' => 'Password Gateway', diff --git a/src/lang/ko_KR.lang.php b/src/lang/ko_KR.lang.php index dcb19402..fd186ca8 100644 --- a/src/lang/ko_KR.lang.php +++ b/src/lang/ko_KR.lang.php @@ -179,6 +179,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', 'sms_from' => 'Sender\'s phone number', diff --git a/src/lang/nl_NL.lang.php b/src/lang/nl_NL.lang.php index 2824e2fd..fccc7f73 100644 --- a/src/lang/nl_NL.lang.php +++ b/src/lang/nl_NL.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Gateway gebruikersnaam', 'sms_gateway_password' => 'Gateway wachtwoord', diff --git a/src/lang/pt_BR.lang.php b/src/lang/pt_BR.lang.php index 3b06652b..a8b412ad 100644 --- a/src/lang/pt_BR.lang.php +++ b/src/lang/pt_BR.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Usuário do Gateway', 'sms_gateway_password' => 'Senha do Gateway', diff --git a/src/lang/ru_RU.lang.php b/src/lang/ru_RU.lang.php index e82eda7c..9fb5add1 100644 --- a/src/lang/ru_RU.lang.php +++ b/src/lang/ru_RU.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'Пользователь', 'sms_gateway_password' => 'Пароль', diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index 8f57b26e..4f312245 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -178,6 +178,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', + 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_username' => 'SMS网关用户名', 'sms_gateway_password' => 'SMS网关密码', diff --git a/src/psm/Module/Config/Controller/ConfigController.class.php b/src/psm/Module/Config/Controller/ConfigController.class.php index 4d422be1..10d8ee23 100644 --- a/src/psm/Module/Config/Controller/ConfigController.class.php +++ b/src/psm/Module/Config/Controller/ConfigController.class.php @@ -271,6 +271,7 @@ class ConfigController extends AbstractController { 'label_sms_gateway_clickatell' => psm_get_lang('config', 'sms_gateway_clickatell'), 'label_sms_gateway_textmarketer' => psm_get_lang('config', 'sms_gateway_textmarketer'), 'label_sms_gateway_smsit' => psm_get_lang('config', 'sms_gateway_smsit'), + 'label_sms_gateway_smsglobal' => psm_get_lang('config', 'sms_gateway_smsglobal'), '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/Smsglobal.class.php b/src/psm/Txtmsg/Smsglobal.class.php new file mode 100644 index 00000000..762104e9 --- /dev/null +++ b/src/psm/Txtmsg/Smsglobal.class.php @@ -0,0 +1,80 @@ +. + * + * @package phpservermon + * @author Victor Macko + * @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 + **/ + +namespace psm\Txtmsg; + +class Smsglobal extends Core { + // ========================================================================= + // [ Fields ] + // ========================================================================= + public $gateway = 1; + public $resultcode = null; + public $resultmessage = null; + public $success = false; + public $successcount = 0; + + /** + * Send the SMS message + * @param string $message + * @return boolean (true = message was sent successfully, false = there was a problem sending the message) + */ + public function sendSMS($message) { + $recipients = join(',', $this->recipients); + + if(count($recipients) == 0) { + return false; + } + /** + * Documentation is here: http://www.smsglobal.com/http-api/ + * Recipient numbers should be in the MSIDSN format (eg. 61400111222). The '+' sign should not be included before the country code. + */ + + $from = urlencode(substr($this->originator,0 , 11)); // Max 11 Char. + + $url = 'http://www.smsglobal.com/http-api.php' . + '?action=sendsms' . + '&user=' . $this->username . + '&password=' . $this->password . + '&from=' . $from . + '&to=' . rawurlencode($recipients) . + '&clientcharset=ISO-8859-1' . + '&text=' . substr(rawurlencode($message), 0, 153); + + $returnedData = file_get_contents($url); + $isOk = strpos($returnedData, 'OK: 0') !== false; + + $this->success = $isOk; + $this->resultmessage = $returnedData; + + if(!$isOk) { + error_log($this->resultmessage, E_USER_NOTICE); + } + + return $isOk; + } +} diff --git a/src/templates/config/config.tpl.html b/src/templates/config/config.tpl.html index 502eefb6..28daab5a 100755 --- a/src/templates/config/config.tpl.html +++ b/src/templates/config/config.tpl.html @@ -123,6 +123,7 @@ +