aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2014-03-28 13:26:30 +0000
committerplegall <plg@piwigo.org>2014-03-28 13:26:30 +0000
commit393b1b38ef0b639357d4c9d6df9eed8362da8f8a (patch)
treef157180715dff3a57a2f7a791393e87f37101598
parent4b7102bd45e3d8394ac02af3ef49ec9b416bc80b (diff)
merge r27996 from branch 2.6 to trunk
bug 3065 fixed: avoid SQL errors with external authentication git-svn-id: http://piwigo.org/svn/trunk@27997 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/group_list.php2
-rw-r--r--admin/user_list_backend.php29
-rw-r--r--include/functions_mail.inc.php2
3 files changed, 26 insertions, 7 deletions
diff --git a/admin/group_list.php b/admin/group_list.php
index 4912458f7..5c53a8b1f 100644
--- a/admin/group_list.php
+++ b/admin/group_list.php
@@ -394,7 +394,7 @@ $toggle_is_default_url = $admin_url.'group_list&amp;toggle_is_default=';
while ($row = pwg_db_fetch_assoc($result))
{
$query = '
-SELECT username
+SELECT u.'. $conf['user_fields']['username'].' AS username
FROM '.USERS_TABLE.' AS u
INNER JOIN '.USER_GROUP_TABLE.' AS ug
ON u.'.$conf['user_fields']['id'].' = ug.user_id
diff --git a/admin/user_list_backend.php b/admin/user_list_backend.php
index b390ed1ec..1edaa1369 100644
--- a/admin/user_list_backend.php
+++ b/admin/user_list_backend.php
@@ -35,14 +35,23 @@ check_status(ACCESS_ADMINISTRATOR);
/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
-$aColumns = array('id', 'username', 'status', 'mail_address', 'recent_period', 'level', 'registration_date');
+$aColumns = array(
+ $conf['user_fields']['id'],
+ $conf['user_fields']['username'],
+ 'status',
+ $conf['user_fields']['email'],
+ 'recent_period',
+ 'level',
+ 'registration_date'
+ );
+
$aColumns = trigger_change('user_list_columns', $aColumns);
/* Indexed column (used for fast and accurate table cardinality) */
-$sIndexColumn = "id";
+$sIndexColumn = 'user_id';
/* DB table to use */
-$sTable = USERS_TABLE.' INNER JOIN '.USER_INFOS_TABLE.' AS ui ON id = ui.user_id';
+$sTable = USERS_TABLE.' INNER JOIN '.USER_INFOS_TABLE.' AS ui ON '.$conf['user_fields']['id'].' = ui.user_id';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
@@ -162,7 +171,7 @@ $user_ids = array();
while ( $aRow = pwg_db_fetch_array( $rResult ) )
{
- $user_ids[] = $aRow['id'];
+ $user_ids[] = $aRow[ $conf['user_fields']['id'] ];
$row = array();
for ( $i=0 ; $i<count($aColumns) ; $i++ )
@@ -178,8 +187,18 @@ while ( $aRow = pwg_db_fetch_array( $rResult ) )
else if ( $aColumns[$i] != ' ' )
{
/* General output */
- $row[] = $aRow[ $aColumns[$i] ];
+ $colname = $aColumns[$i];
+ foreach ($conf['user_fields'] as $real_name => $alias)
+ {
+ if ($aColumns[$i] == $real_name)
+ {
+ $colname = $alias;
+ }
+ }
+
+ $row[] = $aRow[$colname];
}
+
}
$output['aaData'][] = $row;
}
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index e40e94b55..8b93afdfe 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -440,7 +440,7 @@ SELECT
WHERE i.status in (\'webmaster\', \'admin\')
AND u.'.$conf['user_fields']['email'].' IS NOT NULL
AND i.user_id <> '.$user['id'].'
- ORDER BY username
+ ORDER BY name
;';
$admins = array_from_query($query);