diff options
author | doktornotor <notordoktor@gmail.com> | 2015-08-08 12:39:17 +0200 |
---|---|---|
committer | doktornotor <notordoktor@gmail.com> | 2015-08-08 12:39:17 +0200 |
commit | ae7156d6dc0bb528f423844f989e552b13bed7bd (patch) | |
tree | 60596b586d275b0c546350c4f44c14c0ea62683a /config/arpwatch/sm.php | |
parent | 504838113451d91e88142dd3216d0c914b6275da (diff) | |
download | pfsense-packages-ae7156d6dc0bb528f423844f989e552b13bed7bd.tar.gz pfsense-packages-ae7156d6dc0bb528f423844f989e552b13bed7bd.tar.bz2 pfsense-packages-ae7156d6dc0bb528f423844f989e552b13bed7bd.zip |
arpwatch - code style cleanup
- Add missing copyright header
- Remove obsolete pfSense version check
- Code style cleanup
Diffstat (limited to 'config/arpwatch/sm.php')
-rw-r--r-- | config/arpwatch/sm.php | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/config/arpwatch/sm.php b/config/arpwatch/sm.php index 2e1cc4a0..4df6cead 100644 --- a/config/arpwatch/sm.php +++ b/config/arpwatch/sm.php @@ -1,33 +1,49 @@ #!/usr/local/bin/php -q <?php +/* + sm.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2015 ESF, LLC + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ require_once("config.inc"); require_once("globals.inc"); require_once("notices.inc"); -$pf_version=substr(trim(file_get_contents("/etc/version")),0,3); -if (($pf_version < 2.1)) { - $error = "Sending e-mail on this version of pfSense is not supported. Please use pfSense 2.1 or later"; - log_error($error); - echo "{$error}\n"; - return; -} - $options = getopt("s::"); - $message = ""; -if($options['s'] <> "") { +if ($options['s'] <> "") { $subject = $options['s']; } - $in = file("php://stdin"); -foreach($in as $line){ +foreach ($in as $line) { $line = trim($line); - if ( (substr($line, 0, 6) == "From: ") - || (substr($line, 0, 6) == "Date: ") - || (substr($line, 0, 4) == "To: ")) + if ((substr($line, 0, 6) == "From: ") || (substr($line, 0, 6) == "Date: ") || (substr($line, 0, 4) == "To: ")) { continue; + } if (empty($subject) && (substr($line, 0, 9) == "Subject: ")) { $subject = substr($line, 9); continue; @@ -35,8 +51,10 @@ foreach($in as $line){ $message .= "$line\n"; } -if (!empty($subject)) +if (!empty($subject)) { send_smtp_message($message, $subject); -else +} else { send_smtp_message($message); -?>
\ No newline at end of file +} + +?> |