2009-06-30 08:07:14 +00:00
|
|
|
<?php
|
2009-06-30 10:40:03 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.64 2006/01/03 20:39:58 wurley Exp $
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
/**
|
2009-06-30 08:05:37 +00:00
|
|
|
* Displays the schema for the specified server_id
|
2009-06-30 09:29:51 +00:00
|
|
|
*
|
|
|
|
* Variables that come in via common.php
|
2009-06-30 08:05:37 +00:00
|
|
|
* - server_id
|
2009-06-30 09:29:51 +00:00
|
|
|
* Variables that come in as GET vars:
|
2009-06-30 08:05:37 +00:00
|
|
|
* - view (optional: can be 'attr' or empty. If 'attr', show that attribute)
|
|
|
|
* - attr (optional)
|
2009-06-30 09:29:51 +00:00
|
|
|
* - highlight_oid (optional)
|
|
|
|
*
|
|
|
|
* @package phpLDAPadmin
|
2009-06-30 08:05:37 +00:00
|
|
|
*/
|
2009-06-30 09:29:51 +00:00
|
|
|
/**
|
|
|
|
*/
|
|
|
|
|
2009-06-30 09:22:30 +00:00
|
|
|
require './common.php';
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
if( ! $ldapserver->haveAuthInfo())
|
2009-06-30 10:26:08 +00:00
|
|
|
pla_error( _('Not enough information to login to server. Please check your configuration.') );
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
$view = isset($_GET['view']) ? $_GET['view'] : 'objectClasses';
|
|
|
|
$viewvalue = isset($_GET['viewvalue']) ? $_GET['viewvalue'] : null;
|
|
|
|
|
|
|
|
if (trim($viewvalue) == "")
|
|
|
|
$viewvalue = null;
|
|
|
|
if (! is_null($viewvalue))
|
|
|
|
$viewed = false;
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
include './header.php';
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
$schema_error_str = sprintf('%s <b>%s</b>.<br /><br /></center>%s<ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>',
|
2009-06-30 10:26:08 +00:00
|
|
|
_('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.'));
|
2009-06-30 08:07:14 +00:00
|
|
|
?>
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
<body>
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
<h3 class="title"><?php echo _('Schema for server'); ?>
|
2009-06-30 09:29:51 +00:00
|
|
|
<b><?php echo htmlspecialchars($ldapserver->name); ?></b></h3>
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
<br />
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 08:07:14 +00:00
|
|
|
<center>
|
|
|
|
<?php echo ( $view=='objectClasses' ?
|
2009-06-30 10:26:08 +00:00
|
|
|
_('ObjectClasses') :
|
2009-06-30 09:29:51 +00:00
|
|
|
sprintf('<a href="?server_id=%s&view=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,'objectClasses',_('ObjectClasses'))); ?>
|
2009-06-30 08:07:14 +00:00
|
|
|
|
|
|
|
|
<?php echo ( $view=='attributes' ?
|
2009-06-30 10:26:08 +00:00
|
|
|
_('Attribute Types'):
|
2009-06-30 09:29:51 +00:00
|
|
|
sprintf('<a href="?server_id=%s&view=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,'attributes',_('Attribute Types'))); ?>
|
2009-06-30 08:07:14 +00:00
|
|
|
|
|
|
|
|
<?php echo ( $view=='syntaxes' ?
|
2009-06-30 10:26:08 +00:00
|
|
|
_('Syntaxes') :
|
2009-06-30 09:29:51 +00:00
|
|
|
sprintf('<a href="?server_id=%s&view=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,'syntaxes',_('Syntaxes'))); ?>
|
2009-06-30 08:07:14 +00:00
|
|
|
|
|
|
|
|
<?php echo ( $view=='matching_rules' ?
|
2009-06-30 10:26:08 +00:00
|
|
|
_('Matching Rules') :
|
2009-06-30 09:29:51 +00:00
|
|
|
sprintf('<a href="?server_id=%s&view=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,'matching_rules',_('Matching Rules'))); ?>
|
2009-06-30 08:07:14 +00:00
|
|
|
</center>
|
|
|
|
<br />
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
<?php flush();
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
switch($view) {
|
|
|
|
|
|
|
|
case 'syntaxes':
|
|
|
|
$highlight_oid = isset($_GET['highlight_oid']) ? $_GET['highlight_oid'] : false;
|
|
|
|
|
|
|
|
print '<table class="schema_attr" width="100%">';
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<tr><th>%s</th><th>%s</th></tr>',_('Syntax OID'),_('Description'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
$counter = 1;
|
|
|
|
|
2009-06-30 09:40:37 +00:00
|
|
|
$schema_syntaxes = $ldapserver->SchemaSyntaxes(null,true);
|
2009-06-30 09:29:51 +00:00
|
|
|
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 '<tr class="highlight">';
|
|
|
|
|
|
|
|
else
|
|
|
|
printf('<tr class="%s">',$counter%2==0?'even':'odd');
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td><td>%s</td></tr>',$oid,$desc);
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'attributes':
|
2009-06-30 10:26:08 +00:00
|
|
|
$schema_attrs = $ldapserver->SchemaAttributes();
|
|
|
|
$schema_object_classes = $ldapserver->SchemaObjectClasses();
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
if (! $schema_attrs || ! $schema_object_classes)
|
|
|
|
pla_error($schema_error_str);
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<small>%s:</small>',_('Jump to an attribute type'));
|
|
|
|
echo '<form action="schema.php" method="get">';
|
|
|
|
printf('<input type="hidden" name="view" value="%s" />',$view);
|
|
|
|
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<select name="viewvalue" onChange="submit()">';
|
|
|
|
echo '<option value=""> - all -</option>';
|
|
|
|
|
|
|
|
foreach ($schema_attrs as $name => $attr)
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<option value="%s" %s>%s</option>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$name,$name == $viewvalue ? 'selected ': '',$attr->getName());
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</select>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<input type="submit" value="%s" /></form>',_('Go'));
|
|
|
|
|
|
|
|
echo '<br />';
|
|
|
|
echo '<table class="schema_attr" width="100%">';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
foreach ($schema_attrs as $attr) {
|
|
|
|
if (is_null($viewvalue) || ! strcasecmp($viewvalue,$attr->getName())) {
|
|
|
|
if (! is_null($viewvalue))
|
|
|
|
$viewed = true;
|
|
|
|
|
|
|
|
printf('<tr><th colspan="2"><a name="%s">%s</a></th></tr>',
|
|
|
|
strtolower($attr->getName()),$attr->getName());
|
|
|
|
|
|
|
|
$counter = 0;
|
|
|
|
|
|
|
|
foreach (
|
|
|
|
array('desc','obsolete','inherits','equality','ordering','substring_rule','syntax',
|
|
|
|
'single_valued','collective','user_modification','usage','maximum_length',
|
|
|
|
'aliases','used_by_objectclasses'
|
2009-06-30 10:26:08 +00:00
|
|
|
) as $item) {
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
|
|
|
|
|
|
|
|
switch ($item) {
|
|
|
|
case 'desc':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Description'));
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<td>%s</td>',
|
|
|
|
is_null($attr->getDescription()) ?
|
2009-06-30 10:26:08 +00:00
|
|
|
'('._('no description').')' : $attr->getDescription());
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
print '</tr>';
|
|
|
|
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<td><acronym title="Object Identier">OID</acronym></td>';
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<td>%s</td>',$attr->getOID());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'obsolete':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Obsolete'));
|
|
|
|
printf('<td>%s</td>',$attr->getIsObsolete() ? '<b>'._('Yes').'</b>' : _('No'));
|
2009-06-30 09:29:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'inherits':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Inherits from'));
|
2009-06-30 09:29:51 +00:00
|
|
|
print '<td>';
|
|
|
|
|
|
|
|
if (is_null($attr->getSupAttribute()))
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('(%s)',_('none'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
printf('<a href="?server_id=%s&view=%s&viewvalue=%s">%s</a>',
|
|
|
|
$ldapserver->server_id,$view,
|
|
|
|
strtolower($attr->getSupAttribute()),$attr->getSupAttribute());
|
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'equality':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Equality'));
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<td>%s</td>',
|
2009-06-30 10:26:08 +00:00
|
|
|
is_null($attr->getEquality()) ? '('._('not specified').')' :
|
2009-06-30 09:29:51 +00:00
|
|
|
sprintf('<a href="?server_id=%s&view=matching_rules&viewvalue=%s">%s</a>',
|
|
|
|
$ldapserver->server_id,$attr->getEquality(),$attr->getEquality()));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'ordering':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Ordering'));
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<td>%s</td>',
|
2009-06-30 10:26:08 +00:00
|
|
|
is_null($attr->getOrdering()) ? '('._('not specified').')' : $attr->getOrdering());
|
2009-06-30 09:29:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'substring_rule':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Substring Rule'));
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<td>%s</td>',
|
2009-06-30 10:26:08 +00:00
|
|
|
is_null($attr->getSubstr()) ? '('._('not specified').')' : $attr->getSubstr());
|
2009-06-30 09:29:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'syntax':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Syntax'));
|
2009-06-30 09:29:51 +00:00
|
|
|
print '<td>';
|
|
|
|
|
|
|
|
if (is_null($attr->getType())) {
|
|
|
|
echo $attr->getSyntaxOID();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
printf('<a href="?server_id=%s&view=syntaxes&highlight_oid=%s#%s">%s (%s)</a>',
|
|
|
|
$ldapserver->server_id,
|
|
|
|
$attr->getSyntaxOID(),$attr->getSyntaxOID(),
|
|
|
|
$attr->getType(),$attr->getSyntaxOID());
|
|
|
|
}
|
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'single_valued':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Single Valued'));
|
|
|
|
printf('<td>%s</td>',$attr->getIsSingleValue() ? _('Yes') : _('No'));
|
2009-06-30 09:29:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'collective':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Collective'));
|
|
|
|
printf('<td>%s</td>',$attr->getIsCollective() ? _('Yes') : _('No'));
|
2009-06-30 09:29:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'user_modification':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('User Modification'));
|
|
|
|
printf('<td>%s</td>',$attr->getIsNoUserModification() ? _('No') : _('Yes'));
|
2009-06-30 09:29:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'usage':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Usage'));
|
|
|
|
printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')');
|
2009-06-30 09:29:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'maximum_length':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Maximum Length'));
|
2009-06-30 09:29:51 +00:00
|
|
|
print '<td>';
|
|
|
|
|
|
|
|
if ( is_null($attr->getMaxLength()))
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '('._('not applicable').')';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
printf('%s %s',number_format($attr->getMaxLength()),
|
2009-06-30 10:26:08 +00:00
|
|
|
$attr->getMaxLength()>1 ? _('characters') : _('character'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'aliases':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Aliases'));
|
2009-06-30 09:29:51 +00:00
|
|
|
print '<td>';
|
|
|
|
|
|
|
|
if (count($attr->getAliases()) == 0)
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '('._('none').')';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
foreach ($attr->getAliases() as $alias_attr_name)
|
|
|
|
printf('<a href="?server_id=%s&view=attributes&viewvalue=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,strtolower($alias_attr_name),$alias_attr_name);
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'used_by_objectclasses':
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<td>%s</td>',_('Used by objectClasses'));
|
2009-06-30 09:29:51 +00:00
|
|
|
print '<td>';
|
|
|
|
|
|
|
|
if (count($attr->getUsedInObjectClasses()) == 0)
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '('._('none').')';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
foreach ($attr->getUsedInObjectClasses() as $used_in_oclass)
|
|
|
|
printf('<a href="?server_id=%s&view=objectClasses&viewvalue=%s">%s</a> ',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,strtolower($used_in_oclass),$used_in_oclass);
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
print '</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
flush();
|
|
|
|
}
|
2009-06-30 09:22:30 +00:00
|
|
|
}
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'matching_rules':
|
2009-06-30 09:40:37 +00:00
|
|
|
$schema_matching_rules = $ldapserver->MatchingRules(null,true);
|
2009-06-30 09:29:51 +00:00
|
|
|
if (! $schema_matching_rules)
|
|
|
|
pla_error($schema_error_str);
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<small>%s</small><br />',_('Jump to a matching rule'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
print '<form action="schema.php" method="get">';
|
|
|
|
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
|
|
|
print '<input type="hidden" name="view" value="matching_rules" />';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
print '<select name="viewvalue" onChange="submit()">';
|
|
|
|
print '<option value=""> - all -</option>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
foreach ($schema_matching_rules as $rule)
|
|
|
|
printf('<option value="%s" %s>%s</option>',
|
|
|
|
$rule->getName(),
|
|
|
|
($rule->getName() == $viewvalue ? 'selected': ''),
|
|
|
|
$rule->getName());
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
print '</select>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<input type="submit" value="%s" />',_('Go'));
|
2009-06-30 09:29:51 +00:00
|
|
|
print '</form>';
|
|
|
|
|
|
|
|
print '<table class="schema_attr" width="100%">';
|
|
|
|
printf('<tr><th>%s</th><th>%s</th><th>%s</th></tr>',
|
2009-06-30 10:26:08 +00:00
|
|
|
_('Matching Rule OID'),_('Name'),_('Used by Attributes'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
$counter = 1;
|
|
|
|
|
|
|
|
foreach ($schema_matching_rules as $rule) {
|
|
|
|
$counter++;
|
|
|
|
$oid = htmlspecialchars($rule->getOID());
|
|
|
|
$desc = htmlspecialchars($rule->getName());
|
|
|
|
|
|
|
|
if ( is_null($viewvalue) || $viewvalue == ($rule->getName())) {
|
|
|
|
|
|
|
|
if (! is_null($viewvalue))
|
|
|
|
$viewed = true;
|
|
|
|
|
|
|
|
if (null != $rule->getDescription())
|
|
|
|
$desc .= sprintf(' (%s)',$rule->getDescription());
|
|
|
|
|
|
|
|
if ( $rule->getIsObsolete())
|
2009-06-30 10:26:08 +00:00
|
|
|
$desc .= sprintf(' <span style="color:red">%s</span>',_('Obsolete'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
printf('<tr class="%s">',$counter%2 ? 'odd' : 'even');
|
|
|
|
printf('<td>%s</td>',$oid);
|
|
|
|
printf('<td>%s</td>',$desc);
|
|
|
|
|
|
|
|
print '<td>';
|
|
|
|
|
|
|
|
if (count($rule->getUsedByAttrs()) == 0) {
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<center>(%s)</center><br /><br />',_('none'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
print '<table><tr><td style="text-align: right">';
|
2009-06-30 10:26:08 +00:00
|
|
|
print '<form action="schema.php" method="get">';
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
|
|
|
print '<input type="hidden" name="view" value="attributes" />';
|
|
|
|
|
|
|
|
print '<select style="width: 150px; color:black; background-color: #eee" size="4" name="viewvalue">';
|
|
|
|
foreach ($rule->getUsedByAttrs() as $attr)
|
|
|
|
printf('<option>%s</option>',$attr);
|
|
|
|
|
|
|
|
print '</select><br />';
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<input type="submit" value="%s" />',_('Go'));
|
2009-06-30 09:29:51 +00:00
|
|
|
print '</form>';
|
|
|
|
print '</td></tr></table>';
|
|
|
|
}
|
|
|
|
print '</td>';
|
|
|
|
print '</tr>';
|
|
|
|
}
|
2009-06-30 08:09:20 +00:00
|
|
|
}
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'objectClasses':
|
2009-06-30 10:26:08 +00:00
|
|
|
$schema_oclasses = $ldapserver->SchemaObjectClasses();
|
2009-06-30 09:29:51 +00:00
|
|
|
if (! $schema_oclasses)
|
|
|
|
pla_error($schema_error_str);
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<small>%s:</small>',_('Jump to an objectClass'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<form action="schema.php" method="get">';
|
|
|
|
printf('<input type="hidden" name="view" value="%s" />',$view);
|
|
|
|
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
|
|
|
|
|
|
|
echo '<select name="viewvalue" onChange="submit()">';
|
|
|
|
echo '<option value=""> - all - </option>';
|
|
|
|
|
|
|
|
foreach ($schema_oclasses as $name => $oclass)
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<option value="%s" %s>%s</option>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$name,$name == $viewvalue ? 'selected ': '',$oclass->getName());
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</select>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<input type="submit" value="%s" />',_('Go'));
|
|
|
|
echo '</form>';
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<br />';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
flush();
|
|
|
|
|
|
|
|
foreach ($schema_oclasses as $name => $oclass) {
|
2009-06-30 10:26:08 +00:00
|
|
|
if (is_null($viewvalue) || ($viewvalue == $name)) {
|
|
|
|
if (! is_null($viewvalue))
|
2009-06-30 09:29:51 +00:00
|
|
|
$viewed = true;
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<h4 class="oclass"><a name="%s">%s</a></h4>',$name,$oclass->getName());
|
|
|
|
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('OID'),$oclass->getOID());
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
if ($oclass->getDescription())
|
|
|
|
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('Description'),$oclass->getDescription());
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('Type'),$oclass->getType());
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
if ($oclass->getIsObsolete())
|
|
|
|
printf('<h4 class="oclass_sub">%s</h4>',_('This objectClass is obsolete.'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<h4 class="oclass_sub">%s: <b>',_('Inherits from'));
|
2009-06-30 09:29:51 +00:00
|
|
|
if (count($oclass->getSupClasses()) == 0)
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('(%s)',_('none'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
foreach ($oclass->getSupClasses() as $i => $object_class) {
|
|
|
|
printf('<a title="%s" href="?server_id=%s&view=%s&viewvalue=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
_('Jump to this objectClass definition'),
|
|
|
|
$ldapserver->server_id,$view,strtolower(htmlspecialchars($object_class)),
|
2009-06-30 09:29:51 +00:00
|
|
|
htmlspecialchars($object_class));
|
|
|
|
|
|
|
|
if ($i < count($oclass->getSupClasses()) - 1)
|
2009-06-30 10:26:08 +00:00
|
|
|
echo ', ';
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</b></h4>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<h4 class="oclass_sub">%s: <b>',_('Parent to'));
|
2009-06-30 09:29:51 +00:00
|
|
|
if (strcasecmp($oclass->getName(),'top') == 0)
|
|
|
|
printf('(<a href="schema.php?view=objectClasses&server_id=%s">all</a>)',$ldapserver->server_id);
|
|
|
|
|
|
|
|
elseif (count($oclass->getChildObjectClasses()) == 0)
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('(%s)',_('none'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
foreach ($oclass->getChildObjectClasses() as $i => $object_class) {
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<a title="%s" href="?server_id=%s&view=%s&viewvalue=%s">%s</a>',
|
|
|
|
_('Jump to this objectClass definition'),
|
|
|
|
$ldapserver->server_id,$view,strtolower(htmlspecialchars($object_class)),
|
2009-06-30 09:29:51 +00:00
|
|
|
htmlspecialchars($object_class));
|
|
|
|
|
|
|
|
if ( $i < count($oclass->getChildObjectClasses()) - 1)
|
2009-06-30 10:26:08 +00:00
|
|
|
echo ', ';
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</b></h4>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<table width="100%" class="schema_oclasses">';
|
|
|
|
echo '<tr>';
|
|
|
|
printf('<th width="50%%"><b>%s</b></th>',_('Required Attributes'));
|
|
|
|
printf('<th width="50%%"><b>%s</b></th>',_('Optional Attributes'));
|
|
|
|
echo '</tr>';
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<tr>';
|
|
|
|
echo '<td>';
|
2009-06-30 09:29:51 +00:00
|
|
|
if (count($oclass->getMustAttrs($schema_oclasses)) > 0) {
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<ul class="schema">';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
foreach ($oclass->getMustAttrs($schema_oclasses) as $attr) {
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<li>';
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<a href="?server_id=%s&view=attributes&viewvalue=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,rawurlencode(strtolower($attr->getName())),htmlspecialchars($attr->getName()));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
if ($attr->getSource() != $oclass->getName()) {
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<br />';
|
|
|
|
printf('<small> (%s <a href="?server_id=%s&view=objectClasses&viewvalue=%s">%s</a>)</small>',
|
|
|
|
_('Inherited from'),$ldapserver->server_id,strtolower($attr->getSource()),$attr->getSource());
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</li>';
|
2009-06-30 08:09:20 +00:00
|
|
|
}
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</ul>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
} else
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<center>(%s)</center>',_('none'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</td>';
|
|
|
|
|
|
|
|
echo '<td width="50%">';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
if (count($oclass->getMayAttrs($schema_oclasses)) > 0) {
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<ul class="schema">';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
foreach ($oclass->getMayAttrs($schema_oclasses) as $attr) {
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<li>';
|
2009-06-30 09:29:51 +00:00
|
|
|
printf('<a href="?server_id=%s&view=attributes&viewvalue=%s">%s</a>',
|
2009-06-30 10:26:08 +00:00
|
|
|
$ldapserver->server_id,rawurlencode(strtolower($attr->getName())),htmlspecialchars($attr->getName()));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
if ($attr->getSource() != $oclass->getName()) {
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<br />';
|
|
|
|
printf('<small> (%s <a href="?server_id=%s&view=objectClasses&viewvalue=%s">%s</a>)</small>',
|
|
|
|
_('Inherited from'),$ldapserver->server_id,strtolower($attr->getSource()),$attr->getSource());
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</li>';
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</ul>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
} else
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<center>(%s)</center>',_('none'));
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
|
|
|
echo '</table>';
|
2009-06-30 09:29:51 +00:00
|
|
|
}
|
|
|
|
} /* End foreach objectClass */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
if (! is_null($viewvalue) && ! $viewed)
|
|
|
|
pla_error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($viewvalue)));
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</body>';
|
|
|
|
echo '</html>';
|