diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2588fc3b..dec09a8f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,8 +2,8 @@ Changelog ========= -not yet released ----------------- +v3.1.1 (released November 6, 2014) +---------------------------------- * #130: Added Czech translation. * #138: Added Polish translation. @@ -14,7 +14,10 @@ not yet released * #144: Updated Brazilian translation. * #146: Updated Russian translation. * #147: Updated Spanish translation. +* #128: Added SSL/TLS option for SMTP config. * #131: Allow URL and timeout to be passed as argument to the cronjob. +* #135: Uptime percentage above 100%. +* #151: Links in install results were stripped automatically from template. v3.1.0 (released August 7, 2014) diff --git a/README.rst b/README.rst index e57bdc11..3af8dbbb 100755 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ PHP Server Monitor ================== -Version 3.1.0 +Version 3.1.1 PHP Server Monitor is a script that checks whether your websites and servers are up and running. It comes with a web based user interface where you can manage your services and websites, diff --git a/docs/conf.py b/docs/conf.py index 3ab40df6..0be997f8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -51,7 +51,7 @@ copyright = u'2008-2014, Pepijn Over' # built documents. # # The short X.Y version. -version = '3.1.0' +version = '3.1.1' # The full version, including alpha/beta/rc tags. release = version diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index f6df279e..6a9ab3b1 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -413,6 +413,7 @@ function psm_build_mail($from_name = null, $from_email = null) { $phpmailer->IsSMTP(); $phpmailer->Host = psm_get_conf('email_smtp_host'); $phpmailer->Port = psm_get_conf('email_smtp_port'); + $phpmailer->SMTPSecure = psm_get_conf('email_smtp_security'); $smtp_user = psm_get_conf('email_smtp_username'); $smtp_pass = psm_get_conf('email_smtp_password'); diff --git a/src/includes/psmconfig.inc.php b/src/includes/psmconfig.inc.php index 0316956b..e48aaf40 100644 --- a/src/includes/psmconfig.inc.php +++ b/src/includes/psmconfig.inc.php @@ -29,7 +29,7 @@ /** * Current PSM version */ -define('PSM_VERSION', '3.1.0'); +define('PSM_VERSION', '3.1.1'); /** * URL to check for updates. Will not be checked if turned off on config page. diff --git a/src/lang/bg_BG.lang.php b/src/lang/bg_BG.lang.php index ddd2712c..94e74d9a 100644 --- a/src/lang/bg_BG.lang.php +++ b/src/lang/bg_BG.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Активиране на SMTP', 'email_smtp_host' => 'SMTP сървър', 'email_smtp_port' => 'SMTP порт', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP потребителско име', 'email_smtp_password' => 'SMTP парола', 'email_smtp_noauth' => 'Оставете празно за "без аутентикация"', diff --git a/src/lang/cs_CZ.lang.php b/src/lang/cs_CZ.lang.php index 02c031f2..56b66b1d 100644 --- a/src/lang/cs_CZ.lang.php +++ b/src/lang/cs_CZ.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Zapnout SMTP', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP uživatelské jméno', 'email_smtp_password' => 'SMTP heslo', 'email_smtp_noauth' => 'Ponechte prázdné pro použití SMTP bez hesla', diff --git a/src/lang/da_DK.lang.php b/src/lang/da_DK.lang.php index 6c5d64eb..1ef62410 100644 --- a/src/lang/da_DK.lang.php +++ b/src/lang/da_DK.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Aktiver SMTP', 'email_smtp_host' => 'SMTP vært', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP brugernavn', 'email_smtp_password' => 'SMTP adgangskode', 'email_smtp_noauth' => 'Efterladt blank hvis det ikke er opkrævet', diff --git a/src/lang/de_DE.lang.php b/src/lang/de_DE.lang.php index 8dcb4267..a4a9d216 100644 --- a/src/lang/de_DE.lang.php +++ b/src/lang/de_DE.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'SMTP-Versand aktivieren', 'email_smtp_host' => 'SMTP Server/Host', 'email_smtp_port' => 'SMTP Port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP Benutzername', 'email_smtp_password' => 'SMTP Passwort', 'email_smtp_noauth' => 'Feld leer lassen, bei fehlender Authentifizierung', diff --git a/src/lang/en_US.lang.php b/src/lang/en_US.lang.php index afa1b006..2a404660 100644 --- a/src/lang/en_US.lang.php +++ b/src/lang/en_US.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Enable SMTP', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP username', 'email_smtp_password' => 'SMTP password', 'email_smtp_noauth' => 'Leave blank for no authentication', diff --git a/src/lang/es_ES.lang.php b/src/lang/es_ES.lang.php index e928b464..a35f05cd 100644 --- a/src/lang/es_ES.lang.php +++ b/src/lang/es_ES.lang.php @@ -194,6 +194,8 @@ $sm_lang = array( 'email_smtp' => 'Habilitar SMTP', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP username', 'email_smtp_password' => 'SMTP contraseña', 'email_smtp_noauth' => 'Deja en blanco para ninguna autenticación', diff --git a/src/lang/fr_FR.lang.php b/src/lang/fr_FR.lang.php index 377551f9..e96c1ab6 100644 --- a/src/lang/fr_FR.lang.php +++ b/src/lang/fr_FR.lang.php @@ -194,6 +194,8 @@ $sm_lang = array( 'email_smtp' => 'Utiliser un serveur SMTP', 'email_smtp_host' => 'Adresse serveur SMTP', 'email_smtp_port' => 'Port SMTP', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'Nom utilisateur SMTP', 'email_smtp_password' => 'Mot de passe SMTP', 'email_smtp_noauth' => 'Laisser vide si pas d\'authentication', diff --git a/src/lang/it_IT.lang.php b/src/lang/it_IT.lang.php index 0c1d51dd..2c323f56 100644 --- a/src/lang/it_IT.lang.php +++ b/src/lang/it_IT.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Enable SMTP', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP username', 'email_smtp_password' => 'SMTP password', 'email_smtp_noauth' => 'Leave blank for no authentication', diff --git a/src/lang/ko_KR.lang.php b/src/lang/ko_KR.lang.php index 5f01c193..cf00fc76 100644 --- a/src/lang/ko_KR.lang.php +++ b/src/lang/ko_KR.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Enable SMTP', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP username', 'email_smtp_password' => 'SMTP password', 'email_smtp_noauth' => 'Leave blank for no authentication', diff --git a/src/lang/nl_NL.lang.php b/src/lang/nl_NL.lang.php index 666996f3..d01fbb7a 100644 --- a/src/lang/nl_NL.lang.php +++ b/src/lang/nl_NL.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'SMTP gebruiken', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP poort', + 'email_smtp_security' => 'SMTP beveiliging', + 'email_smtp_security_none' => 'Geen', 'email_smtp_username' => 'SMTP gebruikersnaam', 'email_smtp_password' => 'SMTP wachtwoord', 'email_smtp_noauth' => 'Laat leeg voor geen authenticatie', diff --git a/src/lang/pl_PL.lang.php b/src/lang/pl_PL.lang.php index f6c2beb0..f336409b 100644 --- a/src/lang/pl_PL.lang.php +++ b/src/lang/pl_PL.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Włącz SMTP', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP login', 'email_smtp_password' => 'SMTP hasło', 'email_smtp_noauth' => 'Pozostaw puste dla braku autentykacji', diff --git a/src/lang/pt_BR.lang.php b/src/lang/pt_BR.lang.php index 54de7f10..9c79c395 100644 --- a/src/lang/pt_BR.lang.php +++ b/src/lang/pt_BR.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Enable SMTP', 'email_smtp_host' => 'SMTP host', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP username', 'email_smtp_password' => 'SMTP password', 'email_smtp_noauth' => 'Deixe em branco para nenhuma autenticação', diff --git a/src/lang/ru_RU.lang.php b/src/lang/ru_RU.lang.php index ce6c1e40..213416e5 100644 --- a/src/lang/ru_RU.lang.php +++ b/src/lang/ru_RU.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'Включить SMTP', 'email_smtp_host' => 'SMTP сервер', 'email_smtp_port' => 'SMTP порт', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP пользователь', 'email_smtp_password' => 'SMTP пароль', 'email_smtp_noauth' => 'Оставить пустым, если без аутентификации', diff --git a/src/lang/tr_TR.lang.php b/src/lang/tr_TR.lang.php index 64fc6e11..1a290539 100644 --- a/src/lang/tr_TR.lang.php +++ b/src/lang/tr_TR.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => 'SMTP\'yi aktif et', 'email_smtp_host' => 'SMTP sunucusu', 'email_smtp_port' => 'SMTP port', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP kullanıcı adı', 'email_smtp_password' => 'SMTP şifre', 'email_smtp_noauth' => 'Doğrulama yapmamak için boş bırakın', diff --git a/src/lang/zh_CN.lang.php b/src/lang/zh_CN.lang.php index ada654ee..e2edd81c 100644 --- a/src/lang/zh_CN.lang.php +++ b/src/lang/zh_CN.lang.php @@ -193,6 +193,8 @@ $sm_lang = array( 'email_smtp' => '使用SMTP发送', 'email_smtp_host' => 'SMTP主机', 'email_smtp_port' => 'SMTP端口', + 'email_smtp_security' => 'SMTP security', + 'email_smtp_security_none' => 'None', 'email_smtp_username' => 'SMTP用户名', 'email_smtp_password' => 'SMTP密码', 'email_smtp_noauth' => '留空为无验证', diff --git a/src/psm/Module/Config/Controller/ConfigController.class.php b/src/psm/Module/Config/Controller/ConfigController.class.php index 5c7a2be1..c8216840 100644 --- a/src/psm/Module/Config/Controller/ConfigController.class.php +++ b/src/psm/Module/Config/Controller/ConfigController.class.php @@ -109,8 +109,11 @@ class ConfigController extends AbstractController { ); } + // @todo these selected values can easily be rewritten in the template using twig $tpl_data['sms_selected_' . $config['sms_gateway']] = 'selected="selected"'; $tpl_data['alert_type_selected_' . $config['alert_type']] = 'selected="selected"'; + $smtp_sec = isset($config['email_smtp_security']) ? $config['email_smtp_security'] : ''; + $tpl_data['email_smtp_security_selected_' . $smtp_sec] = 'selected="selected"'; $tpl_data['auto_refresh_servers'] = (isset($config['auto_refresh_servers'])) ? $config['auto_refresh_servers'] : '0'; $tpl_data['log_retention_period'] = (isset($config['log_retention_period'])) ? $config['log_retention_period'] : '365'; @@ -149,6 +152,10 @@ class ConfigController extends AbstractController { 'language' => $_POST['language'], 'sms_gateway' => $_POST['sms_gateway'], 'alert_type' => $_POST['alert_type'], + 'email_smtp_security' => + in_array($_POST['email_smtp_security'], array('', 'ssl', 'tls')) + ? $_POST['email_smtp_security'] + : '', 'auto_refresh_servers' => intval(psm_POST('auto_refresh_servers', 0)), 'log_retention_period' => intval(psm_POST('log_retention_period', 365)), ); @@ -292,6 +299,8 @@ class ConfigController extends AbstractController { 'label_email_smtp' => psm_get_lang('config', 'email_smtp'), 'label_email_smtp_host' => psm_get_lang('config', 'email_smtp_host'), 'label_email_smtp_port' => psm_get_lang('config', 'email_smtp_port'), + 'label_email_smtp_security' => psm_get_lang('config', 'email_smtp_security'), + 'label_email_smtp_security_none' => psm_get_lang('config', 'email_smtp_security_none'), 'label_email_smtp_username' => psm_get_lang('config', 'email_smtp_username'), 'label_email_smtp_password' => psm_get_lang('config', 'email_smtp_password'), 'label_email_smtp_noauth' => psm_get_lang('config', 'email_smtp_noauth'), diff --git a/src/psm/Util/Install/Installer.class.php b/src/psm/Util/Install/Installer.class.php index a908b15f..91709ad1 100644 --- a/src/psm/Util/Install/Installer.class.php +++ b/src/psm/Util/Install/Installer.class.php @@ -136,6 +136,7 @@ class Installer { ('email_smtp', ''), ('email_smtp_host', ''), ('email_smtp_port', ''), + ('email_smtp_security', ''), ('email_smtp_username', ''), ('email_smtp_password', ''), ('sms_status', '0'), diff --git a/src/psm/Util/Server/HistoryGraph.class.php b/src/psm/Util/Server/HistoryGraph.class.php index ddc16e41..42da87a8 100644 --- a/src/psm/Util/Server/HistoryGraph.class.php +++ b/src/psm/Util/Server/HistoryGraph.class.php @@ -19,7 +19,7 @@ * * @package phpservermon * @author Jérôme Cabanis - * Pepijn Over + * @author Pepijn Over * @copyright Copyright (c) 2008-2014 Pepijn Over * @license http://www.gnu.org/licenses/gpl.txt GNU GPL v3 * @version Release: @package_version@ @@ -181,7 +181,7 @@ class HistoryGraph { $records = $this->db->execute( 'SELECT * FROM `' . PSM_DB_PREFIX . "servers_$type` - WHERE `server_id` = :server_id AND `date` BETWEEN :start_time AND :end_time", + WHERE `server_id` = :server_id AND `date` BETWEEN :start_time AND :end_time ORDER BY `date` ASC", array( 'server_id' => $server_id, 'start_time' => $start_time->format('Y-m-d H:i:s'), @@ -192,7 +192,7 @@ class HistoryGraph { /** * Generate data arrays for graphs - * @param array $records all uptime records to parse + * @param array $records all uptime records to parse, MUST BE SORTED BY DATE IN ASCENDING ORDER * @param array $lines array with keys as line ids to prepare (key must be available in uptime records) * @param callable $cb_if_up function to check if the server is up or down * @param string $latency_avg_key which key from uptime records to use for calculating averages @@ -222,10 +222,10 @@ class HistoryGraph { if($cb_if_up($uptime)) { // The server is up - foreach($lines as $key => &$value) { + foreach($lines as $key => $value) { // add the value for each of the different lines if(isset($uptime[$key])) { - $value[] = '[' . $time . ',' . round((float) $uptime[$key], 4) . ']'; + $lines[$key][] = '[' . $time . ',' . round((float) $uptime[$key], 4) . ']'; } } if($last_date) { @@ -246,16 +246,16 @@ class HistoryGraph { $lines_merged = array(); foreach($lines as $line_key => $line_value) { - if(empty($value)) { + if(empty($line_value)) { continue; } $lines_merged[] = '[' . implode(',', $line_value) . ']'; $series[] = "{label: '".psm_get_lang('servers', $line_key)."'}"; } if($last_date) { + // if last_date is still set, the last check was "down" and we are still in down mode $down[] = '[' . $last_date . ',0]'; - $time = $end_time->getTimestamp() * 1000; - $time_down += ($time - $last_date); + $time_down += (($end_time->getTimestamp() * 1000) - $last_date); } if($add_uptime) { diff --git a/src/templates/default/module/config/config.tpl.html b/src/templates/default/module/config/config.tpl.html index 88b223b8..6ef7adad 100644 --- a/src/templates/default/module/config/config.tpl.html +++ b/src/templates/default/module/config/config.tpl.html @@ -100,6 +100,16 @@ +
+ +
+ +
+