diff options
author | Phil Davis <phil.davis@inf.org> | 2015-05-30 12:52:54 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-05-30 12:52:54 +0545 |
commit | 2ee8dea1357deb254f46ead392ecca6d95af4cf7 (patch) | |
tree | 6bc69471fe0777ca125497801a916ff7e1e1e25c /usr/local/www/system_advanced_notifications.php | |
parent | 5dcec9f242a94894086dd425ecf9d2f00ccdebd5 (diff) | |
download | pfsense-2ee8dea1357deb254f46ead392ecca6d95af4cf7.zip pfsense-2ee8dea1357deb254f46ead392ecca6d95af4cf7.tar.gz |
Code style system a
Diffstat (limited to 'usr/local/www/system_advanced_notifications.php')
-rw-r--r-- | usr/local/www/system_advanced_notifications.php | 100 |
1 files changed, 61 insertions, 39 deletions
diff --git a/usr/local/www/system_advanced_notifications.php b/usr/local/www/system_advanced_notifications.php index da0c418..67df042 100644 --- a/usr/local/www/system_advanced_notifications.php +++ b/usr/local/www/system_advanced_notifications.php @@ -43,42 +43,55 @@ require_once("notices.inc"); // Growl $pconfig['disable_growl'] = isset($config['notifications']['growl']['disable']); -if($config['notifications']['growl']['password']) +if ($config['notifications']['growl']['password']) { $pconfig['password'] = $config['notifications']['growl']['password']; -if($config['notifications']['growl']['ipaddress']) +} +if ($config['notifications']['growl']['ipaddress']) { $pconfig['ipaddress'] = $config['notifications']['growl']['ipaddress']; +} -if($config['notifications']['growl']['notification_name']) +if ($config['notifications']['growl']['notification_name']) { $pconfig['notification_name'] = $config['notifications']['growl']['notification_name']; -else +} else { $pconfig['notification_name'] = "{$g['product_name']} growl alert"; - -if($config['notifications']['growl']['name']) +} + +if ($config['notifications']['growl']['name']) { $pconfig['name'] = $config['notifications']['growl']['name']; -else +} else { $pconfig['name'] = 'PHP-Growl'; +} // 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 (isset($config['notifications']['smtp']['ssl'])) +} +if (isset($config['notifications']['smtp']['ssl'])) { $pconfig['smtpssl'] = true; -if (isset($config['notifications']['smtp']['tls'])) +} +if (isset($config['notifications']['smtp']['tls'])) { $pconfig['smtptls'] = true; -if ($config['notifications']['smtp']['notifyemailaddress']) +} +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']['authentication_mechanism']) +} +if ($config['notifications']['smtp']['authentication_mechanism']) { $pconfig['smtpauthmech'] = $config['notifications']['smtp']['authentication_mechanism']; -if ($config['notifications']['smtp']['fromaddress']) +} +if ($config['notifications']['smtp']['fromaddress']) { $pconfig['smtpfromaddress'] = $config['notifications']['smtp']['fromaddress']; +} // System Sounds $pconfig['disablebeep'] = isset($config['system']['disablebeep']); @@ -96,7 +109,7 @@ if ($_POST) { if ($_POST['apply']) { $retval = 0; - system_setup_sysctl(); + system_setup_sysctl(); $savemsg = get_std_save_message($retval); } @@ -109,38 +122,43 @@ if ($_POST) { $config['notifications']['growl']['name'] = $_POST['name']; $config['notifications']['growl']['notification_name'] = $_POST['notification_name']; - if($_POST['disable_growl'] == "yes") + if ($_POST['disable_growl'] == "yes") { $config['notifications']['growl']['disable'] = true; - else + } else { unset($config['notifications']['growl']['disable']); + } // SMTP $config['notifications']['smtp']['ipaddress'] = $_POST['smtpipaddress']; $config['notifications']['smtp']['port'] = $_POST['smtpport']; - if (isset($_POST['smtpssl'])) + if (isset($_POST['smtpssl'])) { $config['notifications']['smtp']['ssl'] = true; - else + } else { unset($config['notifications']['smtp']['ssl']); - if (isset($_POST['smtptls'])) + } + if (isset($_POST['smtptls'])) { $config['notifications']['smtp']['tls'] = true; - else + } else { unset($config['notifications']['smtp']['tls']); + } $config['notifications']['smtp']['notifyemailaddress'] = $_POST['smtpnotifyemailaddress']; $config['notifications']['smtp']['username'] = $_POST['smtpusername']; $config['notifications']['smtp']['password'] = $_POST['smtppassword']; $config['notifications']['smtp']['authentication_mechanism'] = $_POST['smtpauthmech']; $config['notifications']['smtp']['fromaddress'] = $_POST['smtpfromaddress']; - if($_POST['disable_smtp'] == "yes") + if ($_POST['disable_smtp'] == "yes") { $config['notifications']['smtp']['disable'] = true; - else + } else { unset($config['notifications']['smtp']['disable']); + } // System Sounds - if($_POST['disablebeep'] == "yes") + if ($_POST['disablebeep'] == "yes") { $config['system']['disablebeep'] = true; - else + } else { unset($config['system']['disablebeep']); + } write_config(); pfSenseHeader("system_advanced_notifications.php"); @@ -149,8 +167,8 @@ if ($_POST) { } if ($_POST['test_growl'] == gettext("Test Growl")) { // Send test message via growl - if($config['notifications']['growl']['ipaddress'] && - $config['notifications']['growl']['password'] = $_POST['password']) { + if ($config['notifications']['growl']['ipaddress'] && + $config['notifications']['growl']['password'] = $_POST['password']) { unlink_if_exists($g['vardb_path'] . "/growlnotices_lastmsg.txt"); register_via_growl(); notify_via_growl(sprintf(gettext("This is a test message from %s. It is safe to ignore this message."), $g['product_name']), true); @@ -158,13 +176,14 @@ if ($_POST) { } if ($_POST['test_smtp'] == gettext("Test SMTP")) { // Send test message via smtp - if(file_exists("/var/db/notices_lastmsg.txt")) + if (file_exists("/var/db/notices_lastmsg.txt")) { unlink("/var/db/notices_lastmsg.txt"); + } $savemsg = notify_via_smtp(sprintf(gettext("This is a test message from %s. It is safe to ignore this message."), $g['product_name']), true); } } -$pgtitle = array(gettext("System"),gettext("Advanced: Notifications")); +$pgtitle = array(gettext("System"), gettext("Advanced: Notifications")); include("head.inc"); ?> @@ -173,10 +192,12 @@ include("head.inc"); <?php include("fbegin.inc"); ?> <form action="system_advanced_notifications.php" method="post"> <?php - if ($input_errors) + if ($input_errors) { print_input_errors($input_errors); - if ($savemsg) + } + if ($savemsg) { print_info_box($savemsg); + } ?> </form> <table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced notifications"> @@ -217,7 +238,7 @@ include("head.inc"); <?=gettext("Enter the name to register with the Growl server (default: PHP-Growl)."); ?> </td> </tr> - <tr> + <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Notification Name"); ?></td> <td width="78%" class="vtable"> <input name='notification_name' value='<?php echo htmlspecialchars($pconfig['notification_name']); ?>' /><br /> @@ -249,7 +270,7 @@ include("head.inc"); </tr> <tr> <td colspan="2" class="list" height="12"> </td> - </tr> + </tr> <!-- SMTP --> <tr> <td colspan="2" valign="top" class="listtopic"><?=gettext("SMTP E-Mail"); ?></td> @@ -317,10 +338,11 @@ include("head.inc"); <?php foreach ($smtp_authentication_mechanisms as $name => $desc): $selected = ""; - if ($pconfig['smtpauthmech'] == $name) + if ($pconfig['smtpauthmech'] == $name) { $selected = "selected=\"selected\""; + } ?> - <option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option> + <option value="<?=$name;?>" <?=$selected;?>><?=$desc;?></option> <?php endforeach; ?> </select> <br /> @@ -338,7 +360,7 @@ include("head.inc"); </tr> <tr> <td colspan="2" class="list" height="12"> </td> - </tr> + </tr> <!-- System Sounds --> <tr> <td colspan="2" valign="top" class="listtopic"><?=gettext("System Sounds"); ?></td> @@ -354,7 +376,7 @@ include("head.inc"); </tr> <tr> <td colspan="2" class="list" height="12"> </td> - </tr> + </tr> <tr> <td valign="top" class=""> |