X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ffollow.php;h=10ce4f667309252b90b9bb7bb14a9d148e9da8dd;hb=bc92b922b45eb8da9d03f4a4d276a0ef706cf3e8;hp=287a38b6bffb03c33e81f5856da461661e3d6be0;hpb=178b7eba1b6fea46b73ddc25dac9e669b8446a7a;p=friendica.git diff --git a/include/follow.php b/include/follow.php index 287a38b6bf..10ce4f6673 100644 --- a/include/follow.php +++ b/include/follow.php @@ -1,5 +1,48 @@ $val) { + if (isset($r[0][$key]) AND ($r[0][$key] != "") AND ($val == "")) + $ret[$key] = $r[0][$key]; + + if (isset($r[0][$key]) AND ($ret[$key] != $r[0][$key])) + $update = true; + } + + if (!$update) + return; + + q("UPDATE `contact` SET `url` = '%s', `nurl` = '%s', `addr` = '%s', `alias` = '%s', `batch` = '%s', `notify` = '%s', `poll` = '%s', `poco` = '%s' WHERE `id` = %d", + dbesc($ret['url']), + dbesc(normalise_link($ret['url'])), + dbesc($ret['addr']), + dbesc($ret['alias']), + dbesc($ret['batch']), + dbesc($ret['notify']), + dbesc($ret['poll']), + dbesc($ret['poco']), + intval($id) + ); +} // // Takes a $uid and a url/handle and adds a new contact @@ -120,9 +163,10 @@ function new_contact($uid,$url,$interactive = false) { // the poll url is more reliable than the profile url, as we may have // indirect links or webfinger links - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `poll` = '%s' AND `network` = '%s' LIMIT 1", + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `poll` IN ('%s', '%s') AND `network` = '%s' LIMIT 1", intval($uid), dbesc($ret['poll']), + dbesc(normalise_link($ret['poll'])), dbesc($ret['network']) ); @@ -136,8 +180,8 @@ function new_contact($uid,$url,$interactive = false) { intval($uid) ); } - } - else { + + } else { // check service class limits @@ -252,7 +296,7 @@ function new_contact($uid,$url,$interactive = false) { '$photo' => $a->contact['photo'], '$thumb' => $a->contact['thumb'], '$published' => datetime_convert('UTC','UTC', 'now', ATOM_TIME), - '$item_id' => 'urn:X-dfrn:' . $a->get_hostname() . ':follow:' . random_string(), + '$item_id' => 'urn:X-dfrn:' . $a->get_hostname() . ':follow:' . get_guid(32), '$title' => '', '$type' => 'text', '$content' => t('following'),