aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-06-14 08:25:45 +0000
committerplegall <plg@piwigo.org>2011-06-14 08:25:45 +0000
commita9ee6d49447f8e7515297aea033a5b2f86e0d2d1 (patch)
tree010c2fc6a4a2544f9a0c24eb2cebf840b4761db7 /include
parentb613d03582a5472985548cbf0a7e263add60248f (diff)
merge r11355 from branch 2.2 to trunk
bug 2340 fixed: external authentication was broken, error in SQL syntax and wrong PHP variable name was used. git-svn-id: http://piwigo.org/svn/trunk@11356 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions_user.inc.php38
1 files changed, 18 insertions, 20 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 61a796e4e..58469c3d7 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -321,42 +321,40 @@ SELECT ';
$row = pwg_db_fetch_assoc(pwg_query($query));
- // retrieve user info
- $query = '
-SELECT
- ui.*,
- uc.*,
- t.name AS theme_name
- FROM '.USER_INFOS_TABLE.' AS ui
- 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.'
-;';
-
- $result = pwg_query($query);
- $user_infos_row = pwg_db_fetch_assoc($result);
-
// retrieve additional user data ?
if ($conf['external_authentification'])
{
$query = '
SELECT
- COUNT(1) AS counter,
+ COUNT(1) AS counter
FROM '.USER_INFOS_TABLE.' AS ui
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.'
GROUP BY ui.user_id
;';
- if (pwg_db_fetch_row(pwg_query($query))!=1)
+ list($counter) = pwg_db_fetch_row(pwg_query($query));
+ if ($counter != 1)
{
create_user_infos($user_id);
-
- $result = pwg_query($user_info_query);
- $user_infos_row = pwg_db_fetch_assoc($result);
}
}
+ // retrieve user info
+ $query = '
+SELECT
+ ui.*,
+ uc.*,
+ t.name AS theme_name
+ FROM '.USER_INFOS_TABLE.' AS ui
+ 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.'
+;';
+
+ $result = pwg_query($query);
+ $user_infos_row = pwg_db_fetch_assoc($result);
+
// then merge basic + additional user data
$row = array_merge($row, $user_infos_row);