Closed Moc closed 10 years ago
Something like this:
public static function coreTemplatePath($id, $override = true)
{
$id = str_replace('..', '', $id); //simple security, '/' is allowed
$override_path = $override ? self::getThemeInfo($override, 'rel').'templates/'.$id.'_template.php' : null;
$legacy_path = e_THEME.'templates/'.$id.'_template.php';
$core_path = e_CORE.'templates/'.$id.'_template.php';
$legacy_theme_path = THEME.$id.'_template.php';
if($override_path && is_readable($override_path))
{
return $override_path;
}
elseif(is_readable($legacy_theme_path))
{
return $legacy_theme_path;
}
elseif(is_readable($legacy_path))
{
return $legacy_path;
}
return $core_path;
}
Thanks @Moc . I did something similar to your option-1 code.
In v1, numerous themes have modified core templates by copying them to the root theme folder. This was the standard in v1, I believe. Currently, the function
coreTemplatePath()
checks the override path (e107_themes/current_theme/templates
) and the legacy path (e107_themes/templates
).After upgrading my v1 install to v2, it seemed that several templates (e.g.
usersettings_template.php
) were loaded from e107_themes/templates rather than from my theme folder (which used to be the case in v1).There are two options here:
1) The function should be adjusted to also include a check for templates in the theme root 2) v1 themes should be updated to move their modified templates into a newly created
templates
folder (within the theme folder).@CaMer0n What do you think?
If option 1, I'll send in a PR