[ticket/10744] Reserved style directory names #690

wants to merge 1 commit into
@@ -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;
@@ -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;
@@ -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.',
p Apr 3, 2012 Contributor

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

cyberalien Apr 3, 2012 Contributor

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

naderman Apr 13, 2012 Owner

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?

cyberalien Apr 13, 2012 Contributor

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?

naderman Apr 19, 2012 Owner

Yup, let's do that.

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