isReadOnly()) pla_error(_('You cannot perform updates while server is in read-only mode')); if (! $ldapserver->haveAuthInfo()) pla_error(_('Not enough information to login to server. Please check your configuration.')); $dn = $_GET['dn']; $encoded_dn = rawurlencode($dn); $rdn = get_rdn($dn); $friendly_attrs = process_friendly_attr_table(); include './header.php'; echo ''; printf('

%s %s

',_('Add new attribute'),htmlspecialchars($rdn)); printf('

%s: %s     %s: %s

', _('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn)); $attrs = $ldapserver->getDNAttrs($dn); $oclasses = $ldapserver->getDNAttr($dn,'objectClass'); if (! is_array($oclasses)) $oclasses = array($oclasses); $avail_attrs = array(); if (array_search('extensibleObject',$oclasses) !== FALSE) { $schema_attrs = $ldapserver->SchemaAttributes(); foreach ($schema_attrs as $attr) $avail_attrs[]=$attr->getName(); } else { $schema_oclasses = $ldapserver->SchemaObjectClasses($dn); foreach ($oclasses as $oclass) { $schema_oclass = $ldapserver->getSchemaObjectClass($oclass,$dn); if ($schema_oclass && strcasecmp('objectclass',get_class($schema_oclass)) == 0) $avail_attrs = array_merge($schema_oclass->getMustAttrNames($schema_oclasses), $schema_oclass->getMayAttrNames($schema_oclasses), $avail_attrs); } } $avail_attrs = array_unique($avail_attrs); $avail_attrs = array_filter($avail_attrs,'not_an_attr'); sort($avail_attrs); $avail_binary_attrs = array(); foreach ($avail_attrs as $i => $attr) { if ($ldapserver->isAttrBinary($attr)) { $avail_binary_attrs[] = $attr; unset($avail_attrs[$i]); } } echo '
'; if (is_array($avail_attrs) && count($avail_attrs) > 0) { echo '
'; echo _('Add new attribute'); echo '
'; echo '
'; echo '
'; printf('',$ldapserver->server_id); printf('',htmlspecialchars($dn)); echo ''; echo ''; printf('',_('Add')); echo '
'; } else { echo '
'; printf('(%s)',_('no new attributes available for this entry')); } if (count($avail_binary_attrs) > 0) { echo '
'; echo _('Add new binary attribute'); echo '
'; echo '
'; echo ''; echo '
'; printf('',$ldapserver->server_id); printf('',$dn); echo ''; echo ''; echo ''; printf('',_('Add')); if (! ini_get('file_uploads')) printf('
%s
', _('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.')); else printf('
%s: %s
',_('Maximum file size'),ini_get('upload_max_filesize')); echo '
'; } else { echo '
'; printf('(%s)',_('no new binary attributes available for this entry')); } echo '
'; echo ''; echo ''; /** * Given an attribute $x, this returns true if it is NOT already specified * in the current entry, returns false otherwise. * * @param attr $x * @return bool * @ignore */ function not_an_attr($x) { global $attrs; foreach($attrs as $attr => $values) if (strcasecmp($attr,$x) == 0) return false; return true; } ?>