X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ffollow.php;h=217b9d07b7b37c22de81af99793c6cd968b1146f;hb=3cccb5ecb1cd010435bfc5058159d7ac9d958dcd;hp=287a38b6bffb03c33e81f5856da461661e3d6be0;hpb=893e91a14d62f2732ff8741f6e2a06aa39d463da;p=friendica.git diff --git a/include/follow.php b/include/follow.php index 287a38b6bf..217b9d07b7 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,12 +163,18 @@ 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']) ); + if(!count($r)) + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `network` = '%s' LIMIT 1", + intval($uid), dbesc(normalise_link($url)), dbesc($ret['network']) + ); + if(count($r)) { // update contact if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) { @@ -136,8 +185,7 @@ function new_contact($uid,$url,$interactive = false) { intval($uid) ); } - } - else { + } else { // check service class limits @@ -241,7 +289,7 @@ function new_contact($uid,$url,$interactive = false) { // pull feed and consume it, which should subscribe to the hub. - proc_run('php',"include/poller.php","$contact_id"); + proc_run('php',"include/onepoll.php","$contact_id", "force"); // create a follow slap @@ -252,7 +300,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'),