From 712593096a9e1a8c2fdcec14e87a98adcd5213b8 Mon Sep 17 00:00:00 2001 From: Perri Date: Sun, 12 Jan 2014 05:19:14 +0000 Subject: [PATCH] Add Textmarketer gateway --- src/lang/de.lang.php | 3 +- src/lang/en.lang.php | 1 + src/lang/fr.lang.php | 1 + src/lang/kr.lang.php | 1 + src/lang/nl.lang.php | 1 + src/psm/Module/Config.class.php | 3 +- src/psm/Txtmsg/Textmarketer.php | 61 +++++++++++++++++++++++++++++++++ src/psm/UpdaterStatus.class.php | 3 ++ src/templates/config.tpl.html | 1 + 9 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 src/psm/Txtmsg/Textmarketer.php diff --git a/src/lang/de.lang.php b/src/lang/de.lang.php index 6b24e33a..cecdffae 100755 --- a/src/lang/de.lang.php +++ b/src/lang/de.lang.php @@ -97,7 +97,8 @@ $sm_lang = array( 'sms_gateway_mollie' => 'Mollie', 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', - 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_username' => 'Gateway Benutzername', 'sms_gateway_password' => 'Gateway Passwort', 'sms_from' => 'SMS Sendernummer', diff --git a/src/lang/en.lang.php b/src/lang/en.lang.php index 36680ed4..f7cc61df 100755 --- a/src/lang/en.lang.php +++ b/src/lang/en.lang.php @@ -98,6 +98,7 @@ $sm_lang = array( 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', 'sms_from' => 'Sender\'s phone number', diff --git a/src/lang/fr.lang.php b/src/lang/fr.lang.php index b0371b84..74be5b9a 100755 --- a/src/lang/fr.lang.php +++ b/src/lang/fr.lang.php @@ -98,6 +98,7 @@ $sm_lang = array( 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_username' => 'Utilisateur sur la passerelle', 'sms_gateway_password' => 'Mot de passe sur la passerelle', 'sms_from' => 'SMS de l expéditeur', diff --git a/src/lang/kr.lang.php b/src/lang/kr.lang.php index 120f1485..8427bac2 100755 --- a/src/lang/kr.lang.php +++ b/src/lang/kr.lang.php @@ -99,6 +99,7 @@ $sm_lang = array( 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_username' => 'Gateway username', 'sms_gateway_password' => 'Gateway password', 'sms_from' => 'Sender\'s phone number', diff --git a/src/lang/nl.lang.php b/src/lang/nl.lang.php index 4fb3d767..3c87f4e8 100755 --- a/src/lang/nl.lang.php +++ b/src/lang/nl.lang.php @@ -98,6 +98,7 @@ $sm_lang = array( 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_clickatell' => 'Clickatell', + 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_username' => 'Gateway gebruikersnaam', 'sms_gateway_password' => 'Gateway wachtwoord', 'sms_from' => 'Telefoonnummer afzender', diff --git a/src/psm/Module/Config.class.php b/src/psm/Module/Config.class.php index cbc0ee93..66bb9fab 100755 --- a/src/psm/Module/Config.class.php +++ b/src/psm/Module/Config.class.php @@ -175,7 +175,8 @@ class Config extends Core { 'label_sms_gateway_mollie' => psm_get_lang('config', 'sms_gateway_mollie'), '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_clickatell' => psm_get_lang('config', 'sms_gateway_clickatell'), + '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'), 'label_sms_from' => psm_get_lang('config', 'sms_from'), diff --git a/src/psm/Txtmsg/Textmarketer.php b/src/psm/Txtmsg/Textmarketer.php new file mode 100644 index 00000000..9dc2d487 --- /dev/null +++ b/src/psm/Txtmsg/Textmarketer.php @@ -0,0 +1,61 @@ +. + * + * @package phpservermon + * @author Perri Vardy-Mason + * @copyright Copyright (c) 2008-2014 Pepijn Over + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://phpservermon.neanderthal-technology.com/ + * @since phpservermon 2.1 + **/ + +namespace psm\Txtmsg; + +class Textmarketer extends Core { + // ========================================================================= + // [ Fields ] + // ========================================================================= + public $gateway = 1; + public $resultcode = null; + public $resultmessage = null; + public $success = false; + public $successcount = 0; + + public function sendSMS($message) { + + $textmarketer_url = "https://api.textmarketer.co.uk/gateway/"; + $textmarketer_data = urlencode( $message ); + $textmarketer_origin = urlencode( 'SERVERALERT' ); + + + foreach( $this->recipients as $phone ){ + + $URL = $textmarketer_url."?username=" . $this->username . "&password=" . $this->password . "&to=" . $phone . "&message=" . $textmarketer_data . "&orig=" . $textmarketer_origin; + + $result = file_get_contents( $URL ); + + } + + return $result; + } + +} + +?> diff --git a/src/psm/UpdaterStatus.class.php b/src/psm/UpdaterStatus.class.php index 3b1e2711..db573cd2 100755 --- a/src/psm/UpdaterStatus.class.php +++ b/src/psm/UpdaterStatus.class.php @@ -317,6 +317,9 @@ class UpdaterStatus { case 'clickatell': $sms = new \psm\Txtmsg\Clickatell(); break; + case 'textmarketer': + $sms = new \psm\Txtmsg\Textmarketer(); + break; } // copy login information from the config file diff --git a/src/templates/config.tpl.html b/src/templates/config.tpl.html index 9b574c93..b1850e93 100755 --- a/src/templates/config.tpl.html +++ b/src/templates/config.tpl.html @@ -62,6 +62,7 @@ +