X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ffollow.php;h=e7693822abc17575d2f57a7aab67b944ecf4491d;hb=c2213760412f6d178d77451d69ae467534042457;hp=77f0bbe2f102f246e8abab9cf68dc311207d8684;hpb=463a80e91d4f5de3b51b956b2e0c65ee7bea2c20;p=friendica.git diff --git a/include/follow.php b/include/follow.php index 77f0bbe2f1..e7693822ab 100644 --- a/include/follow.php +++ b/include/follow.php @@ -77,12 +77,12 @@ function new_contact($uid,$url,$interactive = false) { $url = str_replace('/#!/','/',$url); - if(! allowed_url($url)) { + if (! allowed_url($url)) { $result['message'] = t('Disallowed profile URL.'); return $result; } - if(! $url) { + if (! $url) { $result['message'] = t('Connect URL missing.'); return $result; } @@ -91,17 +91,21 @@ function new_contact($uid,$url,$interactive = false) { call_hooks('follow', $arr); - if(x($arr['contact'],'name')) + if (x($arr['contact'],'name')) { $ret = $arr['contact']; - else + } + else { $ret = probe_url($url); + } - if($ret['network'] === NETWORK_DFRN) { - if($interactive) { - if(strlen($a->path)) - $myaddr = bin2hex($a->get_baseurl() . '/profile/' . $a->user['nickname']); - else + if ($ret['network'] === NETWORK_DFRN) { + if ($interactive) { + if (strlen($a->path)) { + $myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']); + } + else { $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname()); + } goaway($ret['request'] . "&addr=$myaddr"); @@ -177,12 +181,12 @@ function new_contact($uid,$url,$interactive = false) { dbesc($ret['network']) ); - if(!count($r)) + if (!dbm::is_result($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)) { + 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", @@ -200,7 +204,7 @@ function new_contact($uid,$url,$interactive = false) { $r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0", intval($uid) ); - if(count($r)) + if (dbm::is_result($r)) $total_contacts = $r[0]['total']; if(! service_class_allows($uid,'total_contacts',$total_contacts)) { @@ -212,7 +216,7 @@ function new_contact($uid,$url,$interactive = false) { intval($uid), dbesc($network) ); - if(count($r)) + if (dbm::is_result($r)) $total_network = $r[0]['total']; if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) { @@ -254,7 +258,7 @@ function new_contact($uid,$url,$interactive = false) { intval($uid) ); - if(! count($r)) { + if (! dbm::is_result($r)) { $result['message'] .= t('Unable to retrieve contact information.') . EOL; return $result; } @@ -289,8 +293,9 @@ function new_contact($uid,$url,$interactive = false) { $slap = ostatus::salmon($item, $r[0]); slapper($r[0], $contact['notify'], $slap); } + if ($contact['network'] == NETWORK_DIASPORA) { - $ret = diaspora::send_share($a->user,$contact); + $ret = Diaspora::send_share($a->user,$contact); logger('share returns: '.$ret); } }