diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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"; |