" .
+ " | " .
+ " " . _("Edit") . " | ");
for ($k = 0; $k < sizeof($attr_array); $k++) {
echo ("");
// print all attribute entries seperated by "; "
- if (sizeof($info[$i][strtolower($attr_array[$k])]) > 0) {
+ if (sizeof($grp_info[$i][strtolower($attr_array[$k])]) > 0) {
// delete first array entry which is "count"
- array_shift($info[$i][strtolower($attr_array[$k])]);
+ if (! $_GET['norefresh']) array_shift($grp_info[$i][strtolower($attr_array[$k])]);
// generate links for group members
if (strtolower($attr_array[$k]) == "memberuid") {
$linklist = array();
- for ($d = 0; $d < sizeof($info[$i][strtolower($attr_array[$k])]); $d++) {
- $user = $info[$i][strtolower($attr_array[$k])][$d]; // user name
- $dn = $_SESSION["ldap"]->search_username($user); // DN entry
+ for ($d = 0; $d < sizeof($grp_info[$i][strtolower($attr_array[$k])]); $d++) {
+ $user = $grp_info[$i][strtolower($attr_array[$k])][$d]; // user name
// if user was found in LDAP make link, otherwise just print name
- if ($dn) {
- $linklist[$d] = "" .
- $info[$i][strtolower($attr_array[$k])][$d] . "";
- }
- else $linklist[$d] = $user;
+ $linklist[$d] = "" . $user . "";
}
echo implode("; ", $linklist);
}
// print all other attributes
else {
- echo implode("; ", $info[$i][strtolower($attr_array[$k])]);
+ echo implode("; ", $grp_info[$i][strtolower($attr_array[$k])]);
}
}
echo (" | ");
@@ -217,35 +224,39 @@ echo ("");
echo ("
");
// draw navigation bar if group accounts were found
-if (sizeof($info) > 0) {
-draw_navigation_bar(sizeof($info));
+if (sizeof($grp_info) > 0) {
+draw_navigation_bar(sizeof($grp_info));
echo ("
\n");
}
-// generate list of possible suffixes
-$sr = @ldap_search($_SESSION["ldap"]->server(),
- $_SESSION["config"]->get_GroupSuffix(),
- "objectClass=organizationalunit", array("DN"));
-if ($sr) {
- $units = ldap_get_entries($_SESSION["ldap"]->server, $sr);
- // delete first array entry which is "count"
- array_shift($units);
- // remove sub arrays
- for ($i = 0; $i < sizeof($units); $i++) $units[$i] = $units[$i]['dn'];
- // add root suffix from config
- if (!in_array($_SESSION["config"]->get_GroupSuffix(), $units)) array_push($units, $_SESSION["config"]->get_GroupSuffix());
+if (! $_GET['norefresh']) {
+ // generate list of possible suffixes
+ $sr = @ldap_search($_SESSION["ldap"]->server(),
+ $_SESSION["config"]->get_GroupSuffix(),
+ "objectClass=organizationalunit", array("DN"));
+ if ($sr) {
+ $grp_units = ldap_get_entries($_SESSION["ldap"]->server, $sr);
+ // delete first array entry which is "count"
+ array_shift($grp_units);
+ // remove sub arrays
+ for ($i = 0; $i < sizeof($grp_units); $i++) $grp_units[$i] = $grp_units[$i]['dn'];
+ // add root suffix from config
+ if (!in_array($_SESSION["config"]->get_GroupSuffix(), $grp_units)) {
+ array_push($grp_units, $_SESSION["config"]->get_GroupSuffix());
+ }
+ }
}
echo ("\n");
echo ("\n");
-if (sizeof($info) > 0) echo ("\n");
+if (sizeof($grp_info) > 0) echo ("\n");
// print combobox with possible sub-DNs
-if (sizeof($units) > 1) {
+if (sizeof($grp_units) > 1) {
echo (" " . _("Suffix") . ": ");
echo ("\n");
echo ("");
diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php
index d6012e94..9db7e426 100644
--- a/lam/templates/lists/listhosts.php
+++ b/lam/templates/lists/listhosts.php
@@ -38,6 +38,11 @@ $sort = $_GET['sort'];
// copy HTTP-GET variables to HTTP-POST
$_POST = $_POST + $_GET;
+$hst_info = $_SESSION['hst_info'];
+session_register('hst_info');
+$hst_units = $_SESSION['hst_units'];
+session_register('hst_units');
+
// check if button was pressed and if we have to add/delete a host
if ($_POST['new_host'] || $_POST['del_host']){
// add new host
@@ -104,48 +109,55 @@ session_register('hst_suffix');
$searchfilter = "";
for ($k = 0; $k < sizeof($desc_array); $k++) {
if ($_POST["filter" . strtolower($attr_array[$k])]) {
- $searchfilter = $searchfilter . "&filter" . strtolower($attr_array[$k]) . "='".
- $_POST["filter" . strtolower($attr_array[$k])] . "'";
+ $searchfilter = $searchfilter . "&filter" . strtolower($attr_array[$k]) . "=".
+ $_POST["filter" . strtolower($attr_array[$k])];
}
}
-// configure search filter
-if ($_SESSION['config']->get_samba3() == "yes") {
- // Samba hosts have the attribute "sambaSamAccount" and end with "$"
- $filter = "(&(objectClass=sambaSamAccount) (uid=*$)";
+if (! $_GET['norefresh']) {
+ // configure search filter
+ if ($_SESSION['config']->get_samba3() == "yes") {
+ // Samba hosts have the attribute "sambaSamAccount" and end with "$"
+ $filter = "(&(objectClass=sambaSamAccount) (uid=*$)";
+ }
+ else {
+ // Samba hosts have the attribute "sambaAccount" and end with "$"
+ $filter = "(&(objectClass=sambaAccount) (uid=*$)";
+ }
+ for ($k = 0; $k < sizeof($desc_array); $k++) {
+ if ($_POST["filter" . strtolower($attr_array[$k])])
+ $filter = $filter . "(" . strtolower($attr_array[$k]) . "=" .
+ $_POST["filter" . strtolower($attr_array[$k])] . ")";
+ else
+ $_POST["filter" . strtolower($attr_array[$k])] = "";
+ }
+ $filter = $filter . ")";
+ $attrs = $attr_array;
+ $sr = @ldap_search($_SESSION["ldap"]->server(),
+ $hst_suffix,
+ $filter, $attrs);
+ if ($sr) {
+ $hst_info = ldap_get_entries($_SESSION["ldap"]->server, $sr);
+ ldap_free_result($sr);
+ if ($hst_info["count"] == 0) StatusMessage("WARN", "", _("No Samba Hosts found!"));
+ // delete first array entry which is "count"
+ array_shift($hst_info);
+ // sort rows by sort column ($sort)
+ usort($hst_info, "cmp_array");
+ }
+ else StatusMessage("ERROR", _("LDAP Search failed! Please check your preferences."), _("No Samba Hosts found!"));
}
else {
- // Samba hosts have the attribute "sambaAccount" and end with "$"
- $filter = "(&(objectClass=sambaAccount) (uid=*$)";
-}
-for ($k = 0; $k < sizeof($desc_array); $k++) {
- if ($_POST["filter" . strtolower($attr_array[$k])])
- $filter = $filter . "(" . strtolower($attr_array[$k]) . "=" .
- $_POST["filter" . strtolower($attr_array[$k])] . ")";
- else
- $_POST["filter" . strtolower($attr_array[$k])] = "";
-}
-$filter = $filter . ")";
-$attrs = $attr_array;
-$sr = @ldap_search($_SESSION["ldap"]->server(),
- $hst_suffix,
- $filter, $attrs);
-if ($sr) {
- $info = ldap_get_entries($_SESSION["ldap"]->server, $sr);
- ldap_free_result($sr);
- if ($info["count"] == 0) StatusMessage("WARN", "", _("No Samba Hosts found!"));
- // delete first array entry which is "count"
- array_shift($info);
+ if (sizeof($hst_info) == 0) StatusMessage("WARN", "", _("No Hosts found!"));
// sort rows by sort column ($sort)
- usort($info, "cmp_array");
+ if ($hst_info) usort($hst_info, "cmp_array");
}
-else StatusMessage("ERROR", _("LDAP Search failed! Please check your preferences."), _("No Samba Hosts found!"));
echo ("
\n";
// calculate which rows to show
$table_begin = ($page - 1) * $max_pageentrys;
-if (($page * $max_pageentrys) > sizeof($info)) $table_end = sizeof($info);
+if (($page * $max_pageentrys) > sizeof($hst_info)) $table_end = sizeof($hst_info);
else $table_end = ($page * $max_pageentrys);
// print host list
for ($i = $table_begin; $i < $table_end; $i++) {
- echo("" .
+ " | " .
+ " " . _("Edit") . " | ");
for ($k = 0; $k < sizeof($attr_array); $k++) {
echo ("");
// print all attribute entries seperated by "; "
- if (sizeof($info[$i][strtolower($attr_array[$k])]) > 0) {
+ if (sizeof($hst_info[$i][strtolower($attr_array[$k])]) > 0) {
// delete first array entry which is "count"
- array_shift($info[$i][strtolower($attr_array[$k])]);
- echo implode("; ", $info[$i][strtolower($attr_array[$k])]);
+ if (! $_GET['norefresh']) array_shift($hst_info[$i][strtolower($attr_array[$k])]);
+ echo implode("; ", $hst_info[$i][strtolower($attr_array[$k])]);
}
echo (" | ");
}
@@ -206,35 +218,39 @@ echo ("");
echo ("
");
// draw navigation bar if host accounts were found
-if (sizeof($info) > 0) {
-draw_navigation_bar(sizeof($info));
+if (sizeof($hst_info) > 0) {
+draw_navigation_bar(sizeof($hst_info));
echo ("
\n");
}
-// generate list of possible suffixes
-$sr = @ldap_search($_SESSION["ldap"]->server(),
- $_SESSION["config"]->get_HostSuffix(),
- "objectClass=organizationalunit", array("DN"));
-if ($sr) {
- $units = ldap_get_entries($_SESSION["ldap"]->server, $sr);
- // delete first array entry which is "count"
- array_shift($units);
- // remove sub arrays
- for ($i = 0; $i < sizeof($units); $i++) $units[$i] = $units[$i]['dn'];
- // add root suffix from config
- if (!in_array($_SESSION["config"]->get_HostSuffix(), $units)) array_push($units, $_SESSION["config"]->get_HostSuffix());
+if (! $_GET['norefresh']) {
+ // generate list of possible suffixes
+ $sr = @ldap_search($_SESSION["ldap"]->server(),
+ $_SESSION["config"]->get_HostSuffix(),
+ "objectClass=organizationalunit", array("DN"));
+ if ($sr) {
+ $hst_units = ldap_get_entries($_SESSION["ldap"]->server, $sr);
+ // delete first array entry which is "count"
+ array_shift($hst_units);
+ // remove sub arrays
+ for ($i = 0; $i < sizeof($hst_units); $i++) $hst_units[$i] = $hst_units[$i]['dn'];
+ // add root suffix from config
+ if (!in_array($_SESSION["config"]->get_HostSuffix(), $hst_units)) {
+ array_push($hst_units, $_SESSION["config"]->get_HostSuffix());
+ }
+ }
}
echo ("\n");
echo ("\n");
-if (sizeof($info) > 0) echo ("\n");
+if (sizeof($hst_info) > 0) echo ("\n");
// print combobox with possible sub-DNs
-if (sizeof($units) > 1) {
+if (sizeof($hst_units) > 1) {
echo (" " . _("Suffix") . ": ");
echo ("\n");
echo ("");
diff --git a/lam/templates/lists/userlink.php b/lam/templates/lists/userlink.php
new file mode 100644
index 00000000..61d0e0de
--- /dev/null
+++ b/lam/templates/lists/userlink.php
@@ -0,0 +1,59 @@
+search_username($user);
+
+if ($dn) {
+ // redirect to account.php
+ echo("");
+
+}
+else {
+ // print error message if user was not found
+ echo ("\n");
+ echo ("\n");
+ echo "
userlink\n";
+ echo "\n";
+ echo "\n";
+ echo StatusMessage("ERROR", "", _("This user was not found or is invalid!") . " " . $user);
+ echo ("\n");
+}
+
+
+