Basepath function now uses the contact field
This commit is contained in:
parent
be0a102333
commit
dda86f6dfc
2 changed files with 12 additions and 7 deletions
|
@ -85,7 +85,7 @@ function redir_init(App $a) {
|
||||||
|
|
||||||
// When the remote page does support OWA, then we enforce the use of it
|
// When the remote page does support OWA, then we enforce the use of it
|
||||||
$basepath = Contact::getBasepath($contact_url);
|
$basepath = Contact::getBasepath($contact_url);
|
||||||
if ($basepath == System::baseUrl()) {
|
if (Strings::compareLink($basepath, System::baseUrl())) {
|
||||||
$use_magic = true;
|
$use_magic = true;
|
||||||
} else {
|
} else {
|
||||||
$serverret = Network::curl($basepath . '/magic');
|
$serverret = Network::curl($basepath . '/magic');
|
||||||
|
|
|
@ -176,7 +176,6 @@ class Contact extends BaseObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the basepath for a given contact link
|
* @brief Get the basepath for a given contact link
|
||||||
* @todo Add functionality to store this value in the contact table
|
|
||||||
*
|
*
|
||||||
* @param string $url The contact link
|
* @param string $url The contact link
|
||||||
*
|
*
|
||||||
|
@ -186,13 +185,19 @@ class Contact extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function getBasepath($url)
|
public static function getBasepath($url)
|
||||||
{
|
{
|
||||||
$data = Probe::uri($url);
|
$contact = DBA::selectFirst('contact', ['baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
|
||||||
if (!empty($data['baseurl'])) {
|
if (!empty($contact['baseurl'])) {
|
||||||
return $data['baseurl'];
|
return $contact['baseurl'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we can't probe the server, we use some ugly function that does some pattern matching
|
self::updateFromProbeByURL($url, true);
|
||||||
return PortableContact::detectServer($url);
|
|
||||||
|
$contact = DBA::selectFirst('contact', ['baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
|
||||||
|
if (!empty($contact['baseurl'])) {
|
||||||
|
return $contact['baseurl'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue