function Modified($what, $message = '') { // plog('Modified('.$what.','.$message.')'); global $auth, $database; $m = new Modification($database); $mods = $m->Select('r_Auth = ' . $auth['ID'] . ' ORDER BY Timestamp DESC LIMIT 50'); $now = strtotime('now'); $what_json = json_encode($what); // Messages are not saved if they are a duplicate of a recent event. if (!false_or_null($mods)) { foreach ($mods as $a) { if ($now - intval($a['Timestamp']) > 30) { continue; } if (strlen($a['What']) === strlen($what_json) && matches($what_json, $a['What']) && matches($message, $a['Message'])) { /*plog("Modified matched previous message");*/ return FALSE; } } } RemoveOldModifications(); return $m->Insert(array('r_Auth' => $auth['ID'], 'What' => $what_json, 'Message' => $message, 'Timestamp' => $now)); }