Merge pull request #6 from VeoPVM/develop

Improvements
pull/18/head
Pep 2014-01-16 05:58:42 -08:00
commit 9481ae72d0
13 changed files with 103 additions and 15 deletions

18
.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
.idea/scopes/scope_settings.xml
.idea/workspace.xml
.idea/workspace.xml
.idea/encodings.xml
.idea/misc.xml
.idea/phpservermon.iml
.idea/modules.xml
.idea/vcs.xml
.idea/*

View File

@ -23,7 +23,7 @@ whether it is a "service" or a "website":
This function takes care of that. This function takes care of that.
You can enter a link to a website (for example <http://sourceforge.net/index.php>), it will use cURL to open the website and You can enter a link to a website (for example <http://sourceforge.net/index.php>), it will use cURL to open the website and
check the HTTP status code (see <http://en.wikipedia.org/wiki/List_of_HTTP_status_codes> for details). check the HTTP status code (see <http://en.wikipedia.org/wiki/List_of_HTTP_status_codes> for details).
If the HTTP status code is in the 4xx range, it means an error occured and the website is not accesible to the public. If the HTTP status code is in the 4xx range, it means an error occurred and the website is not accessible to the public.
In that case the script will return a "status offline", and will start sending out notifications. In that case the script will return a "status offline", and will start sending out notifications.
Each server has it's own settings regarding notification. Each server has it's own settings regarding notification.
@ -109,7 +109,7 @@ If it is your own server or you have shell access and permission to open the cro
*/15 * * * * root /usr/bin/php /var/www/html/phpservermon/cron/status.cron.php */15 * * * * root /usr/bin/php /var/www/html/phpservermon/cron/status.cron.php
As you can see, this line will run the status.cron.php script every 15 minutes. Change the line to suit your needs. As you can see, this line will run the status.cron.php script every 15 minutes. Change the line to suit your needs.
If you do not have shell access, ask your webhosting to set it up for you. If you do not have shell access, ask your web hosting provider to set it up for you.
### 6. Voila! ### 6. Voila!
@ -119,7 +119,7 @@ If you do not have shell access, ask your webhosting to set it up for you.
### Language ### Language
The server monitor uses language files. That means that any regular text you see on the screen can easily be The server monitor uses language files. That means that any regular text you see on the screen can easily be
changed without having to digg through the code. These language files are stored in the directory "lang". changed without having to dig through the code. These language files are stored in the directory "lang".
The language that's being used by the monitor is defined in the config table. If you like The language that's being used by the monitor is defined in the config table. If you like
you can make changes to the language file or even add a new one. you can make changes to the language file or even add a new one.

View File

@ -25,16 +25,16 @@
* @link http://phpservermon.neanderthal-technology.com/ * @link http://phpservermon.neanderthal-technology.com/
**/ **/
define('SM_CONFIG', true); define('PSM_CONFIG', true);
// Prefix used for tables // Prefix used for tables
define('SM_DB_PREFIX', 'monitor_'); define('PSM_DB_PREFIX', 'monitor_');
// Database username // Database username
define('SM_DB_USER', 'db_user'); define('PSM_DB_USER', 'db_user');
// Database password // Database password
define('SM_DB_PASS', 'db_pass'); define('PSM_DB_PASS', 'db_pass');
// Database name // Database name
define('SM_DB_NAME', 'db_name'); define('PSM_DB_NAME', 'db_name');
// Database host // Database host
define('SM_DB_HOST', 'localhost'); define('PSM_DB_HOST', 'localhost');
?> ?>

View File

@ -98,6 +98,7 @@ $sm_lang = array(
'sms_gateway_spryng' => 'Spryng', 'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_username' => 'Gateway Benutzername', 'sms_gateway_username' => 'Gateway Benutzername',
'sms_gateway_password' => 'Gateway Passwort', 'sms_gateway_password' => 'Gateway Passwort',
'sms_from' => 'SMS Sendernummer', 'sms_from' => 'SMS Sendernummer',

View File

@ -98,6 +98,7 @@ $sm_lang = array(
'sms_gateway_spryng' => 'Spryng', 'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_username' => 'Gateway username', 'sms_gateway_username' => 'Gateway username',
'sms_gateway_password' => 'Gateway password', 'sms_gateway_password' => 'Gateway password',
'sms_from' => 'Sender\'s phone number', 'sms_from' => 'Sender\'s phone number',

View File

@ -98,6 +98,7 @@ $sm_lang = array(
'sms_gateway_spryng' => 'Spryng', 'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_username' => 'Utilisateur sur la passerelle', 'sms_gateway_username' => 'Utilisateur sur la passerelle',
'sms_gateway_password' => 'Mot de passe sur la passerelle', 'sms_gateway_password' => 'Mot de passe sur la passerelle',
'sms_from' => 'SMS de l exp&eacute;diteur', 'sms_from' => 'SMS de l exp&eacute;diteur',

View File

@ -99,6 +99,7 @@ $sm_lang = array(
'sms_gateway_spryng' => 'Spryng', 'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_username' => 'Gateway username', 'sms_gateway_username' => 'Gateway username',
'sms_gateway_password' => 'Gateway password', 'sms_gateway_password' => 'Gateway password',
'sms_from' => 'Sender\'s phone number', 'sms_from' => 'Sender\'s phone number',

View File

@ -98,6 +98,7 @@ $sm_lang = array(
'sms_gateway_spryng' => 'Spryng', 'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx', 'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell', 'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_textmarketer' => 'Textmarketer',
'sms_gateway_username' => 'Gateway gebruikersnaam', 'sms_gateway_username' => 'Gateway gebruikersnaam',
'sms_gateway_password' => 'Gateway wachtwoord', 'sms_gateway_password' => 'Gateway wachtwoord',
'sms_from' => 'Telefoonnummer afzender', 'sms_from' => 'Telefoonnummer afzender',

View File

@ -176,6 +176,7 @@ class Config extends Core {
'label_sms_gateway_spryng' => psm_get_lang('config', 'sms_gateway_spryng'), '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_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_username' => psm_get_lang('config', 'sms_gateway_username'),
'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'), 'label_sms_gateway_password' => psm_get_lang('config', 'sms_gateway_password'),
'label_sms_from' => psm_get_lang('config', 'sms_from'), 'label_sms_from' => psm_get_lang('config', 'sms_from'),

View File

@ -181,9 +181,9 @@ class Servers extends Core {
// check for add/edit mode // check for add/edit mode
if (isset($_POST['label']) && isset($_POST['ip']) && isset($_POST['port'])) { if (isset($_POST['label']) && isset($_POST['ip']) && isset($_POST['port'])) {
$clean = array( $clean = array(
'label' => $_POST['label'], 'label' => strip_tags($_POST['label']),
'ip' => $_POST['ip'], 'ip' => strip_tags($_POST['ip']),
'port' => $_POST['port'], 'port' => strip_tags($_POST['port']),
'type' => $_POST['type'], 'type' => $_POST['type'],
'active' => $_POST['active'], 'active' => $_POST['active'],
'email' => $_POST['email'], 'email' => $_POST['email'],

View File

@ -0,0 +1,60 @@
<?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 Perri Vardy-Mason
* @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/
**/
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;
}
}
?>

View File

@ -317,6 +317,9 @@ class UpdaterStatus {
case 'clickatell': case 'clickatell':
$sms = new \psm\Txtmsg\Clickatell(); $sms = new \psm\Txtmsg\Clickatell();
break; break;
case 'textmarketer':
$sms = new \psm\Txtmsg\Textmarketer();
break;
} }
// copy login information from the config file // copy login information from the config file

View File

@ -62,6 +62,7 @@
<option value="spryng" {sms_selected_spryng}>{label_sms_gateway_spryng}</option> <option value="spryng" {sms_selected_spryng}>{label_sms_gateway_spryng}</option>
<option value="inetworx" {sms_selected_inetworx}>{label_sms_gateway_inetworx}</option> <option value="inetworx" {sms_selected_inetworx}>{label_sms_gateway_inetworx}</option>
<option value="clickatell" {sms_selected_clickatell}>{label_sms_gateway_clickatell}</option> <option value="clickatell" {sms_selected_clickatell}>{label_sms_gateway_clickatell}</option>
<option value="textmarketer" {sms_selected_textmarketer}>{label_sms_gateway_textmarketer}</option>
</select> </select>
</div> </div>
</div> </div>