Apply suggestions from code review

Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
This commit is contained in:
Philipp 2023-02-19 11:12:48 +01:00 committed by GitHub
parent 92850d4482
commit 544168244c
30 changed files with 5 additions and 32 deletions

View File

@ -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:')
]);

View File

@ -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,

View File

@ -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),

View File

@ -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'),

View File

@ -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'), ""],

View File

@ -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' => [

View File

@ -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'), ''],

View File

@ -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,

View File

@ -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,

View File

@ -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"),
]);

View File

@ -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),

View File

@ -220,7 +220,6 @@ class Contact extends BaseModule
$tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => DI::baseUrl(),
]);
$o = '';

View File

@ -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) {

View File

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

View File

@ -102,7 +102,7 @@ class Help extends BaseModule
$idNum[$level] ++;
$href = DI::baseUrl() . "/help/{$filename}#{$anchor}";
$href = "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;

View File

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

View File

@ -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'),

View File

@ -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.')],

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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'),

View File

@ -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:')
]);

View File

@ -132,7 +132,6 @@ class Login extends BaseModule
DI::page()['htmlhead'] .= Renderer::replaceMacros(
Renderer::getMarkupTemplate('login_head.tpl'),
[
'$baseurl' => DI::baseUrl()
]
);

View File

@ -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'] ?? '',

View File

@ -558,7 +558,6 @@ class Account extends BaseSettings
'$desc' => DI::l10n()->t("Your Identity Address is <strong>'%s'</strong> 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',

View File

@ -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],

View File

@ -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'),

View File

@ -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);