RELEASE 0.9.5

This commit is contained in:
Deon George
2009-06-30 19:22:30 +10:00
parent 0a07abd27a
commit d12096bbd3
341 changed files with 22846 additions and 4908 deletions

View File

@@ -1,4 +1,6 @@
<?php
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/modification/default.php,v 1.70 2004/12/20 14:12:33 uugdave Exp $
/*
* edit.php
@@ -14,55 +16,34 @@
/** If an entry has more children than this, stop searching and display this amount with a '+' */
$max_children = 100;
$dn= $_GET['dn'];
isset( $dn ) or $dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
$encoded_dn = rawurlencode( $dn );
$modified_attrs = isset( $_GET['modified_attrs'] ) ? $_GET['modified_attrs'] : false;
$server_id = $_GET['server_id'];
isset( $server_id ) or $server_id = $_GET['server_id'];
$show_internal_attrs = isset( $_GET['show_internal_attrs'] ) ? true : false;
$rdn = pla_explode_dn( $dn );
$rdn = $rdn[0];
if( null != $dn ) {
$rdn = pla_explode_dn( $dn );
if( isset( $rdn[0] ) )
$rdn = $rdn[0];
else
$rdn = null;
} else {
$rdn = null;
}
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." );
pla_ldap_connect( $server_id ) or pla_error( "Coult not connect to LDAP server." );
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] . htmlspecialchars( $server_id ) );
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
$friendly_attrs = process_friendly_attr_table();
$attrs = get_object_attrs( $server_id, $dn );
if( ! isset( $attrs ) )
$attrs = get_object_attrs( $server_id, $dn, false, get_view_deref_setting() );
pla_ldap_connect( $server_id ) or pla_error( "Could not connect to LDAP server" );
$system_attrs = get_entry_system_attrs( $server_id, $dn );
if( ! $attrs )
pla_error( "No such dn, " . htmlspecialchars( ( $dn ) ) );
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
$system_attrs = get_entry_system_attrs( $server_id, $dn, get_view_deref_setting() );
dn_exists( $server_id, $dn ) or pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn ) ) );
$server_name = $servers[$server_id]['name'];
// build a list of attributes available for this object based on its objectClasses
$oclasses = get_object_attr( $server_id, $dn, 'objectClass' );
if( ! is_array( $oclasses ) )
$oclasses = array( $oclasses );
$avail_attrs = array();
if( ! is_server_read_only( $server_id ) ) {
$schema_oclasses = get_schema_objectclasses( $server_id, $dn );
foreach( $oclasses as $oclass ) {
$schema_oclass = get_schema_objectclass( $server_id, $oclass, $dn );
if( $schema_oclass && 'objectclass' == get_class( $schema_oclass ) )
$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( is_attr_binary( $server_id, $attr ) ) {
$avail_binary_attrs[] = $attr;
unset( $avail_attrs[ $i ] );
}
}
}
include 'header.php'; ?>
<body>
@@ -73,55 +54,54 @@ include 'header.php'; ?>
<tr>
<?php $time = gettimeofday(); $random_junk = md5( strtotime( 'now' ) . $time['usec'] ); ?>
<td><img src="images/refresh.png" /></td>
<td class="icon"><img src="images/refresh.png" /></td>
<td><a href="edit.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>&amp;random=<?php
echo $random_junk; ?>"
title="<?php echo $lang['refresh_this_entry']; ?>"><?php echo $lang['refresh_entry']; ?></a></td>
<td class="icon"><img src="images/save.png" /></td>
<?php $export_url = "export_form.php?server_id=$server_id&amp;dn=$encoded_dn&amp;scope=base"; ?>
<td><a href="<?php echo $export_url; ?>" title="<?php echo $lang['export_tooltip']; ?>"><?php echo $lang['export']; ?></a></td>
</tr>
<?php if( ! is_server_read_only( $server_id ) && 0 != strcasecmp( $dn, $servers[$server_id]['base'] ) ) { ?>
<?php /* We won't allow them to delete the base dn of the server */ ?>
<tr>
<td><img src="images/trash.png" /></td>
<td><a href="delete_form.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>"
title="<?php echo $lang['delete_this_entry_tooltip']; ?>"><?php echo $lang['delete_this_entry']; ?></a></td>
</tr>
<?php } ?>
<?php if( show_hints() && ! is_server_read_only( $server_id ) ) { ?>
<tr>
<td><img src="images/light.png" /></td>
<td><?php echo $lang['delete_hint']; ?></td>
</tr>
<?php } ?>
<tr>
<td><img src="images/cut.png" /></td>
<td class="icon"><img src="images/cut.png" /></td>
<td><a href="copy_form.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn?>"
title="<?php echo $lang['copy_this_entry_tooltip']; ?>"><?php echo $lang['copy_this_entry']; ?></a></td>
</tr>
<tr>
<td><img src="images/save.png" /></td>
<?php $ldif_url = "ldif_export.php?server_id=$server_id&amp;dn=$encoded_dn&amp;scope=base"; ?>
<td><a href="<?php echo $ldif_url; ?>" title="<?php echo $lang['export_to_ldif_tooltip']; ?>"><?php echo $lang['export_to_ldif']; ?></a>
(<a href="<?php echo $ldif_url; ?>&amp;format=mac"
title="<?php echo $lang['export_to_ldif_mac']; ?>">mac</a>)
(<a href="<?php echo $ldif_url; ?>&amp;format=win"
title="<?php echo $lang['export_to_ldif_win']; ?>">win</a>)
(<a href="<?php echo $ldif_url; ?>&amp;format=unix"
title="<?php echo $lang['export_to_ldif_unix']; ?>">unix</a>)
</td>
<?php if( $show_internal_attrs ) { ?>
<td class="icon"><img src="images/tools-no.png" /></td>
<td><a href="edit.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>"><?php echo $lang['hide_internal_attrs']; ?></a></td>
<?php } else { ?>
<td class="icon"><img src="images/tools.png" /></td>
<td><a href="edit.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>&amp;show_internal_attrs=true"><?php echo $lang['show_internal_attrs']; ?></a></td>
<?php } ?>
</tr>
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<tr>
<td><img src="images/star.png" /></td>
<td class="icon"><img src="images/trash.png" /></td>
<td><a style="color: red" href="delete_form.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>"
title="<?php echo $lang['delete_this_entry_tooltip']; ?>"><?php echo $lang['delete_this_entry']; ?></a></td>
<td class="icon"><img src="images/rename.png" /></td>
<td><a href="rename_form.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>"><?php echo $lang['rename']; ?></a></td>
<?php if( show_hints() ) { ?>
</tr>
<tr>
<td class="icon"><img src="images/light.png" /></td>
<td colspan="3"><span class="hint"><?php echo $lang['delete_hint']; ?></span></td>
</tr>
<?php } ?>
<tr>
<td class="icon"><img src="images/star.png" /></td>
<td><a href="<?php echo "create_form.php?server_id=$server_id&amp;container=$encoded_dn"; ?>"><?php echo $lang['create_a_child_entry']; ?></a></td>
<td class="icon"><img src="images/add.png" /></td>
<td><a href="<?php echo "add_attr_form.php?server_id=$server_id&amp;dn=$encoded_dn"; ?>"><?php echo $lang['add_new_attribute']; ?></a></td>
</tr>
<?php } ?>
<?php flush(); ?>
<?php $children = get_container_contents( $server_id, $dn, $max_children );
<?php $children = get_container_contents( $server_id, $dn, $max_children, '(objectClass=*)', get_view_deref_setting() );
if( ($children_count = count( $children ) ) > 0 ) {
if( $children_count == $max_children )
@@ -130,254 +110,139 @@ if( ($children_count = count( $children ) ) > 0 ) {
?>
<tr>
<td><img src="images/children.png" /></td>
<td><a href="search.php?search=true&amp;server_id=<?php echo $server_id; ?>&amp;filter=<?php echo rawurlencode('objectClass=*'); ?>&amp;base_dn=<?php echo $encoded_dn; ?>&amp;form=advanced&amp;scope=one"><?php echo $lang['view']; ?> <?php echo $children_count; ?> <?php echo ($children_count==1?'child':'children');?></a></td>
</tr>
<?php } ?>
<?php if( $children_count > 0 ) { ?>
<tr>
<td><img src="images/save.png" /></td>
<?php $ldif_url = "ldif_export.php?server_id=$server_id&amp;dn=$encoded_dn&amp;scope=sub"; ?>
<td><a href="<?php echo $ldif_url; ?>"
title="<?php echo $lang['export_subtree_to_ldif_tooltip']; ?>"><?php echo $lang['export_subtree_to_ldif']; ?></a>
(<a href="<?php echo $ldif_url; ?>&amp;format=mac" title="<?php echo $lang['export_to_ldif_mac'];?>">mac</a>)
(<a href="<?php echo $ldif_url; ?>&amp;format=win" title="<?php echo $lang['export_to_ldif_win'];?>">win</a>)
(<a href="<?php echo $ldif_url; ?>&amp;format=unix" title="<?php echo $lang['export_to_ldif_unix'];?>">unix</a>)
<td class="icon"><img src="images/children.png" /></td>
<td><a href="search.php?search=true&amp;server_id=<?php echo $server_id; ?>&amp;filter=<?php echo rawurlencode('objectClass=*'); ?>&amp;base_dn=<?php echo $encoded_dn; ?>&amp;form=advanced&amp;scope=one"><?php
if( $children_count == 1 )
echo $lang['view_one_child'];
else
echo sprintf( $lang['view_children'], $children_count ); ?></a></td>
<td class="icon"><img src="images/save.png" /></td>
<?php $export_url = "export_form.php?server_id=$server_id&amp;dn=$encoded_dn&amp;scope=sub"; ?>
<td><a href="<?php echo $export_url; ?>"
title="<?php echo $lang['export_subtree_tooltip']; ?>"><?php echo $lang['export_subtree']; ?></a>
</td>
</tr>
<?php } ?>
</tr>
<?php if( show_hints() ) { ?>
<tr>
<td><img src="images/light.png" /></td>
<td><?php echo $lang['attr_schema_hint']; ?></td>
<?php } ?> <?php if( show_hints() ) { ?>
<tr>
<td class="icon"><img src="images/light.png" /></td>
<td colspan="3"><span class="hint"><?php echo $lang['attr_schema_hint']; ?></span></td>
</tr>
<?php } ?>
<?php if( is_server_read_only( $server_id ) ) { ?>
<tr>
<td><img src="images/light.png" /></td>
<td class="icon"><img src="images/light.png" /></td>
<td><?php echo $lang['viewing_read_only']; ?></td>
</tr>
<?php } ?>
<?php if( $modified_attrs ) { ?>
<tr>
<td><img src="images/light.png" /></td>
<td class="icon"><img src="images/light.png" /></td>
<?php if( count( $modified_attrs ) > 1 ) { ?>
<td><?php echo sprintf( $lang['attrs_modified'], implode( ', ', $modified_attrs ) ); ?></td>
<td colspan="3"><?php echo sprintf( $lang['attrs_modified'], implode( ', ', $modified_attrs ) ); ?></td>
<?php } else { ?>
<td><?php echo sprintf( $lang['attr_modified'], implode( '', $modified_attrs ) ); ?></td>
<td colspan="3"><?php echo sprintf( $lang['attr_modified'], implode( '', $modified_attrs ) ); ?></td>
<?php } ?>
</tr>
<?php } ?>
<?php
// lower-case all the modified attrs to remove ambiguity when searching the array later
foreach( $modified_attrs as $i => $attr ) {
$modified_attrs[$i] = strtolower( $attr );
}
}
?>
</table>
<?php flush(); ?>
<br />
<table class="edit_dn">
<?php flush(); ?>
<table class="edit_dn" cellspacing="0">
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<!-- Form to rename this entry -->
<tr class="row1">
<td class="heading"><acronym title="<?php echo $lang['change_entry_rdn']; ?> "><?php echo $lang['rename_entry']; ?></acronym></td>
<td class="heading" align="right">
<nobr>
<form action="rename.php" method="post" class="edit_dn" />
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="text" name="new_rdn" size="30" value="<?php echo htmlspecialchars( ( $rdn ) ); ?>" />
<input class="update_dn" type="submit" value="<?php echo $lang['rename']; ?>" />
</form>
</nobr>
</td>
<?php } ?>
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<!-- Form to add a new attribute to this entry -->
<tr class="spacer"><td colspan="2"></td></tr>
<form action="new_attr.php" method="post">
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<tr class="row1">
<td class="heading">
<nobr>
<acronym title="<?php echo $lang['add_new_attribute_tooltip']; ?>"><?php echo $lang['add_new_attribute']; ?></acronym>
</nobr>
</td>
<td class="heading" align="right"><nobr>
<?php if( is_array( $avail_attrs ) && count( $avail_attrs ) > 0 ) { ?>
<select name="attr">
<?php
$attr_select_html = '';
foreach( $avail_attrs as $a ) {
// is there a user-friendly translation available for this attribute?
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
htmlspecialchars($a) . ")";
} else {
$attr_display = htmlspecialchars( $a );
}
echo $attr_display;
$attr_select_html .= "<option>$attr_display</option>\n";
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
} ?>
</select>
<input type="text" name="val" size="20" />
<input type="submit" name="submit" value="<?php echo $lang['add']; ?>" class="update_dn" />
<?php } else { ?>
<small>(<?php echo $lang['no_new_attrs_available']; ?>)</small>
<?php } ?>
</nobr></td>
</form>
</tr>
<?php } ?>
<?php flush(); ?>
<?php if( ! is_server_read_only( $server_id ) && count( $avail_binary_attrs ) > 0 ) { ?>
<!-- Form to add a new BINARY attribute to this entry -->
<tr class="spacer"><td colspan="2"></td></tr>
<form action="new_attr.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="hidden" name="binary" value="true" />
<tr class="row1">
<td class="heading">
<nobr>
<acronym title="<?php echo $lang['add_new_binary_attr_tooltip']; ?>">
<?php echo $lang['add_new_binary_attr']; ?></acronym>
</nobr>
</td>
<td class="heading" align="right"><nobr>
<select name="attr">
<?php
$attr_select_html = '';
foreach( $avail_binary_attrs as $a ) {
// is there a user-friendly translation available for this attribute?
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
htmlspecialchars($a) . ")";
} else {
$attr_display = htmlspecialchars( $a );
}
echo $attr_display;
$attr_select_html .= "<option>$attr_display</option>\n";
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
} ?>
</select>
<input type="file" name="val" size="20" />
<input type="submit" name="submit" value="<?php echo $lang['add']; ?>" class="update_dn" />
</nobr></td>
</form>
</tr>
<?php } ?>
<tr class="spacer"><td colspan="2"></td></tr>
<tr class="row1">
<td class="heading" colspan="2">
<nobr>
<?php if( $show_internal_attrs ) { ?>
<a href="edit.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>"
><img src="images/minus.png" title="<?php echo $lang['hide_internal_attrs']; ?>" /></a>
<acronym title="<?php echo $lang['internal_attrs_tooltip'];?>"><?php echo $lang['internal_attributes']; ?></acronym>
<?php } else { ?>
<a href="edit.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo $encoded_dn; ?>&amp;show_internal_attrs=true">
<img src="images/plus.png" title="<?php echo $lang['show_internal_attrs']; ?>" /></a>
<acronym title="<?php echo $lang['internal_attrs_tooltip']; ?> (<?php echo $lang['click_to_display']; ?>)"><?php echo $lang['internal_attributes']; ?></acronym>
<small>(<?php echo $lang['hidden']; ?>)</small>
<?php } ?>
</nobr>
</td>
</tr>
<?php
if( $show_internal_attrs ) {
$counter = 0;
foreach( get_entry_system_attrs( $server_id, $dn ) as $attr => $vals ) {
$counter++;
$schema_href = "schema.php?server_id=$server_id&amp;view=attributes&viewvalue=" . real_attr_name($attr);
$schema_href = "schema.php?server_id=$server_id&amp;view=attributes&amp;viewvalue=" . real_attr_name($attr);
?>
<tr class="<?php echo ($counter%2==0?'row1':'row2');?>">
<td class="attr"><b><a title="<?php echo sprintf( $lang['attr_name_tooltip'], $attr ); ?>"
<tr>
<td colspan="2" class="attr"><b><a title="<?php echo sprintf( $lang['attr_name_tooltip'], $attr ); ?>"
href="<?php echo $schema_href; ?>"><?php echo htmlspecialchars( $attr ); ?></b></td>
</tr>
<tr>
<td class="val">
<?php foreach( $vals as $v ) {?>
<?php echo htmlspecialchars( $v ); ?><br />
<?php } ?>
<?php
if( is_attr_binary( $server_id, $attr ) ) {
$href = "download_binary_attr.php?server_id=$server_id&amp;dn=$encoded_dn&amp;attr=$attr";
?>
<small>
<?php echo $lang['binary_value']; ?><br />
<?php if( count( $vals ) > 1 ) { for( $i=1; $i<=count($vals); $i++ ) { ?>
<a href="<?php echo $href . "&amp;value_num=$i"; ?>"><img
src="images/save.png" /> <?php echo $lang['download_value']; ?>(<?php echo $i; ?>)</a><br />
<?php } } else { ?>
<a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo $lang['download_value']; ?></a><br />
<?php }
} else {
foreach( $vals as $v ) {
echo htmlspecialchars( $v );
echo "<br />\n";
}
} ?>
</td>
</tr>
<?php }
if( $counter == 0 )
echo "<tr class=\"row2\"><td colspan=\"2\"><center>(" . $lang['none'] . ")</center></td></tr>\n";
echo "<tr><td colspan=\"2\">(" . $lang['no_internal_attributes'] . ")</td></tr>\n";
}
?>
<?php flush(); ?>
<tr class="spacer"><td colspan="2"></td></tr>
<!-- Table of attributes/values to edit -->
<tr class="row1">
<td class="heading" colspan="2">
<nobr><?php echo $lang['entry_attributes']; ?></nobr>
</td>
</tr>
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<form action="update_confirm.php" method="post">
<form action="update_confirm.php" method="post" name="edit_form">
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<?php } ?>
<?php $counter=0; ?>
<?php /* Prepare the hidden_attrs array by lower-casing it (hidden_attrs comes from config.php). */
if( isset( $hidden_attrs ) && is_array( $hidden_attrs ) && count( $hidden_attrs ) > 0 )
foreach( $hidden_attrs as $i => $attr_name )
$hidden_attrs[$i] = strtolower( $attr_name );
else
$hidden_attrs = array();
?>
<?php
<?php foreach( $attrs as $attr => $vals ) {
if( ! $attrs || ! is_array( $attrs ) ) {
echo "<tr><td colspan=\"2\">(" . $lang['no_attributes'] . ")</td></tr>\n";
echo "</table>";
echo "</html>";
die();
}
uksort( $attrs, 'sortAttrs' );
foreach( $attrs as $attr => $vals ) {
flush();
if( ! is_server_read_only( $server_id ) ) {
$schema_attr = get_schema_attribute( $server_id, $attr, $dn );
if( $schema_attr )
$attr_syntax = $schema_attr->getSyntaxOID();
else
$attr_syntax = null;
}
$schema_attr = get_schema_attribute( $server_id, $attr, $dn );
if( $schema_attr )
$attr_syntax = $schema_attr->getSyntaxOID();
else
$attr_syntax = null;
if( 0 == strcasecmp( $attr, 'dn' ) )
continue;
// has the config.php specified that this attribute is to be hidden?
if( in_array( strtolower( $attr ), $hidden_attrs ) )
continue;
// has the config.php specified that this attribute is to be hidden or shown?
if( is_attr_hidden( $server_id, $attr))
continue;
// Setup the $attr_note, which will be displayed to the right of the attr name (if any)
$attr_note = '';
// is there a user-friendly translation available for this attribute?
if( isset( $friendly_attrs[ strtolower( $attr ) ] ) ) {
@@ -388,27 +253,53 @@ if( $show_internal_attrs ) {
$attr_display = $attr;
}
// is this attribute required by an objectClass?
$required_by = '';
if( $schema_attr )
foreach( $schema_attr->getRequiredByObjectClasses() as $required )
if( in_array( strtolower( $required ), arrayLower( $attrs['objectClass'] ) ) )
$required_by .= $required . ' ';
if( $required_by ) {
if( trim( $attr_note ) )
$attr_note .= ', ';
$attr_note .= "<acronym title=\"" . sprintf( $lang['required_for'], $required_by ) . "\">" . $lang['required'] . "</acronym>&nbsp;";
}
?>
<?php if( is_array( $modified_attrs ) && in_array( $attr, $modified_attrs ) ) { ?>
<?php
if( is_array( $modified_attrs ) && in_array( strtolower($attr), $modified_attrs ) )
$is_modified_attr = true;
else
$is_modified_attr = false;
?>
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr">
<?php } else { ?>
<?php if( $counter++ % 2 == 0 ) { ?>
<tr class="row2">
<?php } else { ?>
<tr class="row1">
<?php } ?>
<tr>
<?php } ?>
<td class="attr">
<?php $schema_href="schema.php?server_id=$server_id&view=attributes&viewvalue=" . real_attr_name($attr); ?>
<b><a title="<?php echo sprintf( $lang['attr_name_tooltip'], $attr ) ?>"
href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a></b>
<sup><small><?php echo $attr_note; ?></small></sup>
<br />
<?php $schema_href="schema.php?server_id=$server_id&amp;view=attributes&amp;viewvalue=" . real_attr_name($attr); ?>
<b>
<a
title="<?php echo sprintf( $lang['attr_name_tooltip'], $attr ) ?>"
href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a></b>
</td>
<td class="attr_note">
<sup><small><?php echo $attr_note; ?></small></sup>
<?php if( is_attr_read_only( $server_id, $attr ) ) { ?>
<small>(<acronym title="<?php echo $lang['read_only_tooltip']; ?>"><?php echo $lang['read_only']; ?></acronym>)</small>
<?php } ?>
</td>
</tr>
<td class="val">
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr">
<?php } else { ?>
<tr>
<?php } ?>
<td class="val" colspan="2">
<?php
@@ -419,12 +310,15 @@ if( $show_internal_attrs ) {
// Don't draw the delete buttons if there is more than one jpegPhoto
// (phpLDAPadmin can't handle this case yet)
if( is_server_read_only( $server_id ) )
draw_jpeg_photos( $server_id, $dn, false );
if( is_server_read_only( $server_id ) || is_attr_read_only( $server_id, $attr ) )
draw_jpeg_photos( $server_id, $dn, $attr, false );
else
draw_jpeg_photos( $server_id, $dn, true );
draw_jpeg_photos( $server_id, $dn, $attr, true );
// proceed to the next attribute
echo "</td></tr>\n";
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
@@ -445,36 +339,51 @@ if( $show_internal_attrs ) {
<a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo $lang['download_value']; ?></a><br />
<?php } ?>
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<?php if( ! is_server_read_only( $server_id ) && ! is_attr_read_only( $server_id, $attr ) ) { ?>
<a href="javascript:deleteAttribute( '<?php echo $attr; ?>' );"
style="color:red;"><img src="images/trash.png" /> <?php echo $lang['delete_attribute']; ?></a>
<?php } ?>
</small>
</td>
</tr>
<?php continue;
<?php
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
/*
* Note: at this point, the attribute must be text-based (not binary or jpeg)
*/
/*
* If we are in read-only mode, simply draw the attribute values and continue.
* If this server is in read-only mode or this attribute is configured as read_only,
* simply draw the attribute values and continue.
*/
if( is_server_read_only( $server_id ) ) {
if( is_server_read_only( $server_id ) || is_attr_read_only( $server_id, $attr ) ) {
if( is_array( $vals ) ) {
foreach( $vals as $i => $val ) {
$val = ( $val );
if( $val == "" )
echo "<span style=\"color:red\">[empty]</span><br />\n";
if( trim( $val ) == "" )
echo "<span style=\"color:red\">[" . $lang['empty'] . "]</span><br />\n";
elseif( 0 == strcasecmp( $attr, 'userPassword' ) && obfuscate_password_display() )
echo preg_replace( '/./', '*', $val ) . "<br />";
else
echo $val . "<br />";
echo htmlspecialchars( $val ) . "<br />";
}
} else {
echo ( $vals ) . "<br />";
if( 0 == strcasecmp( $attr, 'userPassword' ) && obfuscate_password_display() )
echo preg_replace( '/./', '*', $vals ) . "<br />";
else
echo $vals . "<br />";
}
echo "</td>";
echo "</tr>";
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
@@ -483,38 +392,13 @@ if( $show_internal_attrs ) {
*/
if( 0 == strcasecmp( $attr, 'userpassword' ) ) {
$user_password = $vals[0];
/* Capture the stuff in the { } to determine if this is crypt, md5, etc. */
if( preg_match( "/{([^}]+)}/", $user_password, $enc_type) )
$enc_type = strtolower($enc_type[1]);
else
$enc_type = null;
$enc_type = get_enc_type( $user_password );
// Set the default hashing type if the password is blank (must be newly created)
if( $val == '' ) {
$enc_type = $servers[$server_id]['default_hash'];
} ?>
<?php /* handle crypt types */
if($enc_type == "crypt") {
if( preg_match( "/{[^}]+}\\$(.)\\$/", $user_password, $salt) )
$salt = $salt[1];
else
$salt = null;
switch( $salt ) {
case '': // CRYPT_STD_DES
$enc_type = "crypt";
break;
case '1': // CRYPT_MD5
$enc_type = "md5crypt";
break;
case '2': // CRYPT_BLOWFISH
$enc_type = "blowfish";
break;
default:
$enc_type = "crypt";
}
} ?>
// Set the default hashing type if the password is blank (must be newly created)
if( $user_password == '' ) {
$enc_type = get_default_hash( $server_id );
}
?>
<input type="hidden"
name="old_values[userpassword]"
@@ -526,35 +410,57 @@ if( $show_internal_attrs ) {
name="old_enc_type"
value="<?php echo ($enc_type==''?'clear':$enc_type); ?>" />
<input size="38"
type="text"
name="new_values[userpassword]"
value="<?php echo htmlspecialchars($user_password); ?>" />
<?php if( obfuscate_password_display() || is_null( $enc_type ) ) {
echo htmlspecialchars( preg_replace( "/./", "*", $user_password ) );
} else {
echo htmlspecialchars( $user_password );
}
?>
<br />
<input style="width: 260px"
type="password"
name="new_values[userpassword]"
value="<?php echo htmlspecialchars( $user_password ); ?>" />
<select name="enc_type">
<option>clear</option>
<option<?php echo $enc_type=='crypt'?' selected':''; ?>>crypt</option>
<option<?php echo $enc_type=='md5'?' selected':''; ?>>md5</option>
<option<?php echo $enc_type=='smd5'?' selected':''; ?>>smd5</option>
<option<?php echo $enc_type=='md5crypt'?' selected':''; ?>>md5crypt</option>
<option<?php echo $enc_type=='blowfish'?' selected':''; ?>>blowfish</option>
<option<?php echo $enc_type=='sha'?' selected':''; ?>>sha</option>
<option<?php echo $enc_type=='ssha'?' selected':''; ?>>ssha</option>
<option<?php echo $enc_type=='crypt'?' selected="true"':''; ?>>crypt</option>
<option<?php echo $enc_type=='md5'?' selected="true"':''; ?>>md5</option>
<option<?php echo $enc_type=='smd5'?' selected="true"':''; ?>>smd5</option>
<option<?php echo $enc_type=='md5crypt'?' selected="true"':''; ?>>md5crypt</option>
<option<?php echo $enc_type=='blowfish'?' selected="true"':''; ?>>blowfish</option>
<option<?php echo $enc_type=='sha'?' selected="true"':''; ?>>sha</option>
<option<?php echo $enc_type=='ssha'?' selected="true"':''; ?>>ssha</option>
</select>
<?php continue;
<br />
<script language="javascript">
<!--
function passwordComparePopup()
{
mywindow = open( 'password_checker.php', 'myname', 'resizable=no,width=450,height=200,scrollbars=1' );
mywindow.location.href = 'password_checker.php?hash=<?php echo base64_encode($user_password); ?>&base64=true';
if( mywindow.opener == null )
mywindow.opener = self;
}
-->
</script>
<small><a href="javascript:passwordComparePopup()"><?php echo $lang['t_check_pass']; ?></a></small>
</td></tr>
<?php
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
/*
* Is this a boolean attribute?
*/
$type = ( $schema_attr = get_schema_attribute( $server_id, $attr, $dn ) ) ?
$schema_attr->getType() :
null;
if( 0 == strcasecmp( 'boolean', $type ) ) {
if( is_attr_boolean( $server_id, $attr) ) {
$val = $vals[0];
?>
<input type="hidden"
@@ -568,39 +474,128 @@ if( $show_internal_attrs ) {
<?php echo $lang['false']; ?></option>
<option value="">(<?php echo $lang['none_remove_value']; ?>)</option>
</select>
</td>
</tr>
<?php
if( $is_modified_attr )
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
continue;
}
/*
* End of special case attributes.
* End of special case attributes (non plain text).
*/
/*
* This is a normal attribute, to be displayed and edited in plain text.
* This is a plain text attribute, to be displayed and edited in plain text.
*/
foreach( $vals as $i => $val ) {
$val = ( $val ); ?>
<nobr>
$input_name = "new_values[" . htmlspecialchars( $attr ) . "][$i]";
// We smack an id="..." tag in here that doesn't have [][] in it to allow the
// draw_chooser_link() to identify it after the user clicks.
$input_id = "new_values_" . htmlspecialchars($attr) . "_" . $i;
?>
<!-- The old_values array will let update.php know if the entry contents changed
between the time the user loaded this page and saved their changes. -->
<input type="hidden"
name="old_values[<?php echo htmlspecialchars( $attr ); ?>][<?php echo $i; ?>]"
value="<?php echo htmlspecialchars($val); ?>" />
<?php
// Is this value is a structural objectClass, make it read-only
if( 0 == strcasecmp( $attr, 'objectClass' ) ) {
?>
<a
title="<?php echo $lang['view_schema_for_oclass']; ?>"
href="schema.php?server_id=<?php echo $server_id; ?>&amp;view=objectClasses&amp;viewvalue=<?php echo htmlspecialchars( $val ); ?>"><img
src="images/info.png" /></a>
<?php
$schema_object = get_schema_objectclass( $server_id, $val);
if ($schema_object->type == 'structural') {
echo "$val <small>(<acronym title=\"" .
sprintf( $lang['structural_object_class_cannot_remove'] ) . "\">" .
$lang['structural'] . "</acronym>)</small><br />";
?>
<input type="hidden"
name="<?php echo $input_name; ?>"
id="<?php echo $input_id; ?>"
value="<?php echo htmlspecialchars($val); ?>" />
<?php
continue;
}
}
?>
<?php if( $attr_syntax == '1.3.6.1.4.1.1466.115.121.1.40' ) { ?>
<textarea
cols="37" rows="3"
name="new_values[<?php echo htmlspecialchars( $attr ); ?>][<?php echo $i; ?>]"
><?php echo htmlspecialchars($val); ?></textarea><br />
<?php } else { ?>
<input type="text"
size="50"
name="new_values[<?php echo htmlspecialchars( $attr ); ?>][<?php echo $i; ?>]"
value="<?php echo htmlspecialchars($val); ?>" /></nobr><br />
<?php } ?>
<?php if( is_dn_string( $val ) || is_dn_attr( $server_id, $attr ) ) { ?>
<a
title="<?php echo sprintf( $lang['go_to_dn'], htmlspecialchars($val) ); ?>"
href="edit.php?server_id=<?php echo $server_id; ?>&amp;dn=<?php echo rawurlencode($val); ?>"><img
style="vertical-align: top" src="images/go.png" /></a>
<?php } elseif( is_mail_string( $val ) ) { ?>
<a
href="mailto:<?php echo htmlspecialchars($val); ?>"><img
style="vertical-align: center" src="images/mail.png" /></a>
<?php } elseif( is_url_string( $val ) ) { ?>
<a
href="<?php echo htmlspecialchars($val); ?>"
target="new"><img
style="vertical-align: center" src="images/dc.png" /></a>
<?php } ?>
<?php if( is_multi_line_attr( $attr, $val, $server_id ) ) { ?>
<textarea
class="val"
rows="3"
cols="50"
name="<?php echo $input_name; ?>"
id="<?php echo $input_id; ?>"><?php echo htmlspecialchars($val); ?></textarea>
<?php } else { ?>
<input type="text"
class="val"
name="<?php echo $input_name; ?>"
id="<?php echo $input_id; ?>"
value="<?php echo htmlspecialchars($val); ?>" />
<?php } ?>
<?php
// draw a link for popping up the entry browser if this is the type of attribute
// that houses DNs.
if( is_dn_attr( $server_id, $attr ) )
draw_chooser_link( "edit_form.$input_id", false );
// If this is a gidNumber on a non-PosixGroup entry, lookup its name and description for convenience
if( 0 == strcasecmp( $attr, 'gidNumber' ) &&
! in_array_ignore_case( 'posixGroup', get_object_attr( $server_id, $dn, 'objectClass' ) ) ) {
$gid_number = $val;
$search_group_filter = "(&(objectClass=posixGroup)(gidNumber=$val))";
$group = pla_ldap_search( $server_id, $search_group_filter, null, array( 'dn', 'description' ) );
if( count( $group ) > 0 ) {
echo "<br />";
$group = array_pop( $group );
$group_dn = $group['dn'];
$group_name = explode( '=', get_rdn( $group_dn ) );
$group_name = $group_name[1];
$href = "edit.php?server_id=$server_id&amp;dn=" . urlencode( $group_dn );
echo "<small>";
echo "<a href=\"$href\">" . htmlspecialchars($group_name) . "</a>";
$description = isset( $group['description'] ) ? $group['description'] : null;
if( $description ) echo " (" . htmlspecialchars( $description ) . ")";
echo "</small>";
}
}
?>
<br />
<?php } /* end foreach value */ ?>
<?php
@@ -622,6 +617,10 @@ if( $show_internal_attrs ) {
</td>
</tr>
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>
<?php } ?>
<?php
flush();
@@ -629,7 +628,7 @@ if( $show_internal_attrs ) {
} /* End foreach( $attrs as $attr => $vals ) */ ?>
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<tr><td colspan="2"><center><input type="submit" value="<?php echo $lang['save_changes']; ?>" /></center></form></td></tr>
<tr><td colspan="2"><center><input type="submit" value="<?php echo $lang['save_changes']; ?>" /></center></td></tr></form>
<?php } ?>
<?php
@@ -673,5 +672,5 @@ function not_an_attr( $x )
return false;
return true;
}
echo "</body>\n</html>";
?>

View File

@@ -0,0 +1,142 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/modification/group_of_names.php,v 1.7 2004/10/14 04:07:14 uugdave Exp $
/*
* group_of_names.php
* Template for displaying a groupOfNames or groupOfUniqueNames object.
*
* Variables that come in as GET vars:
* - dn
* - server_id
* - modified_attrs (optional) an array of attributes to highlight as
* they were changed by the last operation
*/
include 'header.php';
$members = get_object_attr( $server_id, $dn, 'uniqueMember' );
$unique = true;
$attr_name = 'uniqueMember';
if( null == $members ) {
$attr_name = 'member';
$members = get_object_attr( $server_id, $dn, 'member' );
$unique = false;
}
$rdn = get_rdn( $dn );
$groupName = explode( '=', $rdn, 2 );
$groupName = $groupName[1];
?>
<script language="javascript">
<!--
// For removing elements from the member list.
// This is overly complicated. Good luck figuring
// out what it does. :) In fact, this thing is sooo
// ugly that I'm not even sure it will work on
// all browsers, but oh well... To understand it,
// you'll have to understand how the old_values
// and new_values array works when submitting
// a form to update_confirm.php. So start there.
function remove_member( dn )
{
//alert( 'Looking for ' + dn );
var form = document.remove_member_form;
for ( x=0; x<form.elements.length; x++ ) {
var element = form.elements[x];
if( dn == element.value ) {
//alert( 'Found it at index: ' + x );
element.value = '';
form.submit();
break;
}
}
}
-->
</script>
<form action="update_confirm.php" method="post" name="remove_member_form" style="margin:0">
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo htmlspecialchars( $dn ); ?>" />
<?php for( $i=0; $i<count($members); $i++) { $member=$members[$i]; ?>
<input type="hidden" name="new_values[<?php echo $attr_name; ?>][<?php echo $i; ?>]" value="<?php echo htmlspecialchars( $member ); ?>" />
<?php } ?>
<?php for( $i=0; $i<count($members); $i++) { $member=$members[$i]; ?>
<input type="hidden" name="old_values[<?php echo $attr_name; ?>][<?php echo $i; ?>]" value="<?php echo htmlspecialchars( $member ); ?>" />
<?php } ?>
</form>
<h3 class="title">Group: <b><?php echo htmlspecialchars( $groupName ); ?></b></h3>
<center><small>
Using the <b>group of names</b> template.
You may switch to the <a href="<?php echo $default_href; ?>">default template</a>
</small></center>
<?php
echo '<h3>List of Members (' . ( $unique ? 'unique' : 'non-unique' ) . ')</h3>';
if( ! is_array( $members ) || 0 == count( $members ) ) {
echo "(none)";
echo "<br />";
echo "<br />";
} else {
echo "<ol>";
for( $i=0; $i<count($members); $i++ ) {
$member = $members[$i];
echo "<li>";
echo "<a href=\"edit.php?server_id=$server_id&amp;dn=" . rawurlencode( $member );
echo "&amp;use_default_template=true\" title=\"Jump to this object\">";
echo htmlspecialchars( $member ) . "</a>";
echo " <small>(<a style=\"color:red\" href=\"javascript:remove_member( '" . htmlspecialchars( $member ) . "' );\" title=\"Remove this DN from the list\">remove</a>)</small>";
$member_cn = get_object_attr( $server_id, $member, 'cn' );
$member_cn = @$member_cn[0];
$member_sn = get_object_attr( $server_id, $member, 'sn' );
$member_sn = @$member_sn[0];
echo '<small>';
// Don't display the SN if it is a subset of the CN
if( false !== strpos( $member_cn, $member_sn ) )
$member_sn = ' ';
if( $member_sn && $member_cn )
echo '<br />&nbsp;&nbsp;Name: ' . htmlspecialchars( $member_cn . ' ' . $member_sn );
$object_classes = get_object_attr( $server_id, $member, 'objectClass' );
if( is_array( $object_classes ) )
echo '<br />&nbsp;&nbsp;objectClasses: ' . implode( ', ', $object_classes );
echo '</small>';
"</li>";
}
echo "</ol>";
}
?>
<script language="javascript">
function isValidMember()
{
var newValue = document.add_member_form.new_value.value;
if( trim( newValue ) == '' ) {
alert( 'Your new member cannot be empty.' );
return false;
} else {
return true;
}
}
</script>
<form action="add_value.php" onSubmit="return isValidMember()" method="post" name="add_member_form">
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo htmlspecialchars( $dn ); ?>" />
<input type="hidden" name="attr" value="<?php echo $attr_name; ?>" />
<div style="margin-left: 20px; border:1px solid gray; background-color: #eef; padding:5px; width: 300px">
<small>Add a new member:</small><br />
<input style="margin:0" type="text" name="new_value" size="35" style="font-size: 12px" value="" />
<?php draw_chooser_link( 'add_member_form.new_value', false ); ?><br />
<input type="submit" name="submit" value="Add" />
</div>
</form>

View File

@@ -0,0 +1,32 @@
<?php
/**
* samba_account.php
* Template for displaying a sambasamaccount object.
*
* Variables that come in as GET vars:
* - dn
* - server_id
* - modified_attrs (optional) an array of attributes to highlight as
* they were changed by the last operation
*
* @package phpLDAPadmin
*
* @author The phpLDAPadmin development team
**/
include 'header.php';
$rdn = get_rdn( $dn );
$sambaAccount = explode( '=', $rdn, 2 );
$sambaAccountRdn = $sambaAccount[1];
$attrs = get_object_attrs( $server_id, $dn, false, get_view_deref_setting());
?>
<body>
<h3 class="title"><?php echo $lang['samba_account'] . ': '; ?> <b><?php echo htmlspecialchars( $sambaAccountRdn ); ?></b></h3>
<center><small>
<?php echo $lang['using'] . ' <b>' . $lang['samba_account_lcase'] . '</b>' . $lang['template'] . '.'; ?>
<?php echo $lang['switch_to'] . '<a href=' . $default_href . '>' . $lang['default_template'] . '</a>'; ?>
</small></center>
<h2 style="text-align:center;color:#016;text-decoration:underline;">TO DO</h2>
</body>
</html>

View File

@@ -1,4 +1,6 @@
<?php
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/modification/user.php,v 1.4 2004/03/19 20:13:10 i18phpldapadmin Exp $
/*
* User modification template. All phpLDAPadmin templates can assume that the following
@@ -29,7 +31,6 @@ include 'header.php';
<b><?php echo htmlspecialchars( utf8_decode( $dn ) ); ?></b>
</h3>
<?php $default_href = "edit.php?server_id=$server_id&amp;dn=$encoded_dn&amp;use_default_template=true"; ?>
<center><small>
Using the <b>user</b> template.
You may switch to the <a href="<?php echo $default_href; ?>">default template</a>