X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=pumpio%2Fpumpio.php;h=0a5f50b967f9a2e66bac4c1ccdb504665be2f60c;hb=e59e019fa19a2e811e914b811058daa9fc372041;hp=b90d8b608dfa4cf10ed017404a48c086ed89d71b;hpb=3b54203d80b63101d064581081ec7a2a5236e322;p=friendica-addons.git diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index b90d8b60..0a5f50b9 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -945,33 +945,34 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru function pumpio_get_contact($uid, $contact) { if (function_exists("update_gcontact")) - update_gcontact($contact->url, - NETWORK_PUMPIO, $contact->image->url, - $contact->displayName, $contact->preferredUsername, - $contact->location->displayName, $contact->summary, - str_replace("acct:", "", $contact->id)); - - $r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", - dbesc(normalise_link($contact->url))); - - if (count($r) == 0) - q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')", - dbesc(normalise_link($contact->url)), - dbesc($contact->displayName), - dbesc($contact->preferredUsername), - dbesc($contact->image->url)); - else - q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'", - dbesc($contact->displayName), - dbesc($contact->preferredUsername), - dbesc($contact->image->url), + update_gcontact(array("url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2, + "photo" => $contact->image->url, "name" => $contact->displayName, "hide" => true, + "nick" => $contact->preferredUsername, "location" => $contact->location->displayName, + "about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id))); + else { + // Old Code + $r = q("SELECT id FROM unique_contacts WHERE url='%s' LIMIT 1", dbesc(normalise_link($contact->url))); - if (DB_UPDATE_VERSION >= "1177") - q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'", - dbesc($contact->location->displayName), - dbesc($contact->summary), - dbesc(normalise_link($contact->url))); + if (count($r) == 0) + q("INSERT INTO unique_contacts (url, name, nick, avatar) VALUES ('%s', '%s', '%s', '%s')", + dbesc(normalise_link($contact->url)), + dbesc($contact->displayName), + dbesc($contact->preferredUsername), + dbesc($contact->image->url)); + else + q("UPDATE unique_contacts SET name = '%s', nick = '%s', avatar = '%s' WHERE url = '%s'", + dbesc($contact->displayName), + dbesc($contact->preferredUsername), + dbesc($contact->image->url), + dbesc(normalise_link($contact->url))); + + if (DB_UPDATE_VERSION >= "1177") + q("UPDATE `unique_contacts` SET `location` = '%s', `about` = '%s' WHERE url = '%s'", + dbesc($contact->location->displayName), + dbesc($contact->summary), + dbesc(normalise_link($contact->url))); + } $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1", intval($uid), dbesc($contact->url));