diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index 364c8ca1..3ca0cbc7 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -495,7 +495,9 @@ function psm_build_sms() { case 'nexmo': $sms = new \psm\Txtmsg\Nexmo(); break; - } + case 'octopush': + $sms = new \psm\Txtmsg\Octopush(); + break; } // copy login information from the config file if($sms) { diff --git a/src/lang/bg_BG.lang.php b/src/lang/bg_BG.lang.php index 1601d355..eb73e964 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_octopush' => 'Octopush', 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Потребител', 'sms_gateway_password' => 'Парола', diff --git a/src/lang/cs_CZ.lang.php b/src/lang/cs_CZ.lang.php index 8ff48ed9..5156acce 100644 --- a/src/lang/cs_CZ.lang.php +++ b/src/lang/cs_CZ.lang.php @@ -201,6 +201,7 @@ $sm_lang = array( 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_nexmo' => 'Nexmo', + 'sms_gateway_octopush' => 'Octopush', '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 6dc7b27c..5efc4fef 100644 --- a/src/lang/da_DK.lang.php +++ b/src/lang/da_DK.lang.php @@ -194,6 +194,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_nexmo' => 'Nexmo', 'sms_gateway_username' => 'Gateway brugernavn/apikey', diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php index e5f34f6b..fd8aee95 100644 --- a/src/lang/de_DE.lang.php +++ b/src/lang/de_DE.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index 393686dd..56799a7c 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -199,6 +199,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/es_ES.lang.php b/src/lang/es_ES.lang.php index 97fe4572..8b77b20c 100644 --- a/src/lang/es_ES.lang.php +++ b/src/lang/es_ES.lang.php @@ -198,6 +198,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_username' => 'Usuario', diff --git a/src/lang/fr_FR.lang.php b/src/lang/fr_FR.lang.php index 18d2355c..776a1e3b 100644 --- a/src/lang/fr_FR.lang.php +++ b/src/lang/fr_FR.lang.php @@ -197,6 +197,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/it_IT.lang.php b/src/lang/it_IT.lang.php index 9bf9362c..cf8353ef 100644 --- a/src/lang/it_IT.lang.php +++ b/src/lang/it_IT.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/ko_KR.lang.php b/src/lang/ko_KR.lang.php index accfb5f6..53f7928a 100644 --- a/src/lang/ko_KR.lang.php +++ b/src/lang/ko_KR.lang.php @@ -199,6 +199,7 @@ $sm_lang = array( 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', + 'sms_gateway_octopush' => 'Octopush', '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 45b8fac9..647403a4 100644 --- a/src/lang/nl_NL.lang.php +++ b/src/lang/nl_NL.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/pl_PL.lang.php b/src/lang/pl_PL.lang.php index 40c7ce72..3c22297f 100644 --- a/src/lang/pl_PL.lang.php +++ b/src/lang/pl_PL.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/pt_BR.lang.php b/src/lang/pt_BR.lang.php index 9cf1f00b..74c58b99 100644 --- a/src/lang/pt_BR.lang.php +++ b/src/lang/pt_BR.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_username' => 'Usuário do Gateway', diff --git a/src/lang/ru_RU.lang.php b/src/lang/ru_RU.lang.php index 6d76e8a3..6ebf7b4e 100644 --- a/src/lang/ru_RU.lang.php +++ b/src/lang/ru_RU.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/tr_TR.lang.php b/src/lang/tr_TR.lang.php index 64eab9aa..02b09b2d 100644 --- a/src/lang/tr_TR.lang.php +++ b/src/lang/tr_TR.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index da06bf56..864b3b01 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -196,6 +196,7 @@ $sm_lang = array( 'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_textmarketer' => 'Textmarketer', 'sms_gateway_smsglobal' => 'SMSGlobal', + 'sms_gateway_octopush' => 'Octopush', 'sms_gateway_smsit' => 'Smsit', 'sms_gateway_freevoipdeal' => 'FreeVoipDeal', 'sms_gateway_nexmo' => 'Nexmo', diff --git a/src/psm/Module/Config/Controller/ConfigController.php b/src/psm/Module/Config/Controller/ConfigController.php index c2a0ce99..254d9416 100644 --- a/src/psm/Module/Config/Controller/ConfigController.php +++ b/src/psm/Module/Config/Controller/ConfigController.php @@ -317,6 +317,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_octopush' => psm_get_lang('config', 'sms_gateway_octopush'), '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/Octopush.class.php b/src/psm/Txtmsg/Octopush.class.php new file mode 100644 index 00000000..dd644dda --- /dev/null +++ b/src/psm/Txtmsg/Octopush.class.php @@ -0,0 +1,85 @@ +. + * + * @package phpservermon + * @author Alexis Urien + * @copyright Copyright (c) 2016 Alexis Urien + * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 + * @version Release: @package_version@ + * @link http://www.phpservermonitor.org/ + * @since phpservermon 2.1 + **/ + +namespace psm\Txtmsg; + +class Octopush extends Core { + // ========================================================================= + // [ Fields ] + // ========================================================================= + public $gateway = 1; + public $resultcode = null; + public $resultmessage = null; + public $success = false; + public $successcount = 0; + + public function sendSMS($message) { + // Octopush exemple url + // french documentation can be found here: http://www.octopush-dm.com/public/docs/envoyer-des-sms-avec-octopush.pdf (need to be logged in) + //'http://www.octopush-dm.com/api/sms/?user_login=*****%40******.com&api_key=****************&sms_text=un+exemple+de+texte&sms_recipients=0033601010101&sms_type=FR&sms_sender=UnSender' + if(count($this->recipients) == 0) + return false; + + $testMode = false; + $highPriority = true; + + if ($highPriority) { + $sms_type = 'FR'; + $sms_sender = 'phpServerMon'; + $sms_more = ' STOP au XXXXX'; + } + else { + $sms_type = 'XXX'; + $sms_more = ''; + } + + + $recipients = urlencode(implode(',', $this->recipients)); + $octopush_url = "https://www.octopush-dm.com/api/sms/"; + $octopush_data = urlencode( $message . $sms_more ); + + $URL = $octopush_url. "?" . + "user_login=" . $this->username . + "&api_key=" . $this->password . + "&sms_recipients=" . $recipients . + "&sms_type=" . $sms_type . + ($testMode ? '&request_mode=simu' : '') . + (isset($sms_sender) ? '&sms_sender='.$sms_sender : '') . + "&sms_text=" . $octopush_data; + + $result = file_get_contents( $URL ); + $xmlResults = simplexml_load_string($result); + if ($xmlResults === false) + return false; + + if ($xmlResults->error_code == '000') + return true; + return false; + } + +} diff --git a/src/templates/default/module/config/config.tpl.html b/src/templates/default/module/config/config.tpl.html index f05eaec6..aafb3125 100644 --- a/src/templates/default/module/config/config.tpl.html +++ b/src/templates/default/module/config/config.tpl.html @@ -160,6 +160,7 @@ +