parent
e0d693ed2f
commit
d4a879a987
|
@ -25,6 +25,10 @@ $Id$
|
|||
include_once ('../config/config.php');
|
||||
include_once("ldap.php");
|
||||
|
||||
// start session
|
||||
session_save_path("../sess");
|
||||
@session_start();
|
||||
|
||||
// class representing local user entry with attributes of ldap user entry
|
||||
include_once("userentry.php");
|
||||
|
||||
|
@ -34,47 +38,73 @@ echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\" />
|
|||
echo "<script src=\"./functions.js\" type=\"text/javascript\" language=\"javascript\"></script>";
|
||||
echo "</head>";
|
||||
echo "<body bgcolor=\"#F5F5F5\">";
|
||||
// config object should be in session!!!
|
||||
$config = new Config();
|
||||
$ldap = new Ldap($config);
|
||||
|
||||
// username/password should also be in session!!!
|
||||
$username = "cn=admin,o=test,c=de";
|
||||
$passwd = "secret";
|
||||
$result = $ldap->connect ($username, $passwd);
|
||||
// generate attribute-description table
|
||||
$attr_array; // list of LDAP attributes to show
|
||||
$desc_array; // list of descriptions for the attributes
|
||||
$attr_string = $_SESSION["config"]->get_userlistAttributes();
|
||||
$temp_array = explode(";", $attr_string);
|
||||
$hash_table = $_SESSION["ldap"]->attributeUserArray();
|
||||
for ($i = 0; $i < sizeof($temp_array); $i++) {
|
||||
// if value is predifined, look up description in hash_table
|
||||
if (substr($temp_array[$i],0,1) == "#") {
|
||||
$attr = substr($temp_array[$i],1);
|
||||
$attr_array[$i] = $attr;
|
||||
$desc_array[] = $hash_table[$attr];
|
||||
}
|
||||
// if not predefined, the attribute is seperated by a ":" from description
|
||||
else {
|
||||
$attr = explode(":", $temp_array[$i]);
|
||||
$attr_array[$i] = $attr[0];
|
||||
$desc_array[$i] = $attr[1];
|
||||
}
|
||||
}
|
||||
|
||||
$user_dn_list = $ldap->getUsers ($config->get_UserSuffix());
|
||||
$user_dn_list = $_SESSION["ldap"]->getUsers
|
||||
($_SESSION["config"]->get_UserSuffix());
|
||||
|
||||
|
||||
echo ("<form action=\"../templates/account.php?type=user\" method=\"post\">\n");
|
||||
echo "<table width=\"100%\">\n";
|
||||
|
||||
// print attribute headers
|
||||
echo "<tr>";
|
||||
echo "<th class=\"userlist\"></th>";
|
||||
echo "<th class=\"userlist\">Vorname</th>";
|
||||
echo "<th class=\"userlist\">Nachname</th>";
|
||||
echo "<th class=\"userlist\">Uid</th>";
|
||||
echo "<th class=\"userlist\">Home Verzeichnis</th>";
|
||||
for ($k = 0; $k < sizeof($desc_array); $k++) {
|
||||
echo "<th class=\"userlist\">" . $desc_array[$k] . "</th>";
|
||||
}
|
||||
echo "</tr>";
|
||||
|
||||
$row_number = 0;
|
||||
|
||||
foreach ($user_dn_list as $user_dn) {
|
||||
|
||||
echo "<tr onmouseover=\"setPointer(this, " . $row_number . ", 'over', '#DDDDDD', '#CCFFCC', '#FFCC99');\" onmouseout=\"setPointer(this, " . $row_number . ", 'out', '#DDDDDD', '#CCFFCC', '#FFCC99');\" onmousedown=\"setPointer(this, " . $row_number . ", 'click', '#DDDDDD', '#CCFFCC', '#FFCC99');\">\n";
|
||||
echo "<tr onmouseover=\"setPointer(this, " . $row_number . ", 'over', '#DDDDDD', '#CCCCFF', '#FFCCCC');\" onmouseout=\"setPointer(this, " . $row_number . ", 'out', '#DDDDDD', '#CCCCFF', '#FFCCCC');\" onmousedown=\"setPointer(this, " . $row_number . ", 'click', '#DDDDDD', '#CCCCFF', '#FFCCCC');\">\n";
|
||||
$row_number++;
|
||||
|
||||
$userentry = new UserEntry();
|
||||
$userentry = $ldap->getEntry ($user_dn, $userentry);
|
||||
$ldap->getEntry ($user_dn, $userentry);
|
||||
echo ("<td class=\"userlist\">" . "<input type=\"checkbox\" name=\"..\"" . "</td>");
|
||||
echo ("<td class=\"userlist\">" . current ($userentry->getGivenName()) . "</td>");
|
||||
echo ("<td class=\"userlist\">" . current ($userentry->getSn()) . "</td>");
|
||||
echo ("<td class=\"userlist\">" . current ($userentry->getUid()) . "</td>");
|
||||
echo ("<td class=\"userlist\">" . current ($userentry->gethomeDirectory()) . "</td>");
|
||||
$userentry = $_SESSION["ldap"]->getEntry ($user_dn, $userentry);
|
||||
// $ldap->getEntry ($user_dn, $userentry);
|
||||
echo ("<td bgcolor=\"#DDDDDD\" >" . "<input type=\"checkbox\" name=\"..\"" . "</td>");
|
||||
echo ("<td bgcolor=\"#DDDDDD\" class=\"userlist\"><a href=\"../templates/account.php?type=edituser&uid=" . current ($userentry->getUid()) . "\">" . current ($userentry->getUid()) . "</a></td>");
|
||||
echo ("<td bgcolor=\"#DDDDDD\" class=\"userlist\">" . current ($userentry->getCn()) . "</td>");
|
||||
echo ("<td bgcolor=\"#DDDDDD\" class=\"userlist\">" . current ($userentry->getSn()) . "</td>");
|
||||
echo ("<td bgcolor=\"#DDDDDD\" class=\"userlist\">" . current ($userentry->gethomeDirectory()) . "</td>");
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
echo ("<br />");
|
||||
echo ("<table cellspacing=\"4\" align=\"left\" border=\"0\">");
|
||||
echo ("<tr><td>");
|
||||
echo ("<input type=\"button\" name=\"deluser\" value=\"" . _("Delete selected Users") . "\" onClick=\"self.location.href='../templates/account.php?type=delete'\"></td>\n");
|
||||
echo ("<td>");
|
||||
echo ("<input type=\"button\" name=\"newuser\" value=\"" . _("New User") . "\" onClick=\"self.location.href='../templates/account.php?type=user'\">");
|
||||
echo ("</td></tr>");
|
||||
echo ("</table>\n");
|
||||
echo ("</form>\n");
|
||||
|
||||
echo "</body>";
|
||||
|
||||
$ldap->close();
|
||||
|
||||
echo "</html>";
|
||||
?>
|
||||
|
||||
|
|
Loading…
Reference in New Issue