Adapt BaseURL calls to new UriInterface
This commit is contained in:
parent
9e6d95284b
commit
f0c29edcde
101 changed files with 218 additions and 241 deletions
|
@ -570,7 +570,7 @@ class Contact
|
|||
{
|
||||
if (!parse_url($url, PHP_URL_SCHEME)) {
|
||||
$addr_parts = explode('@', $url);
|
||||
return (count($addr_parts) == 2) && ($addr_parts[1] == DI::baseUrl()->getHostname());
|
||||
return (count($addr_parts) == 2) && ($addr_parts[1] == DI::baseUrl()->getHost());
|
||||
}
|
||||
|
||||
return Strings::compareLink(self::getBasepath($url, true), DI::baseUrl());
|
||||
|
|
|
@ -408,7 +408,7 @@ class Item
|
|||
if ($notify) {
|
||||
// We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
|
||||
// We add the hash of our own host because our host is the original creator of the post.
|
||||
$prefix_host = DI::baseUrl()->getHostname();
|
||||
$prefix_host = DI::baseUrl()->getHost();
|
||||
} else {
|
||||
$prefix_host = '';
|
||||
|
||||
|
@ -2048,7 +2048,7 @@ class Item
|
|||
$guid = System::createUUID();
|
||||
}
|
||||
|
||||
return DI::baseUrl()->get() . '/objects/' . $guid;
|
||||
return DI::baseUrl() . '/objects/' . $guid;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2288,7 +2288,7 @@ class Item
|
|||
}
|
||||
|
||||
// Prevent to forward already forwarded posts
|
||||
if ($datarray['app'] == DI::baseUrl()->getHostname()) {
|
||||
if ($datarray['app'] == DI::baseUrl()->getHost()) {
|
||||
Logger::info('Already forwarded (second test)');
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ class Nodeinfo
|
|||
return [
|
||||
'name' => $administrator['username'] ?? null,
|
||||
'contact' => $administrator['email'] ?? null,
|
||||
'account' => $administrator['nickname'] ?? '' ? DI::baseUrl()->get() . '/profile/' . $administrator['nickname'] : null,
|
||||
'account' => $administrator['nickname'] ?? '' ? DI::baseUrl() . '/profile/' . $administrator['nickname'] : null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -918,7 +918,7 @@ class Photo
|
|||
*/
|
||||
public static function getResourceData(string $name): array
|
||||
{
|
||||
$base = DI::baseUrl()->get();
|
||||
$base = DI::baseUrl();
|
||||
|
||||
$guid = str_replace([Strings::normaliseLink($base), '/photo/'], '', Strings::normaliseLink($name));
|
||||
|
||||
|
@ -982,7 +982,7 @@ class Photo
|
|||
*/
|
||||
public static function isLocalPage(string $name): bool
|
||||
{
|
||||
$base = DI::baseUrl()->get();
|
||||
$base = DI::baseUrl();
|
||||
|
||||
$guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name));
|
||||
$guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid);
|
||||
|
|
|
@ -334,7 +334,7 @@ class Profile
|
|||
if (!$local_user_is_self) {
|
||||
if (!$visitor_is_authenticated) {
|
||||
// Remote follow is only available for local profiles
|
||||
if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()->get()) === 0) {
|
||||
if (!empty($profile['nickname']) && strpos($profile_url, DI::baseUrl()) === 0) {
|
||||
$follow_link = 'profile/' . $profile['nickname'] . '/remote_follow';
|
||||
}
|
||||
} else {
|
||||
|
@ -756,13 +756,13 @@ class Profile
|
|||
$query = rtrim(str_replace($addr_request, '', DI::args()->getQueryString()), '?&');
|
||||
|
||||
// The other instance needs to know where to redirect.
|
||||
$dest = urlencode(DI::baseUrl()->get() . '/' . $query);
|
||||
$dest = urlencode(DI::baseUrl() . '/' . $query);
|
||||
|
||||
// We need to extract the basebath from the profile url
|
||||
// to redirect the visitors '/magic' module.
|
||||
$basepath = Contact::getBasepath($contact['url']);
|
||||
|
||||
if ($basepath != DI::baseUrl()->get() && !strstr($dest, '/magic')) {
|
||||
if ($basepath != DI::baseUrl() && !strstr($dest, '/magic')) {
|
||||
$magic_path = $basepath . '/magic' . '?owa=1&dest=' . $dest . '&' . $addr_request;
|
||||
|
||||
// We have to check if the remote server does understand /magic without invoking something
|
||||
|
@ -870,7 +870,7 @@ class Profile
|
|||
|
||||
$a->setContactId($arr['visitor']['id']);
|
||||
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
|
||||
DI::sysmsg()->addInfo(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHost(), $visitor['name']));
|
||||
|
||||
Logger::info('OpenWebAuth: auth success from ' . $visitor['addr']);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ class User
|
|||
$system['region'] = '';
|
||||
$system['postal-code'] = '';
|
||||
$system['country-name'] = '';
|
||||
$system['homepage'] = DI::baseUrl()->get();
|
||||
$system['homepage'] = DI::baseUrl();
|
||||
$system['dob'] = '0000-00-00';
|
||||
|
||||
// Ensure that the user contains data
|
||||
|
@ -219,7 +219,7 @@ class User
|
|||
'self' => true,
|
||||
'network' => Protocol::ACTIVITYPUB,
|
||||
'name' => 'System Account',
|
||||
'addr' => $system_actor_name . '@' . DI::baseUrl()->getHostname(),
|
||||
'addr' => $system_actor_name . '@' . DI::baseUrl()->getHost(),
|
||||
'nick' => $system_actor_name,
|
||||
'url' => DI::baseUrl() . '/friendica',
|
||||
'pubkey' => $keys['pubkey'],
|
||||
|
@ -1023,7 +1023,7 @@ class User
|
|||
$_SESSION['register'] = 1;
|
||||
$_SESSION['openid'] = $openid_url;
|
||||
|
||||
$openid = new LightOpenID(DI::baseUrl()->getHostname());
|
||||
$openid = new LightOpenID(DI::baseUrl()->getHost());
|
||||
$openid->identity = $openid_url;
|
||||
$openid->returnUrl = DI::baseUrl() . '/openid';
|
||||
$openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
|
||||
|
@ -1360,7 +1360,7 @@ class User
|
|||
$l10n,
|
||||
$user,
|
||||
DI::config()->get('config', 'sitename'),
|
||||
DI::baseUrl()->get(),
|
||||
DI::baseUrl(),
|
||||
($register['password'] ?? '') ?: 'Sent in a previous email'
|
||||
);
|
||||
}
|
||||
|
@ -1457,7 +1457,7 @@ class User
|
|||
Thank you and welcome to %4$s.'));
|
||||
|
||||
$preamble = sprintf($preamble, $user['username'], DI::config()->get('config', 'sitename'));
|
||||
$body = sprintf($body, DI::baseUrl()->get(), $user['nickname'], $result['password'], DI::config()->get('config', 'sitename'));
|
||||
$body = sprintf($body, DI::baseUrl(), $user['nickname'], $result['password'], DI::config()->get('config', 'sitename'));
|
||||
|
||||
$email = DI::emailer()
|
||||
->newSystemMail()
|
||||
|
|
|
@ -59,7 +59,7 @@ class Cookie
|
|||
*/
|
||||
public function __construct(App\Request $request, IManageConfigValues $config, App\BaseURL $baseURL, array $COOKIE = [])
|
||||
{
|
||||
$this->sslEnabled = $baseURL->getSSLPolicy() === App\BaseURL::SSL_POLICY_FULL;
|
||||
$this->sslEnabled = $baseURL->getScheme() === 'https';
|
||||
$this->sitePrivateKey = $config->get('system', 'site_prvkey');
|
||||
|
||||
$authCookieDays = $config->get('system', 'auth_cookie_lifetime',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue