diff options
-rw-r--r-- | etc/inc/growl.class | 22 | ||||
-rw-r--r-- | etc/inc/notices.inc | 2 |
2 files changed, 15 insertions, 9 deletions
diff --git a/etc/inc/growl.class b/etc/inc/growl.class index aa35533..883ec8b 100644 --- a/etc/inc/growl.class +++ b/etc/inc/growl.class @@ -77,20 +77,26 @@ { if(function_exists('socket_create') && function_exists('socket_sendto')) { - $sck = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); - socket_sendto($sck, $data, strlen($data), 0x100, $this->address, $this->port); - return true; + $sck = @socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); + if ($sck) { + socket_sendto($sck, $data, strlen($data), 0x100, $this->address, $this->port); + return true; + } } elseif(function_exists('fsockopen')) { - $fp = fsockopen('udp://' . $this->address, $this->port); - fwrite($fp, $data); - fclose($fp); - return true; + if ($this->address) { + $fp = @fsockopen('udp://' . $this->address, $this->port); + if ($fp) { + fwrite($fp, $data); + fclose($fp); + return true; + } + } } return false; } } -?>
\ No newline at end of file +?> diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index 278d4f4..d2cf505 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -345,7 +345,7 @@ function notify_via_growl($message) { global $config; $growl_ip = $config['notifications']['growl']['ipaddress']; $growl_password = $config['notifications']['growl']['password']; - if($growl_ip) { + if(!empty($growl_ip)) { $growl = new Growl($growl_ip, $growl_password); $growl->notify("pfSense growl alert", "pfSense", "{$message}"); } |