// When the remote page does support OWA, then we enforce the use of it
$basepath = Contact::getBasepath($contact_url);
- if ($basepath == System::baseUrl()) {
+ if (Strings::compareLink($basepath, System::baseUrl())) {
$use_magic = true;
} else {
$serverret = Network::curl($basepath . '/magic');
/**
* @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
*
*/
public static function getBasepath($url)
{
- $data = Probe::uri($url);
- if (!empty($data['baseurl'])) {
- return $data['baseurl'];
+ $contact = DBA::selectFirst('contact', ['baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
+ if (!empty($contact['baseurl'])) {
+ return $contact['baseurl'];
+ }
+
+ self::updateFromProbeByURL($url, true);
+
+ $contact = DBA::selectFirst('contact', ['baseurl'], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
+ if (!empty($contact['baseurl'])) {
+ return $contact['baseurl'];
}
- // When we can't probe the server, we use some ugly function that does some pattern matching
- return PortableContact::detectServer($url);
+ return '';
}
/**