Merge branch 'develop' into issue/386

pull/631/head
Tim 2018-09-05 22:37:17 +02:00 committed by GitHub
commit 05a94c376f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 84 additions and 50 deletions

View File

@ -5,8 +5,13 @@ Changelog
Not yet released
----------------
* #628: Added the option to mark specific HTTP status codes as online.
* #640: Removed () after last offline value when the last offline duration is unknown.
* #637: Added php extensions to composer required list, spelling fixes in changelog and composer update.
* #635: Changed server order on ?&mod=user&action=edit&id=x.
* #634: Changed ' to " in sql query, both were used.
* #629: Fix bug that made it impossible to check rdp:// and fixed port update.
* b49659f: Added question to notification faq about not recieving notifications.
* b49659f: Added question to notification faq about not receiving notifications.
* ef28908: Indentation fix.
* #605: Added Norwegian language.
* f6173d4: Added license to composer.json file.
@ -40,7 +45,7 @@ v3.3.1 (released August 10, 2018)
v3.3.0 (released May 30, 2018)
--------------------------------
* 57f4c36: Added support voor the following SMS gateways: Plivo, SolutionsInfini, Callr and GAtewayAPI.
* 57f4c36: Added support for the following SMS gateways: Plivo, SolutionsInfini, Callr and GatewayAPI.
* c3751e7: Moved Clickatell api key to password field.
* #590: Rollback Twig version update to work with PHP5.
* #589: Enlarge select pattern_online width.
@ -66,7 +71,7 @@ v3.3.0 (released May 30, 2018)
* #541: Fix method declaration error in PHP7.2.
* #515: Run archive and cleanup per server to reduce memory use.
* #516: Fixed #500 ping latency.
* 2471767: Fixed preinstalled server query.
* 2471767: Fixed pre installed server query.
v3.2.2 (released March 27, 2018)
--------------------------------
@ -84,7 +89,7 @@ v3.2.2 (released March 27, 2018)
v3.2.1 (released March 27, 2018)
--------------------------------
* #343: Added optinal header value check.
* #343: Added optional header value check.
* #433: Changed baseurl repoforgeextras.
* #432: Changed baseurl repoforge.
* #437: Octopush.class.php updates to Octopush.php.

View File

@ -2,9 +2,12 @@
"name": "phpservermon/phpservermon",
"description": "PHP Server Monitor",
"license": "GPL-3.0-or-later",
"homepage": "http://www.phpservermonitor.org",
"homepage": "https://www.phpservermonitor.org",
"require": {
"php": ">=5.5.9",
"ext-curl": "*",
"ext-pdo": "*",
"ext-xml": "*",
"phpmailer/phpmailer": "~6.0",
"symfony/config": "~3.4",
"symfony/dependency-injection": "~3.4",

82
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "280e04b14bf6e80bca192b48a12bb342",
"content-hash": "b116489d45aab7506cedf3f94fb60ee4",
"packages": [
{
"name": "paragonie/random_compat",
@ -202,7 +202,7 @@
},
{
"name": "symfony/config",
"version": "v3.4.14",
"version": "v3.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
@ -266,16 +266,16 @@
},
{
"name": "symfony/dependency-injection",
"version": "v3.4.14",
"version": "v3.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
"reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1"
"reference": "09d7df7bf06c1393b6afc85875993cbdbdf897a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/1c0e679e522591fd744fdf242fec41a43d62b2b1",
"reference": "1c0e679e522591fd744fdf242fec41a43d62b2b1",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/09d7df7bf06c1393b6afc85875993cbdbdf897a0",
"reference": "09d7df7bf06c1393b6afc85875993cbdbdf897a0",
"shasum": ""
},
"require": {
@ -333,11 +333,11 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com",
"time": "2018-07-29T15:19:31+00:00"
"time": "2018-08-08T11:42:34+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.4.14",
"version": "v3.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@ -400,16 +400,16 @@
},
{
"name": "symfony/filesystem",
"version": "v4.1.3",
"version": "v4.1.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "2e30335e0aafeaa86645555959572fe7cea22b43"
"reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/2e30335e0aafeaa86645555959572fe7cea22b43",
"reference": "2e30335e0aafeaa86645555959572fe7cea22b43",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e",
"reference": "c0f5f62db218fa72195b8b8700e4b9b9cf52eb5e",
"shasum": ""
},
"require": {
@ -446,20 +446,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
"time": "2018-07-26T11:24:31+00:00"
"time": "2018-08-18T16:52:46+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v3.4.14",
"version": "v3.4.15",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6"
"reference": "2fb33cb6eefe6e790e4023f7c534a9e4214252fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6",
"reference": "19a3267828046a2a4a05e3dc2954bbd2e0ad9fa6",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/2fb33cb6eefe6e790e4023f7c534a9e4214252fc",
"reference": "2fb33cb6eefe6e790e4023f7c534a9e4214252fc",
"shasum": ""
},
"require": {
@ -500,29 +500,32 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2018-08-01T14:04:26+00:00"
"time": "2018-08-27T17:45:33+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.8.0",
"version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae"
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
"dev-master": "1.9-dev"
}
},
"autoload": {
@ -555,20 +558,20 @@
"polyfill",
"portable"
],
"time": "2018-04-30T19:57:29+00:00"
"time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.8.0",
"version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "3296adf6a6454a050679cde90f95350ad604b171"
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171",
"reference": "3296adf6a6454a050679cde90f95350ad604b171",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8",
"reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8",
"shasum": ""
},
"require": {
@ -580,7 +583,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
"dev-master": "1.9-dev"
}
},
"autoload": {
@ -614,30 +617,30 @@
"portable",
"shim"
],
"time": "2018-04-26T10:06:28+00:00"
"time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/polyfill-php70",
"version": "v1.8.0",
"version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6"
"reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
"reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
"shasum": ""
},
"require": {
"paragonie/random_compat": "~1.0|~2.0",
"paragonie/random_compat": "~1.0|~2.0|~9.99",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
"dev-master": "1.9-dev"
}
},
"autoload": {
@ -673,7 +676,7 @@
"portable",
"shim"
],
"time": "2018-04-26T10:06:28+00:00"
"time": "2018-08-06T14:22:27+00:00"
},
{
"name": "twig/twig",
@ -751,7 +754,10 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.5.9"
"php": ">=5.5.9",
"ext-curl": "*",
"ext-pdo": "*",
"ext-xml": "*"
},
"platform-dev": []
}

Binary file not shown.

View File

@ -173,6 +173,8 @@ $sm_lang = array(
'pattern_description' => 'If this pattern is not found on the website, the server will be marked online/offline. Regular expressions are allowed.',
'pattern_online' => 'Pattern indicates website is',
'pattern_online_description' => 'Online: If this pattern is not found on the website, the server will be marked online. Offline: If this pattern is not found on the website, the server will be marked offline.',
'allow_http_status' => 'Allow HTTP status code',
'allow_http_status_description' => 'Mark website as online. HTTP Status codes lower then 400 are marked as online by default. Seperate with |. Example: 401|403.',
'header' => 'Header',
'header_name_description' => 'Header name (case-sensitive)',
'header_value_description' => 'Header value. Regular expressions are allowed.',

View File

@ -142,6 +142,8 @@ $sm_lang = array(
'type_service' => 'Service',
'pattern' => 'Zoek voor tekst/regex',
'pattern_description' => 'Als dit patroon niet gevonden wordt op de website, zal de server als offline gemarkeerd worden. Regular expressions zijn toegestaan.',
'allow_http_status' => 'Sta HTTP status code toe',
'allow_http_status_description' => 'Markeer website als online. HTTP status code lager dan 400 worden standaard als online gemarkeerd. Scheiden met |. Bijvoorbeeld: 401|403.',
'last_check' => 'Laatst gecontroleerd',
'last_online' => 'Laatst online',
'last_offline' => 'Laatst offline',

View File

@ -66,6 +66,7 @@ abstract class AbstractServerController extends AbstractController {
`s`.`label`,
`s`.`pattern`,
`s`.`pattern_online`,
`s`.`allow_http_status`,
`s`.`header_name`,
`s`.`header_value`,
`s`.`status`,
@ -108,7 +109,8 @@ abstract class AbstractServerController extends AbstractController {
$server['last_online'] = psm_timespan($server['last_online']);
$server['last_offline'] = psm_timespan($server['last_offline']);
if ($server['last_offline'] != psm_get_lang('system', 'never')) {
$server['last_offline_duration'] = "(".$server['last_offline_duration'].")";
$server['last_offline_duration'] = is_null($server['last_offline_duration']) ?
null : "(".$server['last_offline_duration'].")";
}
$server['last_check'] = psm_timespan($server['last_check']);
$server['active'] = psm_get_lang('system', $server['active']);

View File

@ -201,6 +201,7 @@ class ServerController extends AbstractServerController {
'default_value_timeout' => PSM_CURL_TIMEOUT,
'edit_value_pattern' => $edit_server['pattern'],
'edit_pattern_selected_'.$edit_server['pattern_online'] => 'selected="selected"',
'edit_value_allow_http_status' => $edit_server['allow_http_status'],
'edit_value_header_name' => $edit_server['header_name'],
'edit_value_header_value' => $edit_server['header_value'],
'edit_value_warning_threshold' => $edit_server['warning_threshold'],
@ -269,6 +270,7 @@ class ServerController extends AbstractServerController {
'type' => psm_POST('type', ''),
'pattern' => psm_POST('pattern', ''),
'pattern_online' => in_array($_POST['pattern_online'], array('yes', 'no')) ? $_POST['pattern_online'] : 'yes',
'allow_http_status' => psm_POST('allow_http_status', ''),
'header_name' => psm_POST('header_name', ''),
'header_value' => psm_POST('header_value', ''),
'rtime' => psm_POST('rtime', '0.0000000'),
@ -479,6 +481,8 @@ class ServerController extends AbstractServerController {
'label_pattern_description' => psm_get_lang('servers', 'pattern_description'),
'label_pattern_online' => psm_get_lang('servers', 'pattern_online'),
'label_pattern_online_description' => psm_get_lang('servers', 'pattern_online_description'),
'label_allow_http_status' => psm_get_lang('servers', 'allow_http_status'),
'label_allow_http_status_description' => psm_get_lang('servers', 'allow_http_status_description'),
'label_header' => psm_get_lang('servers', 'header'),
'label_header_name_description' => psm_get_lang('servers', 'header_name_description'),
'label_header_value_description' => psm_get_lang('servers', 'header_value_description'),

View File

@ -49,7 +49,7 @@ class UserController extends AbstractController {
}
public function run($action = NULL) {
$servers = $this->db->select(PSM_DB_PREFIX.'servers', null, array('server_id', 'label'), '', "ORDER BY `active` ASC, `status` DESC, `label` ASC");
$servers = $this->db->select(PSM_DB_PREFIX.'servers', null, array('server_id', 'label'), '', "ORDER BY `label` ASC");
// change the indexes to reflect their server ids
foreach ($servers as $server) {
$this->servers[$server['server_id']] = $server;
@ -110,6 +110,7 @@ class UserController extends AbstractController {
'label' => $servers_labels[$server_id]
);
}
sort($user['emp_servers']);
$user['url_delete'] = psm_build_url(array(
'mod' => 'user',

View File

@ -228,8 +228,9 @@ class Installer {
`request_method` varchar(50) unsigned NULL,
`label` varchar(255) NOT NULL,
`type` enum('ping','service','website') NOT NULL default 'service',
`pattern` varchar(255) NOT NULL,
`pattern` varchar(255) NOT NULL default '',
`pattern_online` enum('yes','no') NOT NULL default 'yes',
`allow_http_status` varchar(255) NOT NULL default '',
`header_name` varchar(255) NOT NULL default '',
`header_value` varchar(255) NOT NULL default '',
`status` enum('on','off') NOT NULL default 'on',
@ -551,6 +552,7 @@ class Installer {
protected function upgrade340() {
$queries = array();
$queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD COLUMN `request_method` varchar(50) NULL AFTER `port`;";
$queries[] = "ALTER TABLE `".PSM_DB_PREFIX."servers` ADD COLUMN `allow_http_status` VARCHAR(255) NOT NULL DEFAULT '' AFTER `pattern_online`;";
$this->execSQL($queries);
}
}

View File

@ -179,8 +179,8 @@ class HistoryGraph {
}
$records = $this->db->execute(
'SELECT *
FROM `'.PSM_DB_PREFIX."servers_$type`
"SELECT *
FROM `".PSM_DB_PREFIX."servers_$type`
WHERE `server_id` = :server_id AND `date` BETWEEN :start_time AND :end_time ORDER BY `date` ASC",
array(
'server_id' => $server_id,

View File

@ -82,7 +82,7 @@ class StatusUpdater {
$this->server = $this->db->selectRow(PSM_DB_PREFIX.'servers', array(
'server_id' => $server_id,
), array(
'server_id', 'ip', 'port', 'request_method', 'label', 'type', 'pattern', 'pattern_online', 'header_name', 'header_value', 'status', 'active', 'warning_threshold',
'server_id', 'ip', 'port', 'request_method', 'label', 'type', 'pattern', 'pattern_online', 'allow_http_status', 'header_name', 'header_value', 'status', 'active', 'warning_threshold',
'warning_threshold_counter', 'timeout', 'website_username', 'website_password', 'last_offline'
));
if (empty($this->server)) {
@ -251,8 +251,9 @@ class StatusUpdater {
$code = $code_matches[1][0];
$msg = $code_matches[2][0];
$allow_http_status = explode("|", $this->server['allow_http_status']);
// All status codes starting with a 4 or higher mean trouble!
if (substr($code, 0, 1) >= '4') {
if (substr($code, 0, 1) >= '4' && !in_array($code ,$allow_http_status)) {
$this->error = "HTTP STATUS ERROR: ".$code.' '.$msg;
$result = false;
} else {

View File

@ -100,6 +100,12 @@
</select>
</div>
</div>
<div class="control-group types typeWebsite">
<label class="control-label" for="allow_http_status">{{ label_allow_http_status }}</label>
<div class="controls">
<input type="text" id="allow_http_status" name="allow_http_status" value="{{ edit_value_allow_http_status }}" maxlength="255" data-toggle="tooltip" title="{{ label_allow_http_status_description }}" />
</div>
</div>
<div class="control-group types typeWebsite">
<label class="control-label" for="header_name">{{ label_header }}</label>
<div class="controls">