Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving several important warnings to templates #8422

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

live627
Copy link
Contributor

@live627 live627 commented Jan 28, 2025

New Templates for Warnings (Themes/default/index.template.php):

  • Introduced specific templates for:
    • Maintenance warnings (template_maint_warning_*).
    • Security warnings (template_security_warning_above/below).
    • Ban warnings (template_banned_warning_above/below).ins about potential security risks.

$position = array_search('body', Utils::$context['template_layers']);

if ($position !== false) {
array_splice(Utils::$context['template_layers'], $position + 1, 0, ['maint_warning']);
array_splice(Utils::$context['template_layers'], $position + 1, 0, $layers);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this code be better suited for Theme:::loadTemplatesAndLangFiles()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would fit better there in an abstract, conceptual sense, yes. But then it would be called during Theme::load(), which would be problematic for a number of reasons.

Copy link
Member

@Sesquipedalian Sesquipedalian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except for two minor requests.

$position = array_search('body', Utils::$context['template_layers']);

if ($position !== false) {
array_splice(Utils::$context['template_layers'], $position + 1, 0, ['maint_warning']);
array_splice(Utils::$context['template_layers'], $position + 1, 0, $layers);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would fit better there in an abstract, conceptual sense, yes. But then it would be called during Theme::load(), which would be problematic for a number of reasons.

Sources/Security.php Outdated Show resolved Hide resolved
Sources/Security.php Outdated Show resolved Hide resolved
Co-authored-by: Jon Stovell <jonstovell@gmail.com>
Sources/Security.php Outdated Show resolved Hide resolved
@Sesquipedalian Sesquipedalian merged commit a58ca69 into SimpleMachines:release-3.0 Jan 29, 2025
6 checks passed
@live627 live627 deleted the securityFiles branch January 31, 2025 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants