isCommandAvailable('schema')) pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view schema'))); $entry['view'] = get_request('view','GET','false','objectClasses'); $entry['value'] = get_request('viewvalue','GET'); if (! is_null($entry['value'])) { $entry['viewed'] = false; $entry['value'] = strtolower($entry['value']); } $schema_error_str = sprintf('%s %s.

%s', _('Could not retrieve schema from'),htmlspecialchars($ldapserver->name), _('This could happen for several reasons, the most probable of which are:'),_('The server does not fully support the LDAP protocol.'), _('Your version of PHP does not correctly perform the query.'),_('phpLDAPadmin doesn\'t know how to fetch the schema for your server.'), _('Or lastly, your LDAP server doesnt provide this information.')); printf('

%s %s

', _('Schema for server'), htmlspecialchars($ldapserver->name)); $entry['schema_types'] = array( 'objectClasses'=>'ObjectClasses', 'attributes'=>'Attribute Types', 'syntaxes'=>'Syntaxes', 'matching_rules'=>'Matching Rules'); echo '
'; echo '
'; $counter = 0; foreach ($entry['schema_types'] as $item => $value) { if ($counter++) echo ' | '; $entry['href'][$item] = sprintf('?cmd=schema&server_id=%s&view=%s&viewvalue=%%s',$ldapserver->server_id,$item); $href = htmlspecialchars(sprintf($entry['href'][$item],'')); echo ($entry['view'] == $item ? _($value) : sprintf('%s',$href,_($value))); } echo '
'; echo '
'; switch($entry['view']) { case 'syntaxes': $highlight_oid = isset($_GET['highlight_oid']) ? $_GET['highlight_oid'] : false; print ''; printf('',_('Syntax OID'),_('Description')); $counter = 1; $schema_syntaxes = $ldapserver->SchemaSyntaxes(null,true); if (! $schema_syntaxes) pla_error($schema_error_str); foreach ($schema_syntaxes as $syntax) { $counter++; $oid = htmlspecialchars($syntax->getOID()); $desc = htmlspecialchars($syntax->getDescription()); if ($highlight_oid && $highlight_oid == $oid) echo ''; else printf('',$counter%2==0?'even':'odd'); printf('',$oid,$desc); } print '
%s%s
%s%s
'; break; case 'attributes': $entry['attr_types'] = array( 'desc' => _('Description'), 'obsolete' => _('Obsolete'), 'inherits' => _('Inherits from'), 'equality' => _('Equality'), 'ordering' => _('Ordering'), 'substring_rule' => _('Substring Rule'), 'syntax' => _('Syntax'), 'single_valued' => _('Single Valued'), 'collective' => _('Collective'), 'user_modification' => _('User Modification'), 'usage' => _('Usage'), 'maximum_length' => _('Maximum Length'), 'aliases' => _('Aliases'), 'used_by_objectclasses' => _('Used by objectClasses') ); $schema_attrs = $ldapserver->SchemaAttributes(); $schema_object_classes = $ldapserver->SchemaObjectClasses(); if (! $schema_attrs || ! $schema_object_classes) pla_error($schema_error_str); printf('%s:',_('Jump to an attribute type')); echo '
'; echo ''; printf('',$entry['view']); printf('',$ldapserver->server_id); echo ''; printf('
',_('Go')); echo '
'; foreach ($schema_attrs as $attr) { if (is_null($entry['value']) || ! strcasecmp($entry['value'],$attr->getName())) { if (! is_null($entry['value'])) $entry['viewed'] = true; echo ''; printf('', strtolower($attr->getName()),$attr->getName()); $counter = 0; foreach ($entry['attr_types'] as $item => $value) { printf('',++$counter%2 ? 'odd' : 'even'); printf('',$value); switch ($item) { case 'desc': printf('', is_null($attr->getDescription()) ? '('._('no description').')' : $attr->getDescription()); print ''; printf('',++$counter%2 ? 'odd' : 'even'); echo ''; printf('',$attr->getOID()); break; case 'obsolete': printf('',$attr->getIsObsolete() ? ''._('Yes').'' : _('No')); break; case 'inherits': print ''; break; case 'equality': print ''; break; case 'ordering': printf('', is_null($attr->getOrdering()) ? '('._('not specified').')' : $attr->getOrdering()); break; case 'substring_rule': printf('', is_null($attr->getSubstr()) ? '('._('not specified').')' : $attr->getSubstr()); break; case 'syntax': print ''; break; case 'single_valued': printf('',$attr->getIsSingleValue() ? _('Yes') : _('No')); break; case 'collective': printf('',$attr->getIsCollective() ? _('Yes') : _('No')); break; case 'user_modification': printf('',$attr->getIsNoUserModification() ? _('No') : _('Yes')); break; case 'usage': printf('',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')'); break; case 'maximum_length': print ''; break; case 'aliases': print ''; break; case 'used_by_objectclasses': print ''; break; } print ''; } print '
%s
%s%s
OID%s%s'; if (is_null($attr->getSupAttribute())) printf('(%s)',_('none')); else { $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getSupAttribute()))); printf('%s',$href,$attr->getSupAttribute()); } print ''; if (is_null($attr->getEquality())) printf('(%s)',_('not specified')); else { $href = htmlspecialchars(sprintf($entry['href']['matching_rules'],$attr->getEquality())); printf('%s',$href,$attr->getEquality()); } print '%s%s'; if (is_null($attr->getType())) { echo $attr->getSyntaxOID(); } else { $href = htmlspecialchars(sprintf($entry['href']['syntaxes'].'&highlight_oid=%s#%s','', $attr->getSyntaxOID(),$attr->getSyntaxOID())); printf('%s (%s)',$href,$attr->getType(),$attr->getSyntaxOID()); } print '%s%s%s%s'; if ( is_null($attr->getMaxLength())) echo '('._('not applicable').')'; else printf('%s %s',number_format($attr->getMaxLength()), $attr->getMaxLength()>1 ? _('characters') : _('character')); print ''; if (count($attr->getAliases()) == 0) printf('(%s)',_('none')); else foreach ($attr->getAliases() as $alias_attr_name) { $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($alias_attr_name))); printf('%s',$href,$alias_attr_name); } print ''; if (count($attr->getUsedInObjectClasses()) == 0) printf('(%s)',_('none')); else foreach ($attr->getUsedInObjectClasses() as $used_in_oclass) { $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($used_in_oclass))); printf('%s ',$href,$used_in_oclass); } print '
'; echo '
'; } } break; case 'matching_rules': $schema_matching_rules = $ldapserver->MatchingRules(null,true); if (! $schema_matching_rules) pla_error($schema_error_str); printf('%s
',_('Jump to a matching rule')); print '
'; print ''; printf('',$ldapserver->server_id); print ''; print ''; printf('',_('Go')); print '
'; print ''; printf('', _('Matching Rule OID'),_('Name'),_('Used by Attributes')); $counter = 1; foreach ($schema_matching_rules as $rule) { $counter++; $oid = htmlspecialchars($rule->getOID()); $desc = htmlspecialchars($rule->getName()); if ( is_null($entry['value']) || $entry['value'] == strtolower($rule->getName())) { if (! is_null($entry['value'])) $entry['viewed'] = true; if (null != $rule->getDescription()) $desc .= sprintf(' (%s)',$rule->getDescription()); if ( $rule->getIsObsolete()) $desc .= sprintf(' %s',_('Obsolete')); printf('',$counter%2 ? 'odd' : 'even'); printf('',$oid); printf('',$desc); print ''; print ''; } } print '
%s%s%s
%s%s'; if (count($rule->getUsedByAttrs()) == 0) { printf('
(%s)


',_('none')); } else { print '
'; print '
'; print ''; printf('',$ldapserver->server_id); print ''; print '
'; printf('',_('Go')); print '
'; print '
'; } print '
'; break; case 'objectClasses': $schema_oclasses = $ldapserver->SchemaObjectClasses(); if (! $schema_oclasses) pla_error($schema_error_str); printf('%s:',_('Jump to an objectClass')); echo '
'; echo ''; printf('',$entry['view']); printf('',$ldapserver->server_id); echo ''; printf('',_('Go')); echo '
'; echo '
'; foreach ($schema_oclasses as $name => $oclass) { if (is_null($entry['value']) || ($entry['value'] == $name)) { if (! is_null($entry['value'])) $entry['viewed'] = true; echo ''; printf('',$name,$oclass->getName()); printf('',_('OID'),$oclass->getOID()); if ($oclass->getDescription()) printf('',_('Description'),$oclass->getDescription()); printf('',_('Type'),$oclass->getType()); if ($oclass->getIsObsolete()) printf('',_('This objectClass is obsolete.')); printf(''; printf(''; printf('', _('Required Attributes'),_('Optional Attributes')); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
%s
%s: %s
%s: %s
%s: %s
%s
%s: ',_('Inherits from')); if (count($oclass->getSupClasses()) == 0) printf('(%s)',_('none')); else foreach ($oclass->getSupClasses() as $i => $object_class) { $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($object_class))); printf('%s', _('Jump to this objectClass definition'),$href,$object_class); if ($i < count($oclass->getSupClasses()) - 1) echo ', '; } echo '
%s: ',_('Parent to')); if (strcasecmp($oclass->getName(),'top') == 0) { $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],'')); printf('(all)',$href); } elseif (count($oclass->getChildObjectClasses()) == 0) printf('(%s)',_('none')); else foreach ($oclass->getChildObjectClasses() as $i => $object_class) { $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($object_class))); printf('%s',_('Jump to this objectClass definition'),$href,$object_class); if ( $i < count($oclass->getChildObjectClasses()) - 1) echo ', '; } echo '
 %s%s 
 '; if (count($oclass->getMustAttrs($schema_oclasses)) > 0) { echo '
    '; foreach ($oclass->getMustAttrs($schema_oclasses) as $attr) { echo '
  • '; $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getName()))); printf('%s',$href,$attr->getName()); if ($attr->getSource() != $oclass->getName()) { echo '
    '; $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($attr->getSource()))); printf('(%s %s)',_('Inherited from'),$href,$attr->getSource()); } echo '
  • '; } echo '
'; } else printf('(%s)',_('none')); echo '
'; if (count($oclass->getMayAttrs($schema_oclasses)) > 0) { echo '
    '; foreach ($oclass->getMayAttrs($schema_oclasses) as $attr) { echo '
  • '; $href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getName()))); printf('%s',$href,$attr->getName()); if ($attr->getSource() != $oclass->getName()) { echo '
    '; $href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($attr->getSource()))); printf('(%s %s)',_('Inherited from'),$href,$attr->getSource()); } echo '
  • '; } echo '
'; } else printf('(%s)',_('none')); echo '
 
'; echo '
'; } } /* End foreach objectClass */ break; } if (! is_null($entry['value']) && ! $entry['viewed']) pla_error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($entry['value']))); ?>