add webfinger addr to gcontact for friend "connect" links
This commit is contained in:
parent
c4a5fcaf27
commit
e6b538c046
2
boot.php
2
boot.php
|
@ -11,7 +11,7 @@ require_once('include/cache.php');
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_VERSION', '2.3.1198' );
|
define ( 'FRIENDICA_VERSION', '2.3.1198' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1111 );
|
define ( 'DB_UPDATE_VERSION', 1112 );
|
||||||
|
|
||||||
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' );
|
||||||
|
|
|
@ -694,6 +694,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
|
||||||
`url` CHAR( 255 ) NOT NULL ,
|
`url` CHAR( 255 ) NOT NULL ,
|
||||||
`nurl` CHAR( 255 ) NOT NULL ,
|
`nurl` CHAR( 255 ) NOT NULL ,
|
||||||
`photo` CHAR( 255 ) NOT NULL,
|
`photo` CHAR( 255 ) NOT NULL,
|
||||||
|
`connect` CHAR( 255 ) NOT NULL,
|
||||||
INDEX ( `nurl` )
|
INDEX ( `nurl` )
|
||||||
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ function poco_load($cid,$uid = 0,$url = null) {
|
||||||
|
|
||||||
$profile_url = '';
|
$profile_url = '';
|
||||||
$profile_photo = '';
|
$profile_photo = '';
|
||||||
|
$connect_url = '';
|
||||||
$name = '';
|
$name = '';
|
||||||
|
|
||||||
$name = $entry->displayName;
|
$name = $entry->displayName;
|
||||||
|
@ -59,13 +60,18 @@ function poco_load($cid,$uid = 0,$url = null) {
|
||||||
foreach($entry->urls as $url) {
|
foreach($entry->urls as $url) {
|
||||||
if($url->type == 'profile') {
|
if($url->type == 'profile') {
|
||||||
$profile_url = $url->value;
|
$profile_url = $url->value;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
if($url->type == 'webfinger') {
|
||||||
|
$connect_url = str_replace('acct:' , '', $url->value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
foreach($entry->photos as $photo) {
|
foreach($entry->photos as $photo) {
|
||||||
if($photo->type == 'profile') {
|
if($photo->type == 'profile') {
|
||||||
$profile_photo = $photo->value;
|
$profile_photo = $photo->value;
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,21 +86,23 @@ function poco_load($cid,$uid = 0,$url = null) {
|
||||||
$gcid = $x[0]['id'];
|
$gcid = $x[0]['id'];
|
||||||
|
|
||||||
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) {
|
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) {
|
||||||
q("update gcontact set `name` = '%s', `photo` = '%s' where
|
q("update gcontact set `name` = '%s', `photo` = '%s', `connect` = '%s'
|
||||||
`nurl` = '%s' limit 1",
|
where `nurl` = '%s' limit 1",
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
dbesc($profile_photo),
|
dbesc($profile_photo),
|
||||||
|
dbesc($connect_url),
|
||||||
dbesc(normalise_link($profile_url))
|
dbesc(normalise_link($profile_url))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`)
|
q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`,`connect`)
|
||||||
values ( '%s', '%s', '%s', '%s') ",
|
values ( '%s', '%s', '%s', '%s','%s') ",
|
||||||
dbesc($name),
|
dbesc($name),
|
||||||
dbesc($profile_url),
|
dbesc($profile_url),
|
||||||
dbesc(normalise_link($profile_url)),
|
dbesc(normalise_link($profile_url)),
|
||||||
dbesc($profile_photo)
|
dbesc($profile_photo),
|
||||||
|
dbesc($connect_url)
|
||||||
);
|
);
|
||||||
$x = q("select * from `gcontact` where `nurl` = '%s' limit 1",
|
$x = q("select * from `gcontact` where `nurl` = '%s' limit 1",
|
||||||
dbesc(normalise_link($profile_url))
|
dbesc(normalise_link($profile_url))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1111 );
|
define( 'UPDATE_VERSION' , 1112 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -944,3 +944,7 @@ function update_1110() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1111() {
|
||||||
|
q("ALTER TABLE `gcontact` ADD `connect` CHAR( 255 ) NOT NULL ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue