]> git.mxchange.org Git - friendica.git/commitdiff
Remove deprecated App::getBaseURL() - process methods to DI::baseUrl()->get()
authornupplaPhil <admin@philipp.info>
Mon, 16 Dec 2019 00:05:15 +0000 (01:05 +0100)
committernupplaPhil <admin@philipp.info>
Sun, 29 Dec 2019 19:17:48 +0000 (20:17 +0100)
43 files changed:
mod/dfrn_request.php
mod/profile_photo.php
mod/regmod.php
mod/removeme.php
mod/settings.php
src/App.php
src/Content/Text/BBCode.php
src/Core/Renderer.php
src/Model/Item.php
src/Model/Photo.php
src/Model/Profile.php
src/Module/Admin/Addons/Details.php
src/Module/Admin/Addons/Index.php
src/Module/Admin/Blocklist/Contact.php
src/Module/Admin/Blocklist/Server.php
src/Module/Admin/DBSync.php
src/Module/Admin/Logs/Settings.php
src/Module/Admin/Site.php
src/Module/Admin/Summary.php
src/Module/Admin/Themes/Details.php
src/Module/Admin/Themes/Index.php
src/Module/Admin/Users.php
src/Module/AllFriends.php
src/Module/BaseSearchModule.php
src/Module/Bookmarklet.php
src/Module/Contact.php
src/Module/Debug/Localtime.php
src/Module/Diaspora/Fetch.php
src/Module/Friendica.php
src/Module/Help.php
src/Module/Home.php
src/Module/Install.php
src/Module/Invite.php
src/Module/Magic.php
src/Module/OpenSearch.php
src/Module/ReallySimpleDiscovery.php
src/Module/Security/Login.php
src/Module/WellKnown/HostMeta.php
src/Module/WellKnown/NodeInfo.php
src/Module/WellKnown/XSocialRelay.php
src/Module/Xrd.php
src/Protocol/ActivityPub/Transmitter.php
src/Protocol/DFRN.php

index 0c0e5421ad3ba6cb8558ddfd723737729d6e6627..f7dc5f55cdabd77952269ccbd60c84ff936f4c6f 100644 (file)
@@ -437,7 +437,7 @@ function dfrn_request_post(App $a)
                        }
 
                        // "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);
 
                        System::externalRedirect($parms['dfrn-request'] . "?dfrn_url=$dfrn_url"
index 412d19029eac6e34f287c2f3c00de26892cf19f9..6d625cedeb5350e2f67a6ed265e8436311a9b7f2 100644 (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);
                                // Update global directory in background
                                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());
index 0fc5a889940c85758da8341175f1de996e15f843..e08edfbcc90ff56e9cd20cc3f878ce12fce7eca4 100644 (file)
@@ -16,8 +16,6 @@ use Friendica\Module\Security\Login;
 
 function user_allow($hash)
 {
-       $a = \get_app();
-
        $register = Register::getByHash($hash);
        if (!DBA::isResult($register)) {
                return false;
@@ -45,7 +43,7 @@ function user_allow($hash)
                $l10n,
                $user,
                Config::get('config', 'sitename'),
-               $a->getBaseUrl(),
+               DI::baseUrl()->get(),
                ($register['password'] ?? '') ?: 'Sent in a previous email'
        );
 
index 30e332d328d070ffdfb72c749760cd6021db40ca..ecf65c04c1969747ef9462c1296dd6b14eb20973 100644 (file)
@@ -80,7 +80,7 @@ function removeme_content(App $a)
 
        $tpl = Renderer::getMarkupTemplate('removeme.tpl');
        $o = Renderer::replaceMacros($tpl, [
-               '$basedir' => $a->getBaseURL(),
+               '$basedir' => DI::baseUrl()->get(),
                '$hash' => $hash,
                '$title' => L10n::t('Remove My Account'),
                '$desc' => L10n::t('This will completely remove your account. Once this has been done it is not recoverable.'),
index eb664e378ae5b40e99aa9a1423b71185e45bc31d..7dad1f04c15cc3faaa2aa7609a0bb8c2a5dedf03 100644 (file)
@@ -721,7 +721,7 @@ function settings_content(App $a)
                $tpl = Renderer::getMarkupTemplate('settings/oauth.tpl');
                $o .= Renderer::replaceMacros($tpl, [
                        '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"),
-                       '$baseurl'      => $a->getBaseURL(true),
+                       '$baseurl'      => DI::baseUrl()->get(true),
                        '$title'        => L10n::t('Connected Apps'),
                        '$add'          => L10n::t('Add application'),
                        '$edit'         => L10n::t('Edit'),
index c00a574c2dabf836ac04bf5ad344a3645edbbce2..35ef04df6e29480ea533a7b6e7ed220e290ce845 100644 (file)
@@ -271,20 +271,6 @@ class App
                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
         *
@@ -298,7 +284,7 @@ class App
                        FRIENDICA_CODENAME . "' " .
                        FRIENDICA_VERSION . '-' .
                        DB_UPDATE_VERSION . '; ' .
-                       $this->getBaseURL();
+                       $this->baseURL->get();
        }
 
        /**
@@ -478,8 +464,8 @@ class App
                // and www.example.com vs example.com.
                // 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()))) {
-                       $this->config->set('system', 'url', $this->getBaseURL());
+               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->baseURL->get());
                }
        }
 
index f7ca6efd9783946cfe282afaa59bad7a632770d0..ada0a0f35a424e910ae7588a80615c6364f46f73 100644 (file)
@@ -1152,7 +1152,7 @@ class BBCode
                $a = DI::app();
 
                // 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 (!empty($match[3])) {
                                $text = '[img=' . str_replace('-1.', '-0.', $match[2]) . ']' . $match[3] . '[/img]';
index 8366d0db8081120bfa4906f24e54a03024a4a162..32247310cf907e40c5929cb87305795154f65729 100644 (file)
@@ -61,10 +61,9 @@ class Renderer
        public static function replaceMacros($s, array $vars = [])
        {
                $stamp1 = microtime(true);
-               $a = DI::app();
 
                // 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();
 
index 507ee654ec1c24f023e54f02599f0151ed6924df..16a6a0a24cc7990a8ec599c46120ab9ad0430afd 100644 (file)
@@ -2511,7 +2511,7 @@ class Item
                        $guid = System::createUUID();
                }
 
-               return DI::app()->getBaseURL() . '/objects/' . $guid;
+               return DI::baseUrl()->get() . '/objects/' . $guid;
        }
 
        /**
index af17cc395ea5081a7f8e74c945f997414d1ee477..dd49892240e73ee8a1c9e334c267100fc08241a0 100644 (file)
@@ -679,8 +679,7 @@ class Photo
         */
        public static function getGUID($name)
        {
-               $a = \get_app();
-               $base = $a->getBaseURL();
+               $base = DI::baseUrl()->get();
 
                $guid = str_replace([Strings::normaliseLink($base), '/photo/'], '', Strings::normaliseLink($name));
 
@@ -725,8 +724,7 @@ class Photo
         */
        public static function isLocalPage($name)
        {
-               $a = \get_app();
-               $base = $a->getBaseURL();
+               $base = DI::baseUrl()->get();
 
                $guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name));
                $guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid);
index 3f7877c55891ae286d0e82d054ff0d29fe4898ef..0ebb400f6eb3eefca7e8696f02782328f132114f 100644 (file)
@@ -337,7 +337,7 @@ class Profile
                if (isset($profile['url'])) {
                        $profile_url = $profile['url'];
                } else {
-                       $profile_url = $a->getBaseURL() . '/profile/' . $profile['nickname'];
+                       $profile_url = DI::baseUrl()->get() . '/profile/' . $profile['nickname'];
                }
 
                $follow_link = null;
@@ -1080,13 +1080,13 @@ class Profile
                $query = rtrim(str_replace($addr_request, '', $a->query_string), '?&');
 
                // 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
                // to redirect the visitors '/magic' module.
                $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;
 
                        // We have to check if the remote server does understand /magic without invoking something
index afca0b150c6ee6e1dc3918c937609a5ae85443e2..bc1925717e0ebea858295d2efcb80f262bc6f203 100644 (file)
@@ -101,7 +101,7 @@ class Details extends BaseAdminModule
                                '$page' => L10n::t('Addons'),
                                '$toggle' => L10n::t('Toggle'),
                                '$settings' => L10n::t('Settings'),
-                               '$baseurl' => $a->getBaseURL(true),
+                               '$baseurl' => DI::baseUrl()->get(true),
 
                                '$addon' => $addon,
                                '$status' => $status,
index bc28aaa8feb26dcbc7ce10b66924ca9ca997587d..511cb44755ec0e607f365f299c23372068b5ff8a 100644 (file)
@@ -14,8 +14,6 @@ class Index extends BaseAdminModule
        {
                parent::content($parameters);
 
-               $a = DI::app();
-
                // reload active themes
                if (!empty($_GET['action'])) {
                        parent::checkFormSecurityTokenRedirectOnError('/admin/addons', 'admin_addons', 't');
@@ -52,7 +50,7 @@ class Index extends BaseAdminModule
                        '$page' => L10n::t('Addons'),
                        '$submit' => L10n::t('Save Settings'),
                        '$reload' => L10n::t('Reload active addons'),
-                       '$baseurl' => $a->getBaseURL(true),
+                       '$baseurl' => DI::baseUrl()->get(true),
                        '$function' => 'addons',
                        '$addons' => $addons,
                        '$pcount' => count($addons),
index 71e96834b620cf95607f40504c54ec7d4c4084d4..b2e9c508279f4ce92ca19e6d562ddbccac5f4a3b 100644 (file)
@@ -76,7 +76,7 @@ class Contact extends BaseAdminModule
                        '$form_security_token' => parent::getFormSecurityToken('admin_contactblock'),
 
                        // values //
-                       '$baseurl'    => $a->getBaseURL(true),
+                       '$baseurl'    => DI::baseUrl()->get(true),
 
                        '$contacts'   => $contacts,
                        '$total_contacts' => L10n::tt('%s total blocked contact', '%s total blocked contacts', $total),
index 87cb8709db426ca9ddffa2ca11bd54401cc1b0ca..43c6543e46af1718090a5dac84dcfd73f2ea20fd 100644 (file)
@@ -55,8 +55,6 @@ class Server extends BaseAdminModule
        {
                parent::content($parameters);
 
-               $a = DI::app();
-
                $blocklist = Config::get('system', 'blocklist');
                $blocklistform = [];
                if (is_array($blocklist)) {
@@ -91,7 +89,7 @@ class Server extends BaseAdminModule
                        '$threason' => L10n::t('Reason for the block'),
                        '$delentry' => L10n::t('Delete entry from blocklist'),
                        '$entries' => $blocklistform,
-                       '$baseurl' => $a->getBaseURL(true),
+                       '$baseurl' => DI::baseUrl()->get(true),
                        '$confirm_delete' => L10n::t('Delete entry from blocklist?'),
                        '$form_security_token' => parent::getFormSecurityToken("admin_blocklist")
                ]);
index 6f6ebe3d0003ff729127a63f28774c2db0c4456e..a0e70737e5981bfbf24203ab48eee52d973175f4 100644 (file)
@@ -88,13 +88,13 @@ class DBSync extends BaseAdminModule
 
                if (!count($failed)) {
                        $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.'),
                                '$check' => L10n::t('Check database structure'),
                        ]);
                } else {
                        $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/dbsync/failed_updates.tpl'), [
-                               '$base' => $a->getBaseURL(true),
+                               '$base' => DI::baseUrl()->get(true),
                                '$banner' => L10n::t('Failed Updates'),
                                '$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"),
index ccddf69a1de4a4873b0044eec81e8e9782d8e044..21380af4a560d64a8384e7fbb1a07f9ebd5806b1 100644 (file)
@@ -42,8 +42,6 @@ class Settings extends BaseAdminModule
        {
                parent::content($parameters);
 
-               $a = DI::app();
-
                $log_choices = [
                        LogLevel::ERROR   => 'Error',
                        LogLevel::WARNING => 'Warning',
@@ -65,7 +63,7 @@ class Settings extends BaseAdminModule
                        '$page' => L10n::t('Logs'),
                        '$submit' => L10n::t('Save Settings'),
                        '$clear' => L10n::t('Clear'),
-                       '$baseurl' => $a->getBaseURL(true),
+                       '$baseurl' => DI::baseUrl()->get(true),
                        '$logname' => Config::get('system', 'logfile'),
                        // see /help/smarty3-templates#1_1 on any Friendica node
                        '$debugging' => ['debugging', L10n::t("Enable Debugging"), Config::get('system', 'debugging'), ""],
index 267680583d358e8284dcb200686c69522d9cdcca..ed16a65b77ef388f1a97021f97cb9e934cbd39b2 100644 (file)
@@ -56,7 +56,7 @@ class Site extends BaseAdminModule
                         * 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
                        $new_host = str_replace("http://", "@", Strings::normaliseLink($new_url));
@@ -417,8 +417,6 @@ class Site extends BaseAdminModule
        {
                parent::content($parameters);
 
-               $a = DI::app();
-
                /* Installed langs */
                $lang_choices = L10n::getAvailableLanguages();
 
@@ -578,7 +576,7 @@ class Site extends BaseAdminModule
                        '$relay_title'       => L10n::t('Message Relay'),
                        '$relocate'          => L10n::t('Relocate Instance'),
                        '$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...
                        '$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.')],
                        '$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')]],
 
                        '$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_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_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')],
index 9853ce951bdcdfaf8767ffa498ce543696082ff1..6f304082af6d7d355056e8f4950c87927729a329 100644 (file)
@@ -63,18 +63,18 @@ class Summary extends BaseAdminModule
 
                // Legacy config file warning
                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')) {
-                       $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
                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.',
-                               $well_known, $well_known, $a->getBaseURL() . '/help/Install');
+                               $well_known, $well_known, DI::baseUrl()->get() . '/help/Install');
                }
 
                // Check logfile permission
@@ -208,7 +208,7 @@ class Summary extends BaseAdminModule
        private static function checkSelfHostMeta()
        {
                // 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();
        }
 
 }
index f6a3c61b731db6c43af65c5537ce4a4323165a17..2b573eec3b4c2ae36f0422108abaf0443f6a0a22 100644 (file)
@@ -106,7 +106,7 @@ class Details extends BaseAdminModule
                                '$page' => L10n::t('Themes'),
                                '$toggle' => L10n::t('Toggle'),
                                '$settings' => L10n::t('Settings'),
-                               '$baseurl' => $a->getBaseURL(true),
+                               '$baseurl' => DI::baseUrl()->get(true),
                                '$addon' => $theme,
                                '$status' => $status,
                                '$action' => $action,
index 63b3d6f39ef6a03a4cf6ffd30708c03df0bc01b0..dc848f93f85dd2d9008aee3b021c32d3c7a64f11 100644 (file)
@@ -16,13 +16,11 @@ class Index extends BaseAdminModule
        {
                parent::content($parameters);
 
-               $a = DI::app();
-
                $allowed_themes = Theme::getAllowedList();
 
                // reload active themes
                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']) {
                                case 'reload':
@@ -97,7 +95,7 @@ class Index extends BaseAdminModule
                        '$page'                => L10n::t('Themes'),
                        '$submit'              => L10n::t('Save Settings'),
                        '$reload'              => L10n::t('Reload active themes'),
-                       '$baseurl'             => $a->getBaseURL(true),
+                       '$baseurl'             => DI::baseUrl()->get(true),
                        '$function'            => 'themes',
                        '$addons'              => $addons,
                        '$pcount'              => count($themes),
index 7d8574e56b62824570094c85b061ff50ffdc30dd..286bc04452fb940cd366f0933f1d582bd34187a0 100644 (file)
@@ -20,8 +20,6 @@ class Users extends BaseAdminModule
        {
                parent::post($parameters);
 
-               $a = DI::app();
-
                $pending     = $_POST['pending']           ?? [];
                $users       = $_POST['user']              ?? [];
                $nu_name     = $_POST['new_user_name']     ?? '';
@@ -78,7 +76,7 @@ class Users extends BaseAdminModule
                        Thank you and welcome to %4$s.'));
 
                        $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([
                                'type'     => SYSTEM_EMAIL,
@@ -306,7 +304,7 @@ class Users extends BaseAdminModule
                        '$form_security_token' => parent::getFormSecurityToken('admin_users'),
 
                        // values //
-                       '$baseurl' => $a->getBaseURL(true),
+                       '$baseurl' => DI::baseUrl()->get(true),
 
                        '$pending' => $pending,
                        'deleted' => $deleted,
index 26999907363644ee2a8f998b3350ab2352c00fb8..14095f450774cc314c621212a9e16006c304cfd1 100644 (file)
@@ -70,7 +70,7 @@ class AllFriends extends BaseModule
                                $friend['id'] = $friend['cid'];
                                $photoMenu = Model\Contact::photoMenu($friend);
                        } else {
-                               $connlnk = $app->getBaseURL() . '/follow/?url=' . $friend['url'];
+                               $connlnk = DI::baseUrl()->get() . '/follow/?url=' . $friend['url'];
                                $photoMenu = [
                                        'profile' => [L10n::t('View Profile'), Model\Contact::magicLinkbyId($friend['id'], $friend['url'])],
                                        'follow'  => [L10n::t('Connect/Follow'), $connlnk]
index efedca92af3cc543b88ed5f82192d6af1742d193..cf0159cc273daec942dff0212fe3fa99ec02c76f 100644 (file)
@@ -97,8 +97,6 @@ class BaseSearchModule extends BaseModule
                        return '';
                }
 
-               $a = DI::app();
-
                $id      = 0;
                $entries = [];
                foreach ($results->getResults() as $result) {
@@ -131,7 +129,7 @@ class BaseSearchModule extends BaseModule
                                                $photo_menu = [];
                                        }
                                } else {
-                                       $connLink = $a->getBaseURL() . '/follow/?url=' . $result->getUrl();
+                                       $connLink = DI::baseUrl()->get() . '/follow/?url=' . $result->getUrl();
                                        $connTxt  = L10n::t('Connect');
 
                                        $photo_menu['profile'] = [L10n::t("View Profile"), Model\Contact::magicLink($result->getUrl())];
index 93f790a37d7be77642a9a6a187d552bd77960a27..c7f4cdae4a4e0e91e64e27fac1082cfcdc8660bc 100644 (file)
@@ -30,7 +30,7 @@ class Bookmarklet extends BaseModule
                }
 
                $referer = Strings::normaliseLink($_SERVER['HTTP_REFERER'] ?? '');
-               $page = Strings::normaliseLink($app->getBaseURL() . "/bookmarklet");
+               $page = Strings::normaliseLink(DI::baseUrl()->get() . "/bookmarklet");
 
                if (!strstr($referer, $page)) {
                        if (empty($_REQUEST["url"])) {
index 45e4900ac2ee8227f549edd8bdca8d76def3199f..f7c6680ed4592ccccb2356e378e0aa695175471b 100644 (file)
@@ -351,7 +351,7 @@ class Contact extends BaseModule
 
                $tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
                $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
-                       '$baseurl' => $a->getBaseURL(true),
+                       '$baseurl' => DI::baseUrl()->get(true),
                ]);
 
                $sort_type = 0;
@@ -473,7 +473,7 @@ class Contact extends BaseModule
                        $contact = $a->data['contact'];
 
                        $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());
index b762abdbc54c8bf7da59a65da9b1f951bea3eb68..d9e2489790d77751cd9750d18078494af11c2f58 100644 (file)
@@ -40,7 +40,7 @@ class Localtime extends BaseModule
                        $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 .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ);
                $output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
index 9ed8fb109e8e2d6e64908cdc4637892b1dc8e347..c19857fde31625c390484cea5a8967f40853341c 100644 (file)
@@ -47,7 +47,7 @@ class Fetch extends BaseModule
                                }
                                $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);
                                        System::externalRedirect($location, 301);
                                }
index 4f33fea43a2aa98f2e348a90845683826a2ab077..11773a06d2b417fabc5254bd38bf13c2757eb040 100644 (file)
@@ -18,7 +18,6 @@ class Friendica extends BaseModule
 {
        public static function content(array $parameters = [])
        {
-               $app = DI::app();
                $config = DI::config();
 
                $visibleAddonList = Addon::getVisibleList();
@@ -48,7 +47,7 @@ class Friendica extends BaseModule
                }
 
                $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');
@@ -75,7 +74,7 @@ class Friendica extends BaseModule
                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.',
                                '<strong>' . FRIENDICA_VERSION . '</strong>',
-                               $app->getBaseURL(),
+                               DI::baseUrl()->get(),
                                '<strong>' . DB_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.'),
@@ -125,7 +124,7 @@ class Friendica extends BaseModule
                        if (!empty($administrator)) {
                                $admin = [
                                        '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 = [
                        'version'          => FRIENDICA_VERSION,
-                       'url'              => $app->getBaseURL(),
+                       'url'              => DI::baseUrl()->get(),
                        'addons'           => $visible_addons,
                        'locked_features'  => $locked_features,
                        'explicit_content' => intval($config->get('system', 'explicit_content', 0)),
@@ -157,7 +156,7 @@ class Friendica extends BaseModule
                        'site_name'        => $config->get('config', 'sitename'),
                        'platform'         => FRIENDICA_PLATFORM,
                        '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');
index 70c99a0a6fd7c47c78c80f8be0d39a8bb54dd814..d9362712fd6e597d3b9f7ef0f0aeb6d9283f1f66 100644 (file)
@@ -87,7 +87,7 @@ class Help extends BaseModule
 
                                                $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>";
                                                $id = implode("_", array_slice($idNum, 1, $level));
                                                $line = "<a name=\"{$id}\"></a>" . $line;
index fc8817b31b6846d507096bd8775aced5a9d31501..fbdc252a66667a21f6b63249c6a8581be98df9f2 100644 (file)
@@ -42,7 +42,7 @@ class Home extends BaseModule
                        $customHome = $homeFilePath;
 
                        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" />';
                        }
                }
 
index 10a6176e402e2fba7f3866da298b45f93dfb2888..537338da15d3ee93259adf4b88f353998c5ae703 100644 (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
                // 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;
        }
@@ -162,7 +162,7 @@ class Install extends BaseModule
                        case self::SYSTEM_CHECK:
                                $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');
                                $output .= Renderer::replaceMacros($tpl, [
@@ -303,7 +303,7 @@ class Install extends BaseModule
                                        '$title'  => $install_title,
                                        '$checks' => self::$installer->getChecks(),
                                        '$pass'   => L10n::t('Installation finished'),
-                                       '$text'   => $db_return_text . self::whatNext($a),
+                                       '$text'   => $db_return_text . self::whatNext(),
                                ]);
 
                                break;
@@ -315,14 +315,12 @@ class Install extends BaseModule
        /**
         * Creates the text for the next steps
         *
-        * @param App $a The global App
-        *
         * @return string The text for the next steps
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       private static function whatNext($a)
+       private static function whatNext()
        {
-               $baseurl = $a->getBaseUrl();
+               $baseurl = DI::baseUrl()->get();
                return
                        L10n::t('<h1>What next</h1>')
                        . "<p>" . L10n::t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.')
index 52d9bbcea39ac12c834f3042d631fc072bb30f31..67d26f6fa78af31c955f82ff2f721b8150cf9244 100644 (file)
@@ -129,14 +129,14 @@ class Invite extends BaseModule
                        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');
                        } 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');
                        }
                } else { // there is no global directory URL defined
                        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.');
                        } 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.'));
                        }
                }
@@ -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"
                                . $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" . $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",
                        ],
                        '$submit'              => L10n::t('Submit')
index b878b0e7017869e607004d8990b491d35b782e60..0ac05ccdf8e8dc2a97470be0f4018012ca87f428 100644 (file)
@@ -49,7 +49,7 @@ class Magic extends BaseModule
                $contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
 
                // 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) {
                                $ret['success'] = true;
                                $ret['message'] .= 'Local site - you are already authenticated.' . EOL;
index dbf04040b89b5c83561cf38dc6619b194b28841d..e1da6741841190dcb9ad71e0e1d3442c3a8cb197 100644 (file)
@@ -22,7 +22,7 @@ class OpenSearch extends BaseModule
                header('Content-type: application/opensearchdescription+xml');
 
                $hostname = DI::baseUrl()->getHostname()();
-               $baseUrl  = DI::app()->getBaseURL();
+               $baseUrl  = DI::baseUrl()->get();
 
                /** @var DOMDocument $xml */
                $xml = null;
index 43fdcf102c81d3c5f6e19cdc560384579e76e072..382fe12d4f9d3c823482267825935645df0e5cc8 100644 (file)
@@ -16,7 +16,6 @@ class ReallySimpleDiscovery extends BaseModule
        {
                header('Content-Type: text/xml');
 
-               $app = DI::app();
                $xml = null;
                echo XML::fromArray([
                        'rsd' => [
@@ -32,7 +31,7 @@ class ReallySimpleDiscovery extends BaseModule
                                                        '@attributes' => [
                                                                'name'      => 'Twitter',
                                                                'preferred' => 'true',
-                                                               'apiLink'   => $app->getBaseURL(),
+                                                               'apiLink'   => DI::baseUrl()->get(),
                                                                'blogID'    => '',
                                                        ],
                                                        'settings'    => [
index c5257789855a1fc255f19e5d9956f97be5c66928..cddd014d00434da67d74f64f4d81cc9456a14f9f 100644 (file)
@@ -104,7 +104,7 @@ class Login extends BaseModule
                        $a->page['htmlhead'] .= Renderer::replaceMacros(
                                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(
                        $tpl,
                        [
-                               '$dest_url'     => DI::app()->getBaseURL(true) . '/login',
+                               '$dest_url'     => DI::baseUrl()->get(true) . '/login',
                                '$logout'       => L10n::t('Logout'),
                                '$login'        => L10n::t('Login'),
 
index 2e63f300de8d53ad1bb526d1e45e83bc0900bb23..2bae006a7081f7fcff95ee439269d3eca4be89af 100644 (file)
@@ -16,7 +16,6 @@ class HostMeta extends BaseModule
 {
        public static function rawContent(array $parameters = [])
        {
-               $app = DI::app();
                $config = DI::config();
 
                header('Content-type: text/xml');
@@ -31,8 +30,8 @@ class HostMeta extends BaseModule
                $tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
                echo Renderer::replaceMacros($tpl, [
                        '$zhost'  => DI::baseUrl()->getHostname()(),
-                       '$zroot'  => $app->getBaseURL(),
-                       '$domain' => $app->getBaseURL(),
+                       '$zroot'  => DI::baseUrl()->get(),
+                       '$domain' => DI::baseUrl()->get(),
                        '$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))
                ]);
 
index 4f44e81d9c69f122862b0c5cf1a7e540280394a9..d0d2ea7a0212121302418f6291135e5ee38ddec9 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Friendica\Module\WellKnown;
 
-use Friendica\App;
 use Friendica\BaseModule;
 use Friendica\DI;
 
@@ -14,26 +13,22 @@ class NodeInfo extends BaseModule
 {
        public static function rawContent(array $parameters = [])
        {
-               $app = DI::app();
-
-               self::printWellKnown($app);
+               self::printWellKnown();
        }
 
        /**
         * Prints the well-known nodeinfo redirect
         *
-        * @param App $app
-        *
         * @throws \Friendica\Network\HTTPException\NotFoundException
         */
-       private static function printWellKnown(App $app)
+       private static function printWellKnown()
        {
                $nodeinfo = [
                        'links' => [
                                ['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',
-                               'href' => $app->getBaseURL() . '/nodeinfo/2.0'],
+                               'href' => DI::baseUrl()->get() . '/nodeinfo/2.0'],
                        ]
                ];
 
index 38a9e12435091263722e899608ae87522ead71b3..f9a806f03c3ecb0649f27207abc9d1236f91acb9 100644 (file)
@@ -14,7 +14,6 @@ class XSocialRelay extends BaseModule
 {
        public static function rawContent(array $parameters = [])
        {
-               $app = DI::app();
                $config = DI::config();
 
                $subscribe = $config->get('system', 'relay_subscribe', false);
@@ -50,10 +49,10 @@ class XSocialRelay extends BaseModule
                        'tags'      => $tagList,
                        'protocols' => [
                                'diaspora' => [
-                                       'receive' => $app->getBaseURL() . '/receive/public'
+                                       'receive' => DI::baseUrl()->get() . '/receive/public'
                                ],
                                'dfrn'     => [
-                                       'receive' => $app->getBaseURL() . '/dfrn_notify'
+                                       'receive' => DI::baseUrl()->get() . '/dfrn_notify'
                                ]
                        ]
                ];
index 63b293daf43761cb89016cd63f47a9bdd8c4e233..0048350be8a579c85ee9ee6f346273b5bdf5d424 100644 (file)
@@ -75,9 +75,9 @@ class Xrd extends BaseModule
                }
 
                if ($mode == 'xml') {
-                       self::printXML($alias, $app->getBaseURL(), $user, $owner, $avatar);
+                       self::printXML($alias, DI::baseUrl()->get(), $user, $owner, $avatar);
                } else {
-                       self::printJSON($alias, $app->getBaseURL(), $owner, $avatar);
+                       self::printJSON($alias, DI::baseUrl()->get(), $owner, $avatar);
                }
        }
 
index 398ee3ae8f6318b390916f6381ebfce85d511307..d345340f8542029a803f7acefed3e05f25b1819f 100644 (file)
@@ -204,7 +204,7 @@ class Transmitter
        {
                return ['type' => 'Service',
                        'name' =>  FRIENDICA_PLATFORM . " '" . FRIENDICA_CODENAME . "' " . FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
-                       'url' => DI::app()->getBaseURL()];
+                       'url' => DI::baseUrl()->get()];
        }
 
        /**
index c20f06956735419f45701063b7f237b89008561a..e058854c9416ff1f07a8d4ba3f83f8ea628145fb 100644 (file)
@@ -2372,7 +2372,7 @@ class DFRN
 
                /// @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)) {
-                       $base_url = \get_app()->getBaseURL();
+                       $base_url = DI::baseUrl()->get();
                        $item['body'] = HTML::relToAbs($item['body'], $base_url);
 
                        $item['body'] = HTML::toBBCodeVideo($item['body']);