summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class9
1 files changed, 8 insertions, 1 deletions
diff --git a/it.class b/it.class
index 277439a..4fa274a 100644
--- a/it.class
+++ b/it.class
@@ -101,6 +101,7 @@ function error($p = array(), $body = "", $to = "")
{
$stampfn = $GLOBALS['ULTRAHOME'] . "/tmp/errstamp_" . urlencode($p['id']);
$stampage = time() - @filemtime($stampfn);
+ $lastsentfn = "/tmp/alertdata/" . $p['id'];
if ($stampage >= $p['graceperiod'] && $stampage <= $p['graceperiod'] + $p['timewindow'])
$sendalert = true;
@@ -109,10 +110,16 @@ function error($p = array(), $body = "", $to = "")
touch($stampfn);
}
else
+ {
+ $lastsentfn = "/tmp/alertdata/" . getmyuid() . "." . $to;
$sendalert = true;
+ }
- if ($sendalert)
+ if ($sendalert && (time() - @filemtime($lastsentfn)) > 3600)
{
+ mkdir("/tmp/alertdata");
+ touch($lastsentfn);
+
$url = ($_SERVER['HTTPS'] ? "https://" : "http://") . $_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI'];
if (!$title)
$title="Error in $url";