1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

- allow underscores in CSS class names / ids

- remove control characters from clean strings, and map all space characters to ASCII space (\x20)


git-svn-id: file:///svn/phpbb/trunk@6932 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann
2007-01-26 18:15:17 +00:00
parent 4274eb2a07
commit 5bb75c590d
4 changed files with 59 additions and 10 deletions

View File

@@ -967,7 +967,7 @@ parse_css_file = {PARSE_CSS_FILE}
// Pull out a list of classes
$classes = array();
if (preg_match_all('/^([a-z0-9\.,:#> \t]+?)[ \t\n]*?\{.*?\}/msi', $stylesheet, $matches))
if (preg_match_all('/^([a-z0-9\.,:#_\->* \t]+?)[ \t\n]*?\{.*?\}/msi', $stylesheet, $matches))
{
$classes = $matches[1];
}
@@ -1266,14 +1266,14 @@ parse_css_file = {PARSE_CSS_FILE}
else
{
// check whether the custom class name is valid
if (!preg_match('/^[a-z0-9#:.\- ]+$/i', $custom_class))
if (!preg_match('/^[a-z0-9\.,:#_\->*]+$/i', $custom_class))
{
trigger_error($user->lang['THEME_ERR_CLASS_CHARS'] . adm_back_link($this->u_action . "&action=edit&id=$theme_id&text_rows=$text_rows"), E_USER_WARNING);
}
else
{
// append an empty class definition to the stylesheet
$stylesheet .= "\n$custom_class\n{\n}";
$stylesheet .= "\n$custom_class {\n\t\n}";
$message = $user->lang['THEME_CLASS_ADDED'];
}
}