\n"; $this->dn = $d; $a = ldap_explode_dn($this->dn, 1); $this->cn = $a[0]; } cfunction getAttributeName($string) { global $prefs; for ($i=0; $iattribute_names); $i++) { if ($prefs->attribute_names[$i][0] == $string) { return $prefs->attribute_names[$i][1]; } } return $string; } cfunction isVisible($string) { global $prefs; for ($i=0; $iattribute_names); $i++) { if ($prefs->attribute_names[$i][0] == $string) { return $prefs->attribute_names[$i][2]; } } return "FALSE"; } cfunction getValues($l_i, $r_e_i) { //echo "My name is ".$this->name."
\n"; $this->values = ldap_get_values($l_i, $r_e_i, $this->name); } cfunction display() { echo "\n\t\n"; echo "\t\t".$this->name."\n\t\t\n\t\n"; echo "\n"; echo "\n\n"; } cfunction formatHTMLValues() { $ct = $this->values["count"]; $str = ""; $str .= "\n\t\n"; $n = $this->getAttributeName($this->name); $str .= "\t\t".$n."\n\t\t\n\t\n\t\t\n\t\t\n\t\n"; return $str; } cfunction formatHTMLValue($index) { global $prefs, $FILE, $host; $p = ""; switch ($this->name) { case "cn": $p .= "dn).">".$this->values[$index].""; break; case "ou": $p .= "dn).">".$this->values[$index].""; break; case "seealso": case "member": case "requeststo": case "errorsto": case "owner": case "lastmodifiedby": case "modifiersname": $p .= "values[$index]).">".ldap_dn2ufn($this->values[$index]).""; break; case "mail": $p .= "values[$index].">".$this->values[$index].""; break; case "postaladdress": case "homepostaladdress": $i=0; $tok = strtok($this->values[$index], "$"); while ($tok) { $p .= $i." ".$tok."
\n"; $tok = strtok("$"); $i++; } break; case "labeledurl": $tok = strtok($this->values[$index], " "); $tok2 = strtok("\0"); $p .= ''.$tok2.''; break; case "lastmodifiedtime": case "modifytimestamp": $t = $this->values[$index]; $hour = (int) $t[6].$t[7]; $minute = (int) $t[8].$t[9]; $second = (int) $t[10].$t[11]; $month = (int) $t[2].$t[3]; $day = (int) $t[4].$t[5]; $year = (int) $t[0].$t[1]; $timestamp = mktime($hour, $minute, $second, $month, $day, $year); $date = date("h:i:sa, on l, dS of F Y", $timestamp); $p .= $date; break; case "jpegphoto": $p .= 'Image of '.$this->cn.''; break; default: $p .= $this->values[$index]; break; } return $p; } cfunction displayValue($index) { //echo "ldap_entry_attribute.displayValue(".$index.")
\n"; global $FILE, $host; if ($this->name == "cn") { print "dn).">".$this->values[$index].""; } else if ($this->name == "ou") { print "dn).">".$this->values[$index].""; } else if ($this->name == "seealso" || $this->name == "member" || $this->name == "requeststo" || $this->name == "errorsto" || $this->name == "owner" || $this->name == "lastmodifiedby" || $this->name == "modifiersname") { print "values[$index]).">".ldap_dn2ufn($this->values[$index]).""; } else if ($this->name == "mail") { print "values[$index].">".$this->values[$index].""; } else if ($this->name == "labeledurl") { $tok = strtok($this->values[$index], " "); $tok2 = strtok("\0"); print ''.$tok2.''; } else if ($this->name == "lastmodifiedtime" || $this->name == "modifytimestamp") { $t = $this->values[$index]; $hour = (int) $t[6].$t[7]; $minute = (int) $t[8].$t[9]; $second = (int) $t[10].$t[11]; $month = (int) $t[2].$t[3]; $day = (int) $t[4].$t[5]; $year = (int) $t[0].$t[1]; $timestamp = mktime($hour, $minute, $second, $month, $day, $year); $date = date("h:i:sa, on l, dS of F Y", $timestamp); // $date = getdate($timestamp); // $date = getdate($this->values[$index]); // echo "".$date["hours"].":".$date["minutes"].", // ".$date["weekday"].",".$date["month"]." ".$date["mday"].", ".$date["year"]."
\n"; print $date; } else { print $this->values[$index]; } } } ?>