Nespravne volana funkcia

'; return; }; //////////////////////////////////////////////////////////// //sosanie dat z formulara + pustanie do ldap $item_count = $_GET["itemCount"]; $item_index = $_GET["item_index"]; $item_value = $_GET["item_value"]; //$dn = $_GET["itemDN"]; unset($itemIndex2); if ($debug){ for ($i=0; $i\n"; list($level, $subLevel) = explode(';',$item_index[$i]); echo "level=[$level], subLevel=[$subLevel]
\n"; if ($subLevel!=""){ //multivalue echo "..multilevel: itemIndex2[$level][$subLevel]=$level".$brn; $itemIndex2[$level][$subLevel]=$level; } else { //single value echo "..singlelevel: itemIndex2[$level]=$level".$brn; $itemIndex2[$level]=$level; }; echo "schema[item_index[$i]][0]=[".$schema[$item_index[$i]][0]."]".$brn; echo "item_value[$i]=[".$item_value[$i]."]".$brn.$brn; }; }; //return; echo '

'."\n"; //potrebujeme natiahnut stare hodnoty, aby sme vedeli co sa maze, co sa meni a co sa nemeni unset($attrList); for ($i=0; $i"; $lc=@ldap_connect($ldapServer, $ldapPort); if ($debug) echo "connect result is [".$lc."]
"; if ($lc) { $ldapV3 = ldap_set_option($lc,LDAP_OPT_PROTOCOL_VERSION,3); if ($debug) echo "ldap protocol v3 je [".$ldapV3."]
"; if ($debug) echo "Binding as [$ldapLogin:$ldapPwd]
"; if (@ldap_bind($lc, $ldapLogin, $ldapPwd)){ if ($debug) echo "Searching for "; //$attr[]="*"; //sosame vsetky attribs, je to nastavene v $attrList if ($debug){ echo "attrList[]="; for ($i=0;$i\n"; }; $queryStr="(objectClass=*)"; if ($debug) echo "queryStr=[$queryStr]
\n"; //$result=ldap_search($lc, $ldapDN, "(objectclass=*)", $atr, 0, $search_limit); $result=@ldap_search($lc, $dn, $queryStr, $attrList, 0, 1); //just 1 record 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",...) //v tomto behu uz mame attrList nastaveny zo zaciatku scriptu $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 } else { echo "Zaznam nebol najdeny.
\n"; return; }; unset($queryAdd); //for addings unset($queryMod); //for modyfings ;) //vyzera to ze add aj mod sa da robit naraz jednym prikazom, takze tieto dve polia //asi spucim dokopy unset($queryDel); //for deletings for ($i=0; $i".$schema[$item_index[$i]][0]."], "; echo "item_value[$i]=[".$item_value[$i]."], "; echo "attrValues[$i]=[".$attrValues[$i]."]".$brn; echo "(attrValues[$i]=[$attrValues[$i]]) != (item_value[$i]=[$item_value[$i]])$brn"; }; if ($attrValues[$i]!=$item_value[$i]){ if (getSchemaFlag($item_index[$i],$SCHEMA_BINARY)) { //binarna hodnota, toto mozeme maximalne tak zmazat ak je treba if ($item_value[$i]=="delete") { //toz, mazeme! $meno = $schema[$item_index[$i]][0]; $queryDel[$meno][] = ";binary;"; //$attrValues[$i]; //stary obsah }; } else if (($attrValues[$i]=="")&&($item_value[$i]!="")){ //pridavame $meno = $schema[$item_index[$i]][0]; $queryAdd[$meno][] = $item_value[$i]; //novy obsah if ($debug) echo "queryAdd[$meno][] = $item_value[$i]$brn"; //novy obsah } else if (($attrValues[$i]!="")&&($item_value[$i]=="")){ //mazeme $meno = $schema[$item_index[$i]][0]; $queryDel[$meno][] = $attrValues[$i]; //stary obsah if ($debug) echo "queryDel[$meno][] = $attrValues[$i]$brn"; //stary obsah } else { //menime $meno = $schema[$item_index[$i]][0]; $queryMod[$meno][] = $item_value[$i]; //novy obsah if ($debug) echo "queryMod[$meno][] = $item_value[$i]$brn"; //novy obsah }; } else { if ($debug) echo "su rovnake$brn"; //su rovnake, takze sa nic nedeje }; }; //for 0..count($item_index) if ($debug) { echo "
"; echo "add:$brn"; if (is_array($queryAdd)) { while (list ($key, $val) = each($queryAdd)) { echo "$key => "; for ($i=0; $i"; }; }; //if is array }; if (is_array($queryAdd)){ $result = ldap_mod_add($lc, $dn, $queryAdd); if ($debug) echo "ldap_mod_add vratil [$result]$brn"; if (ldap_errno($lc)) echo "ldap add error: ".ldap_error($lc).$brn; }; if ($debug) { echo "
"; echo "
mod:$brn"; if (is_array($queryMod)) { while (list ($key, $val) = each($queryMod)) { echo "$key => "; for ($i=0; $i"; } }; }; if (is_array($queryMod)) { $result = ldap_mod_replace($lc, $dn, $queryMod); if ($debug) echo "ldap_mod_replace vratil [$result]$brn"; if (ldap_errno($lc)) echo "ldap replace error: ".ldap_error($lc).$brn; }; if ($debug) { echo "
"; echo "
del:$brn"; if (is_array($queryDel)) { while (list ($key, $val) = each($queryDel)) { echo "$key => "; for ($i=0; $i"; }; }; }; if (is_array($queryDel)) { $result = ldap_mod_del($lc, $dn, $queryDel); if ($debug) echo "ldap_mod_del vratil [$result]$brn"; if (ldap_errno($lc)) echo "ldap delete error: ".ldap_error($lc).$brn; }; } else { echo "Nemozem sa nalogovat na LDAP server! Je nutne skontrolovat konfiguraciu $wpldapName.
\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."; }; ?>