feature 1514: improvement, if a user has a theme that is (maybe temporary)

unactive, we fallback on default theme (the real default theme, the one set
for default user)

git-svn-id: http://piwigo.org/svn/trunk@5264 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall 2010-03-22 19:49:14 +00:00
commit 6b3dc4ede1

View file

@ -246,9 +246,9 @@ function build_user( $user_id, $use_cache )
$user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page']; $user['nb_image_page'] = $user['nb_image_line'] * $user['nb_line_page'];
// Check user theme // Check user theme
if (!file_exists(PHPWG_ROOT_PATH.'themes/'.$user['theme'].'/themeconf.inc.php')) if (!isset($user['theme_name']))
{ {
$user['theme'] = $conf['default_theme']; $user['theme'] = get_default_theme();
} }
return $user; return $user;
@ -292,9 +292,10 @@ SELECT ';
while (true) while (true)
{ {
$query = ' $query = '
SELECT ui.*, uc.* SELECT ui.*, uc.*, t.name AS theme_name
FROM '.USER_INFOS_TABLE.' AS ui LEFT JOIN '.USER_CACHE_TABLE.' AS uc FROM '.USER_INFOS_TABLE.' AS ui
ON ui.user_id = uc.user_id LEFT JOIN '.USER_CACHE_TABLE.' AS uc ON ui.user_id = uc.user_id
LEFT JOIN '.THEMES_TABLE.' AS t ON t.id = ui.theme
WHERE ui.user_id = \''.$user_id.'\''; WHERE ui.user_id = \''.$user_id.'\'';
$result = pwg_query($query); $result = pwg_query($query);
if (pwg_db_num_rows($result) > 0) if (pwg_db_num_rows($result) > 0)