Remove deprecated App::getBaseURL() - process methods to DI::baseUrl()->get()

This commit is contained in:
Philipp Holzer 2019-12-16 01:05:15 +01:00
parent e57a87f224
commit e944d7bed6
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
43 changed files with 76 additions and 120 deletions

View file

@ -437,7 +437,7 @@ function dfrn_request_post(App $a)
} }
// "Homecoming" - send the requestor back to their site to record the introduction. // "Homecoming" - send the requestor back to their site to record the introduction.
$dfrn_url = bin2hex($a->getBaseURL() . '/profile/' . $nickname); $dfrn_url = bin2hex(DI::baseUrl()->get() . '/profile/' . $nickname);
$aes_allow = ((function_exists('openssl_encrypt')) ? 1 : 0); $aes_allow = ((function_exists('openssl_encrypt')) ? 1 : 0);
System::externalRedirect($parms['dfrn-request'] . "?dfrn_url=$dfrn_url" System::externalRedirect($parms['dfrn-request'] . "?dfrn_url=$dfrn_url"

View file

@ -126,7 +126,7 @@ function profile_photo_post(App $a)
info(L10n::t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL); info(L10n::t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
// Update global directory in background // Update global directory in background
if ($path && strlen(Config::get('system', 'directory'))) { if ($path && strlen(Config::get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, "Directory", $a->getBaseURL() . '/' . $path); Worker::add(PRIORITY_LOW, "Directory", DI::baseUrl()->get() . '/' . $path);
} }
Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user()); Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());

View file

@ -16,8 +16,6 @@ use Friendica\Module\Security\Login;
function user_allow($hash) function user_allow($hash)
{ {
$a = \get_app();
$register = Register::getByHash($hash); $register = Register::getByHash($hash);
if (!DBA::isResult($register)) { if (!DBA::isResult($register)) {
return false; return false;
@ -45,7 +43,7 @@ function user_allow($hash)
$l10n, $l10n,
$user, $user,
Config::get('config', 'sitename'), Config::get('config', 'sitename'),
$a->getBaseUrl(), DI::baseUrl()->get(),
($register['password'] ?? '') ?: 'Sent in a previous email' ($register['password'] ?? '') ?: 'Sent in a previous email'
); );

View file

@ -80,7 +80,7 @@ function removeme_content(App $a)
$tpl = Renderer::getMarkupTemplate('removeme.tpl'); $tpl = Renderer::getMarkupTemplate('removeme.tpl');
$o = Renderer::replaceMacros($tpl, [ $o = Renderer::replaceMacros($tpl, [
'$basedir' => $a->getBaseURL(), '$basedir' => DI::baseUrl()->get(),
'$hash' => $hash, '$hash' => $hash,
'$title' => L10n::t('Remove My Account'), '$title' => L10n::t('Remove My Account'),
'$desc' => L10n::t('This will completely remove your account. Once this has been done it is not recoverable.'), '$desc' => L10n::t('This will completely remove your account. Once this has been done it is not recoverable.'),

View file

@ -721,7 +721,7 @@ function settings_content(App $a)
$tpl = Renderer::getMarkupTemplate('settings/oauth.tpl'); $tpl = Renderer::getMarkupTemplate('settings/oauth.tpl');
$o .= Renderer::replaceMacros($tpl, [ $o .= Renderer::replaceMacros($tpl, [
'$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"), '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"),
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$title' => L10n::t('Connected Apps'), '$title' => L10n::t('Connected Apps'),
'$add' => L10n::t('Add application'), '$add' => L10n::t('Add application'),
'$edit' => L10n::t('Edit'), '$edit' => L10n::t('Edit'),

View file

@ -271,20 +271,6 @@ class App
return $this->baseURL->getScheme(); return $this->baseURL->getScheme();
} }
/**
* Retrieves the Friendica instance base URL
*
* @param bool $ssl Whether to append http or https under BaseURL::SSL_POLICY_SELFSIGN
*
* @return string Friendica server base URL
*
* @deprecated 2019.09 - use BaseUrl->get($ssl) instead
*/
public function getBaseURL($ssl = false)
{
return $this->baseURL->get($ssl);
}
/** /**
* Returns the current UserAgent as a String * Returns the current UserAgent as a String
* *
@ -298,7 +284,7 @@ class App
FRIENDICA_CODENAME . "' " . FRIENDICA_CODENAME . "' " .
FRIENDICA_VERSION . '-' . FRIENDICA_VERSION . '-' .
DB_UPDATE_VERSION . '; ' . DB_UPDATE_VERSION . '; ' .
$this->getBaseURL(); $this->baseURL->get();
} }
/** /**
@ -478,8 +464,8 @@ class App
// and www.example.com vs example.com. // and www.example.com vs example.com.
// We will only change the url to an ip address if there is no existing setting // We will only change the url to an ip address if there is no existing setting
if (empty($url) || (!Util\Strings::compareLink($url, $this->getBaseURL())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $this->baseURL->getHostname()))) { if (empty($url) || (!Util\Strings::compareLink($url, $this->baseURL->get())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $this->baseURL->getHostname()))) {
$this->config->set('system', 'url', $this->getBaseURL()); $this->config->set('system', 'url', $this->baseURL->get());
} }
} }

View file

@ -1152,7 +1152,7 @@ class BBCode
$a = DI::app(); $a = DI::app();
// When the picture link is the own photo path then we can avoid fetching the link // When the picture link is the own photo path then we can avoid fetching the link
$own_photo_url = preg_quote(Strings::normaliseLink($a->getBaseURL()) . '/photos/'); $own_photo_url = preg_quote(Strings::normaliseLink(DI::baseUrl()->get()) . '/photos/');
if (preg_match('|' . $own_photo_url . '.*?/image/|', Strings::normaliseLink($match[1]))) { if (preg_match('|' . $own_photo_url . '.*?/image/|', Strings::normaliseLink($match[1]))) {
if (!empty($match[3])) { if (!empty($match[3])) {
$text = '[img=' . str_replace('-1.', '-0.', $match[2]) . ']' . $match[3] . '[/img]'; $text = '[img=' . str_replace('-1.', '-0.', $match[2]) . ']' . $match[3] . '[/img]';

View file

@ -61,10 +61,9 @@ class Renderer
public static function replaceMacros($s, array $vars = []) public static function replaceMacros($s, array $vars = [])
{ {
$stamp1 = microtime(true); $stamp1 = microtime(true);
$a = DI::app();
// pass $baseurl to all templates if it isn't set // pass $baseurl to all templates if it isn't set
$vars = array_merge(['$baseurl' => $a->getBaseURL()], $vars); $vars = array_merge(['$baseurl' => DI::baseUrl()->get()], $vars);
$t = self::getTemplateEngine(); $t = self::getTemplateEngine();

View file

@ -2511,7 +2511,7 @@ class Item
$guid = System::createUUID(); $guid = System::createUUID();
} }
return DI::app()->getBaseURL() . '/objects/' . $guid; return DI::baseUrl()->get() . '/objects/' . $guid;
} }
/** /**

View file

@ -679,8 +679,7 @@ class Photo
*/ */
public static function getGUID($name) public static function getGUID($name)
{ {
$a = \get_app(); $base = DI::baseUrl()->get();
$base = $a->getBaseURL();
$guid = str_replace([Strings::normaliseLink($base), '/photo/'], '', Strings::normaliseLink($name)); $guid = str_replace([Strings::normaliseLink($base), '/photo/'], '', Strings::normaliseLink($name));
@ -725,8 +724,7 @@ class Photo
*/ */
public static function isLocalPage($name) public static function isLocalPage($name)
{ {
$a = \get_app(); $base = DI::baseUrl()->get();
$base = $a->getBaseURL();
$guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name)); $guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name));
$guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid); $guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid);

View file

@ -337,7 +337,7 @@ class Profile
if (isset($profile['url'])) { if (isset($profile['url'])) {
$profile_url = $profile['url']; $profile_url = $profile['url'];
} else { } else {
$profile_url = $a->getBaseURL() . '/profile/' . $profile['nickname']; $profile_url = DI::baseUrl()->get() . '/profile/' . $profile['nickname'];
} }
$follow_link = null; $follow_link = null;
@ -1080,13 +1080,13 @@ class Profile
$query = rtrim(str_replace($addr_request, '', $a->query_string), '?&'); $query = rtrim(str_replace($addr_request, '', $a->query_string), '?&');
// The other instance needs to know where to redirect. // The other instance needs to know where to redirect.
$dest = urlencode($a->getBaseURL() . '/' . $query); $dest = urlencode(DI::baseUrl()->get() . '/' . $query);
// We need to extract the basebath from the profile url // We need to extract the basebath from the profile url
// to redirect the visitors '/magic' module. // to redirect the visitors '/magic' module.
$basepath = Contact::getBasepath($contact['url']); $basepath = Contact::getBasepath($contact['url']);
if ($basepath != $a->getBaseURL() && !strstr($dest, '/magic')) { if ($basepath != DI::baseUrl()->get() && !strstr($dest, '/magic')) {
$magic_path = $basepath . '/magic' . '?owa=1&dest=' . $dest . '&' . $addr_request; $magic_path = $basepath . '/magic' . '?owa=1&dest=' . $dest . '&' . $addr_request;
// We have to check if the remote server does understand /magic without invoking something // We have to check if the remote server does understand /magic without invoking something

View file

@ -101,7 +101,7 @@ class Details extends BaseAdminModule
'$page' => L10n::t('Addons'), '$page' => L10n::t('Addons'),
'$toggle' => L10n::t('Toggle'), '$toggle' => L10n::t('Toggle'),
'$settings' => L10n::t('Settings'), '$settings' => L10n::t('Settings'),
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$addon' => $addon, '$addon' => $addon,
'$status' => $status, '$status' => $status,

View file

@ -14,8 +14,6 @@ class Index extends BaseAdminModule
{ {
parent::content($parameters); parent::content($parameters);
$a = DI::app();
// reload active themes // reload active themes
if (!empty($_GET['action'])) { if (!empty($_GET['action'])) {
parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't'); parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
@ -52,7 +50,7 @@ class Index extends BaseAdminModule
'$page' => L10n::t('Addons'), '$page' => L10n::t('Addons'),
'$submit' => L10n::t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$reload' => L10n::t('Reload active addons'), '$reload' => L10n::t('Reload active addons'),
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$function' => 'addons', '$function' => 'addons',
'$addons' => $addons, '$addons' => $addons,
'$pcount' => count($addons), '$pcount' => count($addons),

View file

@ -76,7 +76,7 @@ class Contact extends BaseAdminModule
'$form_security_token' => parent::getFormSecurityToken('admin_contactblock'), '$form_security_token' => parent::getFormSecurityToken('admin_contactblock'),
// values // // values //
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$contacts' => $contacts, '$contacts' => $contacts,
'$total_contacts' => L10n::tt('%s total blocked contact', '%s total blocked contacts', $total), '$total_contacts' => L10n::tt('%s total blocked contact', '%s total blocked contacts', $total),

View file

@ -55,8 +55,6 @@ class Server extends BaseAdminModule
{ {
parent::content($parameters); parent::content($parameters);
$a = DI::app();
$blocklist = Config::get('system', 'blocklist'); $blocklist = Config::get('system', 'blocklist');
$blocklistform = []; $blocklistform = [];
if (is_array($blocklist)) { if (is_array($blocklist)) {
@ -91,7 +89,7 @@ class Server extends BaseAdminModule
'$threason' => L10n::t('Reason for the block'), '$threason' => L10n::t('Reason for the block'),
'$delentry' => L10n::t('Delete entry from blocklist'), '$delentry' => L10n::t('Delete entry from blocklist'),
'$entries' => $blocklistform, '$entries' => $blocklistform,
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$confirm_delete' => L10n::t('Delete entry from blocklist?'), '$confirm_delete' => L10n::t('Delete entry from blocklist?'),
'$form_security_token' => parent::getFormSecurityToken("admin_blocklist") '$form_security_token' => parent::getFormSecurityToken("admin_blocklist")
]); ]);

View file

@ -88,13 +88,13 @@ class DBSync extends BaseAdminModule
if (!count($failed)) { if (!count($failed)) {
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/structure_check.tpl'), [
'$base' => $a->getBaseURL(true), '$base' => DI::baseUrl()->get(true),
'$banner' => L10n::t('No failed updates.'), '$banner' => L10n::t('No failed updates.'),
'$check' => L10n::t('Check database structure'), '$check' => L10n::t('Check database structure'),
]); ]);
} else { } else {
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/failed_updates.tpl'), [ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/failed_updates.tpl'), [
'$base' => $a->getBaseURL(true), '$base' => DI::baseUrl()->get(true),
'$banner' => L10n::t('Failed Updates'), '$banner' => L10n::t('Failed Updates'),
'$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'), '$desc' => L10n::t('This does not include updates prior to 1139, which did not return a status.'),
'$mark' => L10n::t("Mark success \x28if update was manually applied\x29"), '$mark' => L10n::t("Mark success \x28if update was manually applied\x29"),

View file

@ -42,8 +42,6 @@ class Settings extends BaseAdminModule
{ {
parent::content($parameters); parent::content($parameters);
$a = DI::app();
$log_choices = [ $log_choices = [
LogLevel::ERROR => 'Error', LogLevel::ERROR => 'Error',
LogLevel::WARNING => 'Warning', LogLevel::WARNING => 'Warning',
@ -65,7 +63,7 @@ class Settings extends BaseAdminModule
'$page' => L10n::t('Logs'), '$page' => L10n::t('Logs'),
'$submit' => L10n::t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$clear' => L10n::t('Clear'), '$clear' => L10n::t('Clear'),
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$logname' => Config::get('system', 'logfile'), '$logname' => Config::get('system', 'logfile'),
// see /help/smarty3-templates#1_1 on any Friendica node // see /help/smarty3-templates#1_1 on any Friendica node
'$debugging' => ['debugging', L10n::t("Enable Debugging"), Config::get('system', 'debugging'), ""], '$debugging' => ['debugging', L10n::t("Enable Debugging"), Config::get('system', 'debugging'), ""],

View file

@ -56,7 +56,7 @@ class Site extends BaseAdminModule
* send relocate for every local user * send relocate for every local user
* */ * */
$old_url = $a->getBaseURL(true); $old_url = DI::baseUrl()->get(true);
// Generate host names for relocation the addresses in the format user@address.tld // Generate host names for relocation the addresses in the format user@address.tld
$new_host = str_replace("http://", "@", Strings::normaliseLink($new_url)); $new_host = str_replace("http://", "@", Strings::normaliseLink($new_url));
@ -417,8 +417,6 @@ class Site extends BaseAdminModule
{ {
parent::content($parameters); parent::content($parameters);
$a = DI::app();
/* Installed langs */ /* Installed langs */
$lang_choices = L10n::getAvailableLanguages(); $lang_choices = L10n::getAvailableLanguages();
@ -578,7 +576,7 @@ class Site extends BaseAdminModule
'$relay_title' => L10n::t('Message Relay'), '$relay_title' => L10n::t('Message Relay'),
'$relocate' => L10n::t('Relocate Instance'), '$relocate' => L10n::t('Relocate Instance'),
'$relocate_warning' => L10n::t('Warning! Advanced function. Could make this server unreachable.'), '$relocate_warning' => L10n::t('Warning! Advanced function. Could make this server unreachable.'),
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
// name, label, value, help string, extra data... // name, label, value, help string, extra data...
'$sitename' => ['sitename', L10n::t('Site name'), Config::get('config', 'sitename'), ''], '$sitename' => ['sitename', L10n::t('Site name'), Config::get('config', 'sitename'), ''],
@ -661,14 +659,14 @@ class Site extends BaseAdminModule
'$proxy_disabled' => ['proxy_disabled', L10n::t('Disable picture proxy'), Config::get('system', 'proxy_disabled'), L10n::t('The picture proxy increases performance and privacy. It shouldn\'t be used on systems with very low bandwidth.')], '$proxy_disabled' => ['proxy_disabled', L10n::t('Disable picture proxy'), Config::get('system', 'proxy_disabled'), L10n::t('The picture proxy increases performance and privacy. It shouldn\'t be used on systems with very low bandwidth.')],
'$only_tag_search' => ['only_tag_search', L10n::t('Only search in tags'), Config::get('system', 'only_tag_search'), L10n::t('On large systems the text search can slow down the system extremely.')], '$only_tag_search' => ['only_tag_search', L10n::t('Only search in tags'), Config::get('system', 'only_tag_search'), L10n::t('On large systems the text search can slow down the system extremely.')],
'$relocate_url' => ['relocate_url', L10n::t('New base url'), $a->getBaseURL(), L10n::t('Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.')], '$relocate_url' => ['relocate_url', L10n::t('New base url'), DI::baseUrl()->get(), L10n::t('Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.')],
'$rino' => ['rino', L10n::t('RINO Encryption'), intval(Config::get('system', 'rino_encrypt')), L10n::t('Encryption layer between nodes.'), [0 => L10n::t('Disabled'), 1 => L10n::t('Enabled')]], '$rino' => ['rino', L10n::t('RINO Encryption'), intval(Config::get('system', 'rino_encrypt')), L10n::t('Encryption layer between nodes.'), [0 => L10n::t('Disabled'), 1 => L10n::t('Enabled')]],
'$worker_queues' => ['worker_queues', L10n::t('Maximum number of parallel workers'), Config::get('system', 'worker_queues'), L10n::t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)], '$worker_queues' => ['worker_queues', L10n::t('Maximum number of parallel workers'), Config::get('system', 'worker_queues'), L10n::t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)],
'$worker_dont_fork' => ['worker_dont_fork', L10n::t('Don\'t use "proc_open" with the worker'), Config::get('system', 'worker_dont_fork'), L10n::t('Enable this if your system doesn\'t allow the use of "proc_open". This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.')], '$worker_dont_fork' => ['worker_dont_fork', L10n::t('Don\'t use "proc_open" with the worker'), Config::get('system', 'worker_dont_fork'), L10n::t('Enable this if your system doesn\'t allow the use of "proc_open". This can happen on shared hosters. If this is enabled you should increase the frequency of worker calls in your crontab.')],
'$worker_fastlane' => ['worker_fastlane', L10n::t('Enable fastlane'), Config::get('system', 'worker_fastlane'), L10n::t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')], '$worker_fastlane' => ['worker_fastlane', L10n::t('Enable fastlane'), Config::get('system', 'worker_fastlane'), L10n::t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
'$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', $a->getBaseURL())], '$worker_frontend' => ['worker_frontend', L10n::t('Enable frontend worker'), Config::get('system', 'frontend_worker'), L10n::t('When enabled the Worker process is triggered when backend access is performed (e.g. messages being delivered). On smaller sites you might want to call %s/worker on a regular basis via an external cron job. You should only enable this option if you cannot utilize cron/scheduled jobs on your server.', DI::baseUrl()->get())],
'$relay_subscribe' => ['relay_subscribe', L10n::t('Subscribe to relay'), Config::get('system', 'relay_subscribe'), L10n::t('Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.')], '$relay_subscribe' => ['relay_subscribe', L10n::t('Subscribe to relay'), Config::get('system', 'relay_subscribe'), L10n::t('Enables the receiving of public posts from the relay. They will be included in the search, subscribed tags and on the global community page.')],
'$relay_server' => ['relay_server', L10n::t('Relay server'), Config::get('system', 'relay_server', 'https://relay.diasp.org'), L10n::t('Address of the relay server where public posts should be send to. For example https://relay.diasp.org')], '$relay_server' => ['relay_server', L10n::t('Relay server'), Config::get('system', 'relay_server', 'https://relay.diasp.org'), L10n::t('Address of the relay server where public posts should be send to. For example https://relay.diasp.org')],

View file

@ -63,18 +63,18 @@ class Summary extends BaseAdminModule
// Legacy config file warning // Legacy config file warning
if (file_exists('.htconfig.php')) { if (file_exists('.htconfig.php')) {
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config'); $warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', DI::baseUrl()->get() . '/help/Config');
} }
if (file_exists('config/local.ini.php')) { if (file_exists('config/local.ini.php')) {
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>config/local.ini.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config'); $warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.config.php, please copy config/local-sample.config.php and move your config from <code>config/local.ini.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', DI::baseUrl()->get() . '/help/Config');
} }
// Check server vitality // Check server vitality
if (!self::checkSelfHostMeta()) { if (!self::checkSelfHostMeta()) {
$well_known = $a->getBaseURL() . '/.well-known/host-meta'; $well_known = DI::baseUrl()->get() . '/.well-known/host-meta';
$warningtext[] = L10n::t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.', $warningtext[] = L10n::t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.',
$well_known, $well_known, $a->getBaseURL() . '/help/Install'); $well_known, $well_known, DI::baseUrl()->get() . '/help/Install');
} }
// Check logfile permission // Check logfile permission
@ -208,7 +208,7 @@ class Summary extends BaseAdminModule
private static function checkSelfHostMeta() private static function checkSelfHostMeta()
{ {
// Fetch the host-meta to check if this really is a vital server // Fetch the host-meta to check if this really is a vital server
return Network::curl(DI::app()->getBaseURL() . '/.well-known/host-meta')->isSuccess(); return Network::curl(DI::baseUrl()->get() . '/.well-known/host-meta')->isSuccess();
} }
} }

View file

@ -106,7 +106,7 @@ class Details extends BaseAdminModule
'$page' => L10n::t('Themes'), '$page' => L10n::t('Themes'),
'$toggle' => L10n::t('Toggle'), '$toggle' => L10n::t('Toggle'),
'$settings' => L10n::t('Settings'), '$settings' => L10n::t('Settings'),
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$addon' => $theme, '$addon' => $theme,
'$status' => $status, '$status' => $status,
'$action' => $action, '$action' => $action,

View file

@ -16,13 +16,11 @@ class Index extends BaseAdminModule
{ {
parent::content($parameters); parent::content($parameters);
$a = DI::app();
$allowed_themes = Theme::getAllowedList(); $allowed_themes = Theme::getAllowedList();
// reload active themes // reload active themes
if (!empty($_GET['action'])) { if (!empty($_GET['action'])) {
parent::checkFormSecurityTokenRedirectOnError($a->getBaseURL() . '/admin/themes', 'admin_themes', 't'); parent::checkFormSecurityTokenRedirectOnError(DI::baseUrl()->get() . '/admin/themes', 'admin_themes', 't');
switch ($_GET['action']) { switch ($_GET['action']) {
case 'reload': case 'reload':
@ -97,7 +95,7 @@ class Index extends BaseAdminModule
'$page' => L10n::t('Themes'), '$page' => L10n::t('Themes'),
'$submit' => L10n::t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$reload' => L10n::t('Reload active themes'), '$reload' => L10n::t('Reload active themes'),
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$function' => 'themes', '$function' => 'themes',
'$addons' => $addons, '$addons' => $addons,
'$pcount' => count($themes), '$pcount' => count($themes),

View file

@ -20,8 +20,6 @@ class Users extends BaseAdminModule
{ {
parent::post($parameters); parent::post($parameters);
$a = DI::app();
$pending = $_POST['pending'] ?? []; $pending = $_POST['pending'] ?? [];
$users = $_POST['user'] ?? []; $users = $_POST['user'] ?? [];
$nu_name = $_POST['new_user_name'] ?? ''; $nu_name = $_POST['new_user_name'] ?? '';
@ -78,7 +76,7 @@ class Users extends BaseAdminModule
Thank you and welcome to %4$s.')); Thank you and welcome to %4$s.'));
$preamble = sprintf($preamble, $user['username'], Config::get('config', 'sitename')); $preamble = sprintf($preamble, $user['username'], Config::get('config', 'sitename'));
$body = sprintf($body, $a->getBaseURL(), $user['nickname'], $result['password'], Config::get('config', 'sitename')); $body = sprintf($body, DI::baseUrl()->get(), $user['nickname'], $result['password'], Config::get('config', 'sitename'));
notification([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,
@ -306,7 +304,7 @@ class Users extends BaseAdminModule
'$form_security_token' => parent::getFormSecurityToken('admin_users'), '$form_security_token' => parent::getFormSecurityToken('admin_users'),
// values // // values //
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
'$pending' => $pending, '$pending' => $pending,
'deleted' => $deleted, 'deleted' => $deleted,

View file

@ -70,7 +70,7 @@ class AllFriends extends BaseModule
$friend['id'] = $friend['cid']; $friend['id'] = $friend['cid'];
$photoMenu = Model\Contact::photoMenu($friend); $photoMenu = Model\Contact::photoMenu($friend);
} else { } else {
$connlnk = $app->getBaseURL() . '/follow/?url=' . $friend['url']; $connlnk = DI::baseUrl()->get() . '/follow/?url=' . $friend['url'];
$photoMenu = [ $photoMenu = [
'profile' => [L10n::t('View Profile'), Model\Contact::magicLinkbyId($friend['id'], $friend['url'])], 'profile' => [L10n::t('View Profile'), Model\Contact::magicLinkbyId($friend['id'], $friend['url'])],
'follow' => [L10n::t('Connect/Follow'), $connlnk] 'follow' => [L10n::t('Connect/Follow'), $connlnk]

View file

@ -97,8 +97,6 @@ class BaseSearchModule extends BaseModule
return ''; return '';
} }
$a = DI::app();
$id = 0; $id = 0;
$entries = []; $entries = [];
foreach ($results->getResults() as $result) { foreach ($results->getResults() as $result) {
@ -131,7 +129,7 @@ class BaseSearchModule extends BaseModule
$photo_menu = []; $photo_menu = [];
} }
} else { } else {
$connLink = $a->getBaseURL() . '/follow/?url=' . $result->getUrl(); $connLink = DI::baseUrl()->get() . '/follow/?url=' . $result->getUrl();
$connTxt = L10n::t('Connect'); $connTxt = L10n::t('Connect');
$photo_menu['profile'] = [L10n::t("View Profile"), Model\Contact::magicLink($result->getUrl())]; $photo_menu['profile'] = [L10n::t("View Profile"), Model\Contact::magicLink($result->getUrl())];

View file

@ -30,7 +30,7 @@ class Bookmarklet extends BaseModule
} }
$referer = Strings::normaliseLink($_SERVER['HTTP_REFERER'] ?? ''); $referer = Strings::normaliseLink($_SERVER['HTTP_REFERER'] ?? '');
$page = Strings::normaliseLink($app->getBaseURL() . "/bookmarklet"); $page = Strings::normaliseLink(DI::baseUrl()->get() . "/bookmarklet");
if (!strstr($referer, $page)) { if (!strstr($referer, $page)) {
if (empty($_REQUEST["url"])) { if (empty($_REQUEST["url"])) {

View file

@ -351,7 +351,7 @@ class Contact extends BaseModule
$tpl = Renderer::getMarkupTemplate('contacts-head.tpl'); $tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
]); ]);
$sort_type = 0; $sort_type = 0;
@ -473,7 +473,7 @@ class Contact extends BaseModule
$contact = $a->data['contact']; $contact = $a->data['contact'];
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [ $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
'$baseurl' => $a->getBaseURL(true), '$baseurl' => DI::baseUrl()->get(true),
]); ]);
$contact['blocked'] = Model\Contact::isBlockedByUser($contact['id'], local_user()); $contact['blocked'] = Model\Contact::isBlockedByUser($contact['id'], local_user());

View file

@ -40,7 +40,7 @@ class Localtime extends BaseModule
$output .= '<p>' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>'; $output .= '<p>' . L10n::t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>';
} }
$output .= '<form action ="' . $app->getBaseURL() . '/localtime?time=' . $time . '" method="post" >'; $output .= '<form action ="' . DI::baseUrl()->get() . '/localtime?time=' . $time . '" method="post" >';
$output .= '<p>' . L10n::t('Please select your timezone:') . '</p>'; $output .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
$output .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ); $output .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ);
$output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>'; $output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';

View file

@ -47,7 +47,7 @@ class Fetch extends BaseModule
} }
$host = $parts["scheme"] . "://" . $parts["host"]; $host = $parts["scheme"] . "://" . $parts["host"];
if (Strings::normaliseLink($host) != Strings::normaliseLink($app->getBaseURL())) { if (Strings::normaliseLink($host) != Strings::normaliseLink(DI::baseUrl()->get())) {
$location = $host . "/fetch/" . $app->argv[1] . "/" . urlencode($guid); $location = $host . "/fetch/" . $app->argv[1] . "/" . urlencode($guid);
System::externalRedirect($location, 301); System::externalRedirect($location, 301);
} }

View file

@ -18,7 +18,6 @@ class Friendica extends BaseModule
{ {
public static function content(array $parameters = []) public static function content(array $parameters = [])
{ {
$app = DI::app();
$config = DI::config(); $config = DI::config();
$visibleAddonList = Addon::getVisibleList(); $visibleAddonList = Addon::getVisibleList();
@ -48,7 +47,7 @@ class Friendica extends BaseModule
} }
$tos = ($config->get('system', 'tosdisplay')) ? $tos = ($config->get('system', 'tosdisplay')) ?
L10n::t('Read about the <a href="%1$s/tos">Terms of Service</a> of this node.', $app->getBaseURL()) : L10n::t('Read about the <a href="%1$s/tos">Terms of Service</a> of this node.', DI::baseUrl()->get()) :
''; '';
$blockList = $config->get('system', 'blocklist'); $blockList = $config->get('system', 'blocklist');
@ -75,7 +74,7 @@ class Friendica extends BaseModule
return Renderer::replaceMacros($tpl, [ return Renderer::replaceMacros($tpl, [
'about' => L10n::t('This is Friendica, version %s that is running at the web location %s. The database version is %s, the post update version is %s.', 'about' => L10n::t('This is Friendica, version %s that is running at the web location %s. The database version is %s, the post update version is %s.',
'<strong>' . FRIENDICA_VERSION . '</strong>', '<strong>' . FRIENDICA_VERSION . '</strong>',
$app->getBaseURL(), DI::baseUrl()->get(),
'<strong>' . DB_UPDATE_VERSION . '</strong>', '<strong>' . DB_UPDATE_VERSION . '</strong>',
'<strong>' . $config->get('system', 'post_update_version') . '</strong>'), '<strong>' . $config->get('system', 'post_update_version') . '</strong>'),
'friendica' => L10n::t('Please visit <a href="https://friendi.ca">Friendi.ca</a> to learn more about the Friendica project.'), 'friendica' => L10n::t('Please visit <a href="https://friendi.ca">Friendi.ca</a> to learn more about the Friendica project.'),
@ -125,7 +124,7 @@ class Friendica extends BaseModule
if (!empty($administrator)) { if (!empty($administrator)) {
$admin = [ $admin = [
'name' => $administrator['username'], 'name' => $administrator['username'],
'profile' => $app->getBaseURL() . '/profile/' . $administrator['nickname'], 'profile' => DI::baseUrl()->get() . '/profile/' . $administrator['nickname'],
]; ];
} }
} }
@ -147,7 +146,7 @@ class Friendica extends BaseModule
$data = [ $data = [
'version' => FRIENDICA_VERSION, 'version' => FRIENDICA_VERSION,
'url' => $app->getBaseURL(), 'url' => DI::baseUrl()->get(),
'addons' => $visible_addons, 'addons' => $visible_addons,
'locked_features' => $locked_features, 'locked_features' => $locked_features,
'explicit_content' => intval($config->get('system', 'explicit_content', 0)), 'explicit_content' => intval($config->get('system', 'explicit_content', 0)),
@ -157,7 +156,7 @@ class Friendica extends BaseModule
'site_name' => $config->get('config', 'sitename'), 'site_name' => $config->get('config', 'sitename'),
'platform' => FRIENDICA_PLATFORM, 'platform' => FRIENDICA_PLATFORM,
'info' => $config->get('config', 'info'), 'info' => $config->get('config', 'info'),
'no_scrape_url' => $app->getBaseURL() . '/noscrape', 'no_scrape_url' => DI::baseUrl()->get() . '/noscrape',
]; ];
header('Content-type: application/json; charset=utf-8'); header('Content-type: application/json; charset=utf-8');

View file

@ -87,7 +87,7 @@ class Help extends BaseModule
$idNum[$level] ++; $idNum[$level] ++;
$href = $a->getBaseURL() . "/help/{$filename}#{$anchor}"; $href = DI::baseUrl()->get() . "/help/{$filename}#{$anchor}";
$toc .= "<li><a href=\"{$href}\">" . strip_tags($line) . "</a></li>"; $toc .= "<li><a href=\"{$href}\">" . strip_tags($line) . "</a></li>";
$id = implode("_", array_slice($idNum, 1, $level)); $id = implode("_", array_slice($idNum, 1, $level));
$line = "<a name=\"{$id}\"></a>" . $line; $line = "<a name=\"{$id}\"></a>" . $line;

View file

@ -42,7 +42,7 @@ class Home extends BaseModule
$customHome = $homeFilePath; $customHome = $homeFilePath;
if (file_exists($cssFilePath)) { if (file_exists($cssFilePath)) {
$app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $app->getBaseURL() . '/home.css' . '" media="all" />'; $app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/home.css' . '" media="all" />';
} }
} }

View file

@ -71,7 +71,7 @@ class Install extends BaseModule
// We overwrite current theme css, because during install we may not have a working mod_rewrite // We overwrite current theme css, because during install we may not have a working mod_rewrite
// so we may not have a css at all. Here we set a static css file for the install procedure pages // so we may not have a css at all. Here we set a static css file for the install procedure pages
Renderer::$theme['stylesheet'] = $a->getBaseURL() . '/view/install/style.css'; Renderer::$theme['stylesheet'] = DI::baseUrl()->get() . '/view/install/style.css';
self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK; self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
} }
@ -162,7 +162,7 @@ class Install extends BaseModule
case self::SYSTEM_CHECK: case self::SYSTEM_CHECK:
$php_path = $configCache->get('config', 'php_path'); $php_path = $configCache->get('config', 'php_path');
$status = self::$installer->checkEnvironment($a->getBaseURL(), $php_path); $status = self::$installer->checkEnvironment(DI::baseUrl()->get(), $php_path);
$tpl = Renderer::getMarkupTemplate('install_checks.tpl'); $tpl = Renderer::getMarkupTemplate('install_checks.tpl');
$output .= Renderer::replaceMacros($tpl, [ $output .= Renderer::replaceMacros($tpl, [
@ -303,7 +303,7 @@ class Install extends BaseModule
'$title' => $install_title, '$title' => $install_title,
'$checks' => self::$installer->getChecks(), '$checks' => self::$installer->getChecks(),
'$pass' => L10n::t('Installation finished'), '$pass' => L10n::t('Installation finished'),
'$text' => $db_return_text . self::whatNext($a), '$text' => $db_return_text . self::whatNext(),
]); ]);
break; break;
@ -315,14 +315,12 @@ class Install extends BaseModule
/** /**
* Creates the text for the next steps * Creates the text for the next steps
* *
* @param App $a The global App
*
* @return string The text for the next steps * @return string The text for the next steps
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
private static function whatNext($a) private static function whatNext()
{ {
$baseurl = $a->getBaseUrl(); $baseurl = DI::baseUrl()->get();
return return
L10n::t('<h1>What next</h1>') L10n::t('<h1>What next</h1>')
. "<p>" . L10n::t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.') . "<p>" . L10n::t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.')

View file

@ -129,14 +129,14 @@ class Invite extends BaseModule
if ($config->get('config', 'register_policy') === Register::CLOSED) { if ($config->get('config', 'register_policy') === Register::CLOSED) {
$linkTxt = L10n::t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirLocation . '/servers'); $linkTxt = L10n::t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirLocation . '/servers');
} else { } else {
$linkTxt = L10n::t('To accept this invitation, please visit and register at %s or any other public Friendica website.', $app->getBaseURL()) $linkTxt = L10n::t('To accept this invitation, please visit and register at %s or any other public Friendica website.', DI::baseUrl()->get())
. "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.', $dirLocation . '/servers'); . "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.', $dirLocation . '/servers');
} }
} else { // there is no global directory URL defined } else { // there is no global directory URL defined
if ($config->get('config', 'register_policy') === Register::CLOSED) { if ($config->get('config', 'register_policy') === Register::CLOSED) {
return L10n::t('Our apologies. This system is not currently configured to connect with other public sites or invite members.'); return L10n::t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
} else { } else {
$linkTxt = L10n::t('To accept this invitation, please visit and register at %s.', $app->getBaseURL() $linkTxt = L10n::t('To accept this invitation, please visit and register at %s.', DI::baseUrl()->get()
. "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks.')); . "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks.'));
} }
} }
@ -152,7 +152,7 @@ class Invite extends BaseModule
L10n::t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" L10n::t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n"
. $linkTxt . $linkTxt
. "\r\n" . "\r\n" . (($inviteOnly) ? L10n::t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . L10n::t('Once you have registered, please connect with me via my profile page at:') . "\r\n" . "\r\n" . (($inviteOnly) ? L10n::t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . L10n::t('Once you have registered, please connect with me via my profile page at:')
. "\r\n" . "\r\n" . $app->getBaseURL() . '/profile/' . $app->user['nickname'] . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->user['nickname']
. "\r\n" . "\r\n" . L10n::t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n", . "\r\n" . "\r\n" . L10n::t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n",
], ],
'$submit' => L10n::t('Submit') '$submit' => L10n::t('Submit')

View file

@ -49,7 +49,7 @@ class Magic extends BaseModule
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]); $contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
// Redirect if the contact is already authenticated on this site. // Redirect if the contact is already authenticated on this site.
if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(DI::app()->getBaseURL())) !== false) { if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(DI::baseUrl()->get())) !== false) {
if ($test) { if ($test) {
$ret['success'] = true; $ret['success'] = true;
$ret['message'] .= 'Local site - you are already authenticated.' . EOL; $ret['message'] .= 'Local site - you are already authenticated.' . EOL;

View file

@ -22,7 +22,7 @@ class OpenSearch extends BaseModule
header('Content-type: application/opensearchdescription+xml'); header('Content-type: application/opensearchdescription+xml');
$hostname = DI::baseUrl()->getHostname()(); $hostname = DI::baseUrl()->getHostname()();
$baseUrl = DI::app()->getBaseURL(); $baseUrl = DI::baseUrl()->get();
/** @var DOMDocument $xml */ /** @var DOMDocument $xml */
$xml = null; $xml = null;

View file

@ -16,7 +16,6 @@ class ReallySimpleDiscovery extends BaseModule
{ {
header('Content-Type: text/xml'); header('Content-Type: text/xml');
$app = DI::app();
$xml = null; $xml = null;
echo XML::fromArray([ echo XML::fromArray([
'rsd' => [ 'rsd' => [
@ -32,7 +31,7 @@ class ReallySimpleDiscovery extends BaseModule
'@attributes' => [ '@attributes' => [
'name' => 'Twitter', 'name' => 'Twitter',
'preferred' => 'true', 'preferred' => 'true',
'apiLink' => $app->getBaseURL(), 'apiLink' => DI::baseUrl()->get(),
'blogID' => '', 'blogID' => '',
], ],
'settings' => [ 'settings' => [

View file

@ -104,7 +104,7 @@ class Login extends BaseModule
$a->page['htmlhead'] .= Renderer::replaceMacros( $a->page['htmlhead'] .= Renderer::replaceMacros(
Renderer::getMarkupTemplate('login_head.tpl'), Renderer::getMarkupTemplate('login_head.tpl'),
[ [
'$baseurl' => $a->getBaseURL(true) '$baseurl' => DI::baseUrl()->get(true)
] ]
); );
@ -127,7 +127,7 @@ class Login extends BaseModule
$o .= Renderer::replaceMacros( $o .= Renderer::replaceMacros(
$tpl, $tpl,
[ [
'$dest_url' => DI::app()->getBaseURL(true) . '/login', '$dest_url' => DI::baseUrl()->get(true) . '/login',
'$logout' => L10n::t('Logout'), '$logout' => L10n::t('Logout'),
'$login' => L10n::t('Login'), '$login' => L10n::t('Login'),

View file

@ -16,7 +16,6 @@ class HostMeta extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent(array $parameters = [])
{ {
$app = DI::app();
$config = DI::config(); $config = DI::config();
header('Content-type: text/xml'); header('Content-type: text/xml');
@ -31,8 +30,8 @@ class HostMeta extends BaseModule
$tpl = Renderer::getMarkupTemplate('xrd_host.tpl'); $tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
echo Renderer::replaceMacros($tpl, [ echo Renderer::replaceMacros($tpl, [
'$zhost' => DI::baseUrl()->getHostname()(), '$zhost' => DI::baseUrl()->getHostname()(),
'$zroot' => $app->getBaseURL(), '$zroot' => DI::baseUrl()->get(),
'$domain' => $app->getBaseURL(), '$domain' => DI::baseUrl()->get(),
'$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey')) '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))
]); ]);

View file

@ -2,7 +2,6 @@
namespace Friendica\Module\WellKnown; namespace Friendica\Module\WellKnown;
use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\DI; use Friendica\DI;
@ -14,26 +13,22 @@ class NodeInfo extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent(array $parameters = [])
{ {
$app = DI::app(); self::printWellKnown();
self::printWellKnown($app);
} }
/** /**
* Prints the well-known nodeinfo redirect * Prints the well-known nodeinfo redirect
* *
* @param App $app
*
* @throws \Friendica\Network\HTTPException\NotFoundException * @throws \Friendica\Network\HTTPException\NotFoundException
*/ */
private static function printWellKnown(App $app) private static function printWellKnown()
{ {
$nodeinfo = [ $nodeinfo = [
'links' => [ 'links' => [
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0', ['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
'href' => $app->getBaseURL() . '/nodeinfo/1.0'], 'href' => DI::baseUrl()->get() . '/nodeinfo/1.0'],
['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0', ['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0',
'href' => $app->getBaseURL() . '/nodeinfo/2.0'], 'href' => DI::baseUrl()->get() . '/nodeinfo/2.0'],
] ]
]; ];

View file

@ -14,7 +14,6 @@ class XSocialRelay extends BaseModule
{ {
public static function rawContent(array $parameters = []) public static function rawContent(array $parameters = [])
{ {
$app = DI::app();
$config = DI::config(); $config = DI::config();
$subscribe = $config->get('system', 'relay_subscribe', false); $subscribe = $config->get('system', 'relay_subscribe', false);
@ -50,10 +49,10 @@ class XSocialRelay extends BaseModule
'tags' => $tagList, 'tags' => $tagList,
'protocols' => [ 'protocols' => [
'diaspora' => [ 'diaspora' => [
'receive' => $app->getBaseURL() . '/receive/public' 'receive' => DI::baseUrl()->get() . '/receive/public'
], ],
'dfrn' => [ 'dfrn' => [
'receive' => $app->getBaseURL() . '/dfrn_notify' 'receive' => DI::baseUrl()->get() . '/dfrn_notify'
] ]
] ]
]; ];

View file

@ -75,9 +75,9 @@ class Xrd extends BaseModule
} }
if ($mode == 'xml') { if ($mode == 'xml') {
self::printXML($alias, $app->getBaseURL(), $user, $owner, $avatar); self::printXML($alias, DI::baseUrl()->get(), $user, $owner, $avatar);
} else { } else {
self::printJSON($alias, $app->getBaseURL(), $owner, $avatar); self::printJSON($alias, DI::baseUrl()->get(), $owner, $avatar);
} }
} }

View file

@ -204,7 +204,7 @@ class Transmitter
{ {
return ['type' => 'Service', return ['type' => 'Service',
'name' => FRIENDICA_PLATFORM . " '" . FRIENDICA_CODENAME . "' " . FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION, 'name' => FRIENDICA_PLATFORM . " '" . FRIENDICA_CODENAME . "' " . FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
'url' => DI::app()->getBaseURL()]; 'url' => DI::baseUrl()->get()];
} }
/** /**

View file

@ -2372,7 +2372,7 @@ class DFRN
/// @todo Do we really need this check for HTML elements? (It was copied from the old function) /// @todo Do we really need this check for HTML elements? (It was copied from the old function)
if ((strpos($item['body'], '<') !== false) && (strpos($item['body'], '>') !== false)) { if ((strpos($item['body'], '<') !== false) && (strpos($item['body'], '>') !== false)) {
$base_url = \get_app()->getBaseURL(); $base_url = DI::baseUrl()->get();
$item['body'] = HTML::relToAbs($item['body'], $base_url); $item['body'] = HTML::relToAbs($item['body'], $base_url);
$item['body'] = HTML::toBBCodeVideo($item['body']); $item['body'] = HTML::toBBCodeVideo($item['body']);