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

[ticket/10744] Reserved style directory names #690

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions phpBB/includes/acp/acp_styles.php
Expand Up @@ -28,6 +28,7 @@ class acp_styles
protected $styles_path;
protected $styles_path_absolute = 'styles';
protected $default_style = 0;
protected $reserved_paths = array('all', 'admin');

protected $db;
protected $user;
Expand Down Expand Up @@ -757,6 +758,13 @@ protected function find_available($all)
}
}

// Check for reserved paths
if (in_array($dir, $this->reserved_paths))
{
$style['_available'] = false;
$style['_note'] = sprintf($user->lang['RESERVED_STYLE_DIR'], htmlspecialchars($dir));
}

if ($all || $style['_available'])
{
$styles[] = $style;
Expand Down
1 change: 1 addition & 0 deletions phpBB/language/en/acp/styles.php
Expand Up @@ -272,6 +272,7 @@
'REPLACE_THEME_EXPLAIN' => 'This theme will replace the one you are deleting in any styles that use it.',
'REPLACE_WITH_OPTION' => 'Replace with “%s”',
'REQUIRES_STYLE' => 'This style requires the style "%s" to be installed.',
'RESERVED_STYLE_DIR' => 'Directory "%s" is reserved, please move style to a different directory.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use "style name" instead of "directory"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Style names are not related to directories, so that would be incorrect. Simply renaming directory will make style installable.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Why is it even possible that name and directory differ? Is there any advantage to that? Can't we just make it a lot simpler by requiring they always be the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No idea why. I also have no idea why template inheritance works by style name instead of directory name (but stores path in database).

I think it would make sense to use directory name for style name. Maybe close this PR for now and make RFC about removing style name completely?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Yup, let's do that.


'SELECT_IMAGE' => 'Select image',
'SELECT_TEMPLATE' => 'Select template file',
Expand Down