mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Changing the way we handle the case where a user's style does not exist in the database
We now try to fallback to the board default if possible and update the database if this succeeds git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@5500 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
722fbae7c0
commit
1ace2eca07
1 changed files with 34 additions and 1 deletions
|
@ -372,7 +372,40 @@ function setup_style($style)
|
||||||
|
|
||||||
if ( !($row = $db->sql_fetchrow($result)) )
|
if ( !($row = $db->sql_fetchrow($result)) )
|
||||||
{
|
{
|
||||||
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
|
// We are trying to setup a style which does not exist in the database
|
||||||
|
// Try to fallback to the board default (if the user had a custom style)
|
||||||
|
// and then any users using this style to the default if it succeeds
|
||||||
|
if ( $style != $board_config['default_style'])
|
||||||
|
{
|
||||||
|
$sql = 'SELECT *
|
||||||
|
FROM ' . THEMES_TABLE . '
|
||||||
|
WHERE themes_id = ' . $board_config['default_style'];
|
||||||
|
if ( !($result = $db->sql_query($sql)) )
|
||||||
|
{
|
||||||
|
message_die(CRITICAL_ERROR, 'Could not query database for theme info');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $row = $db->sql_fetchrow($result) )
|
||||||
|
{
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||||
|
SET user_style = ' . $board_config['default_style'] . "
|
||||||
|
WHERE user_style = $style";
|
||||||
|
if ( !($result = $db->sql_query($sql)) )
|
||||||
|
{
|
||||||
|
message_die(CRITICAL_ERROR, 'Could not query database for theme info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$template_path = 'templates/' ;
|
$template_path = 'templates/' ;
|
||||||
|
|
Loading…
Add table
Reference in a new issue