Merge pull request #11321 from MrPetovan/bug/11319-wrong-path-subfolder-install

Normalize base URL usage in admin templates
This commit is contained in:
Michael Vogel 2022-03-12 08:10:07 +01:00 committed by GitHub
commit 5c4871fe6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 46 additions and 43 deletions

View File

@ -283,7 +283,7 @@ function ping_init(App $a)
foreach ($regs as $reg) { foreach ($regs as $reg) {
$notif = [ $notif = [
'id' => 0, 'id' => 0,
'href' => DI::baseUrl() . '/admin/users/pending', 'href' => DI::baseUrl()->get(true) . '/admin/users/pending',
'name' => $reg['name'], 'name' => $reg['name'],
'url' => $reg['url'], 'url' => $reg['url'],
'photo' => $reg['micro'], 'photo' => $reg['micro'],
@ -296,7 +296,7 @@ function ping_init(App $a)
} else { } else {
$notif = [ $notif = [
'id' => 0, 'id' => 0,
'href' => DI::baseUrl() . '/admin/users/pending', 'href' => DI::baseUrl()->get(true) . '/admin/users/pending',
'name' => $regs[0]['name'], 'name' => $regs[0]['name'],
'url' => $regs[0]['url'], 'url' => $regs[0]['url'],
'photo' => $regs[0]['micro'], 'photo' => $regs[0]['micro'],

View File

@ -21,9 +21,9 @@
namespace Friendica\Module\Admin\Logs; namespace Friendica\Module\Admin\Logs;
use Friendica\DI;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Theme; use Friendica\Core\Theme;
use Friendica\DI;
use Friendica\Module\BaseAdmin; use Friendica\Module\BaseAdmin;
use Psr\Log\LogLevel; use Psr\Log\LogLevel;
@ -80,9 +80,10 @@ class View extends BaseAdmin
} }
} }
return Renderer::replaceMacros($t, [ return Renderer::replaceMacros($t, [
'$title' => DI::l10n()->t('Administration'), '$baseurl' => DI::baseUrl()->get(true),
'$page' => DI::l10n()->t('View Logs'), '$title' => DI::l10n()->t('Administration'),
'$l10n' => [ '$page' => DI::l10n()->t('View Logs'),
'$l10n' => [
'Search' => DI::l10n()->t('Search'), 'Search' => DI::l10n()->t('Search'),
'Search_in_logs' => DI::l10n()->t('Search in logs'), 'Search_in_logs' => DI::l10n()->t('Search in logs'),
'Show_all' => DI::l10n()->t('Show all'), 'Show_all' => DI::l10n()->t('Show all'),

View File

@ -526,7 +526,7 @@ class Site extends BaseAdmin
'$touch_icon' => ['touch_icon', DI::l10n()->t('Touch icon'), DI::config()->get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')], '$touch_icon' => ['touch_icon', DI::l10n()->t('Touch icon'), DI::config()->get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')],
'$additional_info' => ['additional_info', DI::l10n()->t('Additional Info'), $additional_info, DI::l10n()->t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())], '$additional_info' => ['additional_info', DI::l10n()->t('Additional Info'), $additional_info, DI::l10n()->t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())],
'$language' => ['language', DI::l10n()->t('System language'), DI::config()->get('system', 'language'), '', $lang_choices], '$language' => ['language', DI::l10n()->t('System language'), DI::config()->get('system', 'language'), '', $lang_choices],
'$theme' => ['theme', DI::l10n()->t('System theme'), DI::config()->get('system', 'theme'), DI::l10n()->t('Default system theme - may be over-ridden by user profiles - <a href="/admin/themes" id="cnftheme">Change default theme settings</a>'), $theme_choices], '$theme' => ['theme', DI::l10n()->t('System theme'), DI::config()->get('system', 'theme'), DI::l10n()->t('Default system theme - may be over-ridden by user profiles - <a href="%s" id="cnftheme">Change default theme settings</a>', DI::baseUrl()->get(true) . '/admin/themes'), $theme_choices],
'$theme_mobile' => ['theme_mobile', DI::l10n()->t('Mobile system theme'), DI::config()->get('system', 'mobile-theme', '---'), DI::l10n()->t('Theme for mobile devices'), $theme_choices_mobile], '$theme_mobile' => ['theme_mobile', DI::l10n()->t('Mobile system theme'), DI::config()->get('system', 'mobile-theme', '---'), DI::l10n()->t('Theme for mobile devices'), $theme_choices_mobile],
'$ssl_policy' => ['ssl_policy', DI::l10n()->t('SSL link policy'), DI::config()->get('system', 'ssl_policy'), DI::l10n()->t('Determines whether generated links should be forced to use SSL'), $ssl_choices], '$ssl_policy' => ['ssl_policy', DI::l10n()->t('SSL link policy'), DI::config()->get('system', 'ssl_policy'), DI::l10n()->t('Determines whether generated links should be forced to use SSL'), $ssl_choices],
'$force_ssl' => ['force_ssl', DI::l10n()->t('Force SSL'), DI::config()->get('system', 'force_ssl'), DI::l10n()->t('Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.')], '$force_ssl' => ['force_ssl', DI::l10n()->t('Force SSL'), DI::config()->get('system', 'force_ssl'), DI::l10n()->t('Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.')],

View File

@ -76,7 +76,7 @@ class Details extends BaseAdmin
require_once "view/theme/$theme/config.php"; require_once "view/theme/$theme/config.php";
if (function_exists('theme_admin')) { if (function_exists('theme_admin')) {
$admin_form = '<iframe onload="resizeIframe(this);" src="/admin/themes/' . $theme . '/embed?mode=minimal" width="100%" height="600px" frameborder="no"></iframe>'; $admin_form = '<iframe onload="resizeIframe(this);" src="' . DI::baseUrl()->get(true) . '/admin/themes/' . $theme . '/embed?mode=minimal" width="100%" height="600px" frameborder="no"></iframe>';
} }
} }

View File

@ -24,6 +24,7 @@ namespace Friendica\Module\Admin\Themes;
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\BaseAdmin; use Friendica\Module\BaseAdmin;
use Friendica\Module\Response; use Friendica\Module\Response;
use Friendica\Util\Profiler; use Friendica\Util\Profiler;
@ -94,7 +95,7 @@ class Embed extends BaseAdmin
$t = Renderer::getMarkupTemplate('admin/addons/embed.tpl'); $t = Renderer::getMarkupTemplate('admin/addons/embed.tpl');
return Renderer::replaceMacros($t, [ return Renderer::replaceMacros($t, [
'$action' => '/admin/themes/' . $theme . '/embed?mode=minimal', '$action' => DI::baseUrl()->get(true) . '/admin/themes/' . $theme . '/embed?mode=minimal',
'$form' => $admin_form, '$form' => $admin_form,
'$form_security_token' => self::getFormSecurityToken("admin_theme_settings"), '$form_security_token' => self::getFormSecurityToken("admin_theme_settings"),
]); ]);

View File

@ -37,7 +37,7 @@ class Index extends BaseAdmin
// reload active themes // reload active themes
if (!empty($_GET['action'])) { if (!empty($_GET['action'])) {
self::checkFormSecurityTokenRedirectOnError(DI::baseUrl()->get() . '/admin/themes', 'admin_themes', 't'); self::checkFormSecurityTokenRedirectOnError('/admin/themes', 'admin_themes', 't');
switch ($_GET['action']) { switch ($_GET['action']) {
case 'reload': case 'reload':

View File

@ -380,11 +380,11 @@ class Register extends BaseModule
'type' => Model\Notification\Type::SYSTEM, 'type' => Model\Notification\Type::SYSTEM,
'event' => 'SYSTEM_REGISTER_REQUEST', 'event' => 'SYSTEM_REGISTER_REQUEST',
'uid' => $admin['uid'], 'uid' => $admin['uid'],
'link' => $base_url . '/admin/users/', 'link' => DI::baseUrl()->get(true) . '/admin/users/',
'source_name' => $user['username'], 'source_name' => $user['username'],
'source_mail' => $user['email'], 'source_mail' => $user['email'],
'source_nick' => $user['nickname'], 'source_nick' => $user['nickname'],
'source_link' => $base_url . '/admin/users/', 'source_link' => DI::baseUrl()->get(true) . '/admin/users/',
'source_photo' => User::getAvatarUrl($user, Proxy::SIZE_THUMB), 'source_photo' => User::getAvatarUrl($user, Proxy::SIZE_THUMB),
'show_in_notification_page' => false 'show_in_notification_page' => false
]); ]);

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2022.05-dev\n" "Project-Id-Version: 2022.05-dev\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-10 07:35+0000\n" "POT-Creation-Date: 2022-03-11 22:56-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -309,7 +309,7 @@ msgstr ""
#: mod/editpost.php:143 src/Content/Conversation.php:380 #: mod/editpost.php:143 src/Content/Conversation.php:380
#: src/Content/Widget/VCard.php:107 src/Model/Profile.php:460 #: src/Content/Widget/VCard.php:107 src/Model/Profile.php:460
#: src/Module/Admin/Logs/View.php:92 #: src/Module/Admin/Logs/View.php:93
msgid "Message" msgid "Message"
msgstr "" msgstr ""
@ -339,7 +339,7 @@ msgstr ""
msgid "Create New Event" msgid "Create New Event"
msgstr "" msgstr ""
#: mod/events.php:478 src/Module/Admin/Logs/View.php:96 #: mod/events.php:478 src/Module/Admin/Logs/View.php:97
msgid "Event details" msgid "Event details"
msgstr "" msgstr ""
@ -2900,7 +2900,7 @@ msgid "Addon applications, utilities, games"
msgstr "" msgstr ""
#: src/Content/Nav.php:230 src/Content/Text/HTML.php:881 #: src/Content/Nav.php:230 src/Content/Text/HTML.php:881
#: src/Module/Admin/Logs/View.php:86 src/Module/Search/Index.php:96 #: src/Module/Admin/Logs/View.php:87 src/Module/Search/Index.php:96
msgid "Search" msgid "Search"
msgstr "" msgstr ""
@ -4708,7 +4708,7 @@ msgstr ""
#: src/Module/Admin/Blocklist/Server/Add.php:89 #: src/Module/Admin/Blocklist/Server/Add.php:89
#: src/Module/Admin/Blocklist/Server/Index.php:78 #: src/Module/Admin/Blocklist/Server/Index.php:78
#: src/Module/Admin/Federation.php:194 src/Module/Admin/Item/Delete.php:64 #: src/Module/Admin/Federation.php:194 src/Module/Admin/Item/Delete.php:64
#: src/Module/Admin/Logs/Settings.php:79 src/Module/Admin/Logs/View.php:83 #: src/Module/Admin/Logs/Settings.php:79 src/Module/Admin/Logs/View.php:84
#: src/Module/Admin/Queue.php:72 src/Module/Admin/Site.php:498 #: src/Module/Admin/Queue.php:72 src/Module/Admin/Site.php:498
#: src/Module/Admin/Storage.php:138 src/Module/Admin/Summary.php:232 #: src/Module/Admin/Storage.php:138 src/Module/Admin/Summary.php:232
#: src/Module/Admin/Themes/Details.php:90 src/Module/Admin/Themes/Index.php:111 #: src/Module/Admin/Themes/Details.php:90 src/Module/Admin/Themes/Index.php:111
@ -5257,7 +5257,7 @@ msgstr ""
msgid "Implicit Mention" msgid "Implicit Mention"
msgstr "" msgstr ""
#: src/Module/Admin/Item/Source.php:73 src/Module/Admin/Logs/View.php:98 #: src/Module/Admin/Item/Source.php:73 src/Module/Admin/Logs/View.php:99
#: src/Module/Debug/ActivityPubConversion.php:62 #: src/Module/Debug/ActivityPubConversion.php:62
msgid "Source" msgid "Source"
msgstr "" msgstr ""
@ -5329,68 +5329,68 @@ msgid ""
"is readable." "is readable."
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:84 src/Module/BaseAdmin.php:110 #: src/Module/Admin/Logs/View.php:85 src/Module/BaseAdmin.php:110
msgid "View Logs" msgid "View Logs"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:87 #: src/Module/Admin/Logs/View.php:88
msgid "Search in logs" msgid "Search in logs"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:88 #: src/Module/Admin/Logs/View.php:89
#: src/Module/Notifications/Notifications.php:139 #: src/Module/Notifications/Notifications.php:139
msgid "Show all" msgid "Show all"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:89 #: src/Module/Admin/Logs/View.php:90
msgid "Date" msgid "Date"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:90 #: src/Module/Admin/Logs/View.php:91
msgid "Level" msgid "Level"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:91 #: src/Module/Admin/Logs/View.php:92
msgid "Context" msgid "Context"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:93 #: src/Module/Admin/Logs/View.php:94
msgid "ALL" msgid "ALL"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:94 #: src/Module/Admin/Logs/View.php:95
msgid "View details" msgid "View details"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:95 #: src/Module/Admin/Logs/View.php:96
msgid "Click to view details" msgid "Click to view details"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:97 #: src/Module/Admin/Logs/View.php:98
msgid "Data" msgid "Data"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:99 #: src/Module/Admin/Logs/View.php:100
msgid "File" msgid "File"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:100 #: src/Module/Admin/Logs/View.php:101
msgid "Line" msgid "Line"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:101 #: src/Module/Admin/Logs/View.php:102
msgid "Function" msgid "Function"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:102 #: src/Module/Admin/Logs/View.php:103
msgid "UID" msgid "UID"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:103 #: src/Module/Admin/Logs/View.php:104
msgid "Process ID" msgid "Process ID"
msgstr "" msgstr ""
#: src/Module/Admin/Logs/View.php:104 #: src/Module/Admin/Logs/View.php:105
msgid "Close" msgid "Close"
msgstr "" msgstr ""
@ -5651,9 +5651,10 @@ msgid "System theme"
msgstr "" msgstr ""
#: src/Module/Admin/Site.php:529 #: src/Module/Admin/Site.php:529
#, php-format
msgid "" msgid ""
"Default system theme - may be over-ridden by user profiles - <a href=\"/" "Default system theme - may be over-ridden by user profiles - <a href=\"%s\" "
"admin/themes\" id=\"cnftheme\">Change default theme settings</a>" "id=\"cnftheme\">Change default theme settings</a>"
msgstr "" msgstr ""
#: src/Module/Admin/Site.php:530 #: src/Module/Admin/Site.php:530
@ -6596,7 +6597,7 @@ msgstr ""
msgid "Themes" msgid "Themes"
msgstr "" msgstr ""
#: src/Module/Admin/Themes/Embed.php:79 #: src/Module/Admin/Themes/Embed.php:80
msgid "Unknown theme." msgid "Unknown theme."
msgstr "" msgstr ""

View File

@ -11,7 +11,7 @@
<p> <p>
<input type="search" name="q" value="{{$q}}" placeholder="{{$l10n.Search}}"></input> <input type="search" name="q" value="{{$q}}" placeholder="{{$l10n.Search}}"></input>
<input type="submit" value="{{$l10n.Search}}"> <input type="submit" value="{{$l10n.Search}}">
<a href="/admin/logs/view">{{$l10n.Show_all}}</a> <a href="{{$baseurl}}/admin/logs/view">{{$l10n.Show_all}}</a>
</p> </p>

View File

@ -34,7 +34,7 @@
<dt>{{$addons.0}}</dt> <dt>{{$addons.0}}</dt>
{{foreach $addons.1 as $p}} {{foreach $addons.1 as $p}}
<dd><a href="/admin/addons/{{$p}}/">{{$p}}</a></dd> <dd><a href="{{$baseurl}}/admin/addons/{{$p}}/">{{$p}}</a></dd>
{{/foreach}} {{/foreach}}
</dl> </dl>

View File

@ -18,7 +18,7 @@
</div> </div>
</div> </div>
<div class="xol-xs-4"> <div class="xol-xs-4">
<a href="/admin/logs/view" class="btn btn-default">{{$l10n.Show_all}}</a> <a href="{{$baseurl}}/admin/logs/view" class="btn btn-default">{{$l10n.Show_all}}</a>
</div> </div>
</form> </form>
@ -33,7 +33,7 @@
<ul class="dropdown-menu" aria-labelledby="level"> <ul class="dropdown-menu" aria-labelledby="level">
{{foreach $filtersvalues.level as $v }} {{foreach $filtersvalues.level as $v }}
<li {{if $filters.level == $v}}class="active"{{/if}}> <li {{if $filters.level == $v}}class="active"{{/if}}>
<a href="/admin/logs/view?level={{$v}}" data-filter="level" data-filter-value="{{$v}}"> <a href="{{$baseurl}}/admin/logs/view?level={{$v}}" data-filter="level" data-filter-value="{{$v}}">
{{if $v == ""}}{{$l10n.ALL}}{{/if}}{{$v}} {{if $v == ""}}{{$l10n.ALL}}{{/if}}{{$v}}
</a> </a>
</li> </li>
@ -47,7 +47,7 @@
<ul class="dropdown-menu" aria-labelledby="context"> <ul class="dropdown-menu" aria-labelledby="context">
{{foreach $filtersvalues.context as $v }} {{foreach $filtersvalues.context as $v }}
<li {{if $filters.context == $v}}class="active"{{/if}}> <li {{if $filters.context == $v}}class="active"{{/if}}>
<a href="/admin/logs/view?context={{$v}}" data-filter="context" data-filter-value="{{$v}}"> <a href="{{$baseurl}}/admin/logs/view?context={{$v}}" data-filter="context" data-filter-value="{{$v}}">
{{if $v == ""}}{{$l10n.ALL}}{{/if}}{{$v}} {{if $v == ""}}{{$l10n.ALL}}{{/if}}{{$v}}
</a> </a>
</li> </li>

View File

@ -46,7 +46,7 @@
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 admin-summary-label-name text-muted">{{$addons.0}}</div> <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 admin-summary-label-name text-muted">{{$addons.0}}</div>
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12 admin-summary-entry"> <div class="col-lg-8 col-md-8 col-sm-8 col-xs-12 admin-summary-entry">
{{foreach $addons.1 as $p}} {{foreach $addons.1 as $p}}
<a href="/admin/addons/{{$p}}/">{{$p}}</a><br> <a href="{{$baseurl}}/admin/addons/{{$p}}/">{{$p}}</a><br>
{{/foreach}} {{/foreach}}
</div> </div>
</div> </div>