2 include 'include/ldap_entry_attribute.inc';
11 cfunction ldap_entry($l_i) {
12 // echo "creating new ldap_entry<br>\n";
13 $this->link_identifier = $l_i;
16 cfunction getAttributes() {
18 $attrib = new ldap_entry_attribute($this->dn);
19 $n = ldap_first_attribute($this->link_identifier, $this->r_e_i, &$ber);
22 $attrib->getValues($this->link_identifier,$this->r_e_i);
23 $this->attributes[$i] = $attrib;
25 $attrib = new ldap_entry_attribute($this->dn);
26 $n = ldap_next_attribute($this->link_identifier, $this->r_e_i, $ber);
30 cfunction formatHTMLDN($dn) {
33 $attribs = ldap_explode_dn($dn, 0);
34 $names = ldap_explode_dn($dn, 1);
35 for ($i=0; $i<$attribs["count"]; $i++) {
37 for ($j=$i+1; $j<$attribs["count"]; $j++) {
38 $s .= ",".$attribs[$j];
40 if (($s[0] == "c") && ($s[1] == "n")) {
41 $string .= "<a href=".$FILE."?ldap_action=read&base_dn=".urlencode($s).">".$names[$i]."</a>";
44 $string .= "<a href=".$FILE."?ldap_action=list&base_dn=".urlencode($s).">".$names[$i]."</a>";
46 if ($i<$attribs["count"]-1) { $string .= ", "; }
51 cfunction formatHTMLAttributes() {
55 $s .= '<td colspan=2 bgcolor="#9380DB" align="center" valign="middle">';
56 $s .= "\n\t\t<h3 class=head>".$this->formatHTMLDN($this->dn)."</h3>\n";
57 $s .= "\t\t</td>\n\t</tr>\n";
58 $c = count($this->attributes);
59 for ($i=0; $i<$c; $i++) {
60 $attrib = $this->attributes[$i];
61 if ($attrib->isVisible($attrib->name) == "TRUE") {
62 $s .= $attrib->formatHTMLValues();
65 $a = $this->attributes[0];
67 if ($v == "organizationalUnit" || $v == "organization") {
68 $s .= "<tr>\n\t<td colspan=2>\n";
69 $s .= "\t\t<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>\n";
70 $s .= "\t\t</td>\n\t</tr>\n";
72 else if ($v == "person") {
73 $s .= "<tr>\n\t<td colspan=2>\n";
74 $s .= "\t\t<a href=".$FILE."?host=".urlencode($host)."&ldap_action=read&admin_action=modify&base_dn=".urlencode($this->dn).">Modify</a>\n";
75 $s .= "\t\t</td>\n\t</tr>\n";
78 $s .= "<tr>\n\t<td colspan=2>\n\t\t \n\t\t</td>\n\t</tr>\n";
85 echo "<tr><td colspan=2 bgcolor=gray>";
86 echo "<h3>".ldap_dn2ufn($this->dn)."</h3>";
88 $c = count($this->attributes);
89 for ($i=0; $i<$c; $i++) {
90 $attrib = $this->attributes[$i];
93 $a = $this->attributes[0];
95 if ($v == "organizationalUnit" || $v == "organization") {
96 echo "<tr><td colspan=2>";
97 echo "<a href=".$FILE."?host=".urlencode($host)."&ldap_action=list&base_dn=".urlencode($this->dn).">Browse</a>";
101 echo "<tr><td colspan=2> </td></tr>";