RELEASE 0.9.8

This commit is contained in:
Deon George
2009-06-30 20:26:08 +10:00
parent 1f7f96122f
commit fdee1bdbd1
242 changed files with 34529 additions and 34446 deletions

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.60.2.1 2005/10/16 20:19:16 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.61.2.5 2005/12/30 11:52:54 wurley Exp $
/**
* Displays the schema for the specified server_id
@@ -19,7 +19,7 @@
require './common.php';
if( ! $ldapserver->haveAuthInfo())
pla_error( $lang['not_enough_login_info'] );
pla_error( _('Not enough information to login to server. Please check your configuration.') );
$view = isset($_GET['view']) ? $_GET['view'] : 'objectClasses';
$viewvalue = isset($_GET['viewvalue']) ? $_GET['viewvalue'] : null;
@@ -32,39 +32,39 @@ if (! is_null($viewvalue))
include './header.php';
$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>',
$lang['could_not_retrieve_schema_from'],htmlspecialchars($ldapserver->name),
$lang['reasons_for_error'],$lang['schema_retrieve_error_1'],
$lang['schema_retrieve_error_2'],$lang['schema_retrieve_error_3'],
$lang['schema_retrieve_error_4']);
_('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.'));
?>
<body>
<h3 class="title"><?php echo $lang['schema_for_server']; ?>
<h3 class="title"><?php echo _('Schema for server'); ?>
<b><?php echo htmlspecialchars($ldapserver->name); ?></b></h3>
<br />
<center>
<?php echo ( $view=='objectClasses' ?
$lang['objectclasses'] :
_('ObjectClasses') :
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>',
$ldapserver->server_id,'objectClasses',$lang['objectclasses'])); ?>
$ldapserver->server_id,'objectClasses',_('ObjectClasses'))); ?>
|
<?php echo ( $view=='attributes' ?
$lang['attribute_types']:
_('Attribute Types'):
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>',
$ldapserver->server_id,'attributes',$lang['attribute_types'])); ?>
$ldapserver->server_id,'attributes',_('Attribute Types'))); ?>
|
<?php echo ( $view=='syntaxes' ?
$lang['syntaxes'] :
_('Syntaxes') :
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>',
$ldapserver->server_id,'syntaxes',$lang['syntaxes'])); ?>
$ldapserver->server_id,'syntaxes',_('Syntaxes'))); ?>
|
<?php echo ( $view=='matching_rules' ?
$lang['matchingrules'] :
_('Matching Rules') :
sprintf('<a href="?server_id=%s&amp;view=%s">%s</a>',
$ldapserver->server_id,'matching_rules',$lang['matchingrules'])); ?>
$ldapserver->server_id,'matching_rules',_('Matching Rules'))); ?>
</center>
<br />
@@ -76,7 +76,7 @@ switch($view) {
$highlight_oid = isset($_GET['highlight_oid']) ? $_GET['highlight_oid'] : false;
print '<table class="schema_attr" width="100%">';
printf('<tr><th>%s</th><th>%s</th></tr>',$lang['syntax_oid'],$lang['desc']);
printf('<tr><th>%s</th><th>%s</th></tr>',_('Syntax OID'),_('Description'));
$counter = 1;
@@ -95,42 +95,38 @@ switch($view) {
else
printf('<tr class="%s">',$counter%2==0?'even':'odd');
printf('<td><a name="%s">%s</a></td><td>%s</td></tr>',$oid,$oid,$desc);
printf('<td>%s</td><td>%s</td></tr>',$oid,$desc);
}
print '</table>';
break;
case 'attributes':
$schema_attrs = $ldapserver->SchemaAttributes(null,true);
$schema_object_classes = $ldapserver->SchemaObjectClasses(null,true);
$schema_attrs = $ldapserver->SchemaAttributes();
$schema_object_classes = $ldapserver->SchemaObjectClasses();
if (! $schema_attrs || ! $schema_object_classes)
pla_error($schema_error_str);
?>
<small><?php echo $lang['jump_to_attr']; ?>:</small>
<form>
<input type="hidden" name="view" value="<?php echo $view; ?>" />
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<select name="viewvalue" onChange="submit()">
<option value=""> - all -</option>
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);
<?php
foreach ($schema_attrs as $attr) {
echo '<select name="viewvalue" onChange="submit()">';
echo '<option value=""> - all -</option>';
foreach ($schema_attrs as $name => $attr)
printf('<option value="%s" %s>%s</option>',
$attr->getName(),
(! strcasecmp($attr->getName(),$viewvalue) ? 'selected' : ''),$attr->getName());
}
?>
$name,$name == $viewvalue ? 'selected ': '',$attr->getName());
</select>
<input type="submit" value="<?php echo $lang['go']; ?>" /></form>
echo '</select>';
<br />
<table class="schema_attr" width="100%">
printf('<input type="submit" value="%s" /></form>',_('Go'));
echo '<br />';
echo '<table class="schema_attr" width="100%">';
<?php
foreach ($schema_attrs as $attr) {
if (is_null($viewvalue) || ! strcasecmp($viewvalue,$attr->getName())) {
if (! is_null($viewvalue))
@@ -145,34 +141,35 @@ switch($view) {
array('desc','obsolete','inherits','equality','ordering','substring_rule','syntax',
'single_valued','collective','user_modification','usage','maximum_length',
'aliases','used_by_objectclasses'
)
as $item) {
) as $item) {
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
printf('<td>%s</td>',$lang[$item]);
switch ($item) {
case 'desc':
printf('<td>%s</td>',_('Description'));
printf('<td>%s</td>',
is_null($attr->getDescription()) ?
'('.$lang['no_description'].')' : $attr->getDescription());
'('._('no description').')' : $attr->getDescription());
print '</tr>';
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
printf('<td><acronym title="Object Identier">%s</acronym></td>',$lang['oid']);
echo '<td><acronym title="Object Identier">OID</acronym></td>';
printf('<td>%s</td>',$attr->getOID());
break;
case 'obsolete':
printf('<td>%s</td>',$attr->getIsObsolete() ? '<b>'.$lang['yes'].'</b>' : $lang['no']);
printf('<td>%s</td>',_('Obsolete'));
printf('<td>%s</td>',$attr->getIsObsolete() ? '<b>'._('Yes').'</b>' : _('No'));
break;
case 'inherits':
printf('<td>%s</td>',_('Inherits from'));
print '<td>';
if (is_null($attr->getSupAttribute()))
printf('(%s)',$lang['none']);
printf('(%s)',_('none'));
else
printf('<a href="?server_id=%s&amp;view=%s&amp;viewvalue=%s">%s</a>',
@@ -183,23 +180,27 @@ switch($view) {
break;
case 'equality':
printf('<td>%s</td>',_('Equality'));
printf('<td>%s</td>',
is_null($attr->getEquality()) ? '('.$lang['not_specified'].')' :
is_null($attr->getEquality()) ? '('._('not specified').')' :
sprintf('<a href="?server_id=%s&amp;view=matching_rules&amp;viewvalue=%s">%s</a>',
$ldapserver->server_id,$attr->getEquality(),$attr->getEquality()));
break;
case 'ordering':
printf('<td>%s</td>',_('Ordering'));
printf('<td>%s</td>',
is_null($attr->getOrdering()) ? '('.$lang['not_specified'].')' : $attr->getOrdering());
is_null($attr->getOrdering()) ? '('._('not specified').')' : $attr->getOrdering());
break;
case 'substring_rule':
printf('<td>%s</td>',_('Substring Rule'));
printf('<td>%s</td>',
is_null($attr->getSubstr()) ? '('.$lang['not_specified'].')' : $attr->getSubstr());
is_null($attr->getSubstr()) ? '('._('not specified').')' : $attr->getSubstr());
break;
case 'syntax':
printf('<td>%s</td>',_('Syntax'));
print '<td>';
if (is_null($attr->getType())) {
@@ -216,58 +217,65 @@ switch($view) {
break;
case 'single_valued':
printf('<td>%s</td>',$attr->getIsSingleValue() ? $lang['yes'] : $lang['no']);
printf('<td>%s</td>',_('Single Valued'));
printf('<td>%s</td>',$attr->getIsSingleValue() ? _('Yes') : _('No'));
break;
case 'collective':
printf('<td>%s</td>',$attr->getIsCollective() ? $lang['yes'] : $lang['no']);
printf('<td>%s</td>',_('Collective'));
printf('<td>%s</td>',$attr->getIsCollective() ? _('Yes') : _('No'));
break;
case 'user_modification':
printf('<td>%s</td>',$attr->getIsNoUserModification() ? $lang['no'] : $lang['yes']);
printf('<td>%s</td>',_('User Modification'));
printf('<td>%s</td>',$attr->getIsNoUserModification() ? _('No') : _('Yes'));
break;
case 'usage':
printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('.$lang['not_specified'].')');
printf('<td>%s</td>',_('Usage'));
printf('<td>%s</td>',$attr->getUsage() ? $attr->getUsage() : '('._('not specified').')');
break;
case 'maximum_length':
printf('<td>%s</td>',_('Maximum Length'));
print '<td>';
if ( is_null($attr->getMaxLength()))
echo '('.$lang['not_applicable'].')';
echo '('._('not applicable').')';
else
printf('%s %s',number_format($attr->getMaxLength()),
$attr->getMaxLength()>1 ? $lang['characters'] : $lang['character']);
$attr->getMaxLength()>1 ? _('characters') : _('character'));
print '</td>';
break;
case 'aliases':
printf('<td>%s</td>',_('Aliases'));
print '<td>';
if (count($attr->getAliases()) == 0)
echo '('.$lang['none'].')';
echo '('._('none').')';
else
foreach ($attr->getAliases() as $alias_attr_name)
printf('<a href="?server_id=%s&amp;view=attributes&amp;viewvalue=%s">%s</a>',
$ldapserver->server_id,$alias_attr_name,$alias_attr_name);
$ldapserver->server_id,strtolower($alias_attr_name),$alias_attr_name);
print '</td>';
break;
case 'used_by_objectclasses':
printf('<td>%s</td>',_('Used by objectClasses'));
print '<td>';
if (count($attr->getUsedInObjectClasses()) == 0)
echo '('.$lang['none'].')';
echo '('._('none').')';
else
foreach ($attr->getUsedInObjectClasses() as $used_in_oclass)
printf('<a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s">%s</a> ',
$ldapserver->server_id,$used_in_oclass,$used_in_oclass);
$ldapserver->server_id,strtolower($used_in_oclass),$used_in_oclass);
print '</td>';
break;
@@ -288,14 +296,14 @@ switch($view) {
if (! $schema_matching_rules)
pla_error($schema_error_str);
printf('<small>%s</small><br />',$lang['jump_to_matching_rule']);
printf('<small>%s</small><br />',_('Jump to a matching rule'));
print '<form get="?">';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
print '<input type="hidden" name="view" value="matching_rules" />';
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" />';
print '<select name="viewvalue" onChange="submit()">';
print '<option value=""> - all -</option>';
print '<select name="viewvalue" onChange="submit()">';
print '<option value=""> - all -</option>';
foreach ($schema_matching_rules as $rule)
printf('<option value="%s" %s>%s</option>',
@@ -303,14 +311,14 @@ switch($view) {
($rule->getName() == $viewvalue ? 'selected': ''),
$rule->getName());
print '</select>';
print '</select>';
printf('<input type="submit" value="%s" />',$lang['go']);
printf('<input type="submit" value="%s" />',_('Go'));
print '</form>';
print '<table class="schema_attr" width="100%">';
printf('<tr><th>%s</th><th>%s</th><th>%s</th></tr>',
$lang['matching_rule_oid'],$lang['name'],$lang['used_by_attributes']);
_('Matching Rule OID'),_('Name'),_('Used by Attributes'));
$counter = 1;
@@ -328,7 +336,7 @@ switch($view) {
$desc .= sprintf(' (%s)',$rule->getDescription());
if ( $rule->getIsObsolete())
$desc .= sprintf(' <span style="color:red">%s</span>',$lang['obsolete']);
$desc .= sprintf(' <span style="color:red">%s</span>',_('Obsolete'));
printf('<tr class="%s">',$counter%2 ? 'odd' : 'even');
printf('<td>%s</td>',$oid);
@@ -337,11 +345,11 @@ switch($view) {
print '<td>';
if (count($rule->getUsedByAttrs()) == 0) {
printf('<center>(%s)</center><br /><br />',$lang['none']);
printf('<center>(%s)</center><br /><br />',_('none'));
} else {
print '<table><tr><td style="text-align: right">';
print '<form>';
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="attributes" />';
@@ -350,7 +358,7 @@ switch($view) {
printf('<option>%s</option>',$attr);
print '</select><br />';
printf('<input type="submit" value="%s" />',$lang['go']);
printf('<input type="submit" value="%s" />',_('Go'));
print '</form>';
print '</td></tr></table>';
}
@@ -363,181 +371,148 @@ switch($view) {
break;
case 'objectClasses':
$schema_oclasses = $ldapserver->SchemaObjectClasses(null,true);
$schema_oclasses = $ldapserver->SchemaObjectClasses();
if (! $schema_oclasses)
pla_error($schema_error_str);
?>
<small><?php echo $lang['jump_to_objectclass']; ?>:</small>
<form>
<input type="hidden" name="view" value="<?php echo $view; ?>" />
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<select name="viewvalue" onChange="submit()">
<option value=""> - all - </option>
printf('<small>%s:</small>',_('Jump to an objectClass'));
<?php
foreach( $schema_oclasses as $name => $oclass ) {
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)
printf('<option value="%s" %s>%s</option>',
$oclass->getName(),
(strcasecmp($oclass->getName(),$viewvalue) == 0 ? ' selected ':''),
$oclass->getName());
$name,$name == $viewvalue ? 'selected ': '',$oclass->getName());
}
?>
echo '</select>';
</select>
<input type="submit" value="<?php echo $lang['go']; ?>" />
</form>
printf('<input type="submit" value="%s" />',_('Go'));
echo '</form>';
<br />
echo '<br />';
<?php
flush();
foreach ($schema_oclasses as $name => $oclass) {
foreach ($oclass->getSupClasses() as $parent_name) {
if (isset($schema_oclasses[$parent_name]))
$schema_oclasses[$parent_name]->addChildObjectClass($oclass->getName());
}
if ( is_null($viewvalue) || ! strcasecmp($viewvalue,$oclass->getName())) {
if ( ! is_null($viewvalue))
if (is_null($viewvalue) || ($viewvalue == $name)) {
if (! is_null($viewvalue))
$viewed = true;
?>
<h4 class="oclass"><a name="<?php echo $name; ?>"><?php echo $oclass->getName(); ?></a></h4>
<h4 class="oclass_sub"><?php echo $lang['OID']; ?>: <b><?php echo $oclass->getOID(); ?></b></h4>
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());
<?php if ($oclass->getDescription()) { ?>
<h4 class="oclass_sub"><?php echo $lang['desc']; ?>: <b><?php echo $oclass->getDescription(); ?></b></h4>
<?php } ?>
if ($oclass->getDescription())
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('Description'),$oclass->getDescription());
<h4 class="oclass_sub"><?php echo $lang['type']; ?>: <b><?php echo $oclass->getType(); ?></b></h4>
printf('<h4 class="oclass_sub">%s: <b>%s</b></h4>',_('Type'),$oclass->getType());
<?php if ( $oclass->getIsObsolete()) { ?>
<h4 class="oclass_sub"><?php echo $lang['is_obsolete']; ?></h4>
<?php } ?>
<h4 class="oclass_sub"><?php echo $lang['inherits']; ?>: <b>
<?php
if ($oclass->getIsObsolete())
printf('<h4 class="oclass_sub">%s</h4>',_('This objectClass is obsolete.'));
printf('<h4 class="oclass_sub">%s: <b>',_('Inherits from'));
if (count($oclass->getSupClasses()) == 0)
printf('(%s)',$lang['none']);
printf('(%s)',_('none'));
else
foreach ($oclass->getSupClasses() as $i => $object_class) {
printf('<a title="%s" href="?server_id=%s&amp;view=%s&amp;viewvalue=%s">%s</a>',
$lang['jump_to_this_oclass'],$ldapserver->server_id,$view,htmlspecialchars($object_class),
_('Jump to this objectClass definition'),
$ldapserver->server_id,$view,strtolower(htmlspecialchars($object_class)),
htmlspecialchars($object_class));
if ($i < count($oclass->getSupClasses()) - 1)
print ', ';
echo ', ';
}
?>
</b></h4>
<h4 class="oclass_sub"><?php echo $lang['parent_to']; ?>: <b>
<?php
echo '</b></h4>';
printf('<h4 class="oclass_sub">%s: <b>',_('Parent to'));
if (strcasecmp($oclass->getName(),'top') == 0)
printf('(<a href="schema.php?view=objectClasses&amp;server_id=%s">all</a>)',$ldapserver->server_id);
elseif (count($oclass->getChildObjectClasses()) == 0)
printf('(%s)',$lang['none']);
printf('(%s)',_('none'));
else
foreach ($oclass->getChildObjectClasses() as $i => $object_class) {
printf('<a title="%s" href="?server_id=%s&view=%s&amp;viewvalue=%s">%s</a>',
$lang['jump_to_this_oclass'],$ldapserver->server_id,$view,htmlspecialchars($object_class),
printf('<a title="%s" href="?server_id=%s&amp;view=%s&amp;viewvalue=%s">%s</a>',
_('Jump to this objectClass definition'),
$ldapserver->server_id,$view,strtolower(htmlspecialchars($object_class)),
htmlspecialchars($object_class));
if ( $i < count($oclass->getChildObjectClasses()) - 1)
print ', ';
echo ', ';
}
?>
echo '</b></h4>';
</b></h4>
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>';
<table width="100%" class="schema_oclasses">
<tr>
<th width="50%"><b><?php echo $lang['required_attrs']; ?></b></th>
<th width="50%"><b><?php echo $lang['optional_attrs']; ?></b></th>
</tr>
<tr>
<td>
<?php
echo '<tr>';
echo '<td>';
if (count($oclass->getMustAttrs($schema_oclasses)) > 0) {
print '<ul class="schema">';
echo '<ul class="schema">';
foreach ($oclass->getMustAttrs($schema_oclasses) as $attr) {
print '<li>';
echo '<li>';
printf('<a href="?server_id=%s&amp;view=attributes&amp;viewvalue=%s">%s</a>',
$ldapserver->server_id,rawurlencode($attr->getName()),htmlspecialchars($attr->getName()));
$ldapserver->server_id,rawurlencode(strtolower($attr->getName())),htmlspecialchars($attr->getName()));
if ($attr->getSource() != $oclass->getName()) {
printf('<br /><small>&nbsp;&nbsp;(%s ',$lang['inherited_from']);
printf('<a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=">%s</a>',
$ldapserver->server_id,$attr->getSource(),$attr->getSource());
print ')</small>';
echo '<br />';
printf('<small>&nbsp;&nbsp;(%s <a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s">%s</a>)</small>',
_('Inherited from'),$ldapserver->server_id,strtolower($attr->getSource()),$attr->getSource());
}
print '</li>';
echo '</li>';
}
print '</ul>';
echo '</ul>';
} else
printf('<center>(%s)</center>',$lang['none']);
printf('<center>(%s)</center>',_('none'));
?>
</td>
<td width="50%">
echo '</td>';
echo '<td width="50%">';
<?php
if (count($oclass->getMayAttrs($schema_oclasses)) > 0) {
print '<ul class="schema">';
echo '<ul class="schema">';
foreach ($oclass->getMayAttrs($schema_oclasses) as $attr) {
print '<li>';
echo '<li>';
printf('<a href="?server_id=%s&amp;view=attributes&amp;viewvalue=%s">%s</a>',
$ldapserver->server_id,rawurlencode($attr->getName()),htmlspecialchars($attr->getName()));
$ldapserver->server_id,rawurlencode(strtolower($attr->getName())),htmlspecialchars($attr->getName()));
if ($attr->getSource() != $oclass->getName()) {
printf('<br /><small>&nbsp;&nbsp; (%s ',$lang['inherited_from']);
printf('<a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s">%s</a>',
$ldapserver->server_id,$attr->getSource(),$attr->getSource());
print ')</small>';
echo '<br />';
printf('<small>&nbsp;&nbsp; (%s <a href="?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s">%s</a>)</small>',
_('Inherited from'),$ldapserver->server_id,strtolower($attr->getSource()),$attr->getSource());
}
print '</li>';
echo '</li>';
}
print '</ul>';
echo '</ul>';
} else
printf('<center>(%s)</center>',$lang['none']);
?>
printf('<center>(%s)</center>',_('none'));
</ul>
</td>
</tr>
</table>
<?php
echo '</td>';
echo '</tr>';
echo '</table>';
}
} /* End foreach objectClass */
break;
}
if (! is_null( $viewvalue ) && ! $viewed)
pla_error(sprintf($lang['no_such_schema_item'],htmlspecialchars($viewvalue)));
if (! is_null($viewvalue) && ! $viewed)
pla_error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($viewvalue)));
?>
</body>
</html>
echo '</body>';
echo '</html>';