]> git.mxchange.org Git - friendica.git/blobdiff - mod/contacts.php
Merge pull request #5796 from JonnyTischbein/issue_5547
[friendica.git] / mod / contacts.php
index 38896a611a3c7d08f88a480bf2d31dd36665534a..1604f0b6605ec43d6f0e936972ad2394a45c11f2 100644 (file)
@@ -47,6 +47,11 @@ function contacts_init(App $a)
                if (!DBA::isResult($contact)) {
                        $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => 0]);
                }
+
+               // Don't display contacts that are about to be deleted
+               if ($contact['network'] == Protocol::PHANTOM) {
+                       $contact = false;
+               }
        }
 
        if (DBA::isResult($contact)) {
@@ -122,11 +127,12 @@ function contacts_init(App $a)
 
 function contacts_batch_actions(App $a)
 {
-       $contacts_id = $_POST['contact_batch'];
-       if (!is_array($contacts_id)) {
+       if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
                return;
        }
 
+       $contacts_id = $_POST['contact_batch'];
+
        $orig_records = q("SELECT * FROM `contact` WHERE `id` IN (%s) AND `uid` = %d AND `self` = 0",
                implode(",", $contacts_id),
                intval(local_user())
@@ -367,7 +373,7 @@ function _contact_drop($orig_record)
                return;
        }
 
-       Contact::terminateFriendship($r[0], $orig_record);
+       Contact::terminateFriendship($r[0], $orig_record, true);
        Contact::remove($orig_record['id']);
 }
 
@@ -595,17 +601,12 @@ function contacts_content(App $a, $update = 0)
                /// @todo Only show the following link with DFRN when the remote version supports it
                $follow = '';
                $follow_text = '';
-               if ($contact['network'] != Protocol::STATUSNET) {
-                       if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
+               if (in_array($contact['rel'], [Contact::FRIEND, Contact::SHARING])) {
+                       if (in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
                                $follow = System::baseUrl(true) . "/unfollow?url=" . urlencode($contact["url"]);
                                $follow_text = L10n::t("Disconnect/Unfollow");
-                       } else {
-                               $follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
-                               $follow_text = L10n::t("Connect/Follow");
                        }
-               }
-
-               if ($contact['uid'] == 0) {
+               } else {
                        $follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]);
                        $follow_text = L10n::t("Connect/Follow");
                }
@@ -723,6 +724,8 @@ function contacts_content(App $a, $update = 0)
                $sql_extra = " AND `blocked` = 0 ";
        }
 
+       $sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
+
        $search = x($_GET, 'search') ? notags(trim($_GET['search'])) : '';
        $nets   = x($_GET, 'nets'  ) ? notags(trim($_GET['nets']))   : '';