]> git.mxchange.org Git - friendica.git/commitdiff
bug 244 multiple birthday reminders from Diaspora if profile changed repeatedly
authorfriendica <info@friendica.com>
Tue, 20 Dec 2011 03:06:25 +0000 (19:06 -0800)
committerfriendica <info@friendica.com>
Tue, 20 Dec 2011 03:06:25 +0000 (19:06 -0800)
boot.php
include/bbcode.php
include/diaspora.php

index 9f00d8d4b3eac3d36b53e632bacc3201306a7663..61f14d9bc0654a597eff6ccbd1bc1c1e3b9db485 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1036,6 +1036,8 @@ function get_birthdays() {
        if($r && count($r)) {
                $total = 0;
                $now = strtotime('now');
+               $cids = array();
+
                $istoday = false;
                foreach($r as $rr) {
                        if(strlen($rr['name']))
@@ -1052,6 +1054,13 @@ function get_birthdays() {
                        foreach($r as $rr) {
                                if(! strlen($rr['name']))
                                        continue;
+
+                               // avoid duplicates
+
+                               if(in_array($rr['cid'],$cids))
+                                       continue;
+                               $cids[] = $rr['cid'];
+
                                $today = (((strtotime($rr['start'] . ' +00:00') < $now) && (strtotime($rr['finish'] . ' +00:00') > $now)) ? true : false); 
                                $sparkle = '';
                                $url = $rr['url'];
index a8e3bed7011ee87e01b23c9083d19b79af8c0e6a..5218a06e85a39e948f0261326d5fe613d44ffa5b 100644 (file)
@@ -11,7 +11,7 @@ function stripcode_br_cb($s) {
 
 function tryoembed($match){
        $url = ((count($match)==2)?$match[1]:$match[2]);
-       logger('tryoembed: $url');
+       logger("tryoembed: $url");
        
        $o = oembed_fetch_url($url);
 
index 3ab4542462f8a0852ace3f91360baf0a80efff7a..fdf756610ea668ef53bd32d97263fdca9bc3a142 100644 (file)
@@ -1679,6 +1679,12 @@ function diaspora_profile($importer,$xml) {
 
        $birthday = datetime_convert('UTC','UTC',$birthday,'Y-m-d');
 
+       // this is to prevent multiple birthday notifications in a single year
+       // if we already have a stored birthday and the 'm-d' part hasn't changed, preserve the entry, which will preserve the notify year
+
+       if(substr($birthday,5) === substr($contact['bd'],5))
+               $birthday = $contact['bd'];
+
        $r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' , `bd` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
                dbesc($name),
                dbesc(datetime_convert()),