]> git.mxchange.org Git - friendica.git/commitdiff
Remove useless intermediate network_name variable in include/api
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 26 Dec 2018 16:02:28 +0000 (11:02 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 26 Dec 2018 16:02:28 +0000 (11:02 -0500)
include/api.php

index 77dfb7462ba49cc8331dfcd4ad8f636fc377c3fe..20b3844cd5cc93d7a96cf03f1b1f96a34a5920e7 100644 (file)
@@ -643,8 +643,6 @@ function api_get_user(App $a, $contact_id = null)
                $contact = DBA::selectFirst('contact', [], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
 
                if (DBA::isResult($contact)) {
-                       $network_name = ContactSelector::networkToName($contact['network'], $contact['url']);
-
                        // If no nick where given, extract it from the address
                        if (($contact['nick'] == "") || ($contact['name'] == $contact['nick'])) {
                                $contact['nick'] = api_get_nick($contact["url"]);
@@ -655,7 +653,7 @@ function api_get_user(App $a, $contact_id = null)
                                'id_str' => (string) $contact["id"],
                                'name' => $contact["name"],
                                'screen_name' => (($contact['nick']) ? $contact['nick'] : $contact['name']),
-                               'location' => ($contact["location"] != "") ? $contact["location"] : $network_name,
+                               'location' => ($contact["location"] != "") ? $contact["location"] : ContactSelector::networkToName($contact['network'], $contact['url']),
                                'description' => $contact["about"],
                                'profile_image_url' => $contact["micro"],
                                'profile_image_url_https' => $contact["micro"],
@@ -713,8 +711,6 @@ function api_get_user(App $a, $contact_id = null)
                $uinfo[0]['nick'] = api_get_nick($uinfo[0]["url"]);
        }
 
-       $network_name = ContactSelector::networkToName($uinfo[0]['network'], $uinfo[0]['url']);
-
        $pcontact_id  = Contact::getIdForURL($uinfo[0]['url'], 0, true);
 
        if (!empty($profile['about'])) {
@@ -728,7 +724,7 @@ function api_get_user(App $a, $contact_id = null)
        } elseif (!empty($uinfo[0]["location"])) {
                $location = $uinfo[0]["location"];
        } else {
-               $location = $network_name;
+               $location = ContactSelector::networkToName($uinfo[0]['network'], $uinfo[0]['url']);
        }
 
        $ret = [