X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdfrn.php;h=702fbb15fe0f31a19c5eb831f4a0cb8d91b17f03;hb=a71f7aefbb8cf1677236db58019053a4303f3161;hp=fef9ae2fedf07611858821eb6afb8ff2e2afd444;hpb=8d195dc4992ff1e1d083ef0777c24ee897e63875;p=friendica.git diff --git a/include/dfrn.php b/include/dfrn.php index fef9ae2fed..702fbb15fe 100644 --- a/include/dfrn.php +++ b/include/dfrn.php @@ -194,7 +194,7 @@ class dfrn { `contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`, `sign`.`signed_text`, `sign`.`signature`, `sign`.`signer` - FROM `item` USE INDEX (`uid_wall_changed`, `uid_type_changed`) $sql_post_table + FROM `item` USE INDEX (`uid_wall_changed`) $sql_post_table STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND (NOT `contact`.`blocked` OR `contact`.`pending`) LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` @@ -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. @@ -2355,7 +2365,7 @@ class dfrn { dbesc($xt->id), intval($importer["importer_uid"]) ); - if(count($i)) { + if (dbm::is_result($i)) { // For tags, the owner cannot remove the tag on the author's copy of the post.