$r = q("SELECT `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `network` FROM `contact` WHERE `id` = %d", intval($id));
if (!$r)
- return;
+ return false;
$ret = probe_url($r[0]["url"]);
// If probe_url fails the network code will be different
if ($ret["network"] != $r[0]["network"])
- return;
+ return false;
$update = false;
}
if (!$update)
- return;
+ return true;
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($ret['poco']),
intval($id)
);
+
+ return true;
}
//
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
- if($ret['network'] === NETWORK_MAIL) {
- $writeable = 1;
-
- }
- if($ret['network'] === NETWORK_DIASPORA)
+ if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA)))
$writeable = 1;
// check if we already have a contact
return $result;
}
- $new_relation = (($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
- if($ret['network'] === NETWORK_DIASPORA)
- $new_relation = CONTACT_IS_FOLLOWER;
+ $new_relation = ((in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
// create contact record
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network`, `pubkey`, `rel`, `priority`,