From bc2c046446baab7cfe143700e9ddab714f7488f1 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 25 Jan 2015 16:40:20 +0100 Subject: [PATCH] poco: Only update the global contacts when there is a network value/Export your own contact as well --- include/Scrape.php | 2 +- include/socgraph.php | 28 +++++++++++++++------------- mod/poco.php | 4 ++-- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/Scrape.php b/include/Scrape.php index fa2d7944a3..31e2be263f 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -345,7 +345,7 @@ function probe_url($url, $mode = PROBE_NORMAL) { $result = Cache::get("probe_url:".$mode.":".$url); if (!is_null($result)) { - $result = unserialize($result); + $result = unserialize($result); return $result; } diff --git a/include/socgraph.php b/include/socgraph.php index f37fdca98d..f2ccd946a8 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -113,21 +113,23 @@ function poco_load($cid,$uid = 0,$zcid = 0,$url = null) { $gender = $entry->gender; if(isset($entry->tags)) - $keywords = implode(", ", $entry->tags); + foreach($entry->tags as $tag) + $keywords = implode(", ", $tag); - poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid, $uid, $zcid); - - // Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php) - if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != "")) - q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' - WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'", - dbesc($location), - dbesc($about), - dbesc($keywords), - dbesc($gender), - dbesc(normalise_link($profile_url)), - dbesc(NETWORK_DFRN)); + if ($network != "") { + poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $cid, $uid, $zcid); + // Update the Friendica contacts. Diaspora is doing it via a message. (See include/diaspora.php) + if (($location != "") OR ($about != "") OR ($keywords != "") OR ($gender != "")) + q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' + WHERE `nurl` = '%s' AND NOT `self` AND `network` = '%s'", + dbesc($location), + dbesc($about), + dbesc($keywords), + dbesc($gender), + dbesc(normalise_link($profile_url)), + dbesc(NETWORK_DFRN)); + } } logger("poco_load: loaded $total entries",LOGGER_DEBUG); diff --git a/mod/poco.php b/mod/poco.php index aa570ec342..70514606d4 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -46,8 +46,8 @@ function poco_init(&$a) { if($justme) $sql_extra = " AND `contact`.`self` = 1 "; - else - $sql_extra = " AND `contact`.`self` = 0 "; +// else +// $sql_extra = " AND `contact`.`self` = 0 "; if($cid) $sql_extra = sprintf(" AND `contact`.`id` = %d ",intval($cid));