fixed problem with spaces in DN

This commit is contained in:
Roland Gruber 2005-01-27 22:14:01 +00:00
parent 91ba8e753a
commit dc2a192a8a
4 changed files with 46 additions and 33 deletions

View File

@ -239,7 +239,10 @@ function listDoPost($scope) {
elseif ($_POST['del']){ elseif ($_POST['del']){
// search for checkboxes // search for checkboxes
$accounts = array_keys($_POST, "on"); $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) { if (sizeof($accounts) > 0) {
metaRefresh("../delete.php?type=" . $scope); metaRefresh("../delete.php?type=" . $scope);
exit; exit;
@ -254,7 +257,7 @@ function listDoPost($scope) {
// load accounts from LDAP // load accounts from LDAP
for ($i = 0; $i < sizeof($accounts); $i++) { for ($i = 0; $i < sizeof($accounts); $i++) {
$_SESSION["accountPDF-$i"] = new accountContainer($scope, "accountPDF-$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"]; $list[$i] = $_SESSION["accountPDF-$i"];
} }
if (sizeof($list) > 0) { if (sizeof($list) > 0) {

View File

@ -139,7 +139,10 @@ $filter = listBuildFilter($_POST, $attr_array);
$info = listFilterAccounts($info, $filter); $info = listFilterAccounts($info, $filter);
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No groups found!")); if (sizeof($info) == 0) StatusMessage("WARN", "", _("No groups found!"));
// sort rows by sort column ($sort) // 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 // build filter URL
$searchFilter = array(); $searchFilter = array();
@ -173,19 +176,19 @@ else $table_end = ($page * $max_page_entries);
if (sizeof($info) > 0) { if (sizeof($info) > 0) {
// print group list // print group list
for ($i = $table_begin; $i < $table_end; $i++) { for ($i = $table_begin; $i < $table_end; $i++) {
echo("<tr class=\"grouplist\" onMouseOver=\"group_over(this, '" . $info[$i]["dn"] . "')\"" . echo("<tr class=\"grouplist\" onMouseOver=\"group_over(this, '" . $i . "')\"" .
" onMouseOut=\"group_out(this, '" . $info[$i]["dn"] . "')\"" . " onMouseOut=\"group_out(this, '" . $i . "')\"" .
" onClick=\"group_click(this, '" . $info[$i]["dn"] . "')\"" . " onClick=\"group_click(this, '" . $i . "')\"" .
" onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=group&amp;DN=" . $info[$i]["dn"] . "'\">"); " onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=group&amp;DN=" . $i . "'\">");
if ($_GET['selectall'] == "yes") { if ($_GET['selectall'] == "yes") {
echo " <td height=22 align=\"center\"><input onClick=\"group_click(this, '" . $info[$i]["dn"] . "')\" type=\"checkbox\"" . echo " <td height=22 align=\"center\"><input onClick=\"group_click(this, '" . $i . "')\" type=\"checkbox\"" .
" name=\"" . $info[$i]["dn"] . "\" checked></td>"; " name=\"" . $i . "\" checked></td>";
} }
else { else {
echo " <td height=22 align=\"center\"><input onClick=\"group_click(this, '" . $info[$i]["dn"] . "')\" type=\"checkbox\"" . echo " <td height=22 align=\"center\"><input onClick=\"group_click(this, '" . $i . "')\" type=\"checkbox\"" .
" name=\"" . $info[$i]["dn"] . "\"></td>"; " name=\"" . $i . "\"></td>";
} }
echo (" <td align='center'><a href=\"../account/edit.php?type=group&amp;DN='" . $info[$i]["dn"] . "'\">" . _("Edit") . "</a></td>"); echo (" <td align='center'><a href=\"../account/edit.php?type=group&amp;DN='" . $i . "'\">" . _("Edit") . "</a></td>");
for ($k = 0; $k < sizeof($attr_array); $k++) { for ($k = 0; $k < sizeof($attr_array); $k++) {
echo ("<td>"); echo ("<td>");
// print all attribute entries seperated by "; " // print all attribute entries seperated by "; "

View File

@ -139,7 +139,10 @@ $filter = listBuildFilter($_POST, $attr_array);
$info = listFilterAccounts($info, $filter); $info = listFilterAccounts($info, $filter);
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No hosts found!")); if (sizeof($info) == 0) StatusMessage("WARN", "", _("No hosts found!"));
// sort rows by sort column ($sort) // 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 // build filter URL
$searchFilter = array(); $searchFilter = array();
@ -173,19 +176,19 @@ else $table_end = ($page * $max_page_entries);
if (sizeof($info) > 0) { if (sizeof($info) > 0) {
// print host list // print host list
for ($i = $table_begin; $i < $table_end; $i++) { for ($i = $table_begin; $i < $table_end; $i++) {
echo("<tr class=\"hostlist\" onMouseOver=\"host_over(this, '" . $info[$i]["dn"] . "')\"" . echo("<tr class=\"hostlist\" onMouseOver=\"host_over(this, '" . $i . "')\"" .
" onMouseOut=\"host_out(this, '" . $info[$i]["dn"] . "')\"" . " onMouseOut=\"host_out(this, '" . $i . "')\"" .
" onClick=\"host_click(this, '" . $info[$i]["dn"] . "')\"" . " onClick=\"host_click(this, '" . $i . "')\"" .
" onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=host&amp;DN=" . $info[$i]["dn"] . "'\">"); " onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=host&amp;DN=" . $i . "'\">");
if ($_GET['selectall'] == "yes") { if ($_GET['selectall'] == "yes") {
echo " <td height=22 align=\"center\"><input onClick=\"host_click(this, '" . $info[$i]["dn"] . "')\"" . echo " <td height=22 align=\"center\"><input onClick=\"host_click(this, '" . $i . "')\"" .
" type=\"checkbox\" checked name=\"" . $info[$i]["dn"] . "\"></td>"; " type=\"checkbox\" checked name=\"" . $i . "\"></td>";
} }
else { else {
echo " <td height=22 align=\"center\"><input onClick=\"host_click(this, '" . $info[$i]["dn"] . "')\"" . echo " <td height=22 align=\"center\"><input onClick=\"host_click(this, '" . $i . "')\"" .
" type=\"checkbox\" name=\"" . $info[$i]["dn"] . "\"></td>"; " type=\"checkbox\" name=\"" . $i . "\"></td>";
} }
echo (" <td align='center'><a href=\"../account/edit.php?type=host&amp;DN='" . $info[$i]["dn"] . "'\">" . _("Edit") . "</a></td>"); echo (" <td align='center'><a href=\"../account/edit.php?type=host&amp;DN='" . $i . "'\">" . _("Edit") . "</a></td>");
for ($k = 0; $k < sizeof($attr_array); $k++) { for ($k = 0; $k < sizeof($attr_array); $k++) {
echo ("<td>"); echo ("<td>");
// print all attribute entries seperated by "; " // print all attribute entries seperated by "; "

View File

@ -169,7 +169,10 @@ $filter = listBuildFilter($_POST, $attr_array);
$info = listFilterAccounts($info, $filter); $info = listFilterAccounts($info, $filter);
if (sizeof($info) == 0) StatusMessage("WARN", "", _("No users found!")); if (sizeof($info) == 0) StatusMessage("WARN", "", _("No users found!"));
// sort rows by sort column ($sort) // 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 // build filter URL
$searchFilter = array(); $searchFilter = array();
@ -216,24 +219,25 @@ if ($user_count != 0) {
// resort if needed // resort if needed
if ($sort == "gidnumber") { if ($sort == "gidnumber") {
$info = listSort($sort, $attr_array, $info); $info = listSort($sort, $attr_array, $info);
$_SESSION[$scope . 'info'] = $info;
} }
} }
// print user list // print user list
for ($i = $table_begin; $i < $table_end; $i++) { // ignore last entry in array which is "count" for ($i = $table_begin; $i < $table_end; $i++) {
echo("<tr class=\"userlist\"\nonMouseOver=\"user_over(this, '" . $info[$i]["dn"] . "')\"\n" . echo("<tr class=\"userlist\"\nonMouseOver=\"user_over(this, '" . $i . "')\"\n" .
"onMouseOut=\"user_out(this, '" . $info[$i]["dn"] . "')\"\n" . "onMouseOut=\"user_out(this, '" . $i . "')\"\n" .
"onClick=\"user_click(this, '" . $info[$i]["dn"] . "')\"\n" . "onClick=\"user_click(this, '" . $i . "')\"\n" .
"onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=user&amp;DN=" . $info[$i]["dn"] . "'\">\n"); "onDblClick=\"parent.frames[1].location.href='../account/edit.php?type=user&amp;DN=" . $i . "'\">\n");
// checkboxes if selectall = "yes" // checkboxes if selectall = "yes"
if ($_GET['selectall'] == "yes") { if ($_GET['selectall'] == "yes") {
echo "<td height=22 align=\"center\">\n<input onClick=\"user_click(this, '" . $info[$i]["dn"] . "')\" type=\"checkbox\" name=\"" . echo "<td height=22 align=\"center\">\n<input onClick=\"user_click(this, '" . $i . "')\" type=\"checkbox\" name=\"" .
$info[$i]["dn"] . "\" checked>\n</td>\n"; $i . "\" checked>\n</td>\n";
} }
else { else {
echo "<td height=22 align=\"center\">\n<input onClick=\"user_click(this, '" . $info[$i]["dn"] . "')\" type=\"checkbox\" name=\"" . echo "<td height=22 align=\"center\">\n<input onClick=\"user_click(this, '" . $i . "')\" type=\"checkbox\" name=\"" .
$info[$i]["dn"] . "\">\n</td>\n"; $i . "\">\n</td>\n";
} }
echo ("<td align='center'>\n<a href=\"../account/edit.php?type=user&amp;DN='" . $info[$i]["dn"] . "'\">" . echo ("<td align='center'>\n<a href=\"../account/edit.php?type=user&amp;DN='" . $i . "'\">" .
_("Edit") . "</a>\n</td>\n"); _("Edit") . "</a>\n</td>\n");
for ($k = 0; $k < sizeof($attr_array); $k++) { for ($k = 0; $k < sizeof($attr_array); $k++) {
echo ("<td>\n"); echo ("<td>\n");