From 9ff97ac9055daf992a0d3c7ffee23bc48d40a126 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Mon, 10 Aug 2015 16:01:30 +0200 Subject: apcupsd - code style cleanup - Update copyright header - Code style fixes --- config/apcupsd/apcupsd_mail.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'config/apcupsd/apcupsd_mail.php') diff --git a/config/apcupsd/apcupsd_mail.php b/config/apcupsd/apcupsd_mail.php index 15c74fd2..30a8b957 100755 --- a/config/apcupsd/apcupsd_mail.php +++ b/config/apcupsd/apcupsd_mail.php @@ -1,8 +1,9 @@ + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2014-2015 Danilo G. Baio + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -26,7 +27,6 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - require_once("pkg-utils.inc"); require_once("globals.inc"); require_once("phpmailer/PHPMailerAutoload.php"); @@ -49,28 +49,31 @@ $apcstatus[emergency] = "Emergency Shutdown. Possible UPS battery failure"; $apcstatus[changeme] = "Emergency! UPS batteries have failed. Change them NOW"; $apcstatus[remotedown] = "Remote Shutdown. Beginning Shutdown Sequence"; -if (empty($argv[1]) || empty($apcstatus["$argv[1]"])) +if (empty($argv[1]) || empty($apcstatus["$argv[1]"])) { return; +} $apcsubject = $apcstatus["$argv[1]"]; -if (empty($config['notifications']['smtp']['ipaddress'])) +if (empty($config['notifications']['smtp']['ipaddress'])) { return; +} $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = $config['notifications']['smtp']['ipaddress']; -if ((isset($config['notifications']['smtp']['ssl']) && $config['notifications']['smtp']['ssl'] != "unchecked") || $config['notifications']['smtp']['ssl'] == "checked") +if ((isset($config['notifications']['smtp']['ssl']) && $config['notifications']['smtp']['ssl'] != "unchecked") || $config['notifications']['smtp']['ssl'] == "checked") { $mail->SMTPSecure = "ssl"; +} -if ((isset($config['notifications']['smtp']['tls']) && $config['notifications']['smtp']['tls'] != "unchecked") || $config['notifications']['smtp']['tls'] == "checked") +if ((isset($config['notifications']['smtp']['tls']) && $config['notifications']['smtp']['tls'] != "unchecked") || $config['notifications']['smtp']['tls'] == "checked") { $mail->SMTPSecure = "tls"; +} $mail->Port = empty($config['notifications']['smtp']['port']) ? 25 : $config['notifications']['smtp']['port']; -if($config['notifications']['smtp']['username'] && - $config['notifications']['smtp']['password']) { +if ($config['notifications']['smtp']['username'] && $config['notifications']['smtp']['password']) { $mail->SMTPAuth = true; $mail->Username = $config['notifications']['smtp']['username']; $mail->Password = $config['notifications']['smtp']['password']; @@ -91,7 +94,7 @@ while ($line = fgets($ph)) $mail->Body .= htmlspecialchars($line); pclose($ph); $mail->Body .= ""; -if(!$mail->Send()) { +if (!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } -- cgit v1.2.3