X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdiscover_poco.php;h=dd4e3a7dd3c35c723a4bdba124ca011c25210a5e;hb=9c2c4839968169a191084d6d2b0d629d82430e67;hp=2923cd01f127489ca07276df210ef4538d05a5e2;hpb=0fd874a6834c1567daa052e8e1ab7e0e8bdae081;p=friendica.git diff --git a/include/discover_poco.php b/include/discover_poco.php index 2923cd01f1..dd4e3a7dd3 100644 --- a/include/discover_poco.php +++ b/include/discover_poco.php @@ -189,10 +189,10 @@ function discover_directory($search) { $j = json_decode($x); if (count($j->results)) { - foreach($j->results as $jj) { + foreach ($j->results as $jj) { // Check if the contact already exists $exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url)); - if ($exists) { + if (dbm::is_result($exists)) { logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG); if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) AND @@ -245,12 +245,14 @@ function gs_search_user($search) { if (!$result["success"]) { return false; } + $contacts = json_decode($result["body"]); if ($contacts->status == 'ERROR') { return false; } - foreach($contacts->data AS $user) { + + foreach ($contacts->data AS $user) { $contact = probe_url($user->site_address."/".$user->name); if ($contact["network"] != NETWORK_PHANTOM) { $contact["about"] = $user->description;