ldapservers->Instance($server_id_src); if (! $ldapserver_src->haveAuthInfo()) pla_error(_('Not enough information to login to server. Please check your configuration.')); $ldapserver_dst = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_dst); if (! $ldapserver_src->haveAuthInfo()) pla_error(_('Not enough information to login to server. Please check your configuration.')); if (! $ldapserver_src->dnExists($dn_src)) pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_src))); if (! $ldapserver_dst->dnExists($dn_dst)) pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_dst))); $attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$_SESSION[APPCONFIG]->GetValue('deref','view')); $attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$_SESSION[APPCONFIG]->GetValue('deref','view')); # Get a list of all attributes. $attrs_all = array_keys($attrs_src); foreach ($attrs_dst as $key => $val) if (! in_array($key,$attrs_all)) $attrs_all[] = $key; ?> ',_('This entry has no attributes')); print '


 

: name; ?>
:

: name; ?>
:

(%s)
'; return; } sort($attrs_all); # Work through each of the attributes. foreach ($attrs_all as $attr) { flush(); # If this is the DN, get the next attribute. if (! strcasecmp($attr,'dn')) continue; # Has the config.php specified that this attribute is to be hidden or shown? if ($ldapserver_src->isAttrHidden($attr) || $ldapserver_dst->isAttrHidden($attr)) continue; ?> isReadOnly()) { ?>
getSchemaAttribute($attr,$dn_src); $schema_attr_dst = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst); # Setup the $attr_note, which will be displayed to the right of the attr name (if any) $attr_note = ''; $required_note = ''; # is there a user-friendly translation available for this attribute? if ($_SESSION[APPCONFIG]->haveFriendlyName($attr)) { $attr_display = $_SESSION[APPCONFIG]->getFriendlyName($attr); $attr_note = sprintf('%s',_('Note'),$attr_display,_('is an alias for'),$attr,_('alias')); } else { $attr_display = $attr; $attr_note = ''; } # is this attribute required by an objectClass? $required_by = ''; switch ($side) { case 'src': $ldapserver = $ldapserver_src; if ($schema_attr_src) foreach ($schema_attr_src->getRequiredByObjectClasses() as $required) if (isset($attrs_src['objectClass']) && in_array(strtolower($required),arrayLower($attrs_src['objectClass']))) $required_by .= $required . ' '; # It seems that some LDAP servers (Domino) returns attributes in lower case? elseif (isset($attrs_src['objectclass']) && in_array(strtolower($required),arrayLower($attrs_src['objectclass']))) $required_by .= $required . ' '; break; case 'dst': $ldapserver = $ldapserver_dst; if ($schema_attr_dst) foreach ($schema_attr_dst->getRequiredByObjectClasses() as $required) if (isset($attrs_dst['objectClass']) && in_array(strtolower($required),arrayLower($attrs_dst['objectClass']))) $required_by .= $required . ' '; # It seems that some LDAP servers (Domino) returns attributes in lower case? elseif (isset($attrs_dst['objectclass']) && in_array(strtolower($required),arrayLower($attrs_dst['objectclass']))) $required_by .= $required . ' '; break; } if ($side == 'src') { ?> %s',sprintf(_('Required attribute for objectClass(es) %s'),$required_by),_('required')); ?>   isAttrReadOnly($attr)) { ?> ()  '; if (! isset($attrs_src[$attr])) { echo "<". _('No Value').">"; $toJump = 1; continue; } else $vals = $attrs_src[$attr]; $ldapserver = $ldapserver_src; break; case 'dst': print ' '; if (! isset($attrs_dst[$attr])) { echo "<". _('No Value').">"; $toJump = 1; continue; } else $vals = $attrs_dst[$attr]; $ldapserver = $ldapserver_dst; break; } if ($toJump) continue; if (! is_array($vals)) $vals = array($vals); /* * Is this attribute a jpegPhoto? */ if ($ldapserver->isJpegPhoto($attr)) { switch ($side) { case 'src': // Don't draw the delete buttons if there is more than one jpegPhoto // (phpLDAPadmin can't handle this case yet) draw_jpeg_photos($ldapserver,$dn_src,$attr,false); break; case 'dst': if ($ldapserver_dst->isReadOnly() || $ldapserver_dst->isAttrReadOnly($attr)) draw_jpeg_photos($ldapserver,$dn_dst,$attr,false); else draw_jpeg_photos($ldapserver,$dn_dst,$attr,true); break; } // proceed to the next attribute echo "\n"; continue; } /* * Is this attribute binary? */ if ($ldapserver->isAttrBinary($attr)) { switch ($side) { case 'src': $href = sprintf("download_binary_attr.php?server_id=%s&dn=%s&attr=%s",$ldapserver->server_id,$encoded_dn_src,$attr); break; case 'dst': $href = sprintf("download_binary_attr.php?server_id=%s&dn=%s&attr=%s",$ldapserver->server_id,$encoded_dn_dst,$attr); break; } ?>
1) { for($i=1; $i<=count($vals); $i++) { ?> "> ()

isReadOnly() && ! $ldapserver->isAttrReadOnly($attr)) { ?>
isReadOnly() || $ldapserver->isAttrReadOnly($attr))) { if (is_array($vals)) { foreach ($vals as $i => $val) { if (trim($val) == "") echo "[" . _('empty') . "]
\n"; elseif (0 == strcasecmp($attr,'userPassword') && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display')) echo preg_replace('/./','*',$val) . "
"; else echo htmlspecialchars($val) . "
"; } // @todo: redundant - $vals is always an array. } else { if (0 == strcasecmp($attr,'userPassword') && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display')) echo preg_replace('/./','*',$vals) . "
"; else echo $vals . "
"; } echo ""; continue; } /* * Is this a userPassword attribute? */ if (! strcasecmp($attr,'userpassword')) { $user_password = $vals[0]; $enc_type = get_enc_type($user_password); // Set the default hashing type if the password is blank (must be newly created) if ($user_password == '') { $enc_type = get_default_hash($server_id); } if ($side == 'dst') { ?>

isAttrBoolean($attr)) { $val = $vals[0]; if ($side = 'dst') {?> $val) { if ($side == 'dst') { $input_name = "new_values[" . htmlspecialchars($attr) . "][$i]"; // We smack an id="..." tag in here that doesn't have [][] in it to allow the // draw_chooser_link() to identify it after the user clicks. $input_id = "new_values_" . htmlspecialchars($attr) . "_" . $i; ?> getSchemaObjectClass($val); if ($schema_object->getType() == 'structural') { echo "$val (" . _('structural') . ")
"; if ($side == 'dst') {?> isDNAttr($attr)) { ?> isMultiLineAttr($attr,$val)) { if ($side == 'dst') {?> isDNAttr($attr)) draw_chooser_link("edit_form.$input_id",false); ?>
isReadOnly()) { // First check if the required objectClass is in this DN $isOK = 0; $src_oclass = array(); $attr_object = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst); foreach ($attr_object->used_in_object_classes as $oclass) { if (in_array(strtolower($oclass),arrayLower($attrs_dst['objectClass']))) { $isOK = 1; break; } else { // Find oclass that the source has that provides this attribute. if (in_array($oclass,$attrs_src['objectClass'])) $src_oclass[] = $oclass; } } print "  "; if (! $isOK) { if (count($src_oclass) == 1) { $add_href = sprintf('cmd.php?cmd=add_oclass_form&server_id=%s&dn=%s&new_oclass=%s', $ldapserver_dst->server_id,$encoded_dn_dst,$src_oclass[0]); } else { $add_href = sprintf('cmd.php?cmd=add_value_form&server_id=%s&dn=%s&attr=objectClass', $ldapserver_dst->server_id,$encoded_dn_dst); } if ($attr == 'objectClass') printf('
(%s)
',$add_href,_('Add ObjectClass and Attributes'),_('add value')); else printf('
(%s)
',$add_href,sprintf(_('You need one of the following ObjectClass(es) to add this attribute %s.'),implode(" ",$src_oclass)),_('Add new ObjectClass')); } else { if (! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) { $add_href = sprintf('cmd.php?cmd=add_value_form&server_id=%s&dn=%s&attr=%s', $ldapserver_dst->server_id,$encoded_dn_dst,rawurlencode($attr)); printf('
(%s)
', $add_href,sprintf(_('Add an additional value to attribute \'%s\''),$attr),_('add value')); } } } print ""; ?> $vals) */ if (! $ldapserver_dst->isReadOnly()) { ?>