X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fcontacts.php;h=93013972f1c583e5ec3986b96a9367c0af834df0;hb=10ede7314136edb1c475e1af546a59ff4c5648cf;hp=bbbd088cd1bfe5c46521626e30f1ca077419c2f3;hpb=94f6f12ba3a5c1d506255803e709cb640147ebf4;p=friendica.git diff --git a/mod/contacts.php b/mod/contacts.php index bbbd088cd1..93013972f1 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -244,7 +244,7 @@ function _contact_update($contact_id) { return; if ($r[0]["network"] == NETWORK_OSTATUS) { - $result = new_contact($uid, $r[0]["url"], false); + $result = new_contact($uid, $r[0]["url"], false, $r[0]["network"]); if ($result['success']) $r = q("UPDATE `contact` SET `subhub` = 1 WHERE `id` = %d", @@ -348,7 +348,16 @@ function _contact_archive($contact_id, $orig_record) { function _contact_drop($contact_id, $orig_record) { $a = get_app(); - terminate_friendship($a->user,$a->contact,$orig_record); + $r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid` + WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1", + intval($a->user['uid']) + ); + if (!dbm::is_result($r)) { + return; + } + + $self = ""; // Unused parameter + terminate_friendship($r[0], $self, $orig_record); contact_remove($orig_record['id']); } @@ -574,9 +583,15 @@ function contacts_content(App $a) { if ($contact['network'] == NETWORK_DFRN) $profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)); - if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) && - ($contact['rel'] == CONTACT_IS_FOLLOWER)) - $follow = System::baseUrl(true)."/follow?url=".urlencode($contact["url"]); + if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS))) { + if ($contact['rel'] == CONTACT_IS_FOLLOWER) { + $follow = System::baseUrl(true)."/follow?url=".urlencode($contact["url"]); + $follow_text = t("Connect/Follow"); + } elseif ($contact['rel'] == CONTACT_IS_FRIEND) { + $follow = System::baseUrl(true)."/unfollow?url=".urlencode($contact["url"]); + $follow_text = t("Disconnect/Unfollow"); + } + } // Load contactact related actions like hide, suggest, delete and others $contact_actions = contact_actions($contact); @@ -613,7 +628,7 @@ function contacts_content(App $a) { '$last_update' => $last_update, '$udnow' => t('Update now'), '$follow' => $follow, - '$follow_text' => t("Connect/Follow"), + '$follow_text' => $follow_text, '$profile_select' => $profile_select, '$contact_id' => $contact['id'], '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ), @@ -856,7 +871,7 @@ function contacts_tab($a, $contact_id, $active_tab) { 'url' => "contacts/".$contact_id, 'sel' => (($active_tab == 2)?'active':''), 'title' => t('Profile Details'), - 'id' => 'status-tab', + 'id' => 'profile-tab', 'accesskey' => 'o', ) );