Browse Source

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

tags/3.4.3
Michael Vogel 3 years ago
parent
commit
d6080f4c76
6 changed files with 24 additions and 9 deletions
  1. 1
    1
      boot.php
  2. 3
    0
      database.sql
  3. 7
    4
      include/Contact.php
  4. 1
    0
      include/dbstructure.php
  5. 11
    3
      include/socgraph.php
  6. 1
    1
      update.php

+ 1
- 1
boot.php View File

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

+ 3
- 0
database.sql View File

@@ -1,6 +1,6 @@
1 1
 -- ------------------------------------------
2
+-- Friendica 3.4.2 (Lily of the valley)
3
+-- DB_UPDATE_VERSION 1190
2 4
 -- ------------------------------------------
3 5
 
4 6
 
@@ -317,6 +317,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
317 317
 	`gender` varchar(32) NOT NULL DEFAULT '',
318 318
 	`community` tinyint(1) NOT NULL DEFAULT 0,
319 319
 	`network` varchar(255) NOT NULL DEFAULT '',
320
+	`addr` varchar(255) NOT NULL DEFAULT '',
320 321
 	`generation` tinyint(3) NOT NULL DEFAULT 0,
321 322
 	`server_url` varchar(255) NOT NULL DEFAULT '',
322 323
 	 INDEX `nurl` (`nurl`),

+ 7
- 4
include/Contact.php View File

@@ -198,7 +198,7 @@ function get_contact_details_by_url($url, $uid = -1) {
198 198
 	if ($uid == -1)
199 199
 		$uid = local_user();
200 200
 
201
-	$r = q("SELECT `url`, `name`, `nick`, `photo`, `location`, `about`, `keywords`, `gender`, `community`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
201
+	$r = q("SELECT `url`, `name`, `nick`, `addr`. `photo`, `location`, `about`, `keywords`, `gender`, `community`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
202 202
 		dbesc(normalise_link($url)));
203 203
 
204 204
 	if ($r)
@@ -213,19 +213,20 @@ function get_contact_details_by_url($url, $uid = -1) {
213 213
 			$profile["gender"] = "";
214 214
 			$profile["community"] = false;
215 215
 			$profile["network"] = "";
216
+			$profile["addr"] = "";
216 217
 		}
217 218
 	}
218 219
 
219 220
 	// Fetching further contact data from the contact table
220
-	$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'",
221
+	$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'",
221 222
 		dbesc(normalise_link($url)), intval($uid), dbesc($profile["network"]));
222 223
 
223 224
 	if (!count($r))
224
-		$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",
225
+		$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",
225 226
 			dbesc(normalise_link($url)), intval($uid));
226 227
 
227 228
 	if (!count($r))
228
-		$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",
229
+		$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",
229 230
 			dbesc(normalise_link($url)));
230 231
 
231 232
 	if ($r) {
@@ -235,6 +236,8 @@ function get_contact_details_by_url($url, $uid = -1) {
235 236
 			$profile["name"] = $r[0]["name"];
236 237
 		if (isset($r[0]["nick"]) AND $r[0]["nick"] AND ($profile["nick"] == ""))
237 238
 			$profile["nick"] = $r[0]["nick"];
239
+		if (isset($r[0]["addr"]) AND $r[0]["addr"] AND ($profile["addr"] == ""))
240
+			$profile["addr"] = $r[0]["addr"];
238 241
 		if (isset($r[0]["photo"]) AND $r[0]["photo"])
239 242
 			$profile["photo"] = $r[0]["photo"];
240 243
 		if (isset($r[0]["location"]) AND $r[0]["location"])

+ 1
- 0
include/dbstructure.php View File

@@ -642,6 +642,7 @@ function db_definition() {
642 642
 					"gender" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
643 643
 					"community" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
644 644
 					"network" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
645
+					"addr" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
645 646
 					"generation" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
646 647
 					"server_url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
647 648
 					),

+ 11
- 3
include/socgraph.php View File

@@ -225,12 +225,14 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
225 225
 		$created = $x[0]["created"];
226 226
 		$server_url = $x[0]["server_url"];
227 227
 		$nick = $x[0]["nick"];
228
+		$addr = $x[0]["addr"];
228 229
 	} else {
229 230
 		$created = "0000-00-00 00:00:00";
230 231
 		$server_url = "";
231 232
 
232 233
 		$urlparts = parse_url($profile_url);
233 234
 		$nick = end(explode("/", $urlparts["path"]));
235
+		$addr = "";
234 236
 	}
235 237
 
236 238
 	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
242 244
 		$network = $data["network"];
243 245
 		$name = $data["name"];
244 246
 		$nick = $data["nick"];
247
+		$addr = $data["addr"];
245 248
 		$profile_url = $data["url"];
246 249
 		$profile_photo = $data["photo"];
247 250
 		$server_url = $data["baseurl"];
@@ -294,14 +297,18 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
294 297
 		if (($keywords == "") AND ($x[0]['keywords'] != ""))
295 298
 			$keywords = $x[0]['keywords'];
296 299
 
300
+		if (($addr == "") AND ($x[0]['addr'] != ""))
301
+			$addr = $x[0]['addr'];
302
+
297 303
 		if (($generation == 0) AND ($x[0]['generation'] > 0))
298 304
 			$generation = $x[0]['generation'];
299 305
 
300 306
 		if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo || $x[0]['updated'] < $updated) {
301
-			q("UPDATE `gcontact` SET `name` = '%s', `network` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s', `server_url` = '%s',
307
+			q("UPDATE `gcontact` SET `name` = '%s', `addr` = '%s', `network` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s', `server_url` = '%s',
302 308
 				`updated` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s', `generation` = %d
303 309
 				WHERE (`generation` >= %d OR `generation` = 0) AND `nurl` = '%s'",
304 310
 				dbesc($name),
311
+				dbesc($addr),
305 312
 				dbesc($network),
306 313
 				dbesc($profile_photo),
307 314
 				dbesc($connect_url),
@@ -318,10 +325,11 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
318 325
 			);
319 326
 		}
320 327
 	} else {
321
-		q("INSERT INTO `gcontact` (`name`, `nick`, `network`, `url`, `nurl`, `photo`, `connect`, `server_url`, `created`, `updated`, `location`, `about`, `keywords`, `gender`, `generation`)
322
-			VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
328
+		q("INSERT INTO `gcontact` (`name`, `nick`, `addr`, `network`, `url`, `nurl`, `photo`, `connect`, `server_url`, `created`, `updated`, `location`, `about`, `keywords`, `gender`, `generation`)
329
+			VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
323 330
 			dbesc($name),
324 331
 			dbesc($nick),
332
+			dbesc($addr),
325 333
 			dbesc($network),
326 334
 			dbesc($profile_url),
327 335
 			dbesc(normalise_link($profile_url)),

+ 1
- 1
update.php View File

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

Loading…
Cancel
Save