From d269747b358f6e8f844e88d39fe36b8f33343d24 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Sun, 6 Apr 2014 18:51:11 +0200 Subject: Ensure variable is available when testing smtp. Fixes #3577 (well not the rrd summary package). --- usr/local/www/system_advanced_notifications.php | 34 +++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'usr') diff --git a/usr/local/www/system_advanced_notifications.php b/usr/local/www/system_advanced_notifications.php index 59950a2..8f5e90a 100644 --- a/usr/local/www/system_advanced_notifications.php +++ b/usr/local/www/system_advanced_notifications.php @@ -60,21 +60,21 @@ else // SMTP $pconfig['disable_smtp'] = isset($config['notifications']['smtp']['disable']); -if($config['notifications']['smtp']['ipaddress']) +if ($config['notifications']['smtp']['ipaddress']) $pconfig['smtpipaddress'] = $config['notifications']['smtp']['ipaddress']; -if($config['notifications']['smtp']['port']) +if ($config['notifications']['smtp']['port']) $pconfig['smtpport'] = $config['notifications']['smtp']['port']; -if($config['notifications']['smtp']['ssl']) - $pconfig['smtpssl'] = $config['notifications']['smtp']['ssl']; -if($config['notifications']['smtp']['tls']) - $pconfig['smtptls'] = $config['notifications']['smtp']['tls']; -if($config['notifications']['smtp']['notifyemailaddress']) +if (isset($config['notifications']['smtp']['ssl'])) + $pconfig['smtpssl'] = true; +if (isset($config['notifications']['smtp']['tls'])) + $pconfig['smtptls'] = true; +if ($config['notifications']['smtp']['notifyemailaddress']) $pconfig['smtpnotifyemailaddress'] = $config['notifications']['smtp']['notifyemailaddress']; -if($config['notifications']['smtp']['username']) +if ($config['notifications']['smtp']['username']) $pconfig['smtpusername'] = $config['notifications']['smtp']['username']; -if($config['notifications']['smtp']['password']) +if ($config['notifications']['smtp']['password']) $pconfig['smtppassword'] = $config['notifications']['smtp']['password']; -if($config['notifications']['smtp']['fromaddress']) +if ($config['notifications']['smtp']['fromaddress']) $pconfig['smtpfromaddress'] = $config['notifications']['smtp']['fromaddress']; // System Sounds @@ -114,8 +114,14 @@ if ($_POST) { // SMTP $config['notifications']['smtp']['ipaddress'] = $_POST['smtpipaddress']; $config['notifications']['smtp']['port'] = $_POST['smtpport']; - $config['notifications']['smtp']['ssl'] = isset($_POST['smtpssl']) ? 'checked' : 'unchecked'; - $config['notifications']['smtp']['tls'] = isset($_POST['smtptls']) ? (isset($_POST['smtpssl']) ? 'unchecked' : 'checked') : 'unchecked'; + if (isset($_POST['smtpssl'])) + $config['notifications']['smtp']['ssl'] = true; + else + unset($config['notifications']['smtp']['ssl']); + if (isset($_POST['smtptls'])) + $config['notifications']['smtp']['tls'] = true; + else + unset($config['notifications']['smtp']['tls']); $config['notifications']['smtp']['notifyemailaddress'] = $_POST['smtpnotifyemailaddress']; $config['notifications']['smtp']['username'] = $_POST['smtpusername']; $config['notifications']['smtp']['password'] = $_POST['smtppassword']; @@ -268,8 +274,8 @@ include("head.inc"); - />Enable SMTP over SSL/TLS
- />Enable STARTTLS
+ />Enable SMTP over SSL/TLS
+ />Enable STARTTLS
-- cgit v1.1