X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdfrn.php;h=702fbb15fe0f31a19c5eb831f4a0cb8d91b17f03;hb=45ebeba643a6d600e8778475f70f827f32bf3146;hp=ccb43fa98e463d2059059087b2f3b79d75dc9cd7;hpb=722b18ead7adf0a56f1af3f5af5070540ccd9fc7;p=friendica.git diff --git a/include/dfrn.php b/include/dfrn.php index ccb43fa98e..702fbb15fe 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -1105,12 +1105,22 @@ class dfrn { */ private function birthday_event($contact, $birthday) { + // Check for duplicates + $r = q("SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1", + intval($contact["uid"]), + intval($contact["id"]), + dbesc(datetime_convert("UTC","UTC", $birthday)), + dbesc("birthday")); + + if (dbm::is_result($r)) { + return; + } + logger("updating birthday: ".$birthday." for contact ".$contact["id"]); $bdtext = sprintf(t("%s\'s birthday"), $contact["name"]); $bdtext2 = sprintf(t("Happy Birthday %s"), " [url=".$contact["url"]."]".$contact["name"]."[/url]") ; - $r = q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s') ", intval($contact["uid"]), @@ -1411,9 +1421,9 @@ class dfrn { $msg["seen"] = 0; $msg["replied"] = 0; - dbesc_array($msg); + dbm::esc_array($msg, true); - $r = dbq("INSERT INTO `mail` (`".implode("`, `", array_keys($msg))."`) VALUES ('".implode("', '", array_values($msg))."')"); + $r = dbq("INSERT INTO `mail` (`".implode("`, `", array_keys($msg))."`) VALUES (".implode(", ", array_values($msg)).")"); // send notifications.