2018-09-17, 02:32 PM
Hello,
From years now, I translate mybb into french (installation included).
Since v1.8.0 a new functionnality was implemented : colors templates for default theme with the file /install/resources/mybb_themes_color.xml.
I translated the color themes names into french. So "Crepuscule" became "Crépucule". That file was created on february 2015 and never changed nor problematic.
But, since v1.8.16, this file causes an issue.
When editing theme settings, now I get the error "$l['error_invalid_color']" defined in /admin/styles.lang.php, so I was unable to save anything.
Comparing "/admin/modules/style/themes.php" between 1.8.15 and 1.8.16, I see you restrict the stylesheets names to only alphanumeric characters in v1.8.16 and later!
Lines 1095 to 1107.
So, now it's impossible made any changes in default theme. That'a pity!
If I change mybb_theme_colors.xml with new one without accented char, the error remains.
Rebuilding default_theme cache does not correct anything.
I tried to change 'é' to 'e' in database (mybb_themes and mybb_datacache), but doing this breaks completely the default theme ! The CSS are lost and now the error is :
I can't understand why you changed this! Why a stylesheet name should not have accented chars?... I don't know who had the idea to change suddenly this behaviour, but my question is :
How can I correct this on a running mybb >= 1.8.6 ?
I need to inform my members on how to correct without loosing all.
Note : I wrote a little script (see attachment) inspired from install index.php to re-execute the function insert_templates(). After uploaded the file in /install directory et replaced mybb_theme_colors.xml file, it seems working, but are there a best and/or light way to restore default theme functionnality after replaced mybb_theme_colors.xml file?
Thanks for answer.
[attachment=40848]
From years now, I translate mybb into french (installation included).
Since v1.8.0 a new functionnality was implemented : colors templates for default theme with the file /install/resources/mybb_themes_color.xml.
I translated the color themes names into french. So "Crepuscule" became "Crépucule". That file was created on february 2015 and never changed nor problematic.
But, since v1.8.16, this file causes an issue.
When editing theme settings, now I get the error "$l['error_invalid_color']" defined in /admin/styles.lang.php, so I was unable to save anything.
Comparing "/admin/modules/style/themes.php" between 1.8.15 and 1.8.16, I see you restrict the stylesheets names to only alphanumeric characters in v1.8.16 and later!
Lines 1095 to 1107.
foreach($colors as $color)
{
$color = trim($color);
if(preg_match('/^[a-z0-9]+={1}[a-z0-9]+$/i', $color))
{
$color = explode("=", $color);
$properties['colors'][$color[0]] = $color[1];
}
else
{
$errors[] = $lang->sprintf($lang->error_invalid_color, $color);
}
}
So, now it's impossible made any changes in default theme. That'a pity!
If I change mybb_theme_colors.xml with new one without accented char, the error remains.
Rebuilding default_theme cache does not correct anything.
I tried to change 'é' to 'e' in database (mybb_themes and mybb_datacache), but doing this breaks completely the default theme ! The CSS are lost and now the error is :
Warning [2] Invalid argument supplied for foreach() - Line: 1361
File: ...\admin\modules\style\themes.php PHP 5.6.12 (WINNT)
File Line Function
D:\xampp\htdocs\mybb_test\admin\modules\style\themes.php 1361 errorHandler->error
D:\xampp\htdocs\mybb_test\admin\index.php 821 require!
I can't understand why you changed this! Why a stylesheet name should not have accented chars?... I don't know who had the idea to change suddenly this behaviour, but my question is :
How can I correct this on a running mybb >= 1.8.6 ?
I need to inform my members on how to correct without loosing all.
Note : I wrote a little script (see attachment) inspired from install index.php to re-execute the function insert_templates(). After uploaded the file in /install directory et replaced mybb_theme_colors.xml file, it seems working, but are there a best and/or light way to restore default theme functionnality after replaced mybb_theme_colors.xml file?
Thanks for answer.
[attachment=40848]