aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-10-07 21:31:47 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-10-07 21:31:47 +0200
commit6f48b3c044a5339bc019f355db490e1a53b51fdc (patch)
tree55bd7a1d388985e6cc8eceb28fbb17b955deda24
parentb80cbd0e7dbe5fac29338ef1f2b88d29fef60dc2 (diff)
parentc75c13e5554652927a8aa57bd3b9f3902f57b429 (diff)
downloadforums-6f48b3c044a5339bc019f355db490e1a53b51fdc.tar
forums-6f48b3c044a5339bc019f355db490e1a53b51fdc.tar.gz
forums-6f48b3c044a5339bc019f355db490e1a53b51fdc.tar.bz2
forums-6f48b3c044a5339bc019f355db490e1a53b51fdc.tar.xz
forums-6f48b3c044a5339bc019f355db490e1a53b51fdc.zip
Merge branch '3.2.x' into 3.3.x
-rw-r--r--phpBB/language/en/common.php2
-rw-r--r--phpBB/phpbb/user.php36
2 files changed, 36 insertions, 2 deletions
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 5f47fbe6ed..d050c1b109 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -530,7 +530,7 @@ $lang = array_merge($lang, array(
'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.',
'NO_FEED_ENABLED' => 'Feeds are not available on this board.',
'NO_FEED' => 'The requested feed is not available.',
- 'NO_STYLE_DATA' => 'Could not get style data',
+ 'NO_STYLE_DATA' => 'Could not get style data for user_style %s and set for user_id %s',
'NO_STYLE_CFG' => 'Could not get the style configuration file for: %s',
'NO_SUBJECT' => 'No subject specified', // Used for posts having no subject defined but displayed within management pages.
'NO_SUCH_SEARCH_MODULE' => 'The specified search backend doesn’t exist.',
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index 5a06becb52..21d156e060 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -281,9 +281,43 @@ class user extends \phpbb\session
$db->sql_freeresult($result);
}
+ // Fallback to board's default style
if (!$this->style)
{
- trigger_error('NO_STYLE_DATA', E_USER_ERROR);
+ // Verify default style exists in the database
+ $sql = 'SELECT style_id
+ FROM ' . STYLES_TABLE . '
+ WHERE style_id = ' . (int) $config['default_style'];
+ $result = $db->sql_query($sql);
+ $style_id = (int) $db->sql_fetchfield('style_id');
+ $db->sql_freeresult($result);
+
+ if ($style_id > 0)
+ {
+ $db->sql_transaction('begin');
+
+ // Update $user row
+ $sql = 'SELECT *
+ FROM ' . STYLES_TABLE . '
+ WHERE style_id = ' . (int) $config['default_style'];
+ $result = $db->sql_query($sql);
+ $this->style = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ // Update user style preference
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_style = ' . (int) $style_id . '
+ WHERE user_id = ' . (int) $this->data['user_id'];
+ $db->sql_query($sql);
+
+ $db->sql_transaction('commit');
+ }
+ }
+
+ // This should never happen
+ if (!$this->style)
+ {
+ trigger_error($this->language->lang('NO_STYLE_DATA', $this->data['user_style'], $this->data['user_id']), E_USER_ERROR);
}
// Now parse the cfg file and cache it