fixes for GID translation: show GID if name has not been found, resort table by names if GID is selected for sorting

This commit is contained in:
Roland Gruber 2003-09-25 07:01:20 +00:00
parent b300372178
commit a062e8e44f
1 changed files with 14 additions and 7 deletions

View File

@ -247,6 +247,19 @@ if ($user_count != 0) {
echo "</tr>\n"; echo "</tr>\n";
if ($user_count != 0) { if ($user_count != 0) {
// translate GIDs and resort array if selected
if ($trans_primary == "on") {
// translate GIDs
for ($i = 0; $i < sizeof($userinfo); $i++) {
if ($trans_primary_hash[$userinfo[$i]['gidnumber'][0]]) {
$userinfo[$i]['gidnumber'][0] = $trans_primary_hash[$userinfo[$i]['gidnumber'][0]];
}
}
// resort if needed
if ($sortattrib == "gidnumber") {
usort ($userinfo, "cmp_array");
}
}
// print user list // print user list
$userinfo = array_slice ($userinfo, ($page - 1) * $max_pageentrys, $max_pageentrys); $userinfo = array_slice ($userinfo, ($page - 1) * $max_pageentrys, $max_pageentrys);
for ($i = 0; $i < sizeof ($userinfo); $i++) { // ignore last entry in array which is "count" for ($i = 0; $i < sizeof ($userinfo); $i++) { // ignore last entry in array which is "count"
@ -267,14 +280,8 @@ if ($user_count != 0) {
array_shift($userinfo[$i][strtolower($attr_array[$k])]); array_shift($userinfo[$i][strtolower($attr_array[$k])]);
// sort array // sort array
sort($userinfo[$i][strtolower($attr_array[$k])]); sort($userinfo[$i][strtolower($attr_array[$k])]);
if (($trans_primary == "on") && (strtolower($attr_array[$k]) == "gidnumber")) {
// translate GID number to group name
if ($trans_primary_hash[$userinfo[$i][strtolower($attr_array[$k])][0]]) {
echo $trans_primary_hash[$userinfo[$i][strtolower($attr_array[$k])][0]];
}
}
// print all attribute entries seperated by "; " // print all attribute entries seperated by "; "
else echo utf8_decode(implode("; ", $userinfo[$i][strtolower($attr_array[$k])])) . "\n"; echo utf8_decode(implode("; ", $userinfo[$i][strtolower($attr_array[$k])])) . "\n";
} }
else echo utf8_decode($userinfo[$i][strtolower($attr_array[$k])]) . "\n"; else echo utf8_decode($userinfo[$i][strtolower($attr_array[$k])]) . "\n";
} }