1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
|
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/modification/default.php,v 1.69 2004/12/09 14:16:16 uugdave Exp $
/*
* edit.php
* Displays the specified dn from the specified server for editing
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
* - server_id
* - modified_attrs (optional) an array of attributes to highlight as
* they were changed by the last operation
*/
/** If an entry has more children than this, stop searching and display this amount with a '+' */
$max_children = 100;
isset( $dn ) or $dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
$encoded_dn = rawurlencode( $dn );
$modified_attrs = isset( $_GET['modified_attrs'] ) ? $_GET['modified_attrs'] : false;
isset( $server_id ) or $server_id = $_GET['server_id'];
$show_internal_attrs = isset( $_GET['show_internal_attrs'] ) ? true : false;
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( $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();
if( ! isset( $attrs ) )
$attrs = get_object_attrs( $server_id, $dn, false, get_view_deref_setting() );
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'];
include 'header.php'; ?>
<body>
<h3 class="title"><?php echo htmlspecialchars( ( $rdn ) ); ?></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>
<table class="edit_dn_menu">
<tr>
<?php $time = gettimeofday(); $random_junk = md5( strtotime( 'now' ) . $time['usec'] ); ?>
<td class="icon"><img src="images/refresh.png" /></td>
<td><a href="edit.php?server_id=<?php echo $server_id; ?>&dn=<?php echo $encoded_dn; ?>&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&dn=$encoded_dn&scope=base"; ?>
<td><a href="<?php echo $export_url; ?>" title="<?php echo $lang['export_tooltip']; ?>"><?php echo $lang['export']; ?></a></td>
</tr>
<tr>
<td class="icon"><img src="images/cut.png" /></td>
<td><a href="copy_form.php?server_id=<?php echo $server_id; ?>&dn=<?php echo $encoded_dn?>"
title="<?php echo $lang['copy_this_entry_tooltip']; ?>"><?php echo $lang['copy_this_entry']; ?></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; ?>&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; ?>&dn=<?php echo $encoded_dn; ?>&show_internal_attrs=true"><?php echo $lang['show_internal_attrs']; ?></a></td>
<?php } ?>
</tr>
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<tr>
<td class="icon"><img src="images/trash.png" /></td>
<td><a style="color: red" href="delete_form.php?server_id=<?php echo $server_id; ?>&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; ?>&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&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&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, '(objectClass=*)', get_view_deref_setting() );
if( ($children_count = count( $children ) ) > 0 ) {
if( $children_count == $max_children )
$children_count = $children_count . '+';
?>
<tr>
<td class="icon"><img src="images/children.png" /></td>
<td><a href="search.php?search=true&server_id=<?php echo $server_id; ?>&filter=<?php echo rawurlencode('objectClass=*'); ?>&base_dn=<?php echo $encoded_dn; ?>&form=advanced&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&dn=$encoded_dn&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 } ?> <?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 class="icon"><img src="images/light.png" /></td>
<td><?php echo $lang['viewing_read_only']; ?></td>
</tr>
<?php } ?>
<?php if( $modified_attrs ) { ?>
<tr>
<td class="icon"><img src="images/light.png" /></td>
<?php if( count( $modified_attrs ) > 1 ) { ?>
<td colspan="3"><?php echo sprintf( $lang['attrs_modified'], implode( ', ', $modified_attrs ) ); ?></td>
<?php } else { ?>
<td colspan="3"><?php echo sprintf( $lang['attr_modified'], implode( '', $modified_attrs ) ); ?></td>
<?php } ?>
</tr>
<?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
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&view=attributes&viewvalue=" . real_attr_name($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
if( is_attr_binary( $server_id, $attr ) ) {
$href = "download_binary_attr.php?server_id=$server_id&dn=$encoded_dn&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 . "&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><td colspan=\"2\">(" . $lang['no_internal_attributes'] . ")</td></tr>\n";
}
?>
<?php flush(); ?>
<!-- Table of attributes/values to edit -->
<?php if( ! is_server_read_only( $server_id ) ) { ?>
<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
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();
$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 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 ) ] ) ) {
$attr_display = $friendly_attrs[ strtolower( $attr ) ];
$attr_note = "<acronym title=\"" . sprintf( $lang['alias_for'], $attr_display, $attr ) . "\">alias</acronym>";
} else {
$attr_note = "";
$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> ";
}
?>
<?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 { ?>
<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>
</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>
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr">
<?php } else { ?>
<tr>
<?php } ?>
<td class="val" colspan="2">
<?php
/*
* Is this attribute a jpegPhoto?
*/
if( is_jpeg_photo( $server_id, $attr ) ) {
// 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 ) || is_attr_read_only( $server_id, $attr ) )
draw_jpeg_photos( $server_id, $dn, $attr, false );
else
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;
}
/*
* Is this attribute binary?
*/
if( is_attr_binary( $server_id, $attr ) ) {
$href = "download_binary_attr.php?server_id=$server_id&dn=$encoded_dn&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 . "&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 } ?>
<?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
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 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 ) || is_attr_read_only( $server_id, $attr ) ) {
if( is_array( $vals ) ) {
foreach( $vals as $i => $val ) {
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 htmlspecialchars( $val ) . "<br />";
}
} else {
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;
}
/*
* Is this a userPassword attribute?
*/
if( 0 == strcasecmp( $attr, 'userpassword' ) ) {
$user_password = $vals[0];
$enc_type = get_enc_type( $user_password );
// 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]"
value="<?php echo htmlspecialchars($user_password); ?>" />
<!-- Special case of enc_type to detect changes when user changes enc_type but not the password value -->
<input size="38"
type="hidden"
name="old_enc_type"
value="<?php echo ($enc_type==''?'clear':$enc_type); ?>" />
<?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="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>
<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()">Check password...</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?
*/
if( is_attr_boolean( $server_id, $attr) ) {
$val = $vals[0];
?>
<input type="hidden"
name="old_values[<?php echo htmlspecialchars( $attr ); ?>]"
value="<?php echo htmlspecialchars($val); ?>" />
<select name="new_values[<?php echo htmlspecialchars( $attr ); ?>]">
<option value="TRUE"<?php echo ($val=='TRUE' ? ' selected' : ''); ?>>
<?php echo $lang['true']; ?></option>
<option value="FALSE"<?php echo ($val=='FALSE' ? ' selected' : ''); ?>>
<?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 (non plain text).
*/
/*
* This is a plain text attribute, to be displayed and edited in plain text.
*/
foreach( $vals as $i => $val ) {
$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; ?>&view=objectClasses&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( 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; ?>&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&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
/* Draw the "add value" link under the list of values for this attributes */
if( ! is_server_read_only( $server_id ) &&
( $schema_attr = get_schema_attribute( $server_id, $attr, $dn ) ) &&
! $schema_attr->getIsSingleValue() )
{
$add_href = "add_value_form.php?server_id=$server_id&" .
"dn=$encoded_dn&attr=" . rawurlencode( $attr );
echo "<div class=\"add_value\">(<a href=\"$add_href\"
title=\"" . sprintf( $lang['add_value_tooltip'], $attr ) . "\">" .
$lang['add_value'] . "</a>)</div>\n";
}
?>
</td>
</tr>
<?php if( $is_modified_attr ) { ?>
<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>
<?php } ?>
<?php
flush();
} /* 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></td></tr></form>
<?php } ?>
<?php
?>
</table>
<?php /* If this entry has a binary attribute, we need to provide a form for it to submit when deleting it. */ ?>
<script language="javascript">
//<!--
function deleteAttribute( attrName )
{
if( confirm( "<?php echo $lang['really_delete_attribute']; ?> '" + attrName + "'?" ) ) {
document.delete_attribute_form.attr.value = attrName;
document.delete_attribute_form.submit();
}
}
//-->
</script>
<!-- This form is submitted by JavaScript when the user clicks "Delete attribute" on a binary attribute -->
<form name="delete_attribute_form" action="delete_attr.php" method="post">
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="hidden" name="attr" value="FILLED IN BY JAVASCRIPT" />
</form>
<?php
/**
* Given an attribute $x, this returns true if it is NOT already specified
* in the current entry, returns false otherwise.
*/
function not_an_attr( $x )
{
global $attrs;
//return ! isset( $attrs[ strtolower( $x ) ] );
foreach( $attrs as $attr => $values )
if( 0 == strcasecmp( $attr, $x ) )
return false;
return true;
}
echo "</body>\n</html>";
?>
|