From: Michael Vogel Date: Thu, 30 Jul 2015 14:30:18 +0000 (+0200) Subject: Bugfix: Fetching data from noscrape had several issues X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6ab304b5642c8d15a4c32cc4c84c45fa1c1a0110;p=friendica.git Bugfix: Fetching data from noscrape had several issues --- diff --git a/boot.php b/boot.php index ec803a1573..2a11501033 100644 --- a/boot.php +++ b/boot.php @@ -19,7 +19,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Lily of the valley'); define ( 'FRIENDICA_VERSION', '3.4.1' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1186 ); +define ( 'DB_UPDATE_VERSION', 1187 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/include/dbstructure.php b/include/dbstructure.php index e14ce64d81..2370b01bec 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -639,6 +639,7 @@ function db_definition() { "about" => array("type" => "text", "not null" => "1"), "keywords" => array("type" => "text", "not null" => "1"), "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""), + "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"), "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), diff --git a/include/socgraph.php b/include/socgraph.php index 872b730e05..d114ef09cc 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -451,12 +451,14 @@ function poco_last_updated($profile, $force = false) { if ($server) { $noscraperet = z_fetch_url($server[0]["noscrape"]."/".$gcontacts[0]["nick"]); - if ($noscraperet["success"] AND ($noscraperet["body"] = "")) { + + if ($noscraperet["success"] AND ($noscraperet["body"] != "")) { +; $noscrape = json_decode($noscraperet["body"], true); - if (($noscrape["name"] != "") AND ($noscrape["name"] != $gcontacts[0]["name"])) + if (($noscrape["fn"] != "") AND ($noscrape["fn"] != $gcontacts[0]["name"])) q("UPDATE `gcontact` SET `name` = '%s' WHERE `nurl` = '%s'", - dbesc($noscrape["name"]), dbesc(normalise_link($profile))); + dbesc($noscrape["fn"]), dbesc(normalise_link($profile))); if (($noscrape["photo"] != "") AND ($noscrape["photo"] != $gcontacts[0]["photo"])) q("UPDATE `gcontact` SET `photo` = '%s' WHERE `nurl` = '%s'", @@ -470,10 +472,18 @@ function poco_last_updated($profile, $force = false) { q("UPDATE `gcontact` SET `gender` = '%s' WHERE `nurl` = '%s'", dbesc($noscrape["gender"]), dbesc(normalise_link($profile))); - if (($noscrape["about"] != "") AND ($noscrape["about"] != $gcontacts[0]["name"])) + if (($noscrape["pdesc"] != "") AND ($noscrape["pdesc"] != $gcontacts[0]["about"])) + q("UPDATE `gcontact` SET `about` = '%s' WHERE `nurl` = '%s'", + dbesc($noscrape["pdesc"]), dbesc(normalise_link($profile))); + + if (($noscrape["about"] != "") AND ($noscrape["about"] != $gcontacts[0]["about"])) q("UPDATE `gcontact` SET `about` = '%s' WHERE `nurl` = '%s'", dbesc($noscrape["about"]), dbesc(normalise_link($profile))); + if (isset($noscrape["comm"]) AND ($noscrape["comm"] != $gcontacts[0]["community"])) + q("UPDATE `gcontact` SET `community` = %d WHERE `nurl` = '%s'", + intval($noscrape["comm"]), dbesc(normalise_link($profile))); + if (isset($noscrape["tags"])) $keywords = implode(" ", $noscrape["tags"]); else diff --git a/update.php b/update.php index 4f762661a5..a2c8674028 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@