diff --git a/lam/templates/lists/listdomains.php b/lam/templates/lists/listdomains.php index 98ea3f22..0ddc3cdb 100644 --- a/lam/templates/lists/listdomains.php +++ b/lam/templates/lists/listdomains.php @@ -179,21 +179,26 @@ if (! $_GET['norefresh']) { $dom_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_DomainSuffix()); } +// print combobox with possible sub-DNs +if (sizeof($dom_units) > 1) { + echo ("

\n"); + echo ("" . _("Suffix") . ": "); + echo ("\n"); + echo (""); + echo ("

\n"); + echo ("

 

\n"); +} + echo ("

\n"); echo ("\n"); if (sizeof($dom_info) > 0) echo ("\n"); -// print combobox with possible sub-DNs -if (sizeof($dom_units) > 1) { -echo ("    " . _("Suffix") . ": "); -echo ("\n"); -echo (""); -} echo ("

\n"); + echo ("\n"); echo "\n"; diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php index eaa85648..3bb1522e 100644 --- a/lam/templates/lists/listgroups.php +++ b/lam/templates/lists/listgroups.php @@ -234,21 +234,26 @@ if (! $_GET['norefresh']) { $grp_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_GroupSuffix()); } +// print combobox with possible sub-DNs +if (sizeof($grp_units) > 1) { + echo ("

\n"); + echo ("" . _("Suffix") . ": "); + echo ("\n"); + echo (""); + echo ("

\n"); + echo ("

 

\n"); +} + echo ("

\n"); echo ("\n"); if (sizeof($grp_info) > 0) echo ("\n"); -// print combobox with possible sub-DNs -if (sizeof($grp_units) > 1) { -echo ("    " . _("Suffix") . ": "); -echo ("\n"); -echo (""); -} echo ("

\n"); + echo ("\n"); echo "\n"; diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php index 395cc9a5..57ed7cd1 100644 --- a/lam/templates/lists/listhosts.php +++ b/lam/templates/lists/listhosts.php @@ -226,12 +226,10 @@ if (! $_GET['norefresh']) { $hst_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_HostSuffix()); } -echo ("

\n"); -echo ("\n"); -if (sizeof($hst_info) > 0) echo ("\n"); // print combobox with possible sub-DNs if (sizeof($hst_units) > 1) { -echo ("    " . _("Suffix") . ": "); +echo ("

\n"); +echo ("" . _("Suffix") . ": "); echo ("\n"); echo (""); -} echo ("

\n"); +echo ("

 

\n"); +} + +echo ("

\n"); +echo ("\n"); +if (sizeof($hst_info) > 0) echo ("\n"); +echo ("

\n"); + echo ("\n"); echo "\n"; diff --git a/lam/templates/lists/listusers.php b/lam/templates/lists/listusers.php index ea00f6b1..f18b7411 100644 --- a/lam/templates/lists/listusers.php +++ b/lam/templates/lists/listusers.php @@ -36,6 +36,28 @@ setlanguage(); // copy HTTP-GET variables to HTTP-POST $_POST = $_POST + $_GET; +// check if primary group should be translated +if ($_POST['trans_primary'] == "on") $trans_primary = "on"; +else $trans_primary = "off"; +$trans_primary_hash = $_SESSION['trans_primary_hash']; +// generate hash table for group translation +if ($trans_primary == "on" && !$_GET["norefresh"]) { + $trans_primary_hash = array(); + $suffix = $_SESSION['config']->get_groupSuffix(); + $filter = "objectClass=posixGroup"; + $attrs = array("cn", "gidNumber"); + $sr = @ldap_search($_SESSION["ldap"]->server(), $suffix, $filter, $attrs); + if ($sr) { + $info = @ldap_get_entries($_SESSION["ldap"]->server(), $sr); + array_shift($info); // delete count entry + for ($i = 0; $i < sizeof($info); $i++) { + $trans_primary_hash[$info[$i]['gidnumber'][0]] = $info[$i]['cn'][0]; + } + $_SESSION['trans_primary_hash'] = $trans_primary_hash; + } +} + + $usr_units = $_SESSION['usr_units']; // check if button was pressed and if we have to add/delete a user @@ -62,22 +84,21 @@ echo "\n"; echo "\n"; +$page = $_GET["page"]; +if (!$page) $page = 1; + +// take maximum count of user entries shown on one page out of session +if ($_SESSION["config"]->get_MaxListEntries() <= 0) { + $max_pageentrys = 10; // default setting, if not yet set +} +else $max_pageentrys = $_SESSION["config"]->get_MaxListEntries(); + // generate attribute-description table $attr_array = array(); // list of LDAP attributes to show $desc_array = array(); // list of descriptions for the attributes $attr_string = $_SESSION["config"]->get_userlistAttributes(); $temp_array = explode(";", $attr_string); $hash_table = $_SESSION["ldap"]->attributeUserArray(); -$page = $_GET["page"]; -if (!$page) - $page = 1; - -// take maximum count of user entries shown on one page out of session -if ($_SESSION["config"]->get_MaxListEntries() <= 0) - $max_pageentrys = 10; // default setting, if not yet set - else - $max_pageentrys = $_SESSION["config"]->get_MaxListEntries(); - // generate column attributes and descriptions for ($i = 0; $i < sizeof($temp_array); $i++) { @@ -187,7 +208,7 @@ if ($user_count != 0) { else echo "\n"; echo "" . + strtolower($attr_array[$k]) . $searchfilter . "&trans_primary=" . $trans_primary . "\">" . $desc_array[$k] . "\n"; } echo "\n"; @@ -219,12 +240,19 @@ if ($user_count != 0) { _("Edit") . "\n\n"); for ($k = 0; $k < sizeof($attr_array); $k++) { echo ("\n"); - // print all attribute entries seperated by "; " + // print attribute values if (sizeof($userinfo[$i][strtolower($attr_array[$k])]) > 0) { - // delete first array entry which is "count" if (is_array($userinfo[$i][strtolower($attr_array[$k])])) { + // delete first array entry which is "count" array_shift($userinfo[$i][strtolower($attr_array[$k])]); - echo utf8_decode(implode("; ", $userinfo[$i][strtolower($attr_array[$k])])) . "\n"; + 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 "; " + else echo utf8_decode(implode("; ", $userinfo[$i][strtolower($attr_array[$k])])) . "\n"; } else echo utf8_decode($userinfo[$i][strtolower($attr_array[$k])]) . "\n"; } @@ -246,22 +274,41 @@ if (! $_GET['norefresh']) { $usr_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_UserSuffix()); } +// print combobox with possible sub-DNs +if (sizeof($usr_units) > 1) { + echo ("

\n"); + echo ("" . _("Suffix") . ": "); + echo ("\n"); + echo (""); + echo ("

\n"); +} + +// show translate GID to group name box if there is a column with gidnumber +if (in_array("gidnumber", $attr_array)) { + echo "

\n"; + echo "" . _("Translate GID number to group name") . ": "; + if ($trans_primary == "on") { + echo ""; + } + else echo ""; + echo ("  "); + echo "

\n"; +} + +echo ("

 

\n"); + echo ("

\n"); echo ("\n"); if ($user_count != 0) echo ("\n"); -// print combobox with possible sub-DNs -if (sizeof($usr_units) > 1) { -echo ("    " . _("Suffix") . ": "); -echo ("\n"); -echo (""); -} - echo ("

\n"); + +echo ("

 

\n"); + echo ("\n"); echo "\n"; @@ -276,19 +323,20 @@ function draw_navigation_bar ($user_count) { global $page; global $sortattrib; global $searchfilter; + global $trans_primary; echo ("\n"); echo ("\n"); echo ("\n
\n\n  "); if ($page != 1) echo ("<=\n"); + ($page - 1) . "&sortattrib=" . $sortattrib . $searchfilter . "&trans_primary=" . $trans_primary . "\"><=\n"); else echo ("<="); echo (" "); if ($page < ($user_count / $max_pageentrys)) echo ("=>\n"); + ($page + 1) . "&sortattrib=" . $sortattrib . $searchfilter . "&trans_primary=" . $trans_primary . "\">=>\n"); else echo ("=>"); echo ("\n"); @@ -300,7 +348,7 @@ function draw_navigation_bar ($user_count) { for ($i = 0; $i < ($user_count / $max_pageentrys); $i++) { if ($i == $page - 1) echo (" " . ($i + 1)); else echo (" " . ($i + 1) . "\n"); } echo ("
\n");