include 'include/ldap_entry_attribute.inc';
class ldap_entry {
var $attributes;
var $dn;
var $parent;
var $attributeCount;
var $link_identifier;
var $r_e_i;
cfunction ldap_entry($l_i) {
// echo "creating new ldap_entry
\n";
$this->link_identifier = $l_i;
}
cfunction getAttributes() {
$i=0;
$attrib = new ldap_entry_attribute($this->dn);
$n = ldap_first_attribute($this->link_identifier, $this->r_e_i, &$ber);
while ($n) {
$attrib->name = $n;
$attrib->getValues($this->link_identifier,$this->r_e_i);
$this->attributes[$i] = $attrib;
$i++;
$attrib = new ldap_entry_attribute($this->dn);
$n = ldap_next_attribute($this->link_identifier, $this->r_e_i, $ber);
}
}
cfunction formatHTMLDN($dn) {
global $FILE, $host;
$string = "";
$attribs = ldap_explode_dn($dn, 0);
$names = ldap_explode_dn($dn, 1);
for ($i=0; $i<$attribs["count"]; $i++) {
$s = $attribs[$i];
for ($j=$i+1; $j<$attribs["count"]; $j++) {
$s .= ",".$attribs[$j];
}
if (($s[0] == "c") && ($s[1] == "n")) {
$string .= "".$names[$i]."";
}
else {
$string .= "".$names[$i]."";
}
if ($i<$attribs["count"]-1) { $string .= ", "; }
}
return $string;
}
cfunction formatHTMLAttributes() {
global $FILE, $host;
$s = "";
$s .= "