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 @@ +