scrape_dfrn now scrapes the address as well.
This commit is contained in:
parent
b888382cc6
commit
602821279a
2 changed files with 14 additions and 7 deletions
|
@ -4,7 +4,7 @@ require_once('library/HTML5/Parser.php');
|
||||||
require_once('include/crypto.php');
|
require_once('include/crypto.php');
|
||||||
|
|
||||||
if(! function_exists('scrape_dfrn')) {
|
if(! function_exists('scrape_dfrn')) {
|
||||||
function scrape_dfrn($url) {
|
function scrape_dfrn($url, $dont_probe = false) {
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
|
@ -17,6 +17,11 @@ function scrape_dfrn($url) {
|
||||||
if(! $s)
|
if(! $s)
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
|
$probe = probe_url($url);
|
||||||
|
|
||||||
|
if (isset($probe["addr"]))
|
||||||
|
$ret["addr"] = $probe["addr"];
|
||||||
|
|
||||||
$headers = $a->get_curl_headers();
|
$headers = $a->get_curl_headers();
|
||||||
logger('scrape_dfrn: headers=' . $headers, LOGGER_DEBUG);
|
logger('scrape_dfrn: headers=' . $headers, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
@ -524,7 +529,7 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
|
||||||
|
|
||||||
|
|
||||||
if(strlen($dfrn)) {
|
if(strlen($dfrn)) {
|
||||||
$ret = scrape_dfrn(($hcard) ? $hcard : $dfrn);
|
$ret = scrape_dfrn(($hcard) ? $hcard : $dfrn, true);
|
||||||
if(is_array($ret) && x($ret,'dfrn-request')) {
|
if(is_array($ret) && x($ret,'dfrn-request')) {
|
||||||
$network = NETWORK_DFRN;
|
$network = NETWORK_DFRN;
|
||||||
$request = $ret['dfrn-request'];
|
$request = $ret['dfrn-request'];
|
||||||
|
|
|
@ -136,7 +136,7 @@ function dfrn_request_post(&$a) {
|
||||||
|
|
||||||
$dfrn_request = $parms['dfrn-request'];
|
$dfrn_request = $parms['dfrn-request'];
|
||||||
|
|
||||||
/********* Escape the entire array ********/
|
/********* Escape the entire array ********/
|
||||||
|
|
||||||
dbesc_array($parms);
|
dbesc_array($parms);
|
||||||
|
|
||||||
|
@ -146,13 +146,14 @@ function dfrn_request_post(&$a) {
|
||||||
* Create a contact record on our site for the other person
|
* Create a contact record on our site for the other person
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `name`, `nick`, `photo`, `site-pubkey`,
|
$r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `addr`, `name`, `nick`, `photo`, `site-pubkey`,
|
||||||
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`, `hidden`)
|
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`, `hidden`)
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)",
|
VALUES ( %d, '%s', '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d)",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
datetime_convert(),
|
datetime_convert(),
|
||||||
dbesc($dfrn_url),
|
dbesc($dfrn_url),
|
||||||
dbesc(normalise_link($dfrn_url)),
|
dbesc(normalise_link($dfrn_url)),
|
||||||
|
$parms['addr'],
|
||||||
$parms['fn'],
|
$parms['fn'],
|
||||||
$parms['nick'],
|
$parms['nick'],
|
||||||
$parms['photo'],
|
$parms['photo'],
|
||||||
|
@ -539,13 +540,14 @@ function dfrn_request_post(&$a) {
|
||||||
|
|
||||||
|
|
||||||
dbesc_array($parms);
|
dbesc_array($parms);
|
||||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`,`name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
|
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
|
||||||
`request`, `confirm`, `notify`, `poll`, `poco`, `network` )
|
`request`, `confirm`, `notify`, `poll`, `poco`, `network` )
|
||||||
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
|
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
$parms['url'],
|
$parms['url'],
|
||||||
dbesc(normalise_link($parms['url'])),
|
dbesc(normalise_link($parms['url'])),
|
||||||
|
$parms['addr'],
|
||||||
$parms['fn'],
|
$parms['fn'],
|
||||||
$parms['nick'],
|
$parms['nick'],
|
||||||
$parms['issued-id'],
|
$parms['issued-id'],
|
||||||
|
|
Loading…
Reference in a new issue