require_once("setup.php"); require_once("functions.php"); if (!$dn){ echo '
Nespravne volana funkcia
'; return; }; //////////////////////////////////////////////////////////// //form paint ?>
if ($debug) echo "Connecting ...[$ldapServer:$ldapPort] zaznam mozete ';
echo 'ziskat';
echo " aj vo formate vCard (.vcf)
";
$lc=@ldap_connect($ldapServer, $ldapPort);
if ($debug) echo "connect result is [".$lc."]
";
$ldapV3 = ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,3);
if ($debug) echo "ldap protocol v3 je [".$ldapV3."]
";
if ($lc) {
if ($debug) echo "Binding as [$ldapLogin:$ldapPwd]
";
if (@ldap_bind($lc, $ldapLogin, $ldapPwd)){
if ($debug) echo "Searching for ";
$attr[]="*"; //sosame vsetky attribs
if ($debug){
echo "attr[]=";
for ($i=0;$i
\n";
//$result=ldap_search($lc, $ldapDN, "(objectclass=*)", $atr, 0, $search_limit);
$result=@ldap_search($lc, $dn, $queryStr, $attr, 0, 1); //just 1 record
//$result=@ldap_search($lc, $dn); //just 1 record
/*
ldap_search(
connection $this->res
base_dn $this->dn_all
filter sets the restrictions
attributes as array array of attributes returned
attrsonly 1 = return only the attributes, 0 = return attributes and values
amount number of results to return; 0 means all
time limit time limit in seconds; 0 means no limit
deref handling of aliases:
LDAP_DEREF_NEVER never resolv aliases
LDAP_DEREF_SEARCHING not if base object is called
LDAP_DEREF_FINDING only if base object is called
LDAP_DEREF_ALWAYS always resolv aliases
$result=ldap_search($lc, $ldapDN, "(objectclass=*)");
*/
if (!isset($result)){
echo "Zaznam $dn nenajdeny.
Pravdepodobne ho prave niekto zmazal.$brn";
return;
};
if ($debug) echo "Search result is ".$result."
";
if ($debug) echo "Number of entires returned is ".ldap_count_entries($lc,$result)."
";
if ($debug) echo "Getting entries ...
";
$info = ldap_get_entries($lc, $result);
if ($debug) echo "Data for ".$info["count"]." items returned:
\n";
if ($debug) echo "info[count] = ".$info["count"]."
";
if (ldap_count_entries($lc,$result)){
//ziskame zoznam attribs podla toho co mame zadane v setup.php/schema
$attrList=getArraySlice($schema,0);
//attrList je pole a vyzera nejako takto: ("cn","sn","givenName",...)
$attrString=implode(",",$attrList);
if ($debug) echo "attrString=[".$attrString."]$brn";
//attrString je string a vyzera nejako takto: "cn,sn,givenName,..."
//mohol by som to spucit do jedneho s nasledujucim prikazom, ale vyzeralo
//by to velmi hnusne a o par dni by som to urcite ani sam nepochopil
$attrValues=getRecordAttribList($info[0],$attrString);
//attrValues je pole a obsahuje vyplnene data v rovnakom poradi ako $attrList
//toto budeme potrebovat right now tak si to vysosneme este raz
list($cn, $sn, $givenName) = getRecordAttribList($info[0],"cn,sn,givenname");
} else {
echo "Zaznam nebol najdeny.
\n";
return;
};
echo '
';
echo '';
echo '
'."\n";
echo '';
echo ( (($sn=="")||($givenName=="")) ? ($cn) : ("$sn, $givenName") );
echo ' '."\n";
for ($i=0; $iAtribut Hodnota Typ (?) ';
//name
if ($detailShowAttribDescription){
//attr description for dumbheads
echo $detailShowAttribDescriptionFormat[0];
echo $schema[$i][1];
echo $detailShowAttribDescriptionFormat[1].$brn;
};
if ($detailShowAttribName){
//attr name
echo $detailShowAttribNameFormat[0];
echo $schema[$i][0];
echo $detailShowAttribNameFormat[1].$brn; //attr description for dumbheads
};
echo ' '."\n".'';
//value
if (!getSchemaFlag($i,$SCHEMA_BINARY)){
//normalna hodnota
if (!getSchemaFlag($i,$SCHEMA_SECRET)){
//normalna hodnota
if (is_array($attrValues[$i])){
//multivalue
for ($mv=0; $mv '."\n".'
\n";
if (getSchemaFlag($i,$SCHEMA_MAILTO)) echo '';
};
} else {
if (getSchemaFlag($i,$SCHEMA_MAILTO)) echo '';
echo $attrValues[$i];
if (getSchemaFlag($i,$SCHEMA_MAILTO)) echo '';
};
} else {
//secret hodnota
if (is_array($attrValues[$i])){
//multivalue
for ($mv=0; $mv';
//flags
echo iconDef2( "read_only", getSchemaFlag($i,$SCHEMA_READ_ONLY), "R/O", 1);
echo iconDef2( "read_only_admin", getSchemaFlag($i,$SCHEMA_ADMIN_READ_ONLY), "A R/O", 1);
echo iconDef2( "one", getSchemaFlag($i,$SCHEMA_ONE), "1..1", 1);
echo iconDef2( "zero_n", getSchemaFlag($i,$SCHEMA_ZERO_N), "0..N", 1);
echo iconDef2( "one_n", getSchemaFlag($i,$SCHEMA_ONE_N), "1..N", 1);
echo iconDef2( "binary", getSchemaFlag($i,$SCHEMA_BINARY), "BIN", 1);
echo iconDef2( "secret", getSchemaFlag($i,$SCHEMA_SECRET),"***", 1);
echo ' '."\n";
};
echo '
\nKontaktuje prosim administratora systemu.";
}; // if bind
if ($debug) echo "Closing connection";
ldap_close($lc);
} else {
echo "Nemozem sa pripojit k LDAP serveru na adrese $ldapServer:$ldapPort
\nKontaktuje prosim administratora systemu.";
};
?>