RELEASE 0.9.1
This commit is contained in:
@@ -11,34 +11,36 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require 'config.php';
|
||||
require_once 'functions.php';
|
||||
|
||||
$dn = stripslashes( $_GET['dn'] );
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
$rdn = ldap_explode_dn( $dn, 0 );
|
||||
$rdn = pla_explode_dn( $dn );
|
||||
$rdn = $rdn[0];
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
$attr = stripslashes( $_GET['attr'] );
|
||||
$attr = $_GET['attr'];
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
$current_values = get_object_attr( $server_id, $dn, $attr );
|
||||
$num_current_values = ( is_array($current_values) ? count($current_values) : 1 );
|
||||
$is_object_class = ( 0 == strcasecmp( $attr, 'objectClass' ) ) ? true : false;
|
||||
$is_jpeg_photo = ( 0 == strcasecmp( $attr, 'jpegPhoto' ) ) ? true : false;
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
if( $is_object_class ) {
|
||||
// fetch all available objectClasses and remove those from the list that are already defined in the entry
|
||||
$schema_oclasses = get_schema_objectclasses( $server_id );
|
||||
if( ! is_array( $current_values ) )
|
||||
$current_values = array( $current_values );
|
||||
foreach( $current_values as $oclass )
|
||||
unset( $schema_oclasses[ strtolower( $oclass ) ] );
|
||||
} else {
|
||||
$schema_attrs = get_schema_attributes( $server_id );
|
||||
$schema_attr = get_schema_attribute( $server_id, $attr );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -47,11 +49,18 @@ if( $is_object_class ) {
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">New <b><?php echo htmlspecialchars($attr); ?></b> value for <b><?php echo htmlentities($rdn); ?></b></h3>
|
||||
<h3 class="subtitle">Server: <b><?php echo $server_name; ?></b> Distinguished Name: <b><?php echo $dn; ?></b></h3>
|
||||
<h3 class="title">
|
||||
<?php echo $lang['add_new']; ?>
|
||||
<b><?php echo htmlspecialchars($attr); ?></b>
|
||||
<?php echo $lang['value_to']; ?>
|
||||
<b><?php echo htmlentities($rdn); ?></b></h3>
|
||||
<h3 class="subtitle">
|
||||
<?php echo $lang['server']; ?>:
|
||||
<b><?php echo $server_name; ?></b>
|
||||
<?php echo $lang['distinguished_name']; ?>: <b><?php echo htmlspecialchars( $dn ); ?></b></h3>
|
||||
|
||||
Current list of <b><?php echo $num_current_values; ?></b> value<?php echo $num_current_values>1?'s':''; ?>
|
||||
for attribute <b><?php echo htmlspecialchars($attr); ?></b>:
|
||||
<?php echo $lang['current_list_of']; ?> <b><?php echo $num_current_values; ?></b>
|
||||
<?php echo $lang['values_for_attribute']; ?> <b><?php echo htmlspecialchars($attr); ?></b>:
|
||||
|
||||
<?php if( $is_jpeg_photo ) { ?>
|
||||
|
||||
@@ -61,8 +70,23 @@ Current list of <b><?php echo $num_current_values; ?></b> value<?php echo $num_c
|
||||
|
||||
<!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
|
||||
<p><small>
|
||||
Note: You will get an "inappropriate matching" error if you have not<br />
|
||||
setup an <tt>EQUALITY</tt> rule on your LDAP server for <tt>jpegPhoto</tt> attributes.
|
||||
<?php echo $lang['inappropriate_matching_note']; ?>
|
||||
</small></p>
|
||||
<!-- End of temporary warning -->
|
||||
|
||||
<?php } else if( is_attr_binary( $server_id, $attr ) ) { ?>
|
||||
<ul>
|
||||
<?php if( is_array( $vals ) ) { for( $i=1; $i<=count($vals); $i++ ) {
|
||||
$href = "download_binary_attr.php?server_id=$server_id&dn=$encoded_dn&attr=$attr&value_num=" . ($i-1); ?>
|
||||
<li><a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo $lang['download_value'] . ' ' . $i; ?>)</a></li>
|
||||
<?php } } else {
|
||||
$href = "download_binary_attr.php?server_id=$server_id&dn=$encoded_dn&attr=$attr"; ?>
|
||||
<li><a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo $lang['download_value']; ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
|
||||
<p><small>
|
||||
<?php echo $lang['inappropriate_matching_note']; ?>
|
||||
</small></p>
|
||||
<!-- End of temporary warning -->
|
||||
|
||||
@@ -84,7 +108,8 @@ Current list of <b><?php echo $num_current_values; ?></b> value<?php echo $num_c
|
||||
|
||||
<?php } ?>
|
||||
|
||||
Enter the value you would like to add:<br />
|
||||
<?php echo $lang['enter_value_to_add']; ?>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php if( $is_object_class ) { ?>
|
||||
@@ -102,29 +127,31 @@ Enter the value you would like to add:<br />
|
||||
|
||||
</select> <input type="submit" value="Add new objectClass" />
|
||||
|
||||
<br /><small>Note: you may be required to enter new attributes<br />
|
||||
that this objectClass requires (MUST attrs)</small>
|
||||
|
||||
<?php } elseif( $is_jpeg_photo ) { ?>
|
||||
|
||||
<form action="add_value.php" method="post" class="new_value" enctype="multipart/form-data">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
<input type="hidden" name="attr" value="<?php echo $encoded_attr; ?>" />
|
||||
<input type="file" name="jpeg_photo_file" value="" /><br />
|
||||
<br />
|
||||
<input type="submit" name="submit" value="Add new jpeg >>" />
|
||||
<br /><small><?php echo $lang['new_required_attrs_note']; ?></small>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<form action="add_value.php" method="post" class="new_value">
|
||||
<form action="add_value.php" method="post" class="new_value" <?php
|
||||
if( is_attr_binary( $server_id, $attr ) ) echo "enctype=\"multipart/form-data\""; ?>>
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
<input type="hidden" name="attr" value="<?php echo $encoded_attr; ?>" />
|
||||
<input type="text" name="new_value" size="40" value="" />
|
||||
|
||||
<?php if( is_attr_binary( $server_id, $attr ) ) { ?>
|
||||
<input type="file" name="new_value" />
|
||||
<input type="hidden" name="binary" value="true" />
|
||||
<?php } else { ?>
|
||||
<input type="text" name="new_value" size="40" value="" />
|
||||
<?php } ?>
|
||||
|
||||
<input type="submit" name="submit" value="Add New Value" />
|
||||
<br />
|
||||
<small>Syntax: <?php echo $schema_attrs[ strtolower($attr) ]['type']; ?></small>
|
||||
<small><?php echo $lang['syntax']; ?>: <?php echo $schema_attr->getType(); ?></small><br />
|
||||
<?php if( $schema_attr->getMaxLength() ) { ?>
|
||||
<small>Max length: <?php echo number_format( $schema_attr->getMaxLength() ); ?>
|
||||
characters</small>
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
|
Reference in New Issue
Block a user