aboutsummaryrefslogtreecommitdiffstats
path: root/config/apcupsd
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-08-10 16:01:30 +0200
committerdoktornotor <notordoktor@gmail.com>2015-08-10 16:01:30 +0200
commit9ff97ac9055daf992a0d3c7ffee23bc48d40a126 (patch)
treeb267a3c36f016698841dd48d9bf8dff3c90d3b55 /config/apcupsd
parent81f504540bf34e016665106382386b1424cee7d3 (diff)
downloadpfsense-packages-9ff97ac9055daf992a0d3c7ffee23bc48d40a126.tar.gz
pfsense-packages-9ff97ac9055daf992a0d3c7ffee23bc48d40a126.tar.bz2
pfsense-packages-9ff97ac9055daf992a0d3c7ffee23bc48d40a126.zip
apcupsd - code style cleanup
- Update copyright header - Code style fixes
Diffstat (limited to 'config/apcupsd')
-rwxr-xr-xconfig/apcupsd/apcupsd_mail.php23
1 files changed, 13 insertions, 10 deletions
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 @@
<?php
/*
apcupsd_mail.php
- part of pfSense (https://www.pfsense.org/)
- Copyright (C) 2014 Danilo G. Baio <dbaio@bsd.com.br>
+ part of pfSense (https://www.pfSense.org/)
+ Copyright (C) 2014-2015 Danilo G. Baio <dbaio@bsd.com.br>
+ 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 .= "</pre>";
-if(!$mail->Send()) {
+if (!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}