X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ffollow.php;h=cac713b12f93def8d69703b58305e54cf23ce721;hb=aeb6e53d02fdbc3208851a9a4dc8323db29c62c5;hp=cdeac6db2a5bbe97861ad13a3cde5a5bf612fb42;hpb=1f58bcc114928a5a3cd97bd0de34a5aa7d585931;p=friendica.git diff --git a/include/follow.php b/include/follow.php index cdeac6db2a..cac713b12f 100644 --- a/include/follow.php +++ b/include/follow.php @@ -1,6 +1,7 @@ $val) { - if (isset($r[0][$key]) AND ($r[0][$key] != "") AND ($val == "")) + if (isset($r[0][$key]) && ($r[0][$key] != "") && ($val == "")) $ret[$key] = $r[0][$key]; - if (isset($r[0][$key]) AND ($ret[$key] != $r[0][$key])) + if (isset($r[0][$key]) && ($ret[$key] != $r[0][$key])) $update = true; } @@ -109,7 +110,7 @@ function new_contact($uid,$url,$interactive = false) { if ($ret['network'] === NETWORK_DFRN) { if ($interactive) { if (strlen($a->path)) { - $myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']); + $myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']); } else { $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname()); } @@ -186,14 +187,10 @@ function new_contact($uid,$url,$interactive = false) { if (dbm::is_result($r)) { // update contact - if ($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) { - q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d", - intval(CONTACT_IS_FRIEND), - intval($subhub), - intval($r[0]['id']), - intval($uid) - ); - } + $new_relation = (($r[0]['rel'] == CONTACT_IS_FOLLOWER) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING); + + $fields = array('rel' => $new_relation, 'subhub' => $subhub, 'readonly' => false); + dba::update('contact', $fields, array('id' => $r[0]['id'])); } else { // check service class limits @@ -221,7 +218,7 @@ function new_contact($uid,$url,$interactive = false) { return $result; } - $new_relation = ((in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING); + $new_relation = ((in_array($ret['network'], array(NETWORK_MAIL))) ? 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`,