The "addr" field is now in the global contacts as well.

This commit is contained in:
Michael Vogel 2015-11-05 08:37:00 +01:00
parent ff15521e38
commit d6080f4c76
6 changed files with 24 additions and 11 deletions

View file

@ -19,7 +19,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Lily of the valley'); define ( 'FRIENDICA_CODENAME', 'Lily of the valley');
define ( 'FRIENDICA_VERSION', '3.4.2' ); define ( 'FRIENDICA_VERSION', '3.4.2' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1189 ); define ( 'DB_UPDATE_VERSION', 1190 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 3.4.1 (Lily of the valley) -- Friendica 3.4.2 (Lily of the valley)
-- DB_UPDATE_VERSION 1189 -- DB_UPDATE_VERSION 1190
-- ------------------------------------------ -- ------------------------------------------
@ -317,6 +317,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`gender` varchar(32) NOT NULL DEFAULT '', `gender` varchar(32) NOT NULL DEFAULT '',
`community` tinyint(1) NOT NULL DEFAULT 0, `community` tinyint(1) NOT NULL DEFAULT 0,
`network` varchar(255) NOT NULL DEFAULT '', `network` varchar(255) NOT NULL DEFAULT '',
`addr` varchar(255) NOT NULL DEFAULT '',
`generation` tinyint(3) NOT NULL DEFAULT 0, `generation` tinyint(3) NOT NULL DEFAULT 0,
`server_url` varchar(255) NOT NULL DEFAULT '', `server_url` varchar(255) NOT NULL DEFAULT '',
INDEX `nurl` (`nurl`), INDEX `nurl` (`nurl`),

View file

@ -198,7 +198,7 @@ function get_contact_details_by_url($url, $uid = -1) {
if ($uid == -1) if ($uid == -1)
$uid = local_user(); $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))); dbesc(normalise_link($url)));
if ($r) if ($r)
@ -213,19 +213,20 @@ function get_contact_details_by_url($url, $uid = -1) {
$profile["gender"] = ""; $profile["gender"] = "";
$profile["community"] = false; $profile["community"] = false;
$profile["network"] = ""; $profile["network"] = "";
$profile["addr"] = "";
} }
} }
// Fetching further contact data from the contact table // 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"])); dbesc(normalise_link($url)), intval($uid), dbesc($profile["network"]));
if (!count($r)) 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)); dbesc(normalise_link($url)), intval($uid));
if (!count($r)) 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))); dbesc(normalise_link($url)));
if ($r) { if ($r) {
@ -235,6 +236,8 @@ function get_contact_details_by_url($url, $uid = -1) {
$profile["name"] = $r[0]["name"]; $profile["name"] = $r[0]["name"];
if (isset($r[0]["nick"]) AND $r[0]["nick"] AND ($profile["nick"] == "")) if (isset($r[0]["nick"]) AND $r[0]["nick"] AND ($profile["nick"] == ""))
$profile["nick"] = $r[0]["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"]) if (isset($r[0]["photo"]) AND $r[0]["photo"])
$profile["photo"] = $r[0]["photo"]; $profile["photo"] = $r[0]["photo"];
if (isset($r[0]["location"]) AND $r[0]["location"]) if (isset($r[0]["location"]) AND $r[0]["location"])

View file

@ -642,6 +642,7 @@ function db_definition() {
"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""), "gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"), "community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
"network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "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"), "generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
"server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""), "server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
), ),

View file

@ -225,12 +225,14 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
$created = $x[0]["created"]; $created = $x[0]["created"];
$server_url = $x[0]["server_url"]; $server_url = $x[0]["server_url"];
$nick = $x[0]["nick"]; $nick = $x[0]["nick"];
$addr = $x[0]["addr"];
} else { } else {
$created = "0000-00-00 00:00:00"; $created = "0000-00-00 00:00:00";
$server_url = ""; $server_url = "";
$urlparts = parse_url($profile_url); $urlparts = parse_url($profile_url);
$nick = end(explode("/", $urlparts["path"])); $nick = end(explode("/", $urlparts["path"]));
$addr = "";
} }
if ((($network == "") OR ($name == "") OR ($profile_photo == "") OR ($server_url == "") OR $alternate) 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"]; $network = $data["network"];
$name = $data["name"]; $name = $data["name"];
$nick = $data["nick"]; $nick = $data["nick"];
$addr = $data["addr"];
$profile_url = $data["url"]; $profile_url = $data["url"];
$profile_photo = $data["photo"]; $profile_photo = $data["photo"];
$server_url = $data["baseurl"]; $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'] != "")) if (($keywords == "") AND ($x[0]['keywords'] != ""))
$keywords = $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)) if (($generation == 0) AND ($x[0]['generation'] > 0))
$generation = $x[0]['generation']; $generation = $x[0]['generation'];
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo || $x[0]['updated'] < $updated) { 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 `updated` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s', `generation` = %d
WHERE (`generation` >= %d OR `generation` = 0) AND `nurl` = '%s'", WHERE (`generation` >= %d OR `generation` = 0) AND `nurl` = '%s'",
dbesc($name), dbesc($name),
dbesc($addr),
dbesc($network), dbesc($network),
dbesc($profile_photo), dbesc($profile_photo),
dbesc($connect_url), dbesc($connect_url),
@ -318,10 +325,11 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
); );
} }
} else { } else {
q("INSERT INTO `gcontact` (`name`, `nick`, `network`, `url`, `nurl`, `photo`, `connect`, `server_url`, `created`, `updated`, `location`, `about`, `keywords`, `gender`, `generation`) 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', %d)", VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
dbesc($name), dbesc($name),
dbesc($nick), dbesc($nick),
dbesc($addr),
dbesc($network), dbesc($network),
dbesc($profile_url), dbesc($profile_url),
dbesc(normalise_link($profile_url)), dbesc(normalise_link($profile_url)),

View file

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1189 ); define( 'UPDATE_VERSION' , 1190 );
/** /**
* *