Import of v2.0.1

This commit is contained in:
Pepijn Over 2014-01-07 20:27:21 +01:00
parent 50fd088dca
commit 4eaf7a8e28
32 changed files with 970 additions and 296 deletions

142
classes/mod/modConfig.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -32,7 +32,57 @@ class modConfig extends modCore {
}
}
public function executeSave() {
// override parent::createHTML()
public function createHTML() {
$this->setTemplateId('config', 'config.tpl.html');
$this->populateFields();
return parent::createHTML();
}
/**
* Populate all the config fields with values from the database
*/
public function populateFields() {
$config_db = $this->db->select(
SM_DB_PREFIX . 'config',
null,
array('key', 'value')
);
$config = array();
foreach($config_db as $entry) {
$config[$entry['key']] = $entry['value'];
}
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'language_selected_' . $config['language'] => 'selected="selected"',
'email_status_checked' => ($config['email_status'] == '1') ? 'checked="checked"' : '',
'email_from_name' => $config['email_from_name'],
'email_from_email' => $config['email_from_email'],
'sms_status_checked' => ($config['sms_status'] == '1') ? 'checked="checked"' : '',
'sms_selected_' . $config['sms_gateway'] => 'selected="selected"',
'sms_gateway_username' => $config['sms_gateway_username'],
'sms_gateway_password' => $config['sms_gateway_password'],
'sms_from' => $config['sms_from'],
'alert_type_selected_' . $config['alert_type'] => 'selected="selected"',
'log_status_checked' => ($config['log_status'] == '1') ? 'checked="checked"' : '',
'log_email_checked' => ($config['log_email'] == '1') ? 'checked="checked"' : '',
'log_sms_checked' => ($config['log_sms'] == '1') ? 'checked="checked"' : '',
'show_update_checked' => ($config['show_update'] == '1') ? 'checked="checked"' : '',
'auto_refresh_servers' => (isset($config['auto_refresh_servers'])) ? $config['auto_refresh_servers'] : '0',
)
);
}
/**
* If a post has been done, gather all the posted data
* and save it to the database
*/
protected function executeSave() {
// save new config
$clean = array(
'language' => $_POST['language'],
@ -49,73 +99,38 @@ class modConfig extends modCore {
'log_status' => (isset($_POST['log_status'])) ? '1' : '0',
'log_email' => (isset($_POST['log_email'])) ? '1' : '0',
'log_sms' => (isset($_POST['log_sms'])) ? '1' : '0',
'auto_refresh_servers' => (isset($_POST['auto_refresh_servers'])) ? intval($_POST['auto_refresh_servers']) : '0',
);
// save all values to the database
foreach($clean as $key => $value) {
$this->db->save(
SM_DB_PREFIX . 'config',
array('value' => $value),
array('key' => $key)
);
// check if key already exists, otherwise add it
if(sm_get_conf($key) === null) {
// not yet set, add it
$this->db->save(
SM_DB_PREFIX . 'config',
array(
'key' => $key,
'value' => $value,
)
);
} else {
// update
$this->db->save(
SM_DB_PREFIX . 'config',
array('value' => $value),
array('key' => $key)
);
}
}
$this->message = sm_get_lang('config', 'updated');
}
public function createHTML() {
$this->tpl_id = 'config';
$this->tpl->newTemplate($this->tpl_id, 'config.tpl.html');
$this->createHTMLUpdate();
$this->createHTMLLabels();
$this->populateFields();
return parent::createHTML();
}
public function createHTMLUpdate() {
// get latest version number
}
public function populateFields() {
$config_db = $this->db->select(
SM_DB_PREFIX . 'config',
null,
array('key', 'value')
);
$config = array();
foreach($config_db as $entry) {
$config[$entry['key']] = $entry['value'];
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->tpl_id,
array(
'language_selected_' . $config['language'] => 'selected="selected"',
'email_status_checked' => ($config['email_status'] == '1') ? 'checked="checked"' : '',
'email_from_name' => $config['email_from_name'],
'email_from_email' => $config['email_from_email'],
'sms_status_checked' => ($config['sms_status'] == '1') ? 'checked="checked"' : '',
'sms_selected_' . $config['sms_gateway'] => 'selected="selected"',
'sms_gateway_username' => $config['sms_gateway_username'],
'sms_gateway_password' => $config['sms_gateway_password'],
'sms_from' => $config['sms_from'],
'alert_type_selected_' . $config['alert_type'] => 'selected="selected"',
'log_status_checked' => ($config['log_status'] == '1') ? 'checked="checked"' : '',
'log_email_checked' => ($config['log_email'] == '1') ? 'checked="checked"' : '',
'log_sms_checked' => ($config['log_sms'] == '1') ? 'checked="checked"' : '',
'show_update_checked' => ($config['show_update'] == '1') ? 'checked="checked"' : '',
)
);
}
public function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->tpl_id,
$this->getTemplateId(),
array(
'label_settings_email' => sm_get_lang('config', 'settings_email'),
'label_settings_sms' => sm_get_lang('config', 'settings_sms'),
@ -125,6 +140,8 @@ class modConfig extends modCore {
'label_language' => sm_get_lang('config', 'language'),
'label_language_english' => sm_get_lang('config', 'english'),
'label_language_dutch' => sm_get_lang('config', 'dutch'),
'label_language_french' => sm_get_lang('config', 'french'),
'label_language_german' => sm_get_lang('config', 'german'),
'label_show_update' => sm_get_lang('config', 'show_update'),
'label_email_status' => sm_get_lang('config', 'email_status'),
'label_email_from_email' => sm_get_lang('config', 'email_from_email'),
@ -134,6 +151,7 @@ class modConfig extends modCore {
'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'),
'label_sms_gateway_clickatell' => sm_get_lang('config', 'sms_gateway_clickatell'),
'label_sms_gateway_username' => sm_get_lang('config', 'sms_gateway_username'),
'label_sms_gateway_password' => sm_get_lang('config', 'sms_gateway_password'),
'label_sms_from' => sm_get_lang('config', 'sms_from'),
@ -144,9 +162,11 @@ class modConfig extends modCore {
'label_log_status' => sm_get_lang('config', 'log_status'),
'label_log_email' => sm_get_lang('config', 'log_email'),
'label_log_sms' => sm_get_lang('config', 'log_sms'),
'message' => ($this->message == '') ? '&nbsp' : $this->message,
'label_auto_refresh_servers' => sm_get_lang('config', 'auto_refresh_servers'),
)
);
return parent::createHTMLLabels();
}
}

140
classes/mod/modCore.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -23,22 +23,144 @@
*/
abstract class modCore {
public $db;
/**
* Custom message
* @var string
*/
public $message;
/**
* Current mode. Can be used by modules to determine
* what to do
* @var string
*/
public $mode;
public $tpl;
public $tpl_id;
/**
* smDatabase object
* @var object
*/
protected $db;
/**
* smTemplate object
* @var object
*/
protected $tpl;
/**
* Template Id that should be added to the main template
* @var string
* @see setTemplateId() getTemplateId()
*/
protected $tpl_id;
function __construct() {
global $db, $tpl;
global $db;
$this->db = ($db) ? $db : new smDatabase();
$this->tpl = ($tpl) ? $tpl : new smTemplate();
$this->tpl = new smTemplate();
}
/**
* Create the HTML code for the module.
* First the createHTMLLabels() will be called to add all labels to the template,
* Then the tpl_id set in $this->getTemplateId() will be added to the main template automatically
*/
public function createHTML() {
$html = $this->tpl->getTemplate($this->tpl_id);
return $html;
// add JS and CSS files
$this->tpl->addJS('monitor.js');
$this->tpl->addCSS('monitor.css');
if(sm_get_conf('show_update')) {
// user wants updates, lets see what we can do
$this->createHTMLUpdateAvailable();
}
$this->createHTMLLabels();
// add the module's custom template to the main template to get some content
$this->tpl->addTemplatedata(
'main',
array(
'content' => $this->tpl->getTemplate($this->getTemplateId()),
'message' => ($this->message == '') ? '&nbsp' : $this->message,
)
);
// display main template
echo $this->tpl->display('main');
}
/**
* First check if an update is available, if there is add a message
* to the main template
*/
protected function createHTMLUpdateAvailable() {
// check for updates?
if(sm_check_updates()) {
// yay, new update available =D
$this->tpl->addTemplateData(
'main',
array(
'update_available' => '<div id="update">'.sm_get_lang('system', 'update_available').'</div>',
)
);
}
}
/**
* Use this to add language specific labels to template
*
* @see createHTML()
*/
protected function createHTMLLabels() {
global $type;
$this->tpl->addTemplateData(
'main',
array(
'title' => strtoupper(sm_get_lang('system', 'title')),
'subtitle' => sm_get_lang('system', $type),
'active_' . $type => 'active',
'label_servers' => sm_get_lang('system', 'servers'),
'label_users' => sm_get_lang('system', 'users'),
'label_log' => sm_get_lang('system', 'log'),
'label_config' => sm_get_lang('system', 'config'),
'label_update' => sm_get_lang('system', 'update'),
'label_help' => sm_get_lang('system', 'help'),
)
);
}
/**
* Set a template id that will be added to the main template automatically
* once you call the parent::createHTML()
*
* @param string $tpl_id
* @param string $tpl_file if given, the tpl_id will be created automatically from this file
* @see getTemplateId() createHTML()
*/
public function setTemplateId($tpl_id, $tpl_file = null) {
$this->tpl_id = $tpl_id;
if($tpl_file != null) {
// tpl_file given, try to load the template..
$this->tpl->newTemplate($tpl_id, $tpl_file);
}
}
/**
* Get the mpalte id that will be added to the main template
*
* @return string
* @see setTemplateId()
*/
public function getTemplateId() {
return $this->tpl_id;
}
}

61
classes/mod/modLog.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -22,39 +22,29 @@
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Log module. Create the page to view previous log messages
*/
class modLog extends modCore {
function __construct() {
parent::__construct();
}
// override parent::createHTML()
public function createHTML() {
$this->createHTMLList();
$this->tpl->addCSS('tabs.css', 'main');
$this->tpl->addTemplateData(
$this->tpl_id,
array(
'label_status' => sm_get_lang('log', 'status'),
'label_email' => sm_get_lang('log', 'email'),
'label_sms' => sm_get_lang('log', 'sms'),
'label_title' => sm_get_lang('log', 'title'),
'label_server' => sm_get_lang('servers', 'server'),
'label_type' => sm_get_lang('log', 'type'),
'label_message' => sm_get_lang('system', 'message'),
'label_date' => sm_get_lang('system', 'date'),
'label_users' => ucfirst(sm_get_lang('system', 'users')),
)
);
$this->createHTMLList();
return parent::createHTML();
}
public function createHTMLList() {
$this->tpl_id = 'log_list';
$this->tpl->newTemplate($this->tpl_id, 'log.tpl.html');
/**
* Prepare the template with a list of all log entries
*/
protected function createHTMLList() {
$this->setTemplateId('log_list', 'log.tpl.html');
$entries = array();
$entries['status'] = $this->getEntries('status');
@ -98,7 +88,7 @@ class modLog extends modCore {
)
);
$this->tpl->addTemplateData(
$this->tpl_id,
$this->getTemplateId(),
array(
'content_' . $key => $this->tpl->getTemplate('log_entries'),
)
@ -107,6 +97,12 @@ class modLog extends modCore {
}
/**
* Get all the log entries for a specific $type
*
* @param string $type status/email/sms
* @return array
*/
public function getEntries($type) {
$entries = $this->db->query(
'SELECT '.
@ -132,6 +128,25 @@ class modLog extends modCore {
return $entries;
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'label_status' => sm_get_lang('log', 'status'),
'label_email' => sm_get_lang('log', 'email'),
'label_sms' => sm_get_lang('log', 'sms'),
'label_title' => sm_get_lang('log', 'title'),
'label_server' => sm_get_lang('servers', 'server'),
'label_type' => sm_get_lang('log', 'type'),
'label_message' => sm_get_lang('system', 'message'),
'label_date' => sm_get_lang('system', 'date'),
'label_users' => ucfirst(sm_get_lang('system', 'users')),
)
);
return parent::createHTMLLabels();
}
}
?>

110
classes/mod/modServers.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -22,6 +22,9 @@
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Server module. Add/edit/delete servers, show a list of all servers etc.
*/
class modServers extends modCore {
function __construct() {
@ -43,6 +46,7 @@ class modServers extends modCore {
}
}
// override parent::createHTML()
public function createHTML() {
switch($this->mode) {
case 'list':
@ -53,44 +57,20 @@ class modServers extends modCore {
break;
}
// add labels
$this->tpl->addTemplateData(
$this->tpl_id,
array(
'label_label' => sm_get_lang('servers', 'label'),
'label_domain' => sm_get_lang('servers', 'domain'),
'label_port' => sm_get_lang('servers', 'port'),
'label_type' => sm_get_lang('servers', 'type'),
'label_last_check' => sm_get_lang('servers', 'last_check'),
'label_rtime' => sm_get_lang('servers', 'rtime'),
'label_last_online' => sm_get_lang('servers', 'last_online'),
'label_monitoring' => sm_get_lang('servers', 'monitoring'),
'label_send_email' => sm_get_lang('servers', 'send_email'),
'label_send_sms' => sm_get_lang('servers', 'send_sms'),
'label_action' => sm_get_lang('system', 'action'),
'label_save' => sm_get_lang('system', 'save'),
'label_edit' => sm_get_lang('system', 'edit') . ' ' . sm_get_lang('servers', 'server'),
'label_delete' => sm_get_lang('system', 'delete') . ' ' . sm_get_lang('servers', 'server'),
'label_yes' => sm_get_lang('system', 'yes'),
'label_no' => sm_get_lang('system', 'no'),
'label_add_new' => sm_get_lang('system', 'add_new'),
'message' => ($this->message == '') ? '&nbsp' : $this->message,
)
);
return parent::createHTML();
}
public function createHTMLUpdate() {
$this->tpl_id = 'servers_update';
$this->tpl->newTemplate($this->tpl_id, 'servers.tpl.html');
/**
* Prepare the template to show the update screen for a single server
*/
protected function createHTMLUpdate() {
$this->setTemplateId('servers_update', 'servers.tpl.html');
$server_id = $_GET['edit'];
$tpl_data = array();
switch((int) $server_id) {
switch(intval($server_id)) {
case 0:
// insert mode
$tpl_data['titlemode'] = sm_get_lang('system', 'insert');
@ -125,14 +105,16 @@ class modServers extends modCore {
}
$this->tpl->addTemplateData(
$this->tpl_id,
$this->getTemplateId(),
$tpl_data
);
}
public function createHTMLList() {
$this->tpl_id = 'servers_list';
$this->tpl->newTemplate($this->tpl_id, 'servers.tpl.html');
/**
* Prepare the template to show a list of all servers
*/
protected function createHTMLList() {
$this->setTemplateId('servers_list', 'servers.tpl.html');
// get servers from database
$servers = $this->db->query(
@ -159,7 +141,7 @@ class modServers extends modCore {
'`email`, '.
'`sms` '.
'FROM `'.SM_DB_PREFIX.'servers` '.
'ORDER BY `type` ASC, `label` ASC'
'ORDER BY `active` ASC, `status` DESC, `type` ASC, `label` ASC'
);
$server_count = count($servers);
@ -167,13 +149,30 @@ class modServers extends modCore {
for ($x = 0; $x < $server_count; $x++) {
$servers[$x]['class'] = ($x & 1) ? 'odd' : 'even';
$servers[$x]['rtime'] = round((float) $servers[$x]['rtime'], 4);
if($servers[$x]['type'] == 'website') {
// add link to label
$servers[$x]['ip'] = '<a href="'.$servers[$x]['ip'].'" target="_blank">'.$servers[$x]['ip'].'</a>';
}
}
// add servers to template
$this->tpl->addTemplateDataRepeat($this->tpl_id, 'servers', $servers);
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'servers', $servers);
// check if we need to add the auto refresh
$auto_refresh = sm_get_conf('auto_refresh_servers');
if(intval($auto_refresh) > 0) {
// add it
$this->tpl->newTemplate('main_auto_refresh', 'main.tpl.html');
$this->tpl->addTemplateData('main_auto_refresh', array('seconds' => $auto_refresh));
$this->tpl->addTemplateData('main', array('auto_refresh' => $this->tpl->getTemplate('main_auto_refresh')));
}
}
public function executeSave() {
/**
* Executes the saving of one of the servers
*/
protected function executeSave() {
// check for add/edit mode
if (isset($_POST['label']) && isset($_POST['ip']) && isset($_POST['port'])) {
$clean = array(
@ -204,7 +203,10 @@ class modServers extends modCore {
}
}
public function executeDelete() {
/**
* Executes the deletion of one of the servers
*/
protected function executeDelete() {
// do delete
$this->db->delete(
SM_DB_PREFIX . 'servers',
@ -214,6 +216,34 @@ class modServers extends modCore {
);
$this->message = sm_get_lang('system', 'deleted');
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'label_label' => sm_get_lang('servers', 'label'),
'label_domain' => sm_get_lang('servers', 'domain'),
'label_port' => sm_get_lang('servers', 'port'),
'label_type' => sm_get_lang('servers', 'type'),
'label_last_check' => sm_get_lang('servers', 'last_check'),
'label_rtime' => sm_get_lang('servers', 'rtime'),
'label_last_online' => sm_get_lang('servers', 'last_online'),
'label_monitoring' => sm_get_lang('servers', 'monitoring'),
'label_send_email' => sm_get_lang('servers', 'send_email'),
'label_send_sms' => sm_get_lang('servers', 'send_sms'),
'label_action' => sm_get_lang('system', 'action'),
'label_save' => sm_get_lang('system', 'save'),
'label_edit' => sm_get_lang('system', 'edit') . ' ' . sm_get_lang('servers', 'server'),
'label_delete' => sm_get_lang('system', 'delete') . ' ' . sm_get_lang('servers', 'server'),
'label_yes' => sm_get_lang('system', 'yes'),
'label_no' => sm_get_lang('system', 'no'),
'label_add_new' => sm_get_lang('system', 'add_new'),
)
);
return parent::createHTMLLabels();
}
}
?>

79
classes/mod/modUsers.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -22,6 +22,10 @@
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* User module. Add, edit and delete users, or assign
* servers to users.
*/
class modUsers extends modCore {
public $servers;
@ -46,6 +50,7 @@ class modUsers extends modCore {
$this->servers = $this->db->select(SM_DB_PREFIX.'servers', null, array('server_id', 'label'));
}
// override parent::createHTML()
public function createHTML() {
switch($this->mode) {
case 'list':
@ -56,31 +61,14 @@ class modUsers extends modCore {
break;
}
// add labels
$this->tpl->addTemplateData(
$this->tpl_id,
array(
'label_users' => sm_get_lang('system', 'users'),
'label_name' => sm_get_lang('users', 'name'),
'label_mobile' => sm_get_lang('users', 'mobile'),
'label_email' => sm_get_lang('users', 'email'),
'label_servers' => sm_get_lang('system', 'servers'),
'label_action' => sm_get_lang('system', 'action'),
'label_save' => sm_get_lang('system', 'save'),
'label_edit' => sm_get_lang('system', 'edit') . ' ' . sm_get_lang('users', 'user'),
'label_delete' => sm_get_lang('system', 'delete') . ' ' . sm_get_lang('users', 'user'),
'label_add_new' => sm_get_lang('system', 'add_new'),
'message' => ($this->message == '') ? '&nbsp' : $this->message,
)
);
return parent::createHTML();
}
public function createHTMLUpdate() {
$this->tpl_id = 'users_update';
$this->tpl->newTemplate($this->tpl_id, 'users.tpl.html');
/**
* Prepare the template to show the update screen for a user
*/
protected function createHTMLUpdate() {
$this->setTemplateId('users_update', 'users.tpl.html');
$user_id = $_GET['edit'];
@ -134,16 +122,18 @@ class modUsers extends modCore {
}
$this->tpl->addTemplateData(
$this->tpl_id,
$this->getTemplateId(),
$tpl_data
);
// add servers to template for the edit form
$this->tpl->addTemplateDataRepeat('users_update', 'servers', $this->servers);
}
public function createHTMLList() {
$this->tpl_id = 'users_list';
$this->tpl->newTemplate($this->tpl_id, 'users.tpl.html');
/**
* Prepare the template to show a list of all users
*/
protected function createHTMLList() {
$this->setTemplateId('users_list', 'users.tpl.html');
// build label array for the next loop
$servers_labels = array();
@ -178,11 +168,14 @@ class modUsers extends modCore {
$users[$x]['emp_servers'] = substr($users[$x]['emp_servers'], 0, -5);
}
// add servers to template
$this->tpl->addTemplateDataRepeat($this->tpl_id, 'users', $users);
$this->tpl->addTemplateDataRepeat($this->getTemplateId(), 'users', $users);
}
public function executeSave() {
/**
* Executes the saving of a user
*/
protected function executeSave() {
// check for add/edit mode
if (isset($_POST['name']) && isset($_POST['mobile']) && isset($_POST['email'])) {
@ -210,7 +203,10 @@ class modUsers extends modCore {
}
}
public function executeDelete() {
/**
* Executes the deletion of a user
*/
protected function executeDelete() {
// do delete
$this->db->delete(
SM_DB_PREFIX . 'users',
@ -220,6 +216,27 @@ class modUsers extends modCore {
);
$this->message = sm_get_lang('system', 'deleted');
}
// override parent::createHTMLLabels()
protected function createHTMLLabels() {
$this->tpl->addTemplateData(
$this->getTemplateId(),
array(
'label_users' => sm_get_lang('system', 'users'),
'label_name' => sm_get_lang('users', 'name'),
'label_mobile' => sm_get_lang('users', 'mobile'),
'label_email' => sm_get_lang('users', 'email'),
'label_servers' => sm_get_lang('system', 'servers'),
'label_action' => sm_get_lang('system', 'action'),
'label_save' => sm_get_lang('system', 'save'),
'label_edit' => sm_get_lang('system', 'edit') . ' ' . sm_get_lang('users', 'user'),
'label_delete' => sm_get_lang('system', 'delete') . ' ' . sm_get_lang('users', 'user'),
'label_add_new' => sm_get_lang('system', 'add_new'),
)
);
return parent::createHTMLLabels();
}
}
?>

4
classes/sm/smCore.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify

6
classes/sm/smDatabase.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -362,4 +362,4 @@ class smDatabase {
}
}
?>
?>

4
classes/sm/smTemplate.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify

13
classes/sm/smUpdaterStatus.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -119,7 +119,7 @@ class smUpdaterStatus extends smCore {
// We're only interested in the header, because that should tell us plenty!
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
curl_setopt($ch, CURLOPT_NOBODY, true);
$headers = curl_exec ($ch);
curl_close ($ch);
@ -143,8 +143,8 @@ class smUpdaterStatus extends smCore {
$code = $code_matches[1][0];
$msg = $code_matches[2][0];
// All status codes starting with a 4 mean trouble!
if(substr($code, 0, 1) == '4') {
// All status codes starting with a 4 or higher mean trouble!
if(substr($code, 0, 1) >= '4') {
$this->server['error'] = $this->error = $code . ' ' . $msg;
$this->status_new = 'off';
} else {
@ -298,6 +298,9 @@ class smUpdaterStatus extends smCore {
case 'spryng':
$sms = new txtmsgSpryng();
break;
case 'clickatell':
$sms = new txtmsgClickatell();
break;
}
// copy login information from the config file

View File

@ -0,0 +1,63 @@
<?php
/*
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* 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/>.
*/
class txtmsgClickatell extends txtmsgCore {
// =========================================================================
// [ Fields ]
// =========================================================================
public $gateway = 1;
public $resultcode = null;
public $resultmessage = null;
public $success = false;
public $successcount = 0;
// =========================================================================
// [ Methods ]
// =========================================================================
public function setGateway($gateway) {
$this->gateway = $gateway;
}
public function sendSMS($message) {
//$message MUST BE urlencode or it will send only part message (first word in most cases)
$recipients = implode(',', $this->recipients);
//example: https://api.clickatell.com/http/sendmsg?user=XXXXXX&password=PASSWORD&api_id=111111&to=11111111&text=Message
//YOU MUST MANUALLY CHANGE THE VALUE OF 'api_id' EX: '&api_id=' . '1234567'
$result = $this->_auth_https_post('api.clickatell.com', '/http/sendmsg',
'?user=' . $this->username .
'&password=' . $this->password .
'&to=' . $recipients .
'&api_id=' . 'XXXXXX' .
'&text=' . substr(urlencode($message), 0, 153)
);
return $result;
}
protected function _auth_https_post($host, $path, $data) {
$url = $host . $path . $data;
return sm_curl_get($url);
}
}
?>

6
classes/txtmsg/txtmsgCore.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -58,4 +58,4 @@ abstract class txtmsgCore implements txtmsgInterface {
}
}
?>
?>

4
classes/txtmsg/txtmsgInetworx.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify

4
classes/txtmsg/txtmsgInterface.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify

4
classes/txtmsg/txtmsgMollie.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify

4
classes/txtmsg/txtmsgSpryng.class.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify

8
config.inc.php → config.inc.php.sample Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -54,7 +54,7 @@ define('SM_PATH_CSS', 'inc/');
define('SM_PATH_JS', 'inc/');
error_reporting(0);
ini_set('display_errors', '0');
ini_set('display_errors', 'Off');
require 'functions.inc.php';
$db = new smDatabase();
@ -68,4 +68,4 @@ if(!$lang) {
}
sm_load_lang($lang);
?>
?>

4
cron/status.cron.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify

View File

@ -1,3 +1,18 @@
#########################
#
# Version 2.0.1
# October 29, 2011
#
#########################
- adding german language file (thanks to Brunbaur Herbert)
- adding french language file (thanks to David Ribeiro)
- classes/sm/smUpdaterStatus.class.php: the curl option CURLOPT_CUSTOMREQUEST has been changed to CURLOPT_NOBODY
- servers page: auto refresh can be configured at the config page
- servers page: if the server is a website, the "Domain/Ip" field will be a link to the website
- new text message gateway: Clickatell.com (thanks to Simon)
- if cURL is not installed, the install.php script will throw an error
- HTTP status codes 5xx will also be treated as error
#########################
#
# Version 2.0.0
@ -20,6 +35,6 @@
- log.php
tpl/log.tpl.html
select order by clause used datetime field after DATE_FORMAT had been performed,
resulting in a wrong list of log entries shown
- tpl/log.tpl.html
select order by clause used datetime field after DATE_FORMAT had been performed,
resulting in a wrong list of log entries shown

40
docs/README Normal file → Executable file
View File

@ -1,6 +1,6 @@
PHP Server Monitor v2.0.0
PHP Server Monitor v2.0.1
http://phpservermon.sourceforge.net
Copyright (c) 2008-2009 Pepijn Over <ipdope[at]users.sourceforge.net>
Copyright (c) 2008-2011 Pepijn Over <ipdope[at]users.sourceforge.net>
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
@ -16,9 +16,9 @@
along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
#################
# #
# #
# SUMMARY #
# #
# #
#################
PHP Server Monitor is a script that checks whether the servers on your list are up
@ -58,29 +58,30 @@ I'd appreciate any feedback you might have regarding this script. Please leave i
project page (tracker), or send me an email (see top of file for link).
#################
# #
# #
# DOWNLOAD #
# #
# #
#################
The latest version can be found at http://phpservermon.sourceforge.net
#################
# #
# #
# REQUIREMENTS #
# #
# #
#################
1. php 5
2. MySQL Database
3. FTP access
2. php packages: cURL
3. MySQL Database
4. FTP access
#################
# #
# #
# INSTALL #
# #
# #
#################
By default the PHP Server Monitor does not come with any security methods. After uploading these files to
@ -90,7 +91,8 @@ be found in the example/ dir. To create your own username and password for the .
http://www.htaccesstools.com/htpasswd-generator/
1. Configuration
Open the config.php file with a plain text editor such as Notepad.
Rename the config.inc.php.sample file to config.inc.php, then open the
config.inc.php file with a plain text editor such as Notepad.
The first thing to do now in order to get started, is to get your database login information
right. The information is stored using php's define() function. To change these values correctly, only
update the second parameter of the function.
@ -130,9 +132,9 @@ http://www.htaccesstools.com/htpasswd-generator/
#################
# #
# #
# CUSTOMIZING #
# #
# #
#################
1. Language
@ -168,9 +170,11 @@ http://www.htaccesstools.com/htpasswd-generator/
- Send a copy to ipdope[at]users.sourceforge.net so I can add it to the next release :)
#################
# #
# #
# CREDITS #
# #
# #
#################
1. classes/phpmailer.class.php - Brent R. Matzelle
1. classes/phpmailer.class.php - Brent R. Matzelle
2. german translation - Brunbaur Herbert
3. french translation - David Ribeiro

61
functions.inc.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -63,7 +63,8 @@ function __autoload($class) {
/**
* Retrieve language settings from the selected language file
*
* @return unknown
* @return string
* @see sm_load_lang()
*/
function sm_get_lang() {
$args = func_get_args();
@ -81,6 +82,12 @@ function sm_get_lang() {
return $result;
}
/**
* Load language from the language file to the $GLOBALS['sm_lang'] variable
*
* @param string $lang language
* @see sm_get_lang()
*/
function sm_load_lang($lang) {
$lang_file = dirname(__FILE__) . '/lang/' . $lang . '.lang.php';
@ -93,12 +100,26 @@ function sm_load_lang($lang) {
$GLOBALS['sm_lang'] = $sm_lang;
}
/**
* Get a setting from the config.
* The config must have been loaded first using sm_load_conf()
*
* @param string $key
* @return string
* @see sm_load_conf()
*/
function sm_get_conf($key) {
$result = (isset($GLOBALS['sm_config'][$key])) ? $GLOBALS['sm_config'][$key] : null;
return $result;
}
/**
* Load config from the database to the $GLOBALS['sm_config'] variable
*
* @global object $db
* @see sm_get_conf()
*/
function sm_load_conf() {
global $db;
@ -168,6 +189,12 @@ function sm_parse_msg($status, $type, $vars) {
return $message;
}
/**
* Shortcut to curl_init(), curl_exec and curl_close()
*
* @param string $href
* @return string cURL result
*/
function sm_curl_get($href) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
@ -181,13 +208,28 @@ function sm_curl_get($href) {
return $result;
}
/**
* Check if an update is available for PHP Server Monitor
*
* @global object $db
* @return boolean
*/
function sm_check_updates() {
$latest = sm_curl_get('http://phpservermon.neanderthal-technology.com/version');
$current = sm_get_conf('version');
global $db;
if((int) $current < (int) $latest) {
// new update available
return true;
$last_update = sm_get_conf('last_update_check');
if((time() - (7 * 24 * 60 * 60)) > $last_update) {
// been more than a week since update, lets go
// update "update-date"
$db->save(SM_DB_PREFIX . 'config', array('value' => time()), array('key' => 'last_update_check'));
$latest = sm_curl_get('http://phpservermon.neanderthal-technology.com/version');
$current = sm_get_conf('version');
if((int) $current < (int) $latest) {
// new update available
return true;
}
}
return false;
}
@ -210,6 +252,9 @@ function pre($arr = null) {
echo "</pre>";
}
/**
* Send headers to the browser to avoid caching
*/
function sm_no_cache() {
header("Expires: Mon, 20 Dec 1998 01:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

36
inc/monitor.css Normal file → Executable file
View File

@ -1,4 +1,26 @@
body {
/*
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* 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/>.
*/
body {
color: #000000;
background-color: #FFFFFF;
font-family: Arial;
@ -77,6 +99,18 @@ a:active {
width: 860px;
}
.container table a,
.container table a:visited {
color: #000000;
text-decoration: none;
}
.container table a:hover,
.container table a:active {
color: #000000;
text-decoration: underline;
mouse: pointer;
}
.footer {
color: #666666;
background-color: #B3B3B3;

22
inc/monitor.js Normal file → Executable file
View File

@ -1,3 +1,25 @@
/*
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* 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/>.
*/
function sm_delete(id, type) {
var del = confirm("Are you sure you want to delete this record?");
if (del == true) {

22
inc/tabs.css Normal file → Executable file
View File

@ -1,3 +1,25 @@
/*
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* 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/>.
*/
.tabs ul {
list-style: none;
padding: 0;

68
index.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -22,6 +22,9 @@
* along with PHP Server Monitor. If not, see <http://www.gnu.org/licenses/>.
*/
if(!file_exists('config.inc.php')) {
die('Failed to locate config file. Please read docs/README for more information on how to setup PHP Server Monitor.');
}
require_once 'config.inc.php';
sm_no_cache();
@ -31,67 +34,16 @@ if(isset($_GET['action']) && $_GET['action'] == 'check') {
header('Location: index.php');
}
$tpl = new smTemplate();
$tpl->addJS('monitor.js');
$tpl->addCSS('monitor.css');
// check for updates?
if(sm_get_conf('show_update')) {
$last_update = sm_get_conf('last_update_check');
if((time() - (7 * 24 * 60 * 60)) > $last_update) {
// been more than a week since update, lets go
$need_upd = sm_check_updates();
// update "update-date"
$db->save(SM_DB_PREFIX . 'config', array('value' => time()), array('key' => 'last_update_check'));
if($need_upd) {
// yay, new update available =D
$tpl->addTemplateData(
'main',
array(
'update_available' => '<div id="update">'.sm_get_lang('system', 'update_available').'</div>',
)
);
}
}
}
$type = (!isset($_GET['type'])) ? 'servers' : $_GET['type'];
$allowed_types = array('servers', 'users', 'log', 'config');
// add some default vars
$tpl->addTemplateData(
'main',
array(
'title' => strtoupper(sm_get_lang('system', 'title')),
'subtitle' => sm_get_lang('system', $type),
'label_servers' => sm_get_lang('system', 'servers'),
'label_users' => sm_get_lang('system', 'users'),
'label_log' => sm_get_lang('system', 'log'),
'label_config' => sm_get_lang('system', 'config'),
'label_update' => sm_get_lang('system', 'update'),
'label_help' => sm_get_lang('system', 'help'),
'active_' . $type => 'active',
)
);
// make sure user selected a valid type. if so, include the file and add to template
if(in_array($type, $allowed_types)) {
eval('$mod = new mod'.ucfirst($type).'();');
$html = $mod->createHTML();
$tpl->addTemplatedata(
'main',
array(
'content' => $html,
)
);
if(!in_array($type, $allowed_types)) {
$type = $allowed_types[0];
}
echo $tpl->display('main');
eval('$mod = new mod'.ucfirst($type).'();');
// let the module prepare it's HTML code
$mod->createHTML();
?>

10
install.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -26,6 +26,11 @@
error_reporting(0x0ffffff);
require 'config.inc.php';
if(!function_exists('curl_init')) {
die('PHP is installed without the cURL module. Please install cURL first.');
}
$tpl = new smTemplate();
$tpl->addCSS('monitor.css', 'install');
@ -111,6 +116,7 @@ $tables = array(
(null, 'log_email', '1'),
(null, 'log_sms', '1'),
(null, 'version', '200'),
(null, 'auto_refresh_servers', '0'),
(null, 'show_update', '1'),
(null, 'last_update_check', '0');",
)

139
lang/de.lang.php Executable file
View File

@ -0,0 +1,139 @@
<?php
/*
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* 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/>.
*/
$sm_lang = array(
'system' => array(
'title' => 'Server Monitor',
'servers' => 'Server',
'users' => 'Benutzer',
'log' => 'Log',
'update' => 'Updates',
'config' => 'Einstellungen',
'help' => 'Hilfe',
'action' => 'Aktion',
'save' => 'Speichern',
'edit' => 'Bearbeiten',
'delete' => 'L&ouml;schen',
'deleted' => 'Eintrag wurde gel&ouml;scht',
'date' => 'Datum',
'message' => 'Meldung',
'yes' => 'Ja',
'no' => 'Nein',
'edit' => 'Bearbeiten',
'insert' => 'Einf&uuml;gen',
'add_new' => 'Neuen Eintrag erstellen?',
'update_available' => 'Ein neues Update ist verf&uuml;gbar auf <a href="http://phpservermon.sourceforge.net" target="_blank">http://phpservermon.sourceforge.net</a>.',
),
'users' => array(
'user' => 'Benutzer',
'name' => 'Name',
'mobile' => 'Mobil',
'email' => 'Email',
'updated' => 'Benutzer bearbeitet.',
'inserted' => 'Benutzer eingetragen.',
),
'log' => array(
'title' => 'Log Eintr&auml;ge',
'type' => 'Type',
'status' => 'Status',
'email' => 'Email',
'sms' => 'SMS',
),
'servers' => array(
'server' => 'Server',
'label' => 'Beschriftung',
'domain' => 'Domain/IP',
'port' => 'Port',
'type' => 'Type',
'last_check' => 'Letzter Check',
'last_online' => 'Letztes mal Online',
'monitoring' => 'Monitoring',
'send_email' => 'Email',
'send_sms' => 'SMS',
'updated' => 'Server aktualisiert.',
'inserted' => 'Server eingetragen.',
'rtime' => 'Antwortzeit',
),
'config' => array(
'general' => 'General',
'language' => 'Sprache',
'show_update' => 'Updats w&ouml;chentlich pr&uuml;fen?',
'english' => 'English',
'dutch' => 'Dutch',
'french' => 'French',
'german' => 'German',
'email_status' => 'Email senden erlauben?',
'email_from_email' => 'Email from address',
'email_from_name' => 'Email from name',
'sms_status' => 'SMS Nachricht senden erlauben?',
'sms_gateway' => 'SMS Gateway',
'sms_gateway_mollie' => 'Mollie',
'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_username' => 'Gateway Benutzername',
'sms_gateway_password' => 'Gateway Passwort',
'sms_from' => 'SMS Sendernummer',
'alert_type' =>
'Wann m&ouml;chten Sie benachrichtig werden?<br/>'.
'<div class="small">'.
'1) ... wenn sich der Status &auml;ndert<br/>'.
'z.B. online -> offline oder offline -> online.<br/>'.
'2) Offline<br/>'.
'Sie bekommen eine Benachrichtigung, wenn ein Server Offline ist.<br/>'.
'Es wird nur eine Mitteilung versendet.<br/>'.
'3) Immer<br/>'.
'Sie werden jedesmal wenn der CronJob oder das Script ausgef&uuml;hrt wird benachrichtigt,<br>'.
'auch wenn der Dienst mehreres Stunden offline ist'.
'</div>',
'alert_type_status' => 'Status ge&auml;ndert',
'alert_type_offline' => 'Offline',
'alert_type_always' => 'Immer',
'log_status' => 'Log Status<br/><div class="small">Ist der Log Status auf TRUE (ein Hacken) gesetzt, wird jeder Status protokolliert</div>',
'log_email' => 'Email Log per Script senden?',
'log_sms' => 'SMS Log per Script senden?',
'updated' => 'Die Einstellungen wurden gespeichert.',
'settings_email' => 'Email',
'settings_sms' => 'SMS Nachricht',
'settings_notification' => 'Benachrichtigung',
'settings_log' => 'Log',
'auto_refresh_servers' =>
'Auto-refresh servers page<br/>'.
'<div class="small">'.
'Time in seconds, if 0 the page won\'t refresh.'.
'</div>',
),
// for newlines in the email messages use <br/>
'notifications' => array(
'off_sms' => 'Server \'%LABEL%\' ist Offline: ip=%IP%, port=%PORT%. Fehler=%ERROR%',
'off_email_subject' => 'Wichtig: Server \'%LABEL%\' ist Offline',
'off_email_body' => "Kann keine Verbindung zum Server aufbauen:<br/><br/>Server: %LABEL%<br/>IP: %IP%<br/>Port: %PORT%<br/>Fehler: %ERROR%<br/>Datum: %DATE%",
'on_sms' => 'Server \'%LABEL%\' ist wieder Online: ip=%IP%, port=%PORT%',
'on_email_subject' => 'Wichtig: Server \'%LABEL%\' ist wieder Online',
'on_email_body' => "Server '%LABEL%' l&auml;uft wieder:<br/><br/>Server: %LABEL%<br/>IP: %IP%<br/>Port: %PORT%<br/>Datum: %DATE%",
),
);
?>

12
lang/en.lang.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -81,6 +81,8 @@ $sm_lang = array(
'show_update' => 'Check for new updates weekly?',
'english' => 'English',
'dutch' => 'Dutch',
'french' => 'French',
'german' => 'German',
'email_status' => 'Allow sending email?',
'email_from_email' => 'Email from address',
'email_from_name' => 'Email from name',
@ -89,6 +91,7 @@ $sm_lang = array(
'sms_gateway_mollie' => 'Mollie',
'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_username' => 'Gateway username',
'sms_gateway_password' => 'Gateway password',
'sms_from' => 'Sender\'s phone number',
@ -117,6 +120,11 @@ $sm_lang = array(
'settings_sms' => 'Text message settings',
'settings_notification' => 'Notification settings',
'settings_log' => 'Log settings',
'auto_refresh_servers' =>
'Auto-refresh servers page<br/>'.
'<div class="small">'.
'Time in seconds, if 0 the page won\'t refresh.'.
'</div>',
),
// for newlines in the email messages use <br/>
'notifications' => array(

139
lang/fr.lang.php Executable file
View File

@ -0,0 +1,139 @@
<?php
/*
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* 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/>.
*/
$sm_lang = array(
'system' => array(
'title' => 'Serveur de Supervision',
'servers' => 'Serveurs',
'users' => 'Utilisateurs',
'log' => 'Evenements',
'update' => 'Mise &agrave; jour',
'config' => 'Configuration',
'help' => 'Aide',
'action' => 'Action',
'save' => 'Enregistrer',
'edit' => 'Editer',
'delete' => 'Effacer',
'deleted' => 'L enregistrement a ete effac&eacute;',
'date' => 'Date',
'message' => 'Message',
'yes' => 'Oui',
'no' => 'Non',
'edit' => 'Editer',
'insert' => 'Inserer',
'add_new' => 'Rajouter un nouveau serveur?',
'update_available' => 'Une nouvelle version est disponible &agrave; l adresse <a href="http://phpservermon.sourceforge.net" target="_blank">http://phpservermon.sourceforge.net</a>.',
),
'users' => array(
'user' => 'Utilisateur',
'name' => 'Nom',
'mobile' => 'Mobile',
'email' => 'Email',
'updated' => 'Utilisateur mis &agrave; jour.',
'inserted' => 'Utilisateur ajout&eacute;.',
),
'log' => array(
'title' => 'Evenements',
'type' => 'Type',
'status' => 'Etat',
'email' => 'Email',
'sms' => 'SMS',
),
'servers' => array(
'server' => 'Serveur',
'label' => 'Description',
'domain' => 'Domaine/IP',
'port' => 'Port',
'type' => 'Type',
'last_check' => 'Derni&egrave;re v&eacute;rification',
'last_online' => 'Derni&egrave;re fois OK',
'monitoring' => 'Supervision',
'send_email' => 'Envoyer un Email',
'send_sms' => 'Envoyer un SMS',
'updated' => 'Serveur mis &agrave; jour.',
'inserted' => 'Serveur ajout&eacute;.',
'rtime' => 'Temps de r&acute;ponse',
),
'config' => array(
'general' => 'General',
'language' => 'Langue',
'show_update' => 'V&eacute;rifier les nouvelles mis &agrave; jour hebdomadairement?',
'english' => 'English',
'dutch' => 'Dutch',
'french' => 'Francais',
'german' => 'German',
'email_status' => 'Autoriser l envoi de mail?',
'email_from_email' => 'Exp&eacute;diteur',
'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_mollie' => 'Mollie',
'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_username' => 'Utilisateur sur la passerelle',
'sms_gateway_password' => 'Mot de passe sur la passerelle',
'sms_from' => 'SMS de l exp&eacute;diteur',
'alert_type' =>
'Choisissez quand vous souhaitez etre notifi&eacute;.<br/>'.
'<div class="small">'.
'1) Changement de statut<br/>'.
'Vous recevrez une notification quand le serveur changera de statut. Cest-&agrave;-dire de l etat OK vers NOK ou NOK vers OK.<br/>'.
'2) Eteint<br/>'.
'Vous recevrez une notification quand le serveur passera au statut ETEINT *uniquement la premi&egrave;re fois*. Par exemple, '.
'Votre tache planifi&eacute;e s execute toute les 15 minutes et votre serveur entre dans le statut ETEINT &agrave; 1 heure du matin et il le reste jusqu &agrave; 6 heures du matin. '.
'Vous recevrez une seule notification &agrave; 1 heure du matin et uniquement celle-ci.<br/>'.
'3) Toujours<br/>'.
'Vous recevrez une notification &agrave; chaque passage de la tache planifi&eacute;e si le site est en statut ETEINT '.
'</div>',
'alert_type_status' => 'Changement de statut',
'alert_type_offline' => 'Eteint',
'alert_type_always' => 'Toujours',
'log_status' => 'Etat des &eacute;venements<br/><div class="small">Si l etat des evenements est param&eacute;tr&eacute; &agrave; VRAI, tous les enregistrements seront enregistr&eacute;s jusqu au changement d etat</div>',
'log_email' => 'Enregistrer tout les emails envoy&eacute;s par la tache planifi&eacute;e?',
'log_sms' => 'Enregistrer tout les SMS envoy&eacute;s par la tache planifi&eacute;e?',
'updated' => 'La configuration a bien e&eacute;t&eacute; mis &agrave; jour.',
'settings_email' => 'Configuration mail',
'settings_sms' => 'Configuration SMS',
'settings_notification' => 'Configuration des notifications',
'settings_log' => 'Configuration des &eacute;venements',
'auto_refresh_servers' =>
'Auto-refresh servers page<br/>'.
'<div class="small">'.
'Time in seconds, if 0 the page won\'t refresh.'.
'</div>',
),
// for newlines in the email messages use <br/>
'notifications' => array(
'off_sms' => 'Le Serveur \'%LABEL%\' est ETEINT: IP=%IP%, Port=%PORT%. Erreur=%ERROR%',
'off_email_subject' => 'IMPORTANT: Le Serveur \'%LABEL%\' est ETEINT',
'off_email_body' => "Impossible de v&eacute;rifier le serveur suivant:<br/><br/>Serveur: %LABEL%<br/>IP: %IP%<br/>Port: %PORT%<br/>Erreur: %ERROR%<br/>Date: %DATE%",
'on_sms' => 'Le Serveur \'%LABEL%\' est OK: IP=%IP%, Port=%PORT%',
'on_email_subject' => 'IMPORTANT: Le Serveur \'%LABEL%\' est OK',
'on_email_body' => "Le Serveur '%LABEL%' est de nouveau OK:<br/><br/>Serveur: %LABEL%<br/>IP: %IP%<br/>Port: %PORT%<br/>Date: %DATE%",
),
);
?>

12
lang/nl.lang.php Normal file → Executable file
View File

@ -1,11 +1,11 @@
<?php
/*
* PHP Server Monitor v2.0.0
* PHP Server Monitor v2.0.1
* Monitor your servers with error notification
* http://phpservermon.sourceforge.net/
*
* Copyright (c) 2008-2009 Pepijn Over (ipdope@users.sourceforge.net)
* Copyright (c) 2008-2011 Pepijn Over (ipdope@users.sourceforge.net)
*
* This file is part of PHP Server Monitor.
* PHP Server Monitor is free software: you can redistribute it and/or modify
@ -81,6 +81,8 @@ $sm_lang = array(
'show_update' => 'Check for new updates weekly?',
'english' => 'Engels',
'dutch' => 'Nederlands',
'french' => 'Frans',
'german' => 'Duits',
'email_status' => 'Sta email berichten toe?',
'email_from_email' => 'Email van adres',
'email_from_name' => 'Email van naam',
@ -89,6 +91,7 @@ $sm_lang = array(
'sms_gateway_mollie' => 'Mollie',
'sms_gateway_spryng' => 'Spryng',
'sms_gateway_inetworx' => 'Inetworx',
'sms_gateway_clickatell' => 'Clickatell',
'sms_gateway_username' => 'Gateway gebruikersnaam',
'sms_gateway_password' => 'Gateway wachtwoord',
'sms_from' => 'Telefoonnummer afzender',
@ -116,6 +119,11 @@ $sm_lang = array(
'settings_sms' => 'SMS instellingen',
'settings_notification' => 'Notificatie instellingen',
'settings_log' => 'Log instellingen',
'auto_refresh_servers' =>
'Auto-refresh servers pagina<br/>'.
'<div class="small">'.
'Tijd in seconden, als de tijd 0 is wordt de pagina niet ververst.'.
'</div>',
),
// for newlines in the email messages use <br/>
'notifications' => array(

View File

@ -18,6 +18,8 @@
<select name="language">
<option value="en" {language_selected_en}>{label_language_english}</option>
<option value="nl" {language_selected_nl}>{label_language_dutch}</option>
<option value="fr" {language_selected_fr}>{label_language_french}</option>
<option value="de" {language_selected_de}>{label_language_german}</option>
</select>
</td>
</tr>
@ -25,6 +27,10 @@
<td>{label_show_update}</td>
<td><input type="checkbox" name="show_update[]" {show_update_checked} /></td>
</tr>
<tr class="odd">
<td>{label_auto_refresh_servers}</td>
<td><input type="text" name="auto_refresh_servers" value="{auto_refresh_servers}" maxlength="10" />&nbsp;seconds</td>
</tr>
<tr class="head">
<td colspan="2">
{label_settings_email}
@ -58,6 +64,7 @@
<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>
<option value="clickatell" {sms_selected_clickatell}>{label_sms_gateway_clickatell}</option>
</select>
</td>
</tr>

9
tpl/main.tpl.html Normal file → Executable file
View File

@ -3,6 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{auto_refresh}
<title>PHP Server Monitor</title>
</head>
<body>
@ -27,10 +28,12 @@
</div>
{update_available}
<div class="footer">
Powered by <a href="http://phpservermon.sourceforge.net" target="_blank">PHP Server Monitor v2.0.0</a><br/>
Copyright &copy; 2008-2009 <a href="mailto:ipdope@users.sourceforge.net">Pepijn Over<a/>
Powered by <a href="http://phpservermon.sourceforge.net" target="_blank">PHP Server Monitor v2.0.1</a><br/>
Copyright &copy; 2008-2011 <a href="mailto:ipdope@users.sourceforge.net">Pepijn Over<a/>
</div>
</div>
</body>
</html>
<!--%%tpl_main-->
<!--%%tpl_main-->
<!--%tpl_main_auto_refresh--><meta http-equiv="refresh" content="{seconds}" /><!--%%tpl_main_auto_refresh-->

View File

@ -73,8 +73,8 @@
<td>{label_monitoring}</td>
<td>
<select name="active">
<option value="yes" {edit_active_selected_yes}>Yes</option>
<option value="no" {edit_active_selected_no}>No</option>
<option value="yes" {edit_active_selected_yes}>{label_yes}</option>
<option value="no" {edit_active_selected_no}>{label_no}</option>
</select>
</td>
</tr>
@ -82,8 +82,8 @@
<td>{label_send_email}</td>
<td>
<select name="email">
<option value="yes" {edit_email_selected_yes}>Yes</option>
<option value="no" {edit_email_selected_no}>No</option>
<option value="yes" {edit_email_selected_yes}>{label_yes}</option>
<option value="no" {edit_email_selected_no}>{label_no}</option>
</select>
</td>
</tr>
@ -91,8 +91,8 @@
<td>{label_send_sms}</td>
<td>
<select name="sms">
<option value="yes" {edit_sms_selected_yes}>Yes</option>
<option value="no" {edit_sms_selected_no}>No</option>
<option value="yes" {edit_sms_selected_yes}>{label_yes}</option>
<option value="no" {edit_sms_selected_no}>{label_no}</option>
</select>
</td>
</tr>