From dc2a192a8ad64e944714f0f776a6130032d0f3b4 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 27 Jan 2005 22:14:01 +0000 Subject: [PATCH] fixed problem with spaces in DN --- lam/lib/lists.inc | 7 +++++-- lam/templates/lists/listgroups.php | 23 +++++++++++++---------- lam/templates/lists/listhosts.php | 23 +++++++++++++---------- lam/templates/lists/listusers.php | 26 +++++++++++++++----------- 4 files changed, 46 insertions(+), 33 deletions(-) diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index e3c0748d..99dc2d55 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -239,7 +239,10 @@ function listDoPost($scope) { elseif ($_POST['del']){ // search for checkboxes $accounts = array_keys($_POST, "on"); - $_SESSION['delete_dn'] = $accounts; + $_SESSION['delete_dn'] = array(); + for ($i = 0; $i < sizeof($accounts); $i++) { + $_SESSION['delete_dn'][] = $_SESSION[$scope . 'info'][$accounts[$i]]['dn']; + } if (sizeof($accounts) > 0) { metaRefresh("../delete.php?type=" . $scope); exit; @@ -254,7 +257,7 @@ function listDoPost($scope) { // load accounts from LDAP for ($i = 0; $i < sizeof($accounts); $i++) { $_SESSION["accountPDF-$i"] = new accountContainer($scope, "accountPDF-$i"); - $_SESSION["accountPDF-$i"]->load_account($accounts[$i]); + $_SESSION["accountPDF-$i"]->load_account($_SESSION[$scope . 'info'][$accounts[$i]]['dn']); $list[$i] = $_SESSION["accountPDF-$i"]; } if (sizeof($list) > 0) { diff --git a/lam/templates/lists/listgroups.php b/lam/templates/lists/listgroups.php index a0c1a1e9..9ef764ac 100644 --- a/lam/templates/lists/listgroups.php +++ b/lam/templates/lists/listgroups.php @@ -139,7 +139,10 @@ $filter = listBuildFilter($_POST, $attr_array); $info = listFilterAccounts($info, $filter); if (sizeof($info) == 0) StatusMessage("WARN", "", _("No groups found!")); // sort rows by sort column ($sort) -if ($info) $info = listSort($sort, $attr_array, $info); +if ($info) { + $info = listSort($sort, $attr_array, $info); + $_SESSION[$scope . 'info'] = $info; +} // build filter URL $searchFilter = array(); @@ -173,19 +176,19 @@ else $table_end = ($page * $max_page_entries); if (sizeof($info) > 0) { // print group list for ($i = $table_begin; $i < $table_end; $i++) { - echo(""); + echo(""); if ($_GET['selectall'] == "yes") { - echo " "; + echo " "; } else { - echo " "; + echo " "; } - echo (" " . _("Edit") . ""); + echo (" " . _("Edit") . ""); for ($k = 0; $k < sizeof($attr_array); $k++) { echo (""); // print all attribute entries seperated by "; " diff --git a/lam/templates/lists/listhosts.php b/lam/templates/lists/listhosts.php index 7fd24023..72904fe5 100644 --- a/lam/templates/lists/listhosts.php +++ b/lam/templates/lists/listhosts.php @@ -139,7 +139,10 @@ $filter = listBuildFilter($_POST, $attr_array); $info = listFilterAccounts($info, $filter); if (sizeof($info) == 0) StatusMessage("WARN", "", _("No hosts found!")); // sort rows by sort column ($sort) -if ($info) $info = listSort($sort, $attr_array, $info); +if ($info) { + $info = listSort($sort, $attr_array, $info); + $_SESSION[$scope . 'info'] = $info; +} // build filter URL $searchFilter = array(); @@ -173,19 +176,19 @@ else $table_end = ($page * $max_page_entries); if (sizeof($info) > 0) { // print host list for ($i = $table_begin; $i < $table_end; $i++) { - echo(""); + echo(""); if ($_GET['selectall'] == "yes") { - echo " "; + echo " "; } else { - echo " "; + echo " "; } - echo (" " . _("Edit") . ""); + echo (" " . _("Edit") . ""); for ($k = 0; $k < sizeof($attr_array); $k++) { echo (""); // print all attribute entries seperated by "; " diff --git a/lam/templates/lists/listusers.php b/lam/templates/lists/listusers.php index 2be77119..f900c980 100644 --- a/lam/templates/lists/listusers.php +++ b/lam/templates/lists/listusers.php @@ -169,7 +169,10 @@ $filter = listBuildFilter($_POST, $attr_array); $info = listFilterAccounts($info, $filter); if (sizeof($info) == 0) StatusMessage("WARN", "", _("No users found!")); // sort rows by sort column ($sort) -if ($info) $info = listSort($sort, $attr_array, $info); +if ($info) { + $info = listSort($sort, $attr_array, $info); + $_SESSION[$scope . 'info'] = $info; +} // build filter URL $searchFilter = array(); @@ -216,24 +219,25 @@ if ($user_count != 0) { // resort if needed if ($sort == "gidnumber") { $info = listSort($sort, $attr_array, $info); + $_SESSION[$scope . 'info'] = $info; } } // print user list - for ($i = $table_begin; $i < $table_end; $i++) { // ignore last entry in array which is "count" - echo("\n"); + for ($i = $table_begin; $i < $table_end; $i++) { + echo("\n"); // checkboxes if selectall = "yes" if ($_GET['selectall'] == "yes") { - echo "\n\n\n"; + echo "\n\n\n"; } else { - echo "\n\n\n"; + echo "\n\n\n"; } - echo ("\n" . + echo ("\n" . _("Edit") . "\n\n"); for ($k = 0; $k < sizeof($attr_array); $k++) { echo ("\n");