- $r = q("UPDATE `contact` SET `rel` = %d,
- `name-date` = '%s',
- `uri-date` = '%s',
- `blocked` = 0,
- `pending` = 0,
- `duplex` = %d,
- `hidden` = %d,
- `network` = '%s' WHERE `id` = %d
- ",
- intval($new_relation),
- dbesc(DateTimeFormat::utcNow()),
- dbesc(DateTimeFormat::utcNow()),
- intval($duplex),
- intval($hidden),
- dbesc(NETWORK_DFRN),
- intval($contact_id)
- );
- } else {
- // $network !== NETWORK_DFRN
- $network = defaults($contact, 'network', NETWORK_OSTATUS);
-
- $arr = Probe::uri($contact['url']);
-
- $notify = defaults($contact, 'notify' , $arr['notify']);
- $poll = defaults($contact, 'poll' , $arr['poll']);
-
- $addr = $arr['addr'];
-
- $new_relation = $contact['rel'];
- $writable = $contact['writable'];
-
- if ($network === NETWORK_DIASPORA) {
- if ($duplex) {
- $new_relation = CONTACT_IS_FRIEND;
- } else {
- $new_relation = CONTACT_IS_FOLLOWER;
- }
-
- if ($new_relation != CONTACT_IS_FOLLOWER) {
- $writable = 1;
- }
- }
-
- DBA::delete('intro', ['id' => $intro_id]);
-
- $r = q("UPDATE `contact` SET `name-date` = '%s',
- `uri-date` = '%s',
- `addr` = '%s',
- `notify` = '%s',
- `poll` = '%s',
- `blocked` = 0,
- `pending` = 0,
- `network` = '%s',
- `writable` = %d,
- `hidden` = %d,
- `rel` = %d
- WHERE `id` = %d
- ",
- dbesc(DateTimeFormat::utcNow()),
- dbesc(DateTimeFormat::utcNow()),
- dbesc($addr),
- dbesc($notify),
- dbesc($poll),
- dbesc($network),
- intval($writable),
- intval($hidden),
- intval($new_relation),
- intval($contact_id)
- );