From 544168244c47ef0a01fa6782dd4920d7d9af066b Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 19 Feb 2023 11:12:48 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- mod/message.php | 3 --- src/Module/Admin/Addons/Details.php | 1 - src/Module/Admin/Addons/Index.php | 1 - src/Module/Admin/Features.php | 1 - src/Module/Admin/Logs/Settings.php | 1 - src/Module/Admin/Logs/View.php | 1 - src/Module/Admin/Site.php | 1 - src/Module/Admin/Storage.php | 1 - src/Module/Admin/Themes/Details.php | 1 - src/Module/Admin/Themes/Embed.php | 2 +- src/Module/Admin/Themes/Index.php | 1 - src/Module/Contact.php | 1 - src/Module/Contact/Profile.php | 1 - src/Module/Debug/Localtime.php | 2 +- src/Module/Help.php | 2 +- src/Module/Home.php | 2 +- src/Module/Install.php | 2 +- src/Module/Moderation/Users/Create.php | 1 - src/Module/Moderation/Users/Deleted.php | 1 - src/Module/Moderation/Users/Index.php | 1 - src/Module/Moderation/Users/Pending.php | 1 - src/Module/NodeInfo210.php | 1 - src/Module/Profile/Schedule.php | 1 - src/Module/Profile/UnkMail.php | 1 - src/Module/Security/Login.php | 1 - src/Module/Security/PasswordTooLong.php | 1 - src/Module/Settings/Account.php | 1 - src/Module/Settings/Display.php | 1 - src/Module/Settings/OAuth.php | 1 - src/Module/Settings/Profile/Index.php | 1 - 30 files changed, 5 insertions(+), 32 deletions(-) diff --git a/mod/message.php b/mod/message.php index c5d923de0b..1e8c012eeb 100644 --- a/mod/message.php +++ b/mod/message.php @@ -58,7 +58,6 @@ function message_init(App $a) $head_tpl = Renderer::getMarkupTemplate('message-head.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ - '$baseurl' => DI::baseUrl(), '$base' => $base ]); } @@ -178,7 +177,6 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => DI::baseUrl(), '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); @@ -284,7 +282,6 @@ function message_content(App $a) $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => DI::baseUrl(), '$nickname' => $a->getLoggedInUserNickname(), '$linkurl' => DI::l10n()->t('Please enter a link URL:') ]); diff --git a/src/Module/Admin/Addons/Details.php b/src/Module/Admin/Addons/Details.php index 51b900d611..1667f7d5c7 100644 --- a/src/Module/Admin/Addons/Details.php +++ b/src/Module/Admin/Addons/Details.php @@ -112,7 +112,6 @@ class Details extends BaseAdmin '$page' => DI::l10n()->t('Addons'), '$toggle' => DI::l10n()->t('Toggle'), '$settings' => DI::l10n()->t('Settings'), - '$baseurl' => DI::baseUrl(), '$addon' => $addon, '$status' => $status, diff --git a/src/Module/Admin/Addons/Index.php b/src/Module/Admin/Addons/Index.php index 4ec7a334a9..ca8e075012 100644 --- a/src/Module/Admin/Addons/Index.php +++ b/src/Module/Admin/Addons/Index.php @@ -68,7 +68,6 @@ class Index extends BaseAdmin '$page' => DI::l10n()->t('Addons'), '$submit' => DI::l10n()->t('Save Settings'), '$reload' => DI::l10n()->t('Reload active addons'), - '$baseurl' => DI::baseUrl(), '$function' => 'addons', '$addons' => $addons, '$pcount' => count($addons), diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index b9e3b1f64a..f3e55a7e9c 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -81,7 +81,6 @@ class Features extends BaseAdmin $tpl = Renderer::getMarkupTemplate('admin/features.tpl'); $o = Renderer::replaceMacros($tpl, [ '$form_security_token' => self::getFormSecurityToken("admin_manage_features"), - '$baseurl' => DI::baseUrl(), '$title' => DI::l10n()->t('Manage Additional Features'), '$features' => $features, '$submit' => DI::l10n()->t('Save Settings'), diff --git a/src/Module/Admin/Logs/Settings.php b/src/Module/Admin/Logs/Settings.php index 34460e1cce..91b2938710 100644 --- a/src/Module/Admin/Logs/Settings.php +++ b/src/Module/Admin/Logs/Settings.php @@ -80,7 +80,6 @@ class Settings extends BaseAdmin '$page' => DI::l10n()->t('Logs'), '$submit' => DI::l10n()->t('Save Settings'), '$clear' => DI::l10n()->t('Clear'), - '$baseurl' => DI::baseUrl(), '$logname' => DI::config()->get('system', 'logfile'), // see /help/smarty3-templates#1_1 on any Friendica node '$debugging' => ['debugging', DI::l10n()->t("Enable Debugging"), DI::config()->get('system', 'debugging'), ""], diff --git a/src/Module/Admin/Logs/View.php b/src/Module/Admin/Logs/View.php index cd98ae1336..bab804f4e0 100644 --- a/src/Module/Admin/Logs/View.php +++ b/src/Module/Admin/Logs/View.php @@ -80,7 +80,6 @@ class View extends BaseAdmin } } return Renderer::replaceMacros($t, [ - '$baseurl' => DI::baseUrl(), '$title' => DI::l10n()->t('Administration'), '$page' => DI::l10n()->t('View Logs'), '$l10n' => [ diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index f1ef5d7642..8e2e10fab0 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -406,7 +406,6 @@ class Site extends BaseAdmin '$relocate' => DI::l10n()->t('Relocate Node'), '$relocate_msg' => DI::l10n()->t('Relocating your node enables you to change the DNS domain of this node and keep all the existing users and posts. This process takes a while and can only be started from the relocate console command like this:'), '$relocate_cmd' => DI::l10n()->t('(Friendica directory)# bin/console relocate https://newdomain.com'), - '$baseurl' => DI::baseUrl(), // name, label, value, help string, extra data... '$sitename' => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''], diff --git a/src/Module/Admin/Storage.php b/src/Module/Admin/Storage.php index 8baff7ae24..71d34cb25d 100644 --- a/src/Module/Admin/Storage.php +++ b/src/Module/Admin/Storage.php @@ -144,7 +144,6 @@ class Storage extends BaseAdmin '$use' => DI::l10n()->t('Use storage backend'), '$save_reload' => DI::l10n()->t('Save & Reload'), '$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'), - '$baseurl' => DI::baseUrl(), '$form_security_token' => self::getFormSecurityToken("admin_storage"), '$storagebackend' => $current_storage_backend instanceof ICanWriteToStorage ? $current_storage_backend::getName() : DI::l10n()->t('Database (legacy)'), '$availablestorageforms' => $available_storage_forms, diff --git a/src/Module/Admin/Themes/Details.php b/src/Module/Admin/Themes/Details.php index c6bf3dac38..7648b6b97e 100644 --- a/src/Module/Admin/Themes/Details.php +++ b/src/Module/Admin/Themes/Details.php @@ -91,7 +91,6 @@ class Details extends BaseAdmin '$page' => DI::l10n()->t('Themes'), '$toggle' => DI::l10n()->t('Toggle'), '$settings' => DI::l10n()->t('Settings'), - '$baseurl' => DI::baseUrl(), '$addon' => $theme, '$status' => $status, '$action' => $action, diff --git a/src/Module/Admin/Themes/Embed.php b/src/Module/Admin/Themes/Embed.php index 82539eeb0d..389f829412 100644 --- a/src/Module/Admin/Themes/Embed.php +++ b/src/Module/Admin/Themes/Embed.php @@ -95,7 +95,7 @@ class Embed extends BaseAdmin $t = Renderer::getMarkupTemplate('admin/addons/embed.tpl'); return Renderer::replaceMacros($t, [ - '$action' => DI::baseUrl() . '/admin/themes/' . $theme . '/embed?mode=minimal', + '$action' => 'admin/themes/' . $theme . '/embed?mode=minimal', '$form' => $admin_form, '$form_security_token' => self::getFormSecurityToken("admin_theme_settings"), ]); diff --git a/src/Module/Admin/Themes/Index.php b/src/Module/Admin/Themes/Index.php index 69f516a63d..c74297744b 100644 --- a/src/Module/Admin/Themes/Index.php +++ b/src/Module/Admin/Themes/Index.php @@ -112,7 +112,6 @@ class Index extends BaseAdmin '$page' => DI::l10n()->t('Themes'), '$submit' => DI::l10n()->t('Save Settings'), '$reload' => DI::l10n()->t('Reload active themes'), - '$baseurl' => DI::baseUrl(), '$function' => 'themes', '$addons' => $addons, '$pcount' => count($themes), diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 0e378de36e..a70db02345 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -220,7 +220,6 @@ class Contact extends BaseModule $tpl = Renderer::getMarkupTemplate('contacts-head.tpl'); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => DI::baseUrl(), ]); $o = ''; diff --git a/src/Module/Contact/Profile.php b/src/Module/Contact/Profile.php index d56655218e..34d02ac228 100644 --- a/src/Module/Contact/Profile.php +++ b/src/Module/Contact/Profile.php @@ -236,7 +236,6 @@ class Profile extends BaseModule $_SESSION['return_path'] = $this->args->getQueryString(); $this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [ - '$baseurl' => $this->baseUrl, ]); switch ($localRelationship->rel) { diff --git a/src/Module/Debug/Localtime.php b/src/Module/Debug/Localtime.php index 519fe751e0..1d5d966ad5 100644 --- a/src/Module/Debug/Localtime.php +++ b/src/Module/Debug/Localtime.php @@ -58,7 +58,7 @@ class Localtime extends BaseModule $output .= '

' . DI::l10n()->t('Converted localtime: %s', self::$mod_localtime) . '

'; } - $output .= '
'; + $output .= ''; $output .= '

' . DI::l10n()->t('Please select your timezone:') . '

'; $output .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ); $output .= '
'; diff --git a/src/Module/Help.php b/src/Module/Help.php index 03392c73a6..3212d2fe48 100644 --- a/src/Module/Help.php +++ b/src/Module/Help.php @@ -102,7 +102,7 @@ class Help extends BaseModule $idNum[$level] ++; - $href = DI::baseUrl() . "/help/{$filename}#{$anchor}"; + $href = "help/{$filename}#{$anchor}"; $toc .= "
  • " . strip_tags($line) . "
  • "; $id = implode("_", array_slice($idNum, 1, $level)); $line = "" . $line; diff --git a/src/Module/Home.php b/src/Module/Home.php index cfafc55251..fbba889a88 100644 --- a/src/Module/Home.php +++ b/src/Module/Home.php @@ -69,7 +69,7 @@ class Home extends BaseModule $customHome = $homeFilePath; if (file_exists($cssFilePath)) { - DI::page()['htmlhead'] .= ''; + DI::page()->registerStylesheet('home.css', 'all'); } } diff --git a/src/Module/Install.php b/src/Module/Install.php index e8093095b0..abf7602379 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -228,7 +228,7 @@ class Install extends BaseModule '$system_url' => ['system-url', $this->t('The Friendica system URL'), (string)$baseUrl, - $this->t('Overwrite this field in case the system URL determination isn\'t right, otherwise leave it as is.'), + $this->t("Overwrite this field in case the system URL determination isn't right, otherwise leave it as is."), $this->t('Required')], '$php_path' => $configCache->get('config', 'php_path'), '$submit' => $this->t('Submit'), diff --git a/src/Module/Moderation/Users/Create.php b/src/Module/Moderation/Users/Create.php index 48a9b1eef4..75792541e3 100644 --- a/src/Module/Moderation/Users/Create.php +++ b/src/Module/Moderation/Users/Create.php @@ -65,7 +65,6 @@ class Create extends BaseUsers '$form_security_token' => self::getFormSecurityToken('admin_users_create'), // values // - '$baseurl' => $this->baseUrl, '$query_string' => $this->args->getQueryString(), '$newusername' => ['new_user_name', $this->t('Name'), '', $this->t('Name of the new user.')], diff --git a/src/Module/Moderation/Users/Deleted.php b/src/Module/Moderation/Users/Deleted.php index 4781102876..58a29ed551 100644 --- a/src/Module/Moderation/Users/Deleted.php +++ b/src/Module/Moderation/Users/Deleted.php @@ -85,7 +85,6 @@ class Deleted extends BaseUsers '$form_security_token' => self::getFormSecurityToken('moderation_users_deleted'), // values // - '$baseurl' => $this->baseUrl, '$query_string' => $this->args->getQueryString(), '$users' => $users, diff --git a/src/Module/Moderation/Users/Index.php b/src/Module/Moderation/Users/Index.php index 0df32c5097..d517ab9dd9 100644 --- a/src/Module/Moderation/Users/Index.php +++ b/src/Module/Moderation/Users/Index.php @@ -168,7 +168,6 @@ class Index extends BaseUsers '$form_security_token' => self::getFormSecurityToken('moderation_users'), // values // - '$baseurl' => $this->baseUrl, '$query_string' => $this->args->getQueryString(), '$users' => $users, diff --git a/src/Module/Moderation/Users/Pending.php b/src/Module/Moderation/Users/Pending.php index 40e64bb8af..d0fb7b8d11 100644 --- a/src/Module/Moderation/Users/Pending.php +++ b/src/Module/Moderation/Users/Pending.php @@ -105,7 +105,6 @@ class Pending extends BaseUsers '$form_security_token' => self::getFormSecurityToken('admin_users_pending'), // values // - '$baseurl' => $this->baseUrl, '$query_string' => $this->args->getQueryString(), '$pending' => $pending, diff --git a/src/Module/NodeInfo210.php b/src/Module/NodeInfo210.php index ea55a33f16..e7112846c6 100644 --- a/src/Module/NodeInfo210.php +++ b/src/Module/NodeInfo210.php @@ -52,7 +52,6 @@ class NodeInfo210 extends BaseModule $nodeinfo = [ 'version' => '1.0', 'server' => [ - 'baseUrl' => $this->baseUrl, 'name' => $this->config->get('config', 'sitename'), 'software' => 'friendica', 'version' => App::VERSION . '-' . DB_UPDATE_VERSION, diff --git a/src/Module/Profile/Schedule.php b/src/Module/Profile/Schedule.php index cc4f134414..ef57c294aa 100644 --- a/src/Module/Profile/Schedule.php +++ b/src/Module/Profile/Schedule.php @@ -78,7 +78,6 @@ class Schedule extends BaseProfile $tpl = Renderer::getMarkupTemplate('profile/schedule.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseModule::getFormSecurityToken("profile_schedule"), - '$baseurl' => DI::baseUrl(), '$title' => DI::l10n()->t('Scheduled Posts'), '$nickname' => $this->parameters['nickname'] ?? '', '$scheduled_at' => DI::l10n()->t('Scheduled'), diff --git a/src/Module/Profile/UnkMail.php b/src/Module/Profile/UnkMail.php index 8393327251..4b38d20378 100644 --- a/src/Module/Profile/UnkMail.php +++ b/src/Module/Profile/UnkMail.php @@ -141,7 +141,6 @@ class UnkMail extends \Friendica\BaseModule $tpl = Renderer::getMarkupTemplate('profile/unkmail-header.tpl'); $this->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ - '$baseurl' => $this->baseUrl, '$nickname' => $user['nickname'], '$linkurl' => $this->l10n->t('Please enter a link URL:') ]); diff --git a/src/Module/Security/Login.php b/src/Module/Security/Login.php index 634123a8e3..c5028ffc57 100644 --- a/src/Module/Security/Login.php +++ b/src/Module/Security/Login.php @@ -132,7 +132,6 @@ class Login extends BaseModule DI::page()['htmlhead'] .= Renderer::replaceMacros( Renderer::getMarkupTemplate('login_head.tpl'), [ - '$baseurl' => DI::baseUrl() ] ); diff --git a/src/Module/Security/PasswordTooLong.php b/src/Module/Security/PasswordTooLong.php index b4117a5060..eeeae4084e 100644 --- a/src/Module/Security/PasswordTooLong.php +++ b/src/Module/Security/PasswordTooLong.php @@ -93,7 +93,6 @@ class PasswordTooLong extends \Friendica\BaseModule 'submit' => $this->l10n->t('Update Password'), ], - '$baseurl' => $this->baseUrl, '$form_security_token' => self::getFormSecurityToken('security/password_too_long'), '$return_url' => $request['return_url'] ?? '', diff --git a/src/Module/Settings/Account.php b/src/Module/Settings/Account.php index 4e756a849d..cba12cc395 100644 --- a/src/Module/Settings/Account.php +++ b/src/Module/Settings/Account.php @@ -558,7 +558,6 @@ class Account extends BaseSettings '$desc' => DI::l10n()->t("Your Identity Address is '%s' or '%s'.", $nickname . '@' . DI::baseUrl()->getHost() . DI::baseUrl()->getPath(), DI::baseUrl() . '/profile/' . $nickname), '$submit' => DI::l10n()->t('Save Settings'), - '$baseurl' => DI::baseUrl(), '$uid' => DI::userSession()->getLocalUserId(), '$form_security_token' => self::getFormSecurityToken('settings'), '$open' => $this->parameters['open'] ?? 'password', diff --git a/src/Module/Settings/Display.php b/src/Module/Settings/Display.php index c614eccd04..d24a8e10d4 100644 --- a/src/Module/Settings/Display.php +++ b/src/Module/Settings/Display.php @@ -252,7 +252,6 @@ class Display extends BaseSettings '$calendar_title' => $this->t('Calendar'), '$form_security_token' => self::getFormSecurityToken('settings_display'), - '$baseurl' => $this->baseUrl, '$uid' => $uid, '$theme' => ['theme', $this->t('Display Theme:'), $theme_selected, '', $themes, true], diff --git a/src/Module/Settings/OAuth.php b/src/Module/Settings/OAuth.php index 50ac3e95dc..98c547e1a7 100644 --- a/src/Module/Settings/OAuth.php +++ b/src/Module/Settings/OAuth.php @@ -68,7 +68,6 @@ class OAuth extends BaseSettings $tpl = Renderer::getMarkupTemplate('settings/oauth.tpl'); return Renderer::replaceMacros($tpl, [ '$form_security_token' => BaseSettings::getFormSecurityToken('settings_oauth'), - '$baseurl' => $this->baseUrl, '$title' => $this->t('Connected Apps'), '$name' => $this->t('Name'), '$website' => $this->t('Home Page'), diff --git a/src/Module/Settings/Profile/Index.php b/src/Module/Settings/Profile/Index.php index baf4a71f31..4e3967ec1b 100644 --- a/src/Module/Settings/Profile/Index.php +++ b/src/Module/Settings/Profile/Index.php @@ -208,7 +208,6 @@ class Index extends BaseSettings ]; DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/profile/index_head.tpl'), [ - '$baseurl' => DI::baseUrl(), ]); $personal_account = ($profile['account-type'] != User::ACCOUNT_TYPE_COMMUNITY);