diff --git a/CHANGELOG b/CHANGELOG index 89c8979a..f50b7b0f 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ # ######################### - merged PHP Server Monitor Plus project by Luiz Alberto S. Ribeiro (https://github.com/madeinnordeste/PHP-Server-Monitor-Plus) +- support for mosms provider by Andreas Ek (https://github.com/EkAndreas/PHP-Server-Monitor-Plus/commit/105c734a02477befc01831e3b9b2b8fefd9b5ca5) ######################### # diff --git a/README.md b/README.md index 5ca4e5e7..db5db2a1 100755 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ available: * Spryng - * Inetworx - * Clickatell - +* Mosms - For these gateways you need an account with sufficient credits. @@ -160,6 +161,7 @@ The second part is the actual message. There are a few variables you can use in * French translation - David Ribeiro * Korean translation - Ik-Jun * Bootstrap implementation - Luiz Alberto S. Ribeiro + * Mosms implementation - Andreas Ek ## License diff --git a/classes/mod/modConfig.class.php b/classes/mod/modConfig.class.php index 783455c6..1ca0bc45 100755 --- a/classes/mod/modConfig.class.php +++ b/classes/mod/modConfig.class.php @@ -151,6 +151,7 @@ class modConfig extends modCore { 'label_email_from_name' => sm_get_lang('config', 'email_from_name'), 'label_sms_status' => sm_get_lang('config', 'sms_status'), 'label_sms_gateway' => sm_get_lang('config', 'sms_gateway'), + 'label_sms_gateway_mosms' => sm_get_lang('config', 'sms_gateway_mosms'), 'label_sms_gateway_mollie' => sm_get_lang('config', 'sms_gateway_mollie'), 'label_sms_gateway_spryng' => sm_get_lang('config', 'sms_gateway_spryng'), 'label_sms_gateway_inetworx' => sm_get_lang('config', 'sms_gateway_inetworx'), diff --git a/classes/sm/smUpdaterStatus.class.php b/classes/sm/smUpdaterStatus.class.php index 6666cbe8..a55a3b51 100755 --- a/classes/sm/smUpdaterStatus.class.php +++ b/classes/sm/smUpdaterStatus.class.php @@ -214,6 +214,7 @@ class smUpdaterStatus extends smCore { // send email $this->notifyByEmail(); } + // check if sms is enabled for this server if(sm_get_conf('sms_status') && $this->server['sms'] == 'yes') { // yay lets wake those nerds up! @@ -291,9 +292,12 @@ class smUpdaterStatus extends smCore { // open the right class // not making this any more dynamic, because perhaps some gateways need custom settings (like Mollie) switch(strtolower(sm_get_conf('sms_gateway'))) { + case 'mosms': + $sms = new txtmsgMosms(); + break; case 'inetworx': $sms = new txtmsgInetworx(); - break; + break; case 'mollie': $sms = new txtmsgMollie(); $sms->setGateway(1); diff --git a/classes/txtmsg/txtmsgMosms.class.php b/classes/txtmsg/txtmsgMosms.class.php new file mode 100755 index 00000000..761a098e --- /dev/null +++ b/classes/txtmsg/txtmsgMosms.class.php @@ -0,0 +1,56 @@ +. + * + * @package phpservermon + * @author Andreas Ek + * @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 + **/ + +class txtmsgMosms extends txtmsgCore { + // ========================================================================= + // [ Fields ] + // ========================================================================= + public $gateway = 1; + public $resultcode = null; + public $resultmessage = null; + public $success = false; + public $successcount = 0; + + public function sendSMS($message) { + + $mosms_url = "https://www.mosms.com/se/sms-send.php"; + $mosms_data = rawurlencode( $message ); + + foreach( $this->recipients as $phone ){ + + $result = file_get_contents( $mosms_url . "?username=" . $this->username + . "&password=" . $this->password . "&nr=" . $phone . "&type=text" + . "&data=" . $mosms_data ); + + } + + return $result; + } +} + +?> \ No newline at end of file diff --git a/lang/de.lang.php b/lang/de.lang.php index adc51bbd..6b2f28d2 100755 --- a/lang/de.lang.php +++ b/lang/de.lang.php @@ -91,6 +91,7 @@ $sm_lang = array( 'email_from_name' => 'Email from name', 'sms_status' => 'SMS Nachricht senden erlauben?', 'sms_gateway' => 'SMS Gateway', + 'sms_gateway_mosms' => 'Mosms', 'sms_gateway_mollie' => 'Mollie', 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', diff --git a/lang/en.lang.php b/lang/en.lang.php index dbcda5e8..8a5906a0 100755 --- a/lang/en.lang.php +++ b/lang/en.lang.php @@ -91,6 +91,7 @@ $sm_lang = array( 'email_from_name' => 'Email from name', 'sms_status' => 'Allow sending text messages?', 'sms_gateway' => 'Gateway to use for sending messages', + 'sms_gateway_mosms' => 'Mosms', 'sms_gateway_mollie' => 'Mollie', 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', diff --git a/lang/fr.lang.php b/lang/fr.lang.php index 218a2625..ffaf1dcd 100755 --- a/lang/fr.lang.php +++ b/lang/fr.lang.php @@ -91,6 +91,7 @@ $sm_lang = array( 'email_from_name' => 'Nom de l expéditeur', 'sms_status' => 'Autoriser l envoi de SMS?', 'sms_gateway' => 'Passerelle à utiliser pour l envoi de SMS', + 'sms_gateway_mosms' => 'Mosms', 'sms_gateway_mollie' => 'Mollie', 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', diff --git a/lang/nl.lang.php b/lang/nl.lang.php index 8f27e423..f6105406 100755 --- a/lang/nl.lang.php +++ b/lang/nl.lang.php @@ -91,6 +91,7 @@ $sm_lang = array( 'email_from_name' => 'Email van naam', 'sms_status' => 'Sta SMS berichten toe?', 'sms_gateway' => 'Gateway voor het sturen van SMS', + 'sms_gateway_mosms' => 'Mosms', 'sms_gateway_mollie' => 'Mollie', 'sms_gateway_spryng' => 'Spryng', 'sms_gateway_inetworx' => 'Inetworx', diff --git a/tpl/config.tpl.html b/tpl/config.tpl.html index 69ccf748..1e00274f 100755 --- a/tpl/config.tpl.html +++ b/tpl/config.tpl.html @@ -57,6 +57,7 @@