diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php old mode 100644 new mode 100755 index 36ae7d25..330f234a --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -159,6 +159,7 @@ $sm_lang = array( 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', '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/psm/Module/Config/Controller/ConfigController.class.php b/src/psm/Module/Config/Controller/ConfigController.class.php old mode 100644 new mode 100755 index 34544cc2..7ad8b79e --- a/src/psm/Module/Config/Controller/ConfigController.class.php +++ b/src/psm/Module/Config/Controller/ConfigController.class.php @@ -206,6 +206,7 @@ class ConfigController extends AbstractController { 'label_sms_gateway_spryng' => psm_get_lang('config', 'sms_gateway_spryng'), 'label_sms_gateway_inetworx' => psm_get_lang('config', 'sms_gateway_inetworx'), 'label_sms_gateway_clickatell' => psm_get_lang('config', 'sms_gateway_clickatell'), + 'label_sms_gateway_smsglobal' => psm_get_lang('config', 'sms_gateway_smsglobal'), 'label_sms_gateway_textmarketer' => psm_get_lang('config', 'sms_gateway_textmarketer'), 'label_sms_gateway_username' => psm_get_lang('config', 'sms_gateway_username'), 'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'), diff --git a/src/psm/Txtmsg/Smsglobal.class.php b/src/psm/Txtmsg/Smsglobal.class.php new file mode 100755 index 00000000..f644060f --- /dev/null +++ b/src/psm/Txtmsg/Smsglobal.class.php @@ -0,0 +1,81 @@ +. + * + * @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/ + **/ + +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; + } +} \ No newline at end of file diff --git a/src/psm/Util/Updater/StatusNotifier.class.php b/src/psm/Util/Updater/StatusNotifier.class.php old mode 100644 new mode 100755 index 0d07ad43..462f10df --- a/src/psm/Util/Updater/StatusNotifier.class.php +++ b/src/psm/Util/Updater/StatusNotifier.class.php @@ -248,6 +248,9 @@ class StatusNotifier { 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/templates/config/config.tpl.html b/src/templates/config/config.tpl.html index ff9fcf96..86c38ec4 100755 --- a/src/templates/config/config.tpl.html +++ b/src/templates/config/config.tpl.html @@ -116,6 +116,7 @@ +