From: Michael Vogel Date: Thu, 5 Nov 2015 07:37:00 +0000 (+0100) Subject: The "addr" field is now in the global contacts as well. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d6080f4c76cdd2e2f98ed2c6b8603932f9ec2445;p=friendica.git The "addr" field is now in the global contacts as well. --- diff --git a/boot.php b/boot.php index c9c0d4404e..d1f0d705ff 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.2' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1189 ); +define ( 'DB_UPDATE_VERSION', 1190 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index a6eb71ef3b..e3768c1efb 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ --- Friendica 3.4.1 (Lily of the valley) --- DB_UPDATE_VERSION 1189 +-- Friendica 3.4.2 (Lily of the valley) +-- DB_UPDATE_VERSION 1190 -- ------------------------------------------ @@ -317,6 +317,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` ( `gender` varchar(32) NOT NULL DEFAULT '', `community` tinyint(1) NOT NULL DEFAULT 0, `network` varchar(255) NOT NULL DEFAULT '', + `addr` varchar(255) NOT NULL DEFAULT '', `generation` tinyint(3) NOT NULL DEFAULT 0, `server_url` varchar(255) NOT NULL DEFAULT '', INDEX `nurl` (`nurl`), diff --git a/include/Contact.php b/include/Contact.php index db5480f517..04cf3b4395 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -198,7 +198,7 @@ function get_contact_details_by_url($url, $uid = -1) { if ($uid == -1) $uid = local_user(); - $r = q("SELECT `url`, `name`, `nick`, `photo`, `location`, `about`, `keywords`, `gender`, `community`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", + $r = q("SELECT `url`, `name`, `nick`, `addr`. `photo`, `location`, `about`, `keywords`, `gender`, `community`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1", dbesc(normalise_link($url))); if ($r) @@ -213,19 +213,20 @@ function get_contact_details_by_url($url, $uid = -1) { $profile["gender"] = ""; $profile["community"] = false; $profile["network"] = ""; + $profile["addr"] = ""; } } // Fetching further contact data from the contact table - $r = q("SELECT `id`, `uid`, `url`, `network`, `name`, `nick`, `location`, `about`, `keywords`, `gender`, `photo`, `addr`, `forum`, `prv`, `bd` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'", + $r = q("SELECT `id`, `uid`, `url`, `network`, `name`, `nick`, `addr`, `location`, `about`, `keywords`, `gender`, `photo`, `addr`, `forum`, `prv`, `bd` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `network` = '%s'", dbesc(normalise_link($url)), intval($uid), dbesc($profile["network"])); if (!count($r)) - $r = q("SELECT `id`, `uid`, `url`, `network`, `name`, `nick`, `location`, `about`, `keywords`, `gender`, `photo`, `addr`, `forum`, `prv`, `bd` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d", + $r = q("SELECT `id`, `uid`, `url`, `network`, `name`, `nick`, `addr`, `location`, `about`, `keywords`, `gender`, `photo`, `addr`, `forum`, `prv`, `bd` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d", dbesc(normalise_link($url)), intval($uid)); if (!count($r)) - $r = q("SELECT `id`, `uid`, `url`, `network`, `name`, `nick`, `location`, `about`, `keywords`, `gender`, `photo`, `addr`, `forum`, `prv`, `bd` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0", + $r = q("SELECT `id`, `uid`, `url`, `network`, `name`, `nick`, `addr`, `location`, `about`, `keywords`, `gender`, `photo`, `addr`, `forum`, `prv`, `bd` FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0", dbesc(normalise_link($url))); if ($r) { @@ -235,6 +236,8 @@ function get_contact_details_by_url($url, $uid = -1) { $profile["name"] = $r[0]["name"]; if (isset($r[0]["nick"]) AND $r[0]["nick"] AND ($profile["nick"] == "")) $profile["nick"] = $r[0]["nick"]; + if (isset($r[0]["addr"]) AND $r[0]["addr"] AND ($profile["addr"] == "")) + $profile["addr"] = $r[0]["addr"]; if (isset($r[0]["photo"]) AND $r[0]["photo"]) $profile["photo"] = $r[0]["photo"]; if (isset($r[0]["location"]) AND $r[0]["location"]) diff --git a/include/dbstructure.php b/include/dbstructure.php index deb6ddf533..0dd74ab15f 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -642,6 +642,7 @@ function db_definition() { "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" => ""), + "addr" => 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 17f2fcf01e..5c8da3cc2a 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -225,12 +225,14 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca $created = $x[0]["created"]; $server_url = $x[0]["server_url"]; $nick = $x[0]["nick"]; + $addr = $x[0]["addr"]; } else { $created = "0000-00-00 00:00:00"; $server_url = ""; $urlparts = parse_url($profile_url); $nick = end(explode("/", $urlparts["path"])); + $addr = ""; } if ((($network == "") OR ($name == "") OR ($profile_photo == "") OR ($server_url == "") OR $alternate) @@ -242,6 +244,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca $network = $data["network"]; $name = $data["name"]; $nick = $data["nick"]; + $addr = $data["addr"]; $profile_url = $data["url"]; $profile_photo = $data["photo"]; $server_url = $data["baseurl"]; @@ -294,14 +297,18 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca if (($keywords == "") AND ($x[0]['keywords'] != "")) $keywords = $x[0]['keywords']; + if (($addr == "") AND ($x[0]['addr'] != "")) + $addr = $x[0]['addr']; + if (($generation == 0) AND ($x[0]['generation'] > 0)) $generation = $x[0]['generation']; if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo || $x[0]['updated'] < $updated) { - q("UPDATE `gcontact` SET `name` = '%s', `network` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s', `server_url` = '%s', + q("UPDATE `gcontact` SET `name` = '%s', `addr` = '%s', `network` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s', `server_url` = '%s', `updated` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s', `generation` = %d WHERE (`generation` >= %d OR `generation` = 0) AND `nurl` = '%s'", dbesc($name), + dbesc($addr), dbesc($network), dbesc($profile_photo), dbesc($connect_url), @@ -318,10 +325,11 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca ); } } else { - q("INSERT INTO `gcontact` (`name`, `nick`, `network`, `url`, `nurl`, `photo`, `connect`, `server_url`, `created`, `updated`, `location`, `about`, `keywords`, `gender`, `generation`) - VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", + q("INSERT INTO `gcontact` (`name`, `nick`, `addr`, `network`, `url`, `nurl`, `photo`, `connect`, `server_url`, `created`, `updated`, `location`, `about`, `keywords`, `gender`, `generation`) + VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", dbesc($name), dbesc($nick), + dbesc($addr), dbesc($network), dbesc($profile_url), dbesc(normalise_link($profile_url)), diff --git a/update.php b/update.php index 7c32f5819c..33b4560c09 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@