Adding mosms gateway support as created by Andreas Ek (105c734a02)

This commit is contained in:
Pepijn Over 2014-01-10 11:32:15 +01:00
parent 2d3cf7825e
commit b01091ed2e
10 changed files with 71 additions and 2 deletions

View File

@ -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)
#########################
#

View File

@ -34,6 +34,7 @@ available:
* Spryng - <http://www.spryng.nl>
* Inetworx - <http://www.inetworx.ch>
* Clickatell - <https://www.clickatell.com>
* Mosms - <http://www.mosms.com>
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

View File

@ -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'),

View File

@ -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);

View File

@ -0,0 +1,56 @@
<?php
/**
* PHP Server Monitor
* Monitor your servers and websites.
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PHP Server Monitor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*
* @package phpservermon
* @author Andreas Ek
* @copyright Copyright (c) 2008-2014 Pepijn Over <pep@neanderthal-technology.com>
* @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;
}
}
?>

View File

@ -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',

View File

@ -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',

View File

@ -91,6 +91,7 @@ $sm_lang = array(
'email_from_name' => 'Nom de l exp&eacute;diteur',
'sms_status' => 'Autoriser l envoi de SMS?',
'sms_gateway' => 'Passerelle &agrave; utiliser pour l envoi de SMS',
'sms_gateway_mosms' => 'Mosms',
'sms_gateway_mollie' => 'Mollie',
'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx',

View File

@ -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',

View File

@ -57,6 +57,7 @@
<label class="control-label" for="sms_gateway">{label_sms_gateway}</label>
<div class="controls">
<select name="sms_gateway">
<option value="mosms" {sms_selected_mosms}>{label_sms_gateway_mosms}</option>
<option value="mollie" {sms_selected_mollie}>{label_sms_gateway_mollie}</option>
<option value="spryng" {sms_selected_spryng}>{label_sms_gateway_spryng}</option>
<option value="inetworx" {sms_selected_inetworx}>{label_sms_gateway_inetworx}</option>
@ -134,4 +135,4 @@
<div class="alert alert-info hide">
Please update!
</div>
<!--%%tpl_config_update-->
<!--%%tpl_config_update-->