diff options
author | rvelices <rv-github@modusoptimus.com> | 2013-11-18 05:03:00 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2013-11-18 05:03:00 +0000 |
commit | 77261474451422594d42d4327c62fc448776afbf (patch) | |
tree | 147722e59b894490f9af3f62df926e7683287a1d /include | |
parent | 6078216e689995c5926a4f2e4b1051b7d06316c7 (diff) |
- ws users/groups/perms returns int instead of strings for ids
- fix ws permissions getList (sometimes got objects sometimes arrays)
- users_list data table uses POST (avoid extra lengthy urls)
git-svn-id: http://piwigo.org/svn/trunk@25545 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/ws_functions/pwg.permissions.php | 18 | ||||
-rw-r--r-- | include/ws_functions/pwg.users.php | 10 |
2 files changed, 17 insertions, 11 deletions
diff --git a/include/ws_functions/pwg.permissions.php b/include/ws_functions/pwg.permissions.php index 67fc80f9f..89e120721 100644 --- a/include/ws_functions/pwg.permissions.php +++ b/include/ws_functions/pwg.permissions.php @@ -57,9 +57,9 @@ SELECT user_id, cat_id { if (!isset($perms[ $row['cat_id'] ])) { - $perms[ $row['cat_id'] ]['id'] = $row['cat_id']; + $perms[ $row['cat_id'] ]['id'] = intval($row['cat_id']); } - $perms[ $row['cat_id'] ]['users'][] = $row['user_id']; + $perms[ $row['cat_id'] ]['users'][] = intval($row['user_id']); } // indirect users @@ -76,9 +76,9 @@ SELECT ug.user_id, ga.cat_id { if (!isset($perms[ $row['cat_id'] ])) { - $perms[ $row['cat_id'] ]['id'] = $row['cat_id']; + $perms[ $row['cat_id'] ]['id'] = intval($row['cat_id']); } - $perms[ $row['cat_id'] ]['users_indirect'][] = $row['user_id']; + $perms[ $row['cat_id'] ]['users_indirect'][] = intval($row['user_id']); } // groups @@ -93,9 +93,9 @@ SELECT group_id, cat_id { if (!isset($perms[ $row['cat_id'] ])) { - $perms[ $row['cat_id'] ]['id'] = $row['cat_id']; + $perms[ $row['cat_id'] ]['id'] = intval($row['cat_id']); } - $perms[ $row['cat_id'] ]['groups'][] = $row['group_id']; + $perms[ $row['cat_id'] ]['groups'][] = intval($row['group_id']); } // filter by group and user @@ -120,9 +120,9 @@ SELECT group_id, cat_id } } - $cat['groups'] = !empty($cat['groups']) ? array_unique($cat['groups']) : array(); - $cat['users'] = !empty($cat['users']) ? array_unique($cat['users']) : array(); - $cat['users_indirect'] = !empty($cat['users_indirect']) ? array_unique($cat['users_indirect']) : array(); + $cat['groups'] = !empty($cat['groups']) ? array_values(array_unique($cat['groups'])) : array(); + $cat['users'] = !empty($cat['users']) ? array_values(array_unique($cat['users'])) : array(); + $cat['users_indirect'] = !empty($cat['users_indirect']) ? array_values(array_unique($cat['users_indirect'])) : array(); } unset($cat); diff --git a/include/ws_functions/pwg.users.php b/include/ws_functions/pwg.users.php index cbc988343..c63284d3e 100644 --- a/include/ws_functions/pwg.users.php +++ b/include/ws_functions/pwg.users.php @@ -167,7 +167,13 @@ SELECT DISTINCT '; OFFSET '. ($params['per_page']*$params['page']) .' ;'; - $users = hash_from_query($query, 'id'); + $users = array(); + $result = pwg_query($query); + while ($row = pwg_db_fetch_assoc($result)) + { + $row['id'] = intval($row['id']); + $users[ $row['id'] ] = $row; + } if (count($users) > 0) { @@ -182,7 +188,7 @@ SELECT user_id, group_id while ($row = pwg_db_fetch_assoc($result)) { - $users[ $row['user_id'] ]['groups'][] = $row['group_id']; + $users[ $row['user_id'] ]['groups'][] = intval($row['group_id']); } } |