- $r = q("UPDATE `contact` SET `photo` = '%s',
- `thumb` = '%s',
- `rel` = %d,
- `name-date` = '%s',
- `uri-date` = '%s',
- `avatar-date` = '%s',
- `blocked` = 0,
- `pending` = 0,
- `duplex` = %d,
- `network` = 'dfrn' WHERE `id` = %d LIMIT 1
- ",
- dbesc($photo),
- dbesc($thumb),
- intval($new_relation),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- intval($duplex),
- intval($contact_id)
- );
+ if($contact['network'] === 'dfrn') {
+
+ $new_relation = REL_VIP;
+ if(($relation == REL_FAN) || ($duplex))
+ $new_relation = REL_BUD;
+
+ $r = q("UPDATE `contact` SET `photo` = '%s',
+ `thumb` = '%s',
+ `rel` = %d,
+ `name-date` = '%s',
+ `uri-date` = '%s',
+ `avatar-date` = '%s',
+ `blocked` = 0,
+ `pending` = 0,
+ `duplex` = %d,
+ `network` = 'dfrn' WHERE `id` = %d LIMIT 1
+ ",
+ dbesc($photo),
+ dbesc($thumb),
+ intval($new_relation),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ intval($duplex),
+ intval($contact_id)
+ );
+ }
+ else {
+
+ $notify = '';
+ $poll = '';
+
+ // $contact['network'] !== 'dfrn'
+
+ $arr = lrdd($contact['url']);
+ if(count($arr)) {
+ foreach($arr as $link) {
+ if($link['@attributes']['rel'] === 'salmon')
+ $notify = $link['@attributes']['href'];
+ if($link['@attributes']['rel'] === NAMESPACE_FEED)
+ $poll = $link['@attributes']['href'];
+ }
+ }
+
+ $r = q("DELETE FROM `intro` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($intro_id),
+ intval($uid)
+ );
+
+ $r = q("UPDATE `contact` SET `photo` = '%s',
+ `thumb` = '%s',
+ `name-date` = '%s',
+ `uri-date` = '%s',
+ `avatar-date` = '%s',
+ `notify` = '%s',
+ `poll` = '%s',
+ `blocked` = 0,
+ `pending` = 0
+ WHERE `id` = %d LIMIT 1
+ ",
+ dbesc($photo),
+ dbesc($thumb),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc(datetime_convert()),
+ dbesc($notify),
+ dbesc($poll),
+ intval($contact_id)
+ );
+ }
+