]> git.mxchange.org Git - friendica.git/commitdiff
Corrected "attag" query
authorMichael <heluecht@pirati.ca>
Mon, 22 Jan 2018 21:59:27 +0000 (21:59 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 22 Jan 2018 21:59:27 +0000 (21:59 +0000)
mod/item.php

index 64b773c21c7a1746d9605a30b804848af9185456..b3509dc89de87a55023e577652d133ff1f45095f 100644 (file)
@@ -951,7 +951,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
                // Try to detect the contact in various ways
                if (strpos($name, 'http://')) {
                        // At first we have to ensure that the contact exists
-                       $id = Contact::getIdForURL($name);
+                       Contact::getIdForURL($name);
 
                        // Now we should have something
                        $contact = Contact::getDetailsByURL($name);
@@ -968,25 +968,26 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
                                $contact = dba::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
                        }
 
-                       // select someone by nick and the name passed in the current network
+                       // select someone by nick or attag in the current network
                        if (!DBM::is_result($contact) && ($network != "")) {
-                               $condition = ['nick' => $name, 'network' => $network, 'uid' => $profile_uid];
+                               $condition = ["(`nick` = ? OR `attag` = ?) AND `network` = ? AND `uid` = ?",
+                                               $name, $name, $network, $profile_uid];
                                $contact = dba::selectFirst('contact', $fields, $condition);
                        }
 
-                       //select someone from this user's contacts by name in the current network
+                       //select someone by name in the current network
                        if (!DBM::is_result($contact) && ($network != "")) {
                                $condition = ['name' => $name, 'network' => $network, 'uid' => $profile_uid];
                                $contact = dba::selectFirst('contact', $fields, $condition);
                        }
 
-                       // select someone by nick in any network
+                       // select someone by nick or attag in any network
                        if (!DBM::is_result($contact)) {
-                               $condition = ['nick' => $name, 'uid' => $profile_uid];
+                               $condition = ["(`nick` = ? OR `attag` = ?) AND `uid` = ?", $name, $name, $profile_uid];
                                $contact = dba::selectFirst('contact', $fields, $condition);
                        }
 
-                       // select someone from this user's contacts by name
+                       // select someone by name in any network
                        if (!DBM::is_result($contact)) {
                                $condition = ['name' => $name, 'uid' => $profile_uid];
                                $contact = dba::selectFirst('contact', $fields, $condition);