Compare commits
10 Commits
BRANCH-0.9
...
BRANCH-0.9
Author | SHA1 | Date | |
---|---|---|---|
|
c3713350e2 | ||
|
c131e8b479 | ||
|
a01f7c8289 | ||
|
7741110caf | ||
|
abc62c7fdc | ||
|
fdee1bdbd1 | ||
|
1f7f96122f | ||
|
b443271175 | ||
|
bbcd2cb3b6 | ||
|
df48b8ff9b |
26
INSTALL
@@ -1,5 +1,5 @@
|
||||
For install instructions in non-English languages, see the files
|
||||
in the "doc" directory.
|
||||
For install instructions in non-English languages, see the wiki:
|
||||
http://wiki.phpldapadmin.info
|
||||
|
||||
* Requirements
|
||||
|
||||
@@ -11,27 +11,13 @@ in the "doc" directory.
|
||||
|
||||
1. Unpack the archive (if you're reading this, you already did that).
|
||||
2. Put the resulting 'phpldapadmin' directory somewhere in your webroot.
|
||||
3. Copy 'config.php.example' to 'config.php' and edit to taste.
|
||||
3. Copy 'config.php.example' to 'config.php' and edit to taste (this is in the config/ directory).
|
||||
4. Then, point your browser to the phpldapadmin directory.
|
||||
|
||||
* For additional help
|
||||
|
||||
See the files in the "doc" directory.
|
||||
See the wiki:
|
||||
http://wiki.phpldapadmin.info
|
||||
|
||||
Join our mailing list:
|
||||
https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel
|
||||
|
||||
* Platform specific notes
|
||||
|
||||
* OpenBSD with chroot'ed Apache:
|
||||
|
||||
For jpeg photos to work properly, you must do this:
|
||||
# mkdir /var/www/tmp, and then
|
||||
# chown root:daemon /var/www/tmp
|
||||
# chmod 1755 /var/www/tmp
|
||||
Where tmp is the $jpeg_temp_dir configured in config.php
|
||||
|
||||
* Windows
|
||||
|
||||
For jpeg photos to work properly, be sure to change $jpeg_temp_dir
|
||||
from "/tmp" to "c:\\temp" or similar.
|
||||
|
||||
|
141
add_attr.php
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr.php,v 1.10 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_attr.php
|
||||
* Adds an attribute/value pair to an object
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn
|
||||
* - server_id
|
||||
* - attr
|
||||
* - val
|
||||
* - binary
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = $_POST['server_id'];
|
||||
$attr = $_POST['attr'];
|
||||
$val = isset( $_POST['val'] ) ? $_POST['val'] : false;;
|
||||
$dn = $_POST['dn'] ;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
|
||||
|
||||
if( ! $is_binary_val && $val == "" ) {
|
||||
pla_error( $lang['left_attr_blank'] );
|
||||
}
|
||||
|
||||
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'] );
|
||||
|
||||
// special case for binary attributes (like jpegPhoto and userCertificate):
|
||||
// we must go read the data from the file and override $val with the binary data
|
||||
// Secondly, we must check if the ";binary" option has to be appended to the name
|
||||
// of the attribute.
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $dn, $attr, array($val) ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
if( $is_binary_val ) {
|
||||
if( 0 == $_FILES['val']['size'] )
|
||||
pla_error( $lang['file_empty'] );
|
||||
if( ! is_uploaded_file( $_FILES['val']['tmp_name'] ) ) {
|
||||
if( isset( $_FILES['val']['error'] ) )
|
||||
switch($_FILES['val']['error']){
|
||||
case 0: //no error; possible file attack!
|
||||
pla_error( $lang['invalid_file'] );
|
||||
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
pla_error( $lang['uploaded_file_too_big'] );
|
||||
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
|
||||
pla_error( $lang['uploaded_file_too_big'] );
|
||||
case 3: //uploaded file was only partially uploaded
|
||||
pla_error( $lang['uploaded_file_partial'] );
|
||||
case 4: //no file was uploaded
|
||||
pla_error( $lang['left_attr_blank'] );
|
||||
default: //a default error, just in case! :)
|
||||
pla_error( $lang['invalid_file'] );
|
||||
break;
|
||||
}
|
||||
else
|
||||
pla_error( $lang['invalid_file'] );
|
||||
}
|
||||
$file = $_FILES['val']['tmp_name'];
|
||||
$f = fopen( $file, 'r' );
|
||||
$binary_data = fread( $f, filesize( $file ) );
|
||||
fclose( $f );
|
||||
$val = $binary_data;
|
||||
|
||||
if( is_binary_option_required( $server_id, $attr ) )
|
||||
$attr .=";binary";
|
||||
}
|
||||
|
||||
// Automagically hash new userPassword attributes according to the
|
||||
// chosen in config.php.
|
||||
if( 0 == strcasecmp( $attr, 'userpassword' ) )
|
||||
{
|
||||
if( isset( $servers[$server_id]['default_hash'] ) &&
|
||||
$servers[$server_id]['default_hash'] != '' )
|
||||
{
|
||||
$enc_type = $servers[$server_id]['default_hash'];
|
||||
$val = password_hash( $val, $enc_type );
|
||||
}
|
||||
}
|
||||
elseif( ( 0 == strcasecmp( $attr , 'sambantpassword' ) || 0 == strcasecmp( $attr , 'sambalmpassword') ) ){
|
||||
$mkntPassword = new MkntPasswdUtil();
|
||||
$mkntPassword->createSambaPasswords( $val );
|
||||
$val = $mkntPassword->valueOf($attr);
|
||||
}
|
||||
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$new_entry = array( $attr => $val );
|
||||
$result = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
|
||||
if( $result )
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=$encoded_attr" );
|
||||
else
|
||||
pla_error( $lang['failed_to_add_attr'], ldap_error( $ds ) , ldap_errno( $ds ) );
|
||||
|
||||
// check if we need to append the ;binary option to the name
|
||||
// of some binary attribute
|
||||
|
||||
function is_binary_option_required( $server_id, $attr ){
|
||||
|
||||
// list of the binary attributes which need the ";binary" option
|
||||
$binary_attributes_with_options = array(
|
||||
// Superior: Ldapv3 Syntaxes (1.3.6.1.4.1.1466.115.121.1)
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => "userCertificate",
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => "caCertificate",
|
||||
'1.3.6.1.4.1.1466.115.121.1.10' => "crossCertificatePair",
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => "certificateRevocationList",
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => "authorityRevocationList",
|
||||
// Superior: Netscape Ldap attributes types (2.16.840.1.113730.3.1)
|
||||
'2.16.840.1.113730.3.1.40' => "userSMIMECertificate"
|
||||
);
|
||||
|
||||
// quick check by attr name (short circuits the schema check if possible)
|
||||
//foreach( $binary_attributes_with_options as $oid => $name )
|
||||
//if( 0 == strcasecmp( $attr, $name ) )
|
||||
//return true;
|
||||
|
||||
$schema_attr = get_schema_attribute( $server_id, $attr );
|
||||
if( ! $schema_attr )
|
||||
return false;
|
||||
|
||||
$syntax = $schema_attr->getSyntaxOID();
|
||||
if( isset( $binary_attributes_with_options[ $syntax ] ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
@@ -1,174 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr_form.php,v 1.9 2004/09/15 12:31:52 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_attr_form.php
|
||||
* Displays a form for adding an attribute/value to an LDAP entry.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
$rdn = get_rdn( $dn );
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
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'] );
|
||||
$friendly_attrs = process_friendly_attr_table();
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo sprintf( $lang['add_new_attribute'], htmlspecialchars( $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>
|
||||
|
||||
<?php
|
||||
|
||||
$attrs = get_object_attrs( $server_id, $dn );
|
||||
$oclasses = get_object_attr( $server_id, $dn, 'objectClass' );
|
||||
if( ! is_array( $oclasses ) )
|
||||
$oclasses = array( $oclasses );
|
||||
$avail_attrs = array();
|
||||
$schema_oclasses = get_schema_objectclasses( $server_id, $dn );
|
||||
foreach( $oclasses as $oclass ) {
|
||||
$schema_oclass = get_schema_objectclass( $server_id, $oclass, $dn );
|
||||
if( $schema_oclass && 0 == strcasecmp( '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 ] );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<br />
|
||||
<center>
|
||||
|
||||
|
||||
<?php echo $lang['add_new_attribute']; ?>
|
||||
|
||||
<?php if( is_array( $avail_attrs ) && count( $avail_attrs ) > 0 ) { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<form action="add_attr.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
|
||||
|
||||
<select name="attr"><?php
|
||||
|
||||
$attr_select_html = '';
|
||||
usort($avail_attrs,"sortAttrs");
|
||||
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" />
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<small>(<?php echo $lang['no_new_attrs_available']; ?>)</small>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $lang['add_new_binary_attr']; ?>
|
||||
<?php if( count( $avail_binary_attrs ) > 0 ) { ?>
|
||||
<!-- Form to add a new BINARY attribute to this entry -->
|
||||
<form action="add_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" />
|
||||
<br />
|
||||
<select name="attr">
|
||||
<?php
|
||||
$attr_select_html = '';
|
||||
usort($avail_binary_attrs,"sortAttrs");
|
||||
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" />
|
||||
<?php
|
||||
if( ! ini_get( 'file_uploads' ) )
|
||||
echo "<br><small><b>" . $lang['warning_file_uploads_disabled'] . "</b></small><br>";
|
||||
else
|
||||
echo "<br><small><b>" . sprintf( $lang['max_file_size'], ini_get( 'upload_max_filesize' ) ) . "</b></small><br>";
|
||||
?>
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<small>(<?php echo $lang['no_new_binary_attrs_available']; ?>)</small>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
?>
|
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass.php,v 1.11 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
/*
|
||||
* add_oclass.php
|
||||
* Adds an objectClass to the specified dn.
|
||||
* Variables that come in as POST vars:
|
||||
*
|
||||
* Note, this does not do any schema violation checking. That is
|
||||
* performed in add_oclass_form.php.
|
||||
*
|
||||
* Vars that come in as POST:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
* - new_oclass
|
||||
* - new_attrs (array, if any)
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$new_oclass = $_POST['new_oclass'];
|
||||
$server_id = $_POST['server_id'];
|
||||
$new_attrs = $_POST['new_attrs'];
|
||||
|
||||
if( is_attr_read_only( $server_id, 'objectClass' ) )
|
||||
pla_error( "ObjectClasses are flagged as read only in the phpLDAPadmin 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'] );
|
||||
|
||||
$new_entry = array();
|
||||
$new_entry['objectClass'] = $new_oclass;
|
||||
|
||||
$new_attrs_entry = array();
|
||||
$new_oclass_entry = array( 'objectClass' => $new_oclass );
|
||||
|
||||
if( is_array( $new_attrs ) && count( $new_attrs ) > 0 )
|
||||
foreach( $new_attrs as $attr => $val ) {
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $dn, $attr, array($val) ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
$new_entry[ $attr ] = $val;
|
||||
}
|
||||
|
||||
//echo "<pre>";
|
||||
//print_r( $new_entry );
|
||||
//exit;
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$add_res = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
|
||||
if( ! $add_res )
|
||||
{
|
||||
pla_error( $lang['could_not_perform_ldap_mod_add'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=objectclass" );
|
||||
}
|
||||
|
||||
?>
|
@@ -1,127 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass_form.php,v 1.15 2004/10/22 13:58:59 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_oclass_form.php
|
||||
* This page may simply add the objectClass and take you back to the edit page,
|
||||
* but, in one condition it may prompt the user for input. That condition is this:
|
||||
*
|
||||
* If the user has requested to add an objectClass that requires a set of
|
||||
* attributes with 1 or more not defined by the object. In that case, we will
|
||||
* present a form for the user to add those attributes to the object.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
* - new_oclass
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$new_oclass = $_POST['new_oclass'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
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'] );
|
||||
|
||||
/* Ensure that the object has defined all MUST attrs for this objectClass.
|
||||
* If it hasn't, present a form to have the user enter values for all the
|
||||
* newly required attrs. */
|
||||
|
||||
$entry = get_object_attrs( $server_id, $dn, true );
|
||||
$current_attrs = array();
|
||||
foreach( $entry as $attr => $junk )
|
||||
$current_attrs[] = strtolower($attr);
|
||||
|
||||
// grab the required attributes for the new objectClass
|
||||
$oclass = get_schema_objectclass( $server_id, $new_oclass );
|
||||
if( $oclass )
|
||||
$must_attrs = $oclass->getMustAttrs();
|
||||
else
|
||||
$must_attrs = array();
|
||||
|
||||
// We don't want any of the attr meta-data, just the string
|
||||
//foreach( $must_attrs as $i => $attr )
|
||||
//$must_attrs[$i] = $attr->getName();
|
||||
|
||||
// build a list of the attributes that this new objectClass requires,
|
||||
// but that the object does not currently contain
|
||||
$needed_attrs = array();
|
||||
foreach( $must_attrs as $attr ) {
|
||||
$attr = get_schema_attribute( $server_id, $attr->getName() );
|
||||
//echo "<pre>"; var_dump( $attr ); echo "</pre>";
|
||||
// First, check if one of this attr's aliases is already an attribute of this entry
|
||||
foreach( $attr->getAliases() as $alias_attr_name )
|
||||
if( in_array( strtolower( $alias_attr_name ), $current_attrs ) )
|
||||
// Skip this attribute since it's already in the entry
|
||||
continue;
|
||||
if( in_array( strtolower($attr->getName()), $current_attrs ) )
|
||||
continue;
|
||||
|
||||
// We made it this far, so the attribute needs to be added to this entry in order
|
||||
// to add this objectClass
|
||||
$needed_attrs[] = $attr;
|
||||
}
|
||||
|
||||
if( count( $needed_attrs ) > 0 )
|
||||
{
|
||||
include './header.php'; ?>
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo $lang['new_required_attrs']; ?></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['requires_to_add'] . ' ' . count($needed_attrs) .
|
||||
' ' . $lang['new_attributes']; ?></h3>
|
||||
|
||||
<small>
|
||||
<?php
|
||||
echo $lang['new_required_attrs_instructions'];
|
||||
echo ' ' . count( $needed_attrs ) . ' ' . $lang['new_attributes'] . ' ';
|
||||
echo $lang['that_this_oclass_requires']; ?>
|
||||
</small>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<form action="add_oclass.php" method="post">
|
||||
<input type="hidden" name="new_oclass" value="<?php echo htmlspecialchars( $new_oclass ); ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
|
||||
<table class="edit_dn" cellspacing="0">
|
||||
<tr><th colspan="2"><?php echo $lang['new_required_attrs']; ?></th></tr>
|
||||
|
||||
<?php foreach( $needed_attrs as $count => $attr ) { ?>
|
||||
<tr><td class="attr"><b><?php echo htmlspecialchars($attr->getName()); ?></b></td></tr>
|
||||
<tr><td class="val"><input type="text" name="new_attrs[<?php echo htmlspecialchars($attr->getName()); ?>]" value="" size="40" /></tr>
|
||||
<?php } ?>
|
||||
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
<center><input type="submit" value="<?php echo $lang['add_oclass_and_attrs']; ?>" /></center>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$add_res = @ldap_mod_add( $ds, $dn, array( 'objectClass' => $new_oclass ) );
|
||||
if( ! $add_res )
|
||||
pla_error( "Could not perform ldap_mod_add operation.", ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
else
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=objectClass" );
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value.php,v 1.13 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_value.php
|
||||
* Adds a value to an attribute for a given dn.
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - attr (rawurlencoded) the attribute to which we are adding a value
|
||||
* - server_id
|
||||
* - new_value (form element)
|
||||
* - binary
|
||||
*
|
||||
* On success, redirect to the edit_dn page.
|
||||
* On failure, echo an error.
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$attr = $_POST['attr'];
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
$server_id = $_POST['server_id'];
|
||||
$new_value = $_POST['new_value'];
|
||||
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( is_attr_read_only( $server_id, $attr ) )
|
||||
pla_error( "The attribute '" . htmlspecialchars( $attr ) . "' is flagged as read only in the phpLDAPadmin configuration." );
|
||||
|
||||
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'] );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
// special case for binary attributes:
|
||||
// we must go read the data from the file.
|
||||
if( $is_binary_val )
|
||||
{
|
||||
$file = $_FILES['new_value']['tmp_name'];
|
||||
$f = fopen( $file, 'r' );
|
||||
$binary_value = fread( $f, filesize( $file ) );
|
||||
fclose( $f );
|
||||
$new_value = $binary_value;
|
||||
}
|
||||
|
||||
$new_entry = array( $attr => $new_value );
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $dn, $attr, $new_entry ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
// Call the custom callback for each attribute modification
|
||||
// and verify that it should be modified.
|
||||
if( preAttrAdd( $server_id, $dn, $attr, $new_entry ) ) {
|
||||
|
||||
$add_result = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
|
||||
if( ! $add_result )
|
||||
pla_error( $lang['could_not_perform_ldap_mod_add'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=$encoded_attr" );
|
||||
|
||||
?>
|
@@ -1,187 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value_form.php,v 1.26 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_value_form.php
|
||||
* Displays a form to allow the user to enter a new value to add
|
||||
* to the existing list of values for a multi-valued attribute.
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - attr (rawurlencoded) the attribute to which we are adding a value
|
||||
* - server_id
|
||||
*
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
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( null != $dn ) {
|
||||
$rdn = get_rdn( $dn );
|
||||
} else {
|
||||
$rdn = null;
|
||||
}
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
$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 = is_jpeg_photo( $server_id, $attr ); //( 0 == strcasecmp( $attr, 'jpegPhoto' ) ) ? true : false;
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
|
||||
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 );
|
||||
foreach( $current_values as $oclass )
|
||||
unset( $schema_oclasses[ strtolower( $oclass ) ] );
|
||||
} else {
|
||||
$schema_attr = get_schema_attribute( $server_id, $attr );
|
||||
}
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">
|
||||
<?php echo $lang['add_new']; ?>
|
||||
<b><?php echo htmlspecialchars($attr); ?></b>
|
||||
<?php echo $lang['value_to']; ?>
|
||||
<b><?php echo htmlspecialchars($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>
|
||||
|
||||
<?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 ) { ?>
|
||||
|
||||
<table><td>
|
||||
<?php draw_jpeg_photos( $server_id, $dn, $attr, false ); ?>
|
||||
</td></table>
|
||||
|
||||
<!-- 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 -->
|
||||
|
||||
<?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 -->
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<ul class="current_values">
|
||||
<?php if( is_array( $current_values ) ) /*$num_current_values > 1 )*/ {
|
||||
foreach( $current_values as $val ) { ?>
|
||||
|
||||
<li><nobr><?php echo htmlspecialchars(($val)); ?></nobr></li>
|
||||
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
|
||||
<li><nobr><?php echo htmlspecialchars(($current_values)); ?></nobr></li>
|
||||
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $lang['enter_value_to_add']; ?>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php if( $is_object_class ) { ?>
|
||||
|
||||
<form action="add_oclass_form.php" method="post" class="new_value">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
<select name="new_oclass">
|
||||
|
||||
<?php foreach( $schema_oclasses as $name => $oclass ) {
|
||||
|
||||
// exclude any structural ones, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
|
||||
if ($oclass->type == "structural") continue;
|
||||
?>
|
||||
|
||||
<option value="<?php echo $oclass->getName(); ?>"><?php echo $oclass->getName(); ?></option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select> <input type="submit" value="<?php echo $lang['add_new_objectclass']; ?>" />
|
||||
|
||||
<br />
|
||||
<?php if( show_hints() ) { ?>
|
||||
<small>
|
||||
<br />
|
||||
<img src="images/light.png" /><span class="hint"><?php echo $lang['new_required_attrs_note']; ?></span>
|
||||
</small>
|
||||
<?php } ?>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<form action="add_value.php" method="post" class="new_value" name="new_value_form"<?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; ?>" />
|
||||
|
||||
<?php if( is_attr_binary( $server_id, $attr ) ) { ?>
|
||||
<input type="file" name="new_value" />
|
||||
<input type="hidden" name="binary" value="true" />
|
||||
<?php } else { ?>
|
||||
<?php if( is_multi_line_attr( $attr, $server_id ) ) { ?>
|
||||
<textarea name="new_value" rows="3" cols="30"></textarea>
|
||||
<?php } else { ?>
|
||||
<input type="text" <?php
|
||||
if( $schema_attr->getMaxLength() )
|
||||
echo "maxlength=\"" . $schema_attr->getMaxLength() . "\" ";
|
||||
?>name="new_value" size="40" value="" /><?php
|
||||
// draw the "browse" button next to this input box if this attr houses DNs:
|
||||
if( is_dn_attr( $server_id, $attr ) ) draw_chooser_link( "new_value_form.new_value", false ); ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<input type="submit" name="submit" value="<?php echo $lang['add_new_value']; ?>" />
|
||||
<br />
|
||||
|
||||
<?php if( $schema_attr->getDescription() ) { ?>
|
||||
<small><b><?php echo $lang['desc']; ?>:</b> <?php echo $schema_attr->getDescription(); ?></small><br />
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $schema_attr->getType() ) { ?>
|
||||
<small><b><?php echo $lang['syntax']; ?>:</b> <?php echo $schema_attr->getType(); ?></small><br />
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $schema_attr->getMaxLength() ) { ?>
|
||||
<small><b><?php echo $lang['maximum_length']; ?>:</b> <?php echo number_format( $schema_attr->getMaxLength() ); ?> <?php echo $lang['characters']; ?></small><br />
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/check_lang_files.php,v 1.9 2004/05/23 21:53:08 i18phpldapadmin Exp $
|
||||
?>
|
||||
<?php
|
||||
// phpldapadmin/check_lang_files.php, $Revision: 1.9 $
|
||||
|
||||
echo "<html><head><title>phpldapadmin - check of translation</title></head><body>";
|
||||
|
||||
include realpath( './lang/en.php' );
|
||||
$english_lang = $lang;
|
||||
unset( $lang );
|
||||
$lang_dir = realpath( './lang/recoded' );
|
||||
$dir = opendir( $lang_dir );
|
||||
|
||||
// First, detect any unused strings from the english language:
|
||||
echo "<h1>Checking English language file for unused strings</h1>\n";
|
||||
echo "<ol>\n";
|
||||
$unused_keys = false;
|
||||
|
||||
// special case keys that do not occur hard-coded but are dynamically generated
|
||||
$ignore_keys['equals'] = 1;
|
||||
$ignore_keys['starts with'] = 1;
|
||||
$ignore_keys['ends with'] = 1;
|
||||
$ignore_keys['sounds like'] = 1;
|
||||
$ignore_keys['contains'] = 1;
|
||||
foreach( $english_lang as $key => $string ) {
|
||||
if( isset( $ignore_keys[$key] ) )
|
||||
continue;
|
||||
$grep_cmd = "grep -r \"lang\[['\\\"]$key\" *.php templates/";
|
||||
$used = `$grep_cmd`;
|
||||
if( ! $used ) {
|
||||
$unused_keys = true;
|
||||
echo "<li>Unused English key: <tt>$key</tt> <br /> (<small><tt>" . htmlspecialchars( $grep_cmd ) . "</tt></small>)</li>\n";
|
||||
flush();
|
||||
}
|
||||
}
|
||||
if( false === $unused_keys )
|
||||
echo "No unused English strings.";
|
||||
echo "</ol>\n";
|
||||
|
||||
echo "<h1>Incomplete or Erroneous Language Files</h1>\n\n";
|
||||
echo "<h1><A HREF='?'>check all languages</A></h1>\n";
|
||||
flush();
|
||||
while( ( $file = readdir( $dir ) ) !== false ) {
|
||||
// skip the devel languages, english, and auto
|
||||
if( $file == "zz.php" || $file == "zzz.php" || $file == "auto.php" || $file == "en.php" )
|
||||
continue;
|
||||
// Sanity check. Is this really a PHP file?
|
||||
if( ! preg_match( "/\.php$/", $file ) )
|
||||
continue;
|
||||
echo "<h2><A HREF='?CHECKLANG=$file'>$file</A></h2>\n";
|
||||
echo "<ol>\n";
|
||||
unset( $lang );
|
||||
$lang = array();
|
||||
include realpath( $lang_dir.'/'.$file );
|
||||
$has_errors = false;
|
||||
if ($CHECKLANG=="" || $file===$CHECKLANG ){
|
||||
foreach( $english_lang as $key => $string )
|
||||
if( ! isset( $lang[ $key ] ) ) {
|
||||
$has_errors = true;
|
||||
echo "<li>missing entry: <tt>$key</tt></li>\n";
|
||||
}
|
||||
foreach( $lang as $key => $string )
|
||||
if( ! isset( $english_lang[ $key ] ) ){
|
||||
$has_errors = true;
|
||||
echo "<li>extra entry: <tt>$key</tt></li>\n";
|
||||
}
|
||||
if( ! $has_errors )
|
||||
echo "(No errors)\n";
|
||||
}
|
||||
echo "</ol>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "</body></html>";
|
||||
|
||||
?>
|
44
collapse.php
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/collapse.php,v 1.11 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* collapse.php
|
||||
* This script alters the session variable 'tree', collapsing it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*
|
||||
* Note: this script is equal and opposite to expand.php
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
|
||||
initialize_session_tree();
|
||||
|
||||
if( array_key_exists( $dn, $_SESSION['tree'][$server_id] ) )
|
||||
unset( $_SESSION['tree'][$server_id][$dn] );
|
||||
|
||||
// This is for Opera. By putting "random junk" in the query string, it thinks
|
||||
// that it does not have a cached version of the page, and will thus
|
||||
// fetch the page rather than display the cached version
|
||||
$time = gettimeofday();
|
||||
$random_junk = md5( strtotime( 'now' ) . $time['usec'] );
|
||||
|
||||
// If cookies were disabled, build the url parameter for the session id.
|
||||
// It will be append to the url to be redirect
|
||||
$id_session_param="";
|
||||
if(SID != ""){
|
||||
$id_session_param = "&".session_name()."=".session_id();
|
||||
}
|
||||
|
||||
header( "Location:tree.php?foo=$random_junk#{$server_id}_{$encoded_dn}$id_session_param" );
|
||||
?>
|
162
common.php
@@ -1,162 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/common.php,v 1.55 2004/10/14 20:32:48 uugdave Exp $
|
||||
|
||||
/*
|
||||
* common.php
|
||||
* Contains code to be executed at the top of each phpLDAPadmin page.
|
||||
* include this file at the top of every PHP file.
|
||||
*/
|
||||
|
||||
// Work-around to get PLA to work in PHP5
|
||||
if( phpversion() >= "5" )
|
||||
ini_set( "zend.ze1_compatibility_mode", 1 );
|
||||
|
||||
// Turn on all notices and warnings. This helps us write cleaner code (we hope at least)
|
||||
if( phpversion() >= "5" )
|
||||
// E_DEBUG is PHP5 specific and prevents warnings about using 'var' to declar class members
|
||||
error_reporting( 'E_DEBUG' );
|
||||
else
|
||||
// For PHP4
|
||||
error_reporting( E_ALL );
|
||||
|
||||
|
||||
// For PHP5 backward/forward compatibility
|
||||
if( ! defined( 'E_STRICT' ) ) {
|
||||
define( 'E_STRICT', 2048 );
|
||||
}
|
||||
|
||||
/** The minimum version of PHP required to run phpLDAPadmin. */
|
||||
@define( 'REQUIRED_PHP_VERSION', '4.1.0' );
|
||||
/** The default setting for $search_deref if unspecified or misconfigured by user. */
|
||||
@define( 'DEFAULT_SEARCH_DEREF_SETTING', LDAP_DEREF_ALWAYS );
|
||||
/** The default setting for $tree_deref if unspecified or misconfigured by user. */
|
||||
@define( 'DEFAULT_TREE_DEREF_SETTING', LDAP_DEREF_NEVER );
|
||||
/** The default setting for $export_deref if unspecified or misconfigured by user. */
|
||||
@define( 'DEFAULT_EXPORT_DEREF_SETTING', LDAP_DEREF_NEVER );
|
||||
/** The default setting for $view_deref if unspecified or misconfigured by user. */
|
||||
@define( 'DEFAULT_VIEW_DEREF_SETTING', LDAP_DEREF_NEVER );
|
||||
|
||||
// General functions needed to proceed (pla_ldap_search(), pla_error(), get_object_attrs(), etc.)
|
||||
ob_start();
|
||||
if( ! file_exists( realpath( './functions.php' ) ) ) {
|
||||
ob_end_clean();
|
||||
die( "Fatal error: Required file 'functions.php' does not exist." );
|
||||
}
|
||||
if( ! is_readable( realpath( './functions.php' ) ) ) {
|
||||
ob_end_clean();
|
||||
die( "Cannot read the file 'functions.php' its permissions are too strict." );
|
||||
}
|
||||
require_once realpath( './functions.php' );
|
||||
ob_end_clean();
|
||||
|
||||
// Our custom error handler receives all error notices that pass the error_reporting()
|
||||
// level set above.
|
||||
set_error_handler( 'pla_error_handler' );
|
||||
|
||||
// Creates the language array which will be populated with localized strings
|
||||
// based on the user-configured language.
|
||||
$lang = array();
|
||||
|
||||
// config.php might not exist (if the user hasn't configured PLA yet)
|
||||
// Only include it if it does exist.
|
||||
if( file_exists( realpath( './config.php' ) ) ) {
|
||||
ob_start();
|
||||
is_readable( realpath( './config.php' ) ) or pla_error( "Could not read config.php, its permissions are too strict." );
|
||||
include realpath( './config.php' );
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
$required_files = array(
|
||||
// The base English language strings
|
||||
'./lang/recoded/en.php',
|
||||
// Functions for managing the session (pla_session_start(), etc.)
|
||||
'./session_functions.php',
|
||||
// Functions for reading the server schema (get_schema_object_classes(), etc.)
|
||||
'./schema_functions.php',
|
||||
// Functions that can be defined by the user (preEntryDelete(), postEntryDelete(), etc.)
|
||||
'./custom_functions.php',
|
||||
// Functions for hashing passwords with OpenSSL binary (only if mhash not present)
|
||||
'./emuhash_functions.php' );
|
||||
|
||||
|
||||
// Include each required file and check for sanity.
|
||||
foreach( $required_files as $file_name ) {
|
||||
file_exists( realpath( $file_name ) )
|
||||
or pla_error( "Fatal error: Required file '$file_name' does not exist." );
|
||||
is_readable( realpath( $file_name ) )
|
||||
or pla_error( "Fatal error: Cannot read the file '$file_name', its permissions are too strict." );
|
||||
ob_start();
|
||||
require_once realpath( $file_name );
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
if( pla_session_start() )
|
||||
postSessionInit();
|
||||
|
||||
// Language configuration. Auto or specified?
|
||||
// Shall we attempt to auto-determine the language?
|
||||
if( isset( $language ) ) {
|
||||
if( 0 == strcasecmp( $language, "auto" ) ) {
|
||||
|
||||
// Make sure their browser correctly reports language. If not, skip this.
|
||||
if( isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ) {
|
||||
|
||||
// get the languages which are spetcified in the HTTP header
|
||||
$HTTP_LANGS1 = preg_split ("/[;,]+/", $_SERVER['HTTP_ACCEPT_LANGUAGE'] );
|
||||
$HTTP_LANGS2 = preg_split ("/[;,]+/", $_SERVER['HTTP_ACCEPT_LANGUAGE'] );
|
||||
foreach( $HTTP_LANGS2 as $key => $value ) {
|
||||
$value=preg_split ("/[-]+/", $value );
|
||||
$HTTP_LANGS2[$key]=$value[0];
|
||||
}
|
||||
|
||||
$HTTP_LANGS = array_merge ($HTTP_LANGS1, $HTTP_LANGS2);
|
||||
foreach( $HTTP_LANGS as $HTTP_LANG) {
|
||||
// try to grab one after the other the language file
|
||||
if( file_exists( realpath( "lang/recoded/$HTTP_LANG.php" ) ) &&
|
||||
is_readable( realpath( "lang/recoded/$HTTP_LANG.php" ) ) ) {
|
||||
ob_start();
|
||||
include realpath( "lang/recoded/$HTTP_LANG.php" );
|
||||
ob_end_clean();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// grab the language file configured in config.php
|
||||
if( $language != null ) {
|
||||
if( 0 == strcmp( $language, 'english' ) )
|
||||
$language = 'en';
|
||||
if( file_exists( realpath( "lang/recoded/$language.php" ) ) &&
|
||||
is_readable( realpath( "lang/recoded/$language.php" ) ) ) {
|
||||
ob_start();
|
||||
include realpath( "lang/recoded/$language.php" );
|
||||
ob_end_clean();
|
||||
} else {
|
||||
pla_error( "Could not read language file 'lang/recoded/$language.php'. Either the file
|
||||
does not exist, or its permissions do not allow phpLDAPadmin to read it." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If config.php doesn't create the templates array, create it here.
|
||||
if( ! isset( $templates ) || ! is_array( $templates ) )
|
||||
$templates = array();
|
||||
|
||||
// Always including the 'custom' template (the most generic and flexible)
|
||||
$templates['custom'] =
|
||||
array( 'desc' => 'Custom',
|
||||
'icon' => 'images/object.png',
|
||||
'handler' => 'custom.php' );
|
||||
|
||||
// Strip slashes from GET, POST, and COOKIE variables if this
|
||||
// PHP install is configured to automatically addslashes()
|
||||
if ( get_magic_quotes_gpc() && ( ! isset( $slashes_stripped ) || ! $slashes_stripped ) ) {
|
||||
array_stripslashes($_GET);
|
||||
array_stripslashes($_POST);
|
||||
array_stripslashes($_COOKIE);
|
||||
array_stripslashes($_FILES);
|
||||
$slashes_stripped = true;
|
||||
}
|
||||
|
||||
?>
|
@@ -1,389 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* The phpLDAPadmin config file
|
||||
*
|
||||
* This is where you customize phpLDAPadmin. The most important
|
||||
* part is immediately below: The "LDAP Servers" section.
|
||||
* You must specify at least one LDAP server there. You may add
|
||||
* as many as you like. You can also specify your language, and
|
||||
* many other options.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* phpLDAPadmin can encrypt the content of sensitive cookies if you set this
|
||||
* to a big random string.
|
||||
*/
|
||||
$blowfish_secret = '';
|
||||
|
||||
// Your LDAP servers
|
||||
$i=0;
|
||||
$servers = array();
|
||||
$servers[$i]['name'] = 'My LDAP Server'; /* A convenient name that will appear in
|
||||
the tree viewer and throughout phpLDAPadmin to
|
||||
identify this LDAP server to users. */
|
||||
$servers[$i]['host'] = 'ldap.example.com'; /* Examples:
|
||||
'ldap.example.com',
|
||||
'ldaps://ldap.example.com/',
|
||||
'ldapi://%2fusr%local%2fvar%2frun%2fldapi'
|
||||
(Unix socket at /usr/local/var/run/ldap)
|
||||
Note: Leave 'host' blank to make phpLDAPadmin
|
||||
ignore this server. */
|
||||
$servers[$i]['base'] = 'dc=example,dc=com'; /* The base DN of your LDAP server. Leave this
|
||||
blank to have phpLDAPadmin auto-detect it for you. */
|
||||
$servers[$i]['port'] = 389; /* The port your LDAP server listens on
|
||||
(no quotes). 389 is standard. */
|
||||
$servers[$i]['auth_type'] = 'config'; /* Three options for auth_type:
|
||||
1. 'cookie': you will login via a web form,
|
||||
and a client-side cookie will store your
|
||||
login dn and password.
|
||||
2. 'session': same as cookie but your login dn
|
||||
and password are stored on the web server in
|
||||
a persistent session variable.
|
||||
3. 'config': specify your login dn and password
|
||||
here in this config file. No login will be
|
||||
required to use phpLDAPadmin for this server.
|
||||
Choose wisely to protect your authentication
|
||||
information appropriately for your situation. If
|
||||
you choose 'cookie', your cookie contents will be
|
||||
encrypted using blowfish and the secret your specify
|
||||
above as $blowfish_secret. */
|
||||
$servers[$i]['login_dn'] = 'cn=Manager,dc=example,dc=com';
|
||||
/* The DN of the user for phpLDAPadmin to bind with.
|
||||
For anonymous binds or 'cookie' or 'session' auth_types,
|
||||
leave the login_dn and login_pass blank. If you specify a
|
||||
login_attr in conjunction with a cookie or session auth_type,
|
||||
then you can also specify the login_dn/login_pass here for
|
||||
searching the directory for users (ie, if your LDAP server
|
||||
does not allow anonymous binds. */
|
||||
$servers[$i]['login_pass'] = 'secret'; /* Your LDAP password. If you specified an empty login_dn above, this
|
||||
MUST also be blank. */
|
||||
$servers[$i]['tls'] = false; /* Use TLS (Transport Layer Security) to connect to the LDAP
|
||||
server. */
|
||||
$servers[$i]['low_bandwidth'] = false; /* If the link between your web server and this LDAP server is
|
||||
slow, it is recommended that you set 'low_bandwidth' to true.
|
||||
This will cause phpLDAPadmin to forego some "fancy" features
|
||||
to conserve bandwidth. */
|
||||
$servers[$i]['default_hash'] = 'crypt'; /* Default password hashing algorithm.
|
||||
One of md5, ssha, sha, md5crpyt, smd5, blowfish, crypt or
|
||||
leave blank for now default algorithm. */
|
||||
$servers[$i]['login_attr'] = 'dn'; /* If you specified 'cookie' or 'session' as the auth_type above,
|
||||
you can optionally specify here an attribute
|
||||
to use when logging in. If you enter 'uid'
|
||||
and login as 'dsmith', phpLDAPadmin will
|
||||
search for (uid=dsmith) and log in as that user. Leave
|
||||
blank or specify 'dn' to use full DN for
|
||||
logging in. Note also that if your LDAP server requires
|
||||
you to login to perform searches, you can enter
|
||||
the DN to use when searching in 'login_dn' and
|
||||
'login_pass' above. You may also specify 'string', in which case
|
||||
you can provide a string to use for logging users
|
||||
in. See 'login_string' directly below. */
|
||||
$servers[$i]['login_string'] = 'uid=<username>,ou=People,dc=example,dc=com';
|
||||
/* If you specified 'cookie' or 'session' as the auth_type above,
|
||||
and you specified 'string' for 'login_attr' above, you must provide
|
||||
a string here for logging users in. If, for example, I
|
||||
I have a lot of user entries with DNs like
|
||||
"uid=dsmith,ou=People,dc=example,dc=com", then I can specify a string
|
||||
"uid=<username>,ou=People,dc=example,dc=com" and my users can login with
|
||||
their user names alone, i.e., "dsmith" in this case. */
|
||||
$servers[$i]['login_class'] = ''; /* If 'login_attr' is used above such that phpLDAPadmin will
|
||||
search for your DN at login, you may restrict the search to
|
||||
a specific objectClass. E.g., set this to 'posixAccount' or
|
||||
'inetOrgPerson', depending upon your setup. */
|
||||
$servers[$i]['read_only'] = false; /* Specify true If you want phpLDAPadmin to not
|
||||
display or permit any modification to the
|
||||
LDAP server. */
|
||||
$servers[$i]['show_create'] = true; /* Specify false if you do not want phpLDAPadmin to
|
||||
draw the 'Create new' links in the tree viewer. */
|
||||
$servers[$i]['enable_auto_uid_numbers'] = false;
|
||||
/* This feature allows phpLDAPadmin to
|
||||
automatically determine the next
|
||||
available uidNumber for a new entry. */
|
||||
$servers[$i]['auto_uid_number_mechanism'] = 'search';
|
||||
/* The mechanism to use when finding the next available uidNumber.
|
||||
Two possible values: 'uidpool' or 'search'. The 'uidpool'
|
||||
mechanism uses an existing uidPool entry in your LDAP server
|
||||
to blindly lookup the next available uidNumber. The 'search'
|
||||
mechanism searches for entries with a uidNumber value and finds
|
||||
the first available uidNumber (slower). */
|
||||
$servers[$i]['auto_uid_number_search_base'] = 'ou=People,dc=example,dc=com';
|
||||
/* The DN of the search base when the 'search'
|
||||
mechanism is used above. */
|
||||
$servers[$i]['auto_uid_number_min'] = 1000;
|
||||
/* The minimum number to use when searching for the next
|
||||
available UID number (only when 'search' is used for
|
||||
auto_uid_number_mechanism' */
|
||||
$servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com';
|
||||
/* The DN of the uidPool entry when 'uidpool'
|
||||
mechanism is used above. */
|
||||
$servers[$i]['auto_uid_number_search_dn'] = '';
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user
|
||||
ID when searching for the uidnumber. The idea is, this user id would
|
||||
have full (readonly) access to uidnumber in your ldap directory (the
|
||||
logged in user may not), so that you can be guaranteed to get a unique
|
||||
uidnumber for your directory. */
|
||||
$servers[$i]['auto_uid_number_search_dn_pass'] = '';
|
||||
/* The password for the dn above. */
|
||||
$servers[$i]['disable_anon_bind'] = false;
|
||||
/* Disable the anonymous login. */
|
||||
$servers[$i]['custom_pages_prefix'] = 'custom_';
|
||||
/* Use customized page with prefix when available. */
|
||||
|
||||
$servers[$i]['unique_attrs_dn'] = '';
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user
|
||||
when testing for unique attributes (as set in unique_attrs array). If you
|
||||
want to enforce unique attributes, than this id should have full (readonly)
|
||||
access to the attributes in question (the logged in user may not have
|
||||
enough access) */
|
||||
$servers[$i]['unique_attrs_dn_pass'] = '';
|
||||
/* The password for the dn above */
|
||||
|
||||
// If you want to configure additional LDAP servers, do so below.
|
||||
$i++;
|
||||
$servers[$i]['name'] = 'Another server';
|
||||
$servers[$i]['host'] = '';
|
||||
$servers[$i]['base'] = 'dc=example,dc=com';
|
||||
$servers[$i]['port'] = 389;
|
||||
$servers[$i]['auth_type'] = 'config';
|
||||
$servers[$i]['login_dn'] = '';
|
||||
$servers[$i]['login_pass'] = '';
|
||||
$servers[$i]['tls'] = false;
|
||||
$servers[$i]['low_bandwidth'] = false;
|
||||
$servers[$i]['default_hash'] = 'crypt';
|
||||
$servers[$i]['login_attr'] = 'dn';
|
||||
$servers[$i]['login_class'] = '';
|
||||
$servers[$i]['read_only'] = false;
|
||||
$servers[$i]['show_create'] = true;
|
||||
$servers[$i]['enable_auto_uid_numbers'] = false;
|
||||
$servers[$i]['auto_uid_number_mechanism'] = 'search';
|
||||
$servers[$i]['auto_uid_number_search_base'] = 'ou=People,dc=example,dc=com';
|
||||
$servers[$i]['auto_uid_number_min'] = 1000;
|
||||
$servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com';
|
||||
|
||||
// If you want to configure more LDAP servers, copy and paste the above (including the "$i++;")
|
||||
|
||||
// The temporary storage directory where we will put jpegPhoto data
|
||||
// This directory must be readable and writable by your web server
|
||||
$jpeg_temp_dir = "/tmp"; // Example for Unix systems
|
||||
//$jpeg_temp_dir = "c:\\temp"; // Example for Windows systems
|
||||
|
||||
/** **/
|
||||
/** Appearance and Behavior **/
|
||||
/** **/
|
||||
|
||||
// Set this to true if you want to hide the Request New Feature and Report bugs.
|
||||
$hide_configuration_management = false;
|
||||
|
||||
|
||||
// A format string used to display enties in the tree viewer (left-hand side)
|
||||
// You can use special tokens to draw the entries as you wish. You can even mix in HTML to format the string
|
||||
// Here are all the tokens you can use:
|
||||
// %rdn - draw the RDN of the entry (ie, "cn=Dave")
|
||||
// %dn - draw the DN of the entry (ie, "cn=Dave,ou=People,dc=example,dc=com"
|
||||
// %rdnValue - draw the value of the RDN (ie, instead of "cn=Dave", just draw "Dave")
|
||||
// %[attrname]- draw the value (or values) of the specified attribute.
|
||||
// examle: %gidNumber
|
||||
$tree_display_format = '%rdn';
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// To draw the gidNumber and uidNumber to the right of the RDN in a small, gray font:
|
||||
//$tree_display_format = '%rdn <small style="color:gray">( %gidNumber / %uidNumber )</span>';
|
||||
// To draw the full DN of each entry:
|
||||
//$tree_display_format = '%dn';
|
||||
// To draw the objectClasses to the right in parenthesis:
|
||||
//$tree_display_format = '%rdn <small style="color: gray">( %objectClass )</small>';
|
||||
// To draw the user-friendly RDN value (ie, instead of "cn=Dave", just draw "Dave"):
|
||||
//$tree_display_format = '%rdnValue';
|
||||
|
||||
|
||||
// Aliases and Referrrals
|
||||
//
|
||||
// Similar to ldapsearh's -a option, the following options allow you to configure
|
||||
// how phpLDAPadmin will treat aliases and referrals in the LDAP tree.
|
||||
// For the following four settings, avaialable options include:
|
||||
//
|
||||
// LDAP_DEREF_NEVER - aliases are never dereferenced (eg, the contents of
|
||||
// the alias itself are shown and not the referenced entry).
|
||||
// LDAP_DEREF_SEARCHING - aliases should be dereferenced during the search but
|
||||
// not when locating the base object of the search.
|
||||
// LDAP_DEREF_FINDING - aliases should be dereferenced when locating the base
|
||||
// object but not during the search.
|
||||
// LDAP_DEREF_ALWAYS - aliases should be dereferenced always (eg, the contents
|
||||
// of the referenced entry is shown and not the aliasing entry)
|
||||
|
||||
// How to handle references and aliases in the search form. See above for options.
|
||||
$search_deref = LDAP_DEREF_ALWAYS;
|
||||
|
||||
// How to handle references and aliases in the tree viewer. See above for options.
|
||||
$tree_deref = LDAP_DEREF_NEVER;
|
||||
|
||||
// How to handle references and aliases for exports. See above for options.
|
||||
$export_deref = LDAP_DEREF_NEVER;
|
||||
|
||||
// How to handle references and aliases when viewing entries. See above for options.
|
||||
$view_deref = LDAP_DEREF_NEVER;
|
||||
|
||||
|
||||
// The language setting. If you set this to 'auto', phpLDAPadmin will
|
||||
// attempt to determine your language automatically. Otherwise, available
|
||||
// lanaguages are: 'ct', 'de', 'en', 'es', 'fr', 'it', 'nl', and 'ru'
|
||||
// Localization is not complete yet, but most strings have been translated.
|
||||
// Please help by writing language files. See lang/en.php for an example.
|
||||
$language = 'auto';
|
||||
|
||||
// Set to true if you want to draw a checkbox next to each entry in the tree viewer
|
||||
// to be able to delete multiple entries at once
|
||||
$enable_mass_delete = false;
|
||||
|
||||
// Set to true if you want LDAP data to be displayed read-only (without input fields)
|
||||
// when a user logs in to a server anonymously
|
||||
$anonymous_bind_implies_read_only = true;
|
||||
|
||||
// Set to true if you want phpLDAPadmin to redirect anonymous
|
||||
// users to a search form with no tree viewer on the left after
|
||||
// logging in.
|
||||
$anonymous_bind_redirect_no_tree = false;
|
||||
|
||||
// If you used auth_type 'form' in the servers list, you can adjust how long the cookie will last
|
||||
// (default is 0 seconds, which expires when you close the browser)
|
||||
$cookie_time = 0; // seconds
|
||||
|
||||
// How many pixels wide do you want your left frame view (for the tree browser)
|
||||
$tree_width = 320; // pixels
|
||||
|
||||
// How long to keep jpegPhoto temporary files in the jpeg_temp_dir directory (in seconds)
|
||||
$jpeg_tmp_keep_time = 120; // seconds
|
||||
|
||||
// Would you like to see helpful hint text occacsionally?
|
||||
$show_hints = true; // set to false to disable hints
|
||||
|
||||
// When using the search page, limit result size to this many entries
|
||||
$search_result_size_limit = 50;
|
||||
|
||||
// By default, when searching you may display a list or a table of results.
|
||||
// Set this to 'table' to see table formatted results.
|
||||
// Set this to 'list' to see "Google" style formatted search results.
|
||||
$default_search_display = 'list';
|
||||
|
||||
// If true, display all password hash values as "******". Note that clear-text
|
||||
// passwords will always be displayed as "******", regardless of this setting.
|
||||
$obfuscate_password_display = false;
|
||||
|
||||
/** **/
|
||||
/** Simple Search Form Config **/
|
||||
/** **/
|
||||
|
||||
// Which attributes to include in the drop-down menu of the simple search form (comma-separated)
|
||||
// Change this to suit your needs for convenient searching. Be sure to change the corresponding
|
||||
// list below ($search_attributes_display)
|
||||
$search_attributes = "uid, cn, gidNumber, objectClass, telephoneNumber, mail, street";
|
||||
|
||||
// This list corresponds to the list directly above. If you want to present more readable names
|
||||
// for your search attributes, do so here. Both lists must have the same number of entries.
|
||||
$search_attributes_display = "User Name, Common Name, Group ID, Object Class, Phone Number, Email, Address";
|
||||
|
||||
// The list of attributes to display in each search result entry.
|
||||
// Note that you can add * to the list to display all attributes
|
||||
$search_result_attributes = "cn, sn, uid, postalAddress, telephoneNumber";
|
||||
|
||||
// You can re-arrange the order of the search criteria on the simple search form by modifying this array
|
||||
// You cannot however change the names of the criteria. Criteria names will be translated at run-time.
|
||||
$search_criteria_options = array( "equals", "starts with", "contains", "ends with", "sounds like" );
|
||||
|
||||
// If you want certain attributes to be editable as multi-line, include them in this list
|
||||
// A multi-line textarea will be drawn instead of a single-line text field
|
||||
$multi_line_attributes = array( "postalAddress", "homePostalAddress", "personalSignature" );
|
||||
|
||||
// A list of syntax OIDs which support multi-line attribute values:
|
||||
$multi_line_syntax_oids = array(
|
||||
// octet string syntax OID:
|
||||
"1.3.6.1.4.1.1466.115.121.1.40",
|
||||
// postal address syntax OID:
|
||||
"1.3.6.1.4.1.1466.115.121.1.41" );
|
||||
|
||||
/** **/
|
||||
/** User-friendly attribute translation **/
|
||||
/** **/
|
||||
|
||||
$friendly_attrs = array();
|
||||
|
||||
// Use this array to map attribute names to user friendly names. For example, if you
|
||||
// don't want to see "facsimileTelephoneNumber" but rather "Fax".
|
||||
|
||||
$friendly_attrs[ 'facsimileTelephoneNumber' ] = 'Fax';
|
||||
$friendly_attrs[ 'telephoneNumber' ] = 'Phone';
|
||||
|
||||
/** **/
|
||||
/** Hidden attributes **/
|
||||
/** **/
|
||||
|
||||
// You may want to hide certain attributes from being displayed in the editor screen
|
||||
// Do this by adding the desired attributes to this list (and uncomment it). This
|
||||
// only affects the editor screen. Attributes will still be visible in the schema
|
||||
// browser and elsewhere. An example is provided below:
|
||||
// NOTE: The user must be able to read the hidden_except_dn entry to be excluded.
|
||||
|
||||
//$hidden_attrs = array( 'jpegPhoto', 'objectClass' );
|
||||
//$hidden_except_dn = "cn=PLA UnHide,ou=Groups,c=AU";
|
||||
|
||||
// Hidden attributes in read-only mode. If undefined, it will be equal to $hidden_attrs.
|
||||
//$hidden_attrs_ro = array( 'objectClass','shadowWarning', 'shadowLastChange', 'shadowMax',
|
||||
// 'shadowFlag', 'shadowInactive', 'shadowMin', 'shadowExpire' );
|
||||
|
||||
/** **/
|
||||
/** Read-only attributes **/
|
||||
/** **/
|
||||
|
||||
// You may want to phpLDAPadmin to display certain attributes as read only, meaning
|
||||
// that users will not be presented a form for modifying those attributes, and they
|
||||
// will not be allowed to be modified on the "back-end" either. You may configure
|
||||
// this list here:
|
||||
// NOTE: The user must be able to read the read_only_except_dn entry to be excluded.
|
||||
|
||||
//$read_only_attrs = array( 'objectClass' );
|
||||
//$read_only_except_dn = "cn=PLA ReadWrite,ou=Groups,c=AU";
|
||||
|
||||
// An example of how to specify multiple read-only attributes:
|
||||
// $read_only_attrs = array( 'jpegPhoto', 'objectClass', 'someAttribute' );
|
||||
|
||||
/** **/
|
||||
/** Unique attributes **/
|
||||
/** **/
|
||||
// You may want phpLDAPadmin to enforce some attributes to have unique values (ie:
|
||||
// not belong to other entries in your tree. This (together with "unique_attrs_dn"
|
||||
// and "unique_attrs_dn_pass" option will not let updates to occur with other attributes
|
||||
// have the same value.
|
||||
// NOTE: Currently the unique_attrs is NOT enforced when copying a dn. (Need to present a user with
|
||||
// the option of changing the unique attributes.
|
||||
//$unique_attrs = array('uid','uidNumber','mail');
|
||||
|
||||
/** **/
|
||||
/** Predefined Queries (canned views) **/
|
||||
/** **/
|
||||
|
||||
// To make searching easier, you may setup predefined queries below (activate the lines by removing "//")
|
||||
$q=0;
|
||||
$queries = array();
|
||||
$queries[$q]['name'] = 'Samba Users'; /* The name that will appear in the simple search form */
|
||||
$queries[$q]['server'] = '0'; /* The ldap server to query, must be defined in the $servers list above */
|
||||
$queries[$q]['base'] = 'dc=example,dc=com'; /* The base to search on */
|
||||
$queries[$q]['scope'] = 'sub'; /* The search scope (sub, base, one) */
|
||||
$queries[$q]['filter'] = '(&(|(objectClass=sambaAccount)(objectClass=sambaSamAccount))(objectClass=posixAccount)(!(uid=*$)))';
|
||||
/* The LDAP filter to use */
|
||||
$queries[$q]['attributes'] = 'uid, smbHome, uidNumber';
|
||||
/* The attributes to return */
|
||||
|
||||
// Add more pre-defined queries by copying the text below
|
||||
$q++;
|
||||
$queries[$q]['name'] = 'Samba Computers';
|
||||
$queries[$q]['server'] = '0';
|
||||
$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
$queries[$q]['scope'] = 'sub';
|
||||
$queries[$q]['filter'] = '(&(objectClass=sambaAccount)(uid=*$))';
|
||||
$queries[$q]['attributes'] = 'uid, homeDirectory';
|
||||
|
||||
|
||||
?>
|
381
config/config.php.example
Normal file
@@ -0,0 +1,381 @@
|
||||
<?php
|
||||
/** NOTE **
|
||||
** Make sure that <?php is the FIRST line of this file!
|
||||
** IE: There should NOT be any blank lines or spaces BEFORE <?php
|
||||
**/
|
||||
|
||||
/**
|
||||
* The phpLDAPadmin config file
|
||||
*
|
||||
* This is where you can customise some of the phpLDAPadmin defaults
|
||||
* that are defined in config_default.php.
|
||||
*
|
||||
* To override a default, use the $config->custom variable to do so.
|
||||
* For example, the default for defining the language in config_default.php
|
||||
*
|
||||
* $this->default->appearance['lang'] = array(
|
||||
* 'desc'=>'Language',
|
||||
* 'default'=>'auto');
|
||||
*
|
||||
* to override this, use $config->custom->appearance['lang'] = 'en';
|
||||
*
|
||||
* This file is also used to configure your LDAP server connections.
|
||||
*
|
||||
* You must specify at least one LDAP server there. You may add
|
||||
* as many as you like. You can also specify your language, and
|
||||
* many other options.
|
||||
*
|
||||
* NOTE: Commented out values in this file prefixed by //, represent the
|
||||
* defaults that have been defined in config_default.php.
|
||||
* Commented out values prefixed by #, dont reflect their default value, you can
|
||||
* check config_default.php if you want to see what the default is.
|
||||
*
|
||||
* DONT change config_default.php, you changes will be lost by the next release
|
||||
* of PLA. Instead change this file - as it will NOT be replaced by a new
|
||||
* version of phpLDAPadmin.
|
||||
*/
|
||||
|
||||
/*********************************************/
|
||||
/* Useful important configuration overrides */
|
||||
/*********************************************/
|
||||
|
||||
/* If you are asked to put pla in debug mode, this is how you do it: */
|
||||
# $config->custom->debug['level'] = 255;
|
||||
# $config->custom->debug['syslog'] = true;
|
||||
# $config->custom->debug['file'] = '/tmp/pla_debug.log';
|
||||
|
||||
/* phpLDAPadmin can encrypt the content of sensitive cookies if you set this
|
||||
to a big random string. */
|
||||
$config->custom->session['blowfish'] = '';
|
||||
|
||||
/* The language setting. If you set this to 'auto', phpLDAPadmin will attempt
|
||||
to determine your language automatically. Otherwise, available lanaguages
|
||||
are: 'ct', 'de', 'en', 'es', 'fr', 'it', 'nl', and 'ru'
|
||||
Localization is not complete yet, but most strings have been translated.
|
||||
Please help by writing language files. See lang/en.php for an example. */
|
||||
// $config->custom->appearance['language'] = 'auto';
|
||||
|
||||
/* The temporary storage directory where we will put jpegPhoto data
|
||||
This directory must be readable and writable by your web server. */
|
||||
// $config->custom->jpeg['tmpdir'] = "/tmp"; // Example for Unix systems
|
||||
# $config->custom->jpeg['tmpdir'] = "c:\\temp"; // Example for Windows systems
|
||||
|
||||
/*********************************************/
|
||||
/* Define your LDAP servers in this section */
|
||||
/*********************************************/
|
||||
|
||||
$i=0;
|
||||
$ldapservers = new LDAPServers;
|
||||
|
||||
/* A convenient name that will appear in the tree viewer and throughout
|
||||
phpLDAPadmin to identify this LDAP server to users. */
|
||||
$ldapservers->SetValue($i,'server','name','My LDAP Server');
|
||||
|
||||
/* Examples:
|
||||
'ldap.example.com',
|
||||
'ldaps://ldap.example.com/',
|
||||
'ldapi://%2fusr%local%2fvar%2frun%2fldapi'
|
||||
(Unix socket at /usr/local/var/run/ldap) */
|
||||
// $ldapservers->SetValue($i,'server','host','127.0.0.1');
|
||||
|
||||
/* The port your LDAP server listens on (no quotes). 389 is standard. */
|
||||
// $ldapservers->SetValue($i,'server','port','389');
|
||||
|
||||
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
|
||||
auto-detect it for you. */
|
||||
// $ldapservers->SetValue($i,'server','base',array(''));
|
||||
|
||||
/* Three options for auth_type:
|
||||
1. 'cookie': you will login via a web form, and a client-side cookie will
|
||||
store your login dn and password.
|
||||
2. 'session': same as cookie but your login dn and password are stored on the
|
||||
web server in a persistent session variable.
|
||||
3. 'config': specify your login dn and password here in this config file. No
|
||||
login will be required to use phpLDAPadmin for this server.
|
||||
|
||||
Choose wisely to protect your authentication information appropriately for
|
||||
your situation. If you choose 'cookie', your cookie contents will be
|
||||
encrypted using blowfish and the secret your specify above as
|
||||
session['blowfish']. */
|
||||
// $ldapservers->SetValue($i,'server','auth_type','cookie');
|
||||
|
||||
/* The DN of the user for phpLDAPadmin to bind with. For anonymous binds or
|
||||
'cookie' or 'session' auth_types, LEAVE THE LOGIN_DN AND LOGIN_PASS BLANK. If
|
||||
you specify a login_attr in conjunction with a cookie or session auth_type,
|
||||
then you can also specify the login_dn/login_pass here for searching the
|
||||
directory for users (ie, if your LDAP server does not allow anonymous binds. */
|
||||
// $ldapservers->SetValue($i,'login','dn','');
|
||||
# $ldapservers->SetValue($i,'login','dn','cn=Manager,dc=example,dc=com');
|
||||
|
||||
/* Your LDAP password. If you specified an empty login_dn above, this MUST also
|
||||
be blank. */
|
||||
// $ldapservers->SetValue($i,'login','pass','');
|
||||
# $ldapservers->SetValue($i,'login','pass','secret');
|
||||
|
||||
/* Use TLS (Transport Layer Security) to connect to the LDAP server. */
|
||||
// $ldapservers->SetValue($i,'server','tls',false);
|
||||
|
||||
/* If the link between your web server and this LDAP server is slow, it is
|
||||
recommended that you set 'low_bandwidth' to true. This will enable
|
||||
phpLDAPadmin to forego some "fancy" features to conserve bandwidth. */
|
||||
// $ldapservers->SetValue($i,'server','low_bandwidth',false);
|
||||
|
||||
/* Default password hashing algorithm. One of md5, ssha, sha, md5crpyt, smd5,
|
||||
blowfish, crypt or leave blank for now default algorithm. */
|
||||
// $ldapservers->SetValue($i,'appearance','password_hash','md5');
|
||||
|
||||
/* If you specified 'cookie' or 'session' as the auth_type above, you can
|
||||
optionally specify here an attribute to use when logging in. If you enter
|
||||
'uid' and login as 'dsmith', phpLDAPadmin will search for (uid=dsmith)
|
||||
and log in as that user.
|
||||
Leave blank or specify 'dn' to use full DN for logging in. Note also that if
|
||||
your LDAP server requires you to login to perform searches, you can enter the
|
||||
DN to use when searching in 'login_dn' and 'login_pass' above. You may also
|
||||
specify 'string', in which case you can provide a string to use for logging
|
||||
users in. See 'login_string' directly below. */
|
||||
// $ldapservers->SetValue($i,'login','attr','dn');
|
||||
|
||||
/* If you specified 'cookie' or 'session' as the auth_type above, and you
|
||||
specified 'string' for 'login_attr' above, you must provide a string here for
|
||||
logging users in. If, for example, I have a lot of user entries with DNs like
|
||||
"uid=dsmith,ou=People,dc=example,dc=com", then I can specify a string
|
||||
"uid=<username>,ou=People,dc=example,dc=com" and my users can login with
|
||||
their user names alone, ie: "dsmith" in this case. */
|
||||
# $ldapservers->SetValue($i,'login','string','uid=<username>,ou=People,dc=example,dc=com');
|
||||
|
||||
/* If 'login_attr' is used above such that phpLDAPadmin will search for your DN
|
||||
at login, you may restrict the search to a specific objectClass. EG, set this
|
||||
to 'posixAccount' or 'inetOrgPerson', depending upon your setup. */
|
||||
// $ldapservers->SetValue($i,'login','class',null);
|
||||
|
||||
/* Specify true If you want phpLDAPadmin to not display or permit any
|
||||
modification to the LDAP server. */
|
||||
// $ldapservers->SetValue($i,'server','read_only',false);
|
||||
|
||||
/* Specify false if you do not want phpLDAPadmin to draw the 'Create new' links
|
||||
in the tree viewer. */
|
||||
// $ldapservers->SetValue($i,'appearance','show_create',true);
|
||||
|
||||
/* This feature allows phpLDAPadmin to automatically determine the next
|
||||
available uidNumber for a new entry. */
|
||||
// $ldapservers->SetValue($i,'auto_number','enable',true);
|
||||
|
||||
/* The mechanism to use when finding the next available uidNumber. Two possible
|
||||
values: 'uidpool' or 'search'.
|
||||
The 'uidpool' mechanism uses an existing uidPool entry in your LDAP server to
|
||||
blindly lookup the next available uidNumber. The 'search' mechanism searches
|
||||
for entries with a uidNumber value and finds the first available uidNumber
|
||||
(slower). */
|
||||
// $ldapservers->SetValue($i,'auto_number','mechanism','search');
|
||||
|
||||
/* The DN of the search base when the 'search' mechanism is used above. */
|
||||
# $ldapservers->SetValue($i,'auto_number','search_base','ou=People,dc=example,dc=com');
|
||||
|
||||
/* The minimum number to use when searching for the next available UID number
|
||||
(only when 'search' is used for auto_uid_number_mechanism' */
|
||||
// $ldapservers->SetValue($i,'auto_number','min','1000');
|
||||
|
||||
/* The DN of the uidPool entry when 'uidpool' mechanism is used above. */
|
||||
# $servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com';
|
||||
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user ID when
|
||||
searching for the uidnumber. The idea is, this user id would have full
|
||||
(readonly) access to uidnumber in your ldap directory (the logged in user
|
||||
may not), so that you can be guaranteed to get a unique uidnumber for your
|
||||
directory. */
|
||||
// $ldapservers->SetValue($i,'auto_number','dn',null);
|
||||
|
||||
/* The password for the dn above. */
|
||||
// $ldapservers->SetValue($i,'auto_number','pass',null);
|
||||
|
||||
/* Enable anonymous bind login. */
|
||||
// $ldapservers->SetValue($i,'login','anon_bind',true);
|
||||
|
||||
/* Use customized page with prefix when available. */
|
||||
# $ldapservers->SetValue($i,'custom','pages_prefix','custom_');
|
||||
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user when
|
||||
testing for unique attributes (as set in unique_attrs array). If you want to
|
||||
enforce unique attributes, than this id should have full (readonly) access
|
||||
to the attributes in question (the logged in user may not have enough access)
|
||||
*/
|
||||
// $ldapservers->SetValue($i,'unique_attrs','dn',null);
|
||||
|
||||
/* The password for the dn above */
|
||||
// $ldapservers->SetValue($i,'unique_attrs','pass',null);
|
||||
|
||||
/* If you set this, then only these DNs are allowed to log in. This array can
|
||||
contain individual users, groups or ldap search filter(s). Keep in mind that
|
||||
the user has not authenticated yet, so this will be an anonymous search to
|
||||
the LDAP server, so make your ACLs allow these searches to return results! */
|
||||
# $ldapservers->SetValue($i,'login','allowed_dns',array(
|
||||
# 'uid=stran,ou=People,dc=example,dc=com',
|
||||
# '(&(gidNumber=811)(objectClass=groupOfNames))',
|
||||
# '(|(uidNumber=200)(uidNumber=201))',
|
||||
# 'cn=callcenter,ou=Group,dc=example,dc=com'));
|
||||
|
||||
/* Set this if you dont want this LDAP server to show in the tree */
|
||||
// $ldapservers->SetValue($i,'appearance','visible',true);
|
||||
|
||||
/* This is the time out value in minutes for the server. After as many minutes
|
||||
of inactivity you will be automatically logged out. If not set, the default
|
||||
value will be ( session_cache_expire()-1 ) */
|
||||
# $ldapservers->SetValue($i,'login','timeout',30);
|
||||
|
||||
/* Set this if you want phpldapadmin to perform rename operation on entry which
|
||||
has children. Certain servers are known to allow it, certain are not */
|
||||
// $ldapservers->SetValue($i,'server','branch_rename',false);
|
||||
|
||||
/**************************************************************************
|
||||
* If you want to configure additional LDAP servers, do so below. *
|
||||
* Remove the commented lines and use this section as a template for all *
|
||||
* your other LDAP servers. *
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
$i++;
|
||||
$ldapservers->SetValue($i,'server','name','LDAP Server');
|
||||
$ldapservers->SetValue($i,'server','host','127.0.0.1');
|
||||
$ldapservers->SetValue($i,'server','port','389');
|
||||
$ldapservers->SetValue($i,'server','base',array(''));
|
||||
$ldapservers->SetValue($i,'server','auth_type','cookie');
|
||||
$ldapservers->SetValue($i,'login','dn','');
|
||||
$ldapservers->SetValue($i,'login','pass','');
|
||||
$ldapservers->SetValue($i,'server','tls',false);
|
||||
$ldapservers->SetValue($i,'server','low_bandwidth',false);
|
||||
$ldapservers->SetValue($i,'appearance','password_hash','md5');
|
||||
$ldapservers->SetValue($i,'login','attr','dn');
|
||||
$ldapservers->SetValue($i,'login','string',null);
|
||||
$ldapservers->SetValue($i,'login','class',null);
|
||||
$ldapservers->SetValue($i,'server','read_only',false);
|
||||
$ldapservers->SetValue($i,'appearance','show_create',true);
|
||||
$ldapservers->SetValue($i,'auto_number','enable',true);
|
||||
$ldapservers->SetValue($i,'auto_number','mechanism','search');
|
||||
$ldapservers->SetValue($i,'auto_number','search_base',null);
|
||||
$ldapservers->SetValue($i,'auto_number','min','1000');
|
||||
$ldapservers->SetValue($i,'auto_number','dn',null);
|
||||
$ldapservers->SetValue($i,'auto_number','pass',null);
|
||||
$ldapservers->SetValue($i,'login','anon_bind',true);
|
||||
$ldapservers->SetValue($i,'custom','pages_prefix','custom_');
|
||||
$ldapservers->SetValue($i,'unique_attrs','dn',null);
|
||||
$ldapservers->SetValue($i,'unique_attrs','pass',null);
|
||||
*/
|
||||
|
||||
/*********************************************/
|
||||
/* User-friendly attribute translation */
|
||||
/*********************************************/
|
||||
|
||||
/* Use this array to map attribute names to user friendly names. For example, if
|
||||
you don't want to see "facsimileTelephoneNumber" but rather "Fax". */
|
||||
$friendly_attrs = array();
|
||||
|
||||
$friendly_attrs['facsimileTelephoneNumber'] = 'Fax';
|
||||
$friendly_attrs['telephoneNumber'] = 'Phone';
|
||||
|
||||
/*********************************************/
|
||||
/* Support for attrs display order */
|
||||
/*********************************************/
|
||||
|
||||
/* Use this array if you want to have your attributes displayed in a specific
|
||||
order. You can use default attribute names or their fridenly names.
|
||||
For example, "sn" will be displayed right after "givenName". All the other
|
||||
attributes that are not specified in this array will be displayed after in
|
||||
alphabetical order. */
|
||||
# $attrs_display_order = array(
|
||||
# 'givenName',
|
||||
# 'sn',
|
||||
# 'cn',
|
||||
# 'displayName',
|
||||
# 'uid',
|
||||
# 'uidNumber',
|
||||
# 'gidNumber',
|
||||
# 'homeDirectory',
|
||||
# 'mail',
|
||||
# 'userPassword'
|
||||
# );
|
||||
|
||||
/*********************************************/
|
||||
/* Hidden attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* You may want to hide certain attributes from being displayed in the editor
|
||||
screen. Do this by adding the desired attributes to this list (and uncomment
|
||||
it). This only affects the editor screen. Attributes will still be visible in
|
||||
the schema browser and elsewhere. An example is provided below:
|
||||
NOTE: The user must be able to read the hidden_except_dn entry to be
|
||||
excluded. */
|
||||
# $hidden_attrs = array( 'jpegPhoto', 'objectClass' );
|
||||
# $hidden_except_dn = "cn=PLA UnHide,ou=Groups,c=AU";
|
||||
|
||||
/* Hidden attributes in read-only mode. If undefined, it will be equal to
|
||||
$hidden_attrs. */
|
||||
# $hidden_attrs_ro = array(
|
||||
# 'objectClass','shadowWarning', 'shadowLastChange', 'shadowMax',
|
||||
# 'shadowFlag', 'shadowInactive', 'shadowMin', 'shadowExpire');
|
||||
|
||||
/** **/
|
||||
/** Read-only attributes **/
|
||||
/** **/
|
||||
|
||||
/* You may want to phpLDAPadmin to display certain attributes as read only,
|
||||
meaning that users will not be presented a form for modifying those
|
||||
attributes, and they will not be allowed to be modified on the "back-end"
|
||||
either. You may configure this list here:
|
||||
NOTE: The user must be able to read the read_only_except_dn entry to be
|
||||
excluded. */
|
||||
# $read_only_attrs = array( 'objectClass' );
|
||||
# $read_only_except_dn = "cn=PLA ReadWrite,ou=Groups,c=AU";
|
||||
|
||||
/* An example of how to specify multiple read-only attributes: */
|
||||
# $read_only_attrs = array( 'jpegPhoto', 'objectClass', 'someAttribute' );
|
||||
|
||||
/*********************************************/
|
||||
/* Unique attributes */
|
||||
/*********************************************/
|
||||
|
||||
/* You may want phpLDAPadmin to enforce some attributes to have unique values
|
||||
(ie: not belong to other entries in your tree. This (together with
|
||||
unique_attrs['dn'] and unique_attrs['pass'] option will not let updates to
|
||||
occur with other attributes have the same value.
|
||||
NOTE: Currently the unique_attrs is NOT enforced when copying a dn. (Need to
|
||||
present a user with the option of changing the unique attributes. */
|
||||
# $unique_attrs = array('uid','uidNumber','mail');
|
||||
|
||||
/*********************************************/
|
||||
/* Predefined Queries (canned views) */
|
||||
/*********************************************/
|
||||
|
||||
/* To make searching easier, you may setup predefined queries below: */
|
||||
$q=0;
|
||||
$queries = array();
|
||||
|
||||
/* The name that will appear in the simple search form */
|
||||
$queries[$q]['name'] = 'User List';
|
||||
|
||||
/* The base to search on */
|
||||
$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
|
||||
/* The search scope (sub, base, one) */
|
||||
$queries[$q]['scope'] = 'sub';
|
||||
|
||||
/* The LDAP filter to use */
|
||||
$queries[$q]['filter'] = '(&(objectClass=posixAccount)(uid=*))';
|
||||
|
||||
/* The attributes to return */
|
||||
$queries[$q]['attributes'] = 'cn, uid, homeDirectory, telephonenumber, jpegphoto';
|
||||
|
||||
/* If you want to configure more pre-defined queries, copy and paste the above (including the "$q++;") */
|
||||
$q++;
|
||||
$queries[$q]['name'] = 'Samba Users';
|
||||
$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
$queries[$q]['scope'] = 'sub';
|
||||
$queries[$q]['filter'] = '(&(|(objectClass=sambaAccount)(objectClass=sambaSamAccount))(objectClass=posixAccount)(!(uid=*$)))';
|
||||
$queries[$q]['attributes'] = 'uid, smbHome, uidNumber';
|
||||
|
||||
$q++;
|
||||
$queries[$q]['name'] = 'Samba Computers';
|
||||
$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
$queries[$q]['scope'] = 'sub';
|
||||
$queries[$q]['filter'] = '(&(objectClass=sambaAccount)(uid=*$))';
|
||||
$queries[$q]['attributes'] = 'uid, homeDirectory';
|
||||
?>
|
186
copy.php
@@ -1,186 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy.php,v 1.25 2004/08/15 17:35:25 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* copy.php
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* Vars that come in as POST vars
|
||||
* - source_dn (rawurlencoded)
|
||||
* - new_dn (form element)
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
|
||||
$source_dn = $_POST['old_dn'];
|
||||
$dest_dn = $_POST['new_dn'];
|
||||
$encoded_dn = rawurlencode( $source_dn );
|
||||
$source_server_id = $_POST['server_id'];
|
||||
$dest_server_id = $_POST['dest_server_id'];
|
||||
$do_recursive = ( isset( $_POST['recursive'] ) && $_POST['recursive'] == 'on' ) ? true : false;
|
||||
|
||||
if( is_server_read_only( $dest_server_id ) )
|
||||
pla_error( $lang['copy_server_read_only'] );
|
||||
|
||||
check_server_id( $source_server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $source_server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
check_server_id( $dest_server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $dest_server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
include './header.php';
|
||||
|
||||
/* Error checking */
|
||||
if( 0 == strlen( trim( $dest_dn ) ) )
|
||||
pla_error( $lang['copy_dest_dn_blank'] );
|
||||
if( pla_compare_dns( $source_dn,$dest_dn ) == 0 && $source_server_id == $dest_server_id )
|
||||
pla_error( $lang['copy_source_dest_dn_same'] );
|
||||
if( dn_exists( $dest_server_id, $dest_dn ) )
|
||||
pla_error( sprintf( $lang['copy_dest_already_exists'], pretty_print_dn( $dest_dn ) ) );
|
||||
if( ! dn_exists( $dest_server_id, get_container( $dest_dn ) ) )
|
||||
pla_error( sprintf( $lang['copy_dest_container_does_not_exist'], pretty_print_dn( get_container($dest_dn) ) ) );
|
||||
|
||||
if( $do_recursive ) {
|
||||
$filter = isset( $_POST['filter'] ) ? $_POST['filter'] : '(objectClass=*)';
|
||||
// build a tree similar to that of the tree browser to give to r_copy_dn
|
||||
$snapshot_tree = array();
|
||||
echo "<body>\n";
|
||||
echo "<h3 class=\"title\">". $lang['copy_copying'] . htmlspecialchars( $source_dn ) . "</h3>\n";
|
||||
echo "<h3 class=\"subtitle\">" . $lang['copy_recursive_copy_progress'] ."</h3>\n";
|
||||
echo "<br /><br />";
|
||||
echo "<small>\n";
|
||||
echo $lang['copy_building_snapshot'];
|
||||
flush();
|
||||
build_tree( $source_server_id, $source_dn, $snapshot_tree, $filter );
|
||||
echo " <span style=\"color:green\">" . $lang['success'] . "</span><br />\n";
|
||||
flush();
|
||||
|
||||
// prevent script from bailing early on a long delete
|
||||
@set_time_limit( 0 );
|
||||
|
||||
$copy_result = r_copy_dn( $source_server_id, $dest_server_id, $snapshot_tree, $source_dn, $dest_dn );
|
||||
echo "</small>\n";
|
||||
} else {
|
||||
$copy_result = copy_dn( $source_server_id, $source_dn, $dest_server_id, $dest_dn );
|
||||
}
|
||||
|
||||
if( $copy_result )
|
||||
{
|
||||
$edit_url="edit.php?server_id=$dest_server_id&dn=" . rawurlencode( $dest_dn );
|
||||
$new_rdn = get_rdn( $dest_dn );
|
||||
$container = get_container( $dest_dn );
|
||||
|
||||
if( array_key_exists( 'tree', $_SESSION ) )
|
||||
{
|
||||
// do we not have a tree and tree icons yet? Build a new ones.
|
||||
initialize_session_tree();
|
||||
$tree = $_SESSION['tree'];
|
||||
$tree_icons = $_SESSION['tree_icons'];
|
||||
if( isset( $tree[$dest_server_id][$container] ) )
|
||||
{
|
||||
$tree[$dest_server_id][$container][] = $dest_dn;
|
||||
sort( $tree[ $dest_server_id ][ $container ] );
|
||||
$tree_icons[$dest_server_id][$dest_dn] = get_icon( $dest_server_id, $dest_dn );
|
||||
$_SESSION['tree'] = $tree;
|
||||
$_SESSION['tree_icons'] = $tree_icons;
|
||||
session_write_close();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- refresh the tree view (with the new DN renamed)
|
||||
and redirect to the edit_dn page -->
|
||||
<script language="javascript">
|
||||
parent.left_frame.location.reload();
|
||||
</script>
|
||||
<br />
|
||||
<center>
|
||||
<?php echo $lang['copy_successful_like_to']. "<a href=\"$edit_url\">" . $lang['copy_view_new_entry'] ."</a>"?>
|
||||
</center>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
function r_copy_dn( $source_server_id, $dest_server_id, $tree, $root_dn, $dest_dn )
|
||||
{
|
||||
global $lang;
|
||||
echo "<nobr>". $lang['copy_copying'] . htmlspecialchars( $root_dn ) . "...";
|
||||
flush();
|
||||
$copy_result = copy_dn( $source_server_id, $root_dn, $dest_server_id, $dest_dn );
|
||||
|
||||
if( ! $copy_result ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
echo "<span style=\"color:green\">".$lang['success']."</span></nobr><br />\n";
|
||||
flush();
|
||||
|
||||
$children = isset( $tree[ $root_dn ] ) ? $tree[ $root_dn ] : null;
|
||||
if( is_array( $children ) && count( $children ) > 0 )
|
||||
{
|
||||
foreach( $children as $child_dn ) {
|
||||
$child_rdn = get_rdn( $child_dn );
|
||||
$new_dest_dn = $child_rdn . ',' . $dest_dn;
|
||||
r_copy_dn( $source_server_id, $dest_server_id, $tree, $child_dn, $new_dest_dn );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function copy_dn( $source_server_id, $source_dn, $dest_server_id, $dest_dn )
|
||||
{
|
||||
global $ds, $lang;
|
||||
|
||||
$ds = pla_ldap_connect( $dest_server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
$attrs = get_object_attrs( $source_server_id, $source_dn );
|
||||
$new_entry = $attrs;
|
||||
// modify the prefix-value (ie "bob" in cn=bob) to match the destination DN's value.
|
||||
$rdn_attr = substr( $dest_dn, 0, strpos( $dest_dn, '=' ) );
|
||||
$rdn_value = get_rdn( $dest_dn );
|
||||
$rdn_value = substr( $rdn_value, strpos( $rdn_value, '=' ) + 1 );
|
||||
$new_entry[ $rdn_attr ] = $rdn_value;
|
||||
// don't need a dn attribute in the new entry
|
||||
unset( $new_entry['dn'] );
|
||||
|
||||
// Check the user-defined custom call back first
|
||||
if( true === preEntryCreate( $dest_server_id, $dest_dn, $new_entry ) ) {
|
||||
$add_result = @ldap_add( $ds, $dest_dn, $new_entry );
|
||||
if( ! $add_result ) {
|
||||
postEntryCreate( $dest_server_id, $dest_dn, $new_entry );
|
||||
echo "</small><br /><br />";
|
||||
pla_error( $lang['copy_failed'] . $dest_dn, ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
|
||||
return $add_result;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function build_tree( $source_server_id, $root_dn, &$tree, $filter='(objectClass=*)' )
|
||||
{
|
||||
$children = get_container_contents( $source_server_id, $root_dn, 0, $filter );
|
||||
if( is_array( $children ) && count( $children ) > 0 )
|
||||
{
|
||||
$tree[ $root_dn ] = $children;
|
||||
foreach( $children as $child_dn )
|
||||
build_tree( $source_server_id, $child_dn, $tree, $filter );
|
||||
}
|
||||
}
|
119
copy_form.php
@@ -1,119 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy_form.php,v 1.19 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* copy_form.php
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'] ;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
$rdn = get_rdn( $dn );
|
||||
$container = get_container( $dn );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id_underline'] . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$attrs = get_object_attrs( $server_id, $dn );
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
$select_server_html = "";
|
||||
if (count($servers)>1){
|
||||
$select_server_html .= '<select name="dest_server_id">';
|
||||
foreach( $servers as $id => $server )
|
||||
if( $server['host'] )
|
||||
$select_server_html .= "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . htmlspecialchars($server['name']) . "</option>\n";
|
||||
$select_server_html .= '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
$select_server_html .= '<input type="hidden" name="dest_server_id" value="'.key($servers).'">' .
|
||||
'<b>' . $server['name'] . '</b>';
|
||||
}
|
||||
|
||||
$children = get_container_contents( $server_id, $dn );
|
||||
|
||||
include './header.php';
|
||||
|
||||
// Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if( is_array( $children ) && count( $children ) > 0 ) { ?>
|
||||
<script language="javascript">
|
||||
//<!--
|
||||
function toggle_disable_filter_field( recursive_checkbox )
|
||||
{
|
||||
if( recursive_checkbox.checked ) {
|
||||
recursive_checkbox.form.filter.disabled = false;
|
||||
} else {
|
||||
recursive_checkbox.form.filter.disabled = true;
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo $lang['copyf_title_copy'] . $rdn; ?></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $server_name; ?></b> <?php echo $lang['distinguished_name']?>: <b><?php echo $dn; ?></b></h3>
|
||||
|
||||
<center>
|
||||
<?php echo $lang['copyf_title_copy'] ?><b><?php echo htmlspecialchars( $rdn ); ?></b> <?php echo $lang['copyf_to_new_object']?>:<br />
|
||||
<br />
|
||||
<form action="copy.php" method="post" name="copy_form">
|
||||
<input type="hidden" name="old_dn" value="<?php echo $dn; ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
|
||||
<table style="border-spacing: 10px">
|
||||
<tr>
|
||||
<td><acronym title="<?php echo $lang['copyf_dest_dn_tooltip']; ?>"><?php echo $lang['copyf_dest_dn']?></acronym>:</td>
|
||||
<td>
|
||||
<input type="text" name="new_dn" size="45" value="<?php echo htmlspecialchars( $dn ); ?>" />
|
||||
<?php draw_chooser_link( 'copy_form.new_dn' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $lang['copyf_dest_server']?>:</td>
|
||||
<td><?php echo $select_server_html; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if( is_array( $children ) && count( $children ) > 0 ) { ?>
|
||||
<tr>
|
||||
<td><label for="recursive"><?php echo $lang['recursive_copy']; ?></label>:</td>
|
||||
<td><input type="checkbox" id="recursive" name="recursive" onClick="toggle_disable_filter_field(this)" />
|
||||
<small>(<?php echo $lang['copyf_recursive_copy']?>)</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><acronym title="<?php echo $lang['filter_tooltip']; ?>"><?php echo $lang['filter']; ?></acronym>:</td>
|
||||
<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="<?php echo $lang['copyf_title_copy']; ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script language="javascript">
|
||||
//<!--
|
||||
/* If the user uses the back button, this way we draw the filter field
|
||||
properly. */
|
||||
toggle_disable_filter_field( document.copy_form.recursive );
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<?php if( show_hints() ) {?>
|
||||
<small><img src="images/light.png" /><span class="hint"><?php echo $lang['copyf_note']?></span></small>
|
||||
<?php } ?>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
148
create.php
@@ -1,148 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create.php,v 1.29 2004/10/28 13:37:39 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* create.php
|
||||
* Creates a new object.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - new_dn
|
||||
* - attrs (an array of attributes)
|
||||
* - vals (an array of values for the above attrs)
|
||||
* - required_attrs (an array with indices being the attributes,
|
||||
* and the values being their respective values)
|
||||
* - object_classes (rawurlencoded, and serialized array of objectClasses)
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require realpath( './common.php' );
|
||||
|
||||
$new_dn = isset( $_POST['new_dn'] ) ? $_POST['new_dn'] : null;
|
||||
$encoded_dn = rawurlencode( $new_dn );
|
||||
$server_id = $_POST['server_id'];
|
||||
$vals = isset( $_POST['vals'] ) ? $_POST['vals'] : array();
|
||||
$attrs = isset( $_POST['attrs'] ) ? $_POST['attrs'] : array();
|
||||
$required_attrs = isset( $_POST['required_attrs'] ) ? $_POST['required_attrs'] : false;
|
||||
$object_classes = unserialize( rawurldecode( $_POST['object_classes'] ) );
|
||||
$redirect = isset( $_POST['redirect'] ) ? $_POST['redirect'] : false;
|
||||
$container = get_container( $new_dn );
|
||||
|
||||
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'] );
|
||||
|
||||
// build the new entry
|
||||
$new_entry = array();
|
||||
if( isset( $required_attrs ) && is_array( $required_attrs ) ) {
|
||||
foreach( $required_attrs as $attr => $val ) {
|
||||
if( $val == '' )
|
||||
pla_error( sprintf( $lang['create_required_attribute'], htmlspecialchars( $attr ) ) );
|
||||
$new_entry[ $attr ][] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( $attrs ) && is_array( $attrs ) ) {
|
||||
foreach( $attrs as $i => $attr ) {
|
||||
if( is_attr_binary( $server_id, $attr ) ) {
|
||||
if( isset( $_FILES['vals']['name'][$i] ) && $_FILES['vals']['name'][$i] != '' ) {
|
||||
// read in the data from the file
|
||||
$file = $_FILES['vals']['tmp_name'][$i];
|
||||
$f = fopen( $file, 'r' );
|
||||
$binary_data = fread( $f, filesize( $file ) );
|
||||
fclose( $f );
|
||||
$val = $binary_data;
|
||||
$new_entry[ $attr ][] = $val;
|
||||
}
|
||||
} else {
|
||||
$val = isset( $vals[$i] ) ? $vals[$i] : '';
|
||||
if( '' !== trim($val) )
|
||||
$new_entry[ $attr ][] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$new_entry['objectClass'] = $object_classes;
|
||||
if( ! in_array( 'top', $new_entry['objectClass'] ) )
|
||||
$new_entry['objectClass'][] = 'top';
|
||||
|
||||
foreach( $new_entry as $attr => $vals ) {
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $new_dn, $attr, $vals ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$new_dn,$search_href ) );
|
||||
}
|
||||
|
||||
if( ! is_attr_binary( $server_id, $attr ) )
|
||||
if( is_array( $vals ) )
|
||||
foreach( $vals as $i => $v )
|
||||
$new_entry[ $attr ][ $i ] = $v;
|
||||
else
|
||||
$new_entry[ $attr ] = $vals;
|
||||
}
|
||||
|
||||
//echo "<pre>"; var_dump( $new_dn );print_r( $new_entry ); echo "</pre>";
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
// Check the user-defined custom call back first
|
||||
if( true === preEntryCreate( $server_id, $new_dn, $new_entry ) )
|
||||
$add_result = @ldap_add( $ds, $new_dn, $new_entry );
|
||||
else
|
||||
exit;
|
||||
if( $add_result )
|
||||
{
|
||||
postEntryCreate( $server_id, $new_dn, $new_entry );
|
||||
if( $redirect )
|
||||
$redirect_url = $redirect;
|
||||
else
|
||||
$redirect_url = "edit.php?server_id=$server_id&dn=" . rawurlencode( $new_dn );
|
||||
|
||||
if( array_key_exists( 'tree', $_SESSION ) )
|
||||
{
|
||||
$tree = $_SESSION['tree'];
|
||||
$tree_icons = $_SESSION['tree_icons'];
|
||||
|
||||
if( isset( $tree[$server_id][$container] ) ) {
|
||||
$tree[$server_id][$container][] = $new_dn;
|
||||
sort( $tree[$server_id][$container] );
|
||||
$tree_icons[$server_id][$new_dn] = get_icon( $server_id, $new_dn );
|
||||
}
|
||||
|
||||
$_SESSION['tree'] = $tree;
|
||||
$_SESSION['tree_icons'] = $tree_icons;
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<?php if( isset( $tree[$server_id][$container] ) || $new_dn == $servers[$server_id]['base'] ) { ?>
|
||||
|
||||
<!-- refresh the tree view (with the new DN renamed)
|
||||
and redirect to the edit_dn page -->
|
||||
<script language="javascript">
|
||||
parent.left_frame.location.reload();
|
||||
location.href='<?php echo $redirect_url; ?>';
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<meta http-equiv="refresh" content="0; url=<?php echo $redirect_url; ?>" />
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $lang['redirecting'] ?> <a href="<?php echo $redirect_url; ?>"><?php echo $lang['here']?></a>.
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
pla_error( $lang['create_could_not_add'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
|
||||
?>
|
126
create_form.php
@@ -1,126 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create_form.php,v 1.21 2004/10/28 13:37:39 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* create_form.php
|
||||
* The menu where the user chooses an RDN, Container, and Template for creating a new entry.
|
||||
* After submitting this form, the user is taken to their chosen Template handler.
|
||||
*
|
||||
* Variables that come in as GET vars
|
||||
* - server_id (optional)
|
||||
* - container (rawurlencoded) (optional)
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = $_REQUEST['server_id'];
|
||||
$step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : 1; // defaults to 1
|
||||
$container = $_REQUEST['container'];
|
||||
|
||||
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_underline'] . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
// build the server drop-down html
|
||||
$server_menu_html = '';
|
||||
if (count($servers)>1){
|
||||
$server_menu_html .= '<select name="server_id">';
|
||||
$js_dn_list = '';
|
||||
foreach( $servers as $id => $server ) {
|
||||
if( $server['host'] ) {
|
||||
$server_menu_html .= '<option value="'.$id.'"' . ( $id==$server_id? ' selected="true"' : '' ) . '>';
|
||||
$server_menu_html .= $server['name'] . '</option>';
|
||||
}
|
||||
}
|
||||
$server_menu_html .= '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
$server_menu_html .= '<input type="hidden" name="server_id" value="'.key($servers).'" />' .
|
||||
'<b>' . $server['name'] . '</b>';
|
||||
}
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo $lang['createf_create_object']?></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['createf_choose_temp']?></h3>
|
||||
<center><h3><?php echo $lang['createf_select_temp']?></h3></center>
|
||||
<form action="creation_template.php" method="post">
|
||||
<input type="hidden" name="container" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<table class="create">
|
||||
<tr>
|
||||
<td class="heading"><?php echo $lang['server']; ?>:</td>
|
||||
<td><?php echo $server_menu_html; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="heading">
|
||||
<?php echo $lang['template']; ?>:
|
||||
</td>
|
||||
<td>
|
||||
<table class="template_display">
|
||||
<tr>
|
||||
<td>
|
||||
<table class="templates">
|
||||
<?php
|
||||
$count = count( $templates );
|
||||
$i = -1;
|
||||
foreach( $templates as $name => $template ) {
|
||||
$i++;
|
||||
// Balance the columns properly
|
||||
if( ( count( $templates ) % 2 == 0 && $i == intval( $count / 2 ) ) ||
|
||||
( count( $templates ) % 2 == 1 && $i == intval( $count / 2 ) + 1 ) )
|
||||
echo "</table></td><td><table class=\"templates\">";
|
||||
// Check and see if this template should be shown in the list
|
||||
$isValid = false;
|
||||
if( isset($template['regexp'] ) ) {
|
||||
if( @preg_match( "/".$template['regexp']."/i", $container ) ) {
|
||||
$isValid = true;
|
||||
}
|
||||
} else {
|
||||
$isValid = true;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="radio" name="template" value="<?php echo htmlspecialchars($name);?>"
|
||||
id="<?php echo htmlspecialchars($name); ?>"
|
||||
<?php if( 0 == strcasecmp( 'Custom', $name ) ) echo ' checked';
|
||||
if( ! $isValid ) echo ' disabled'; ?> />
|
||||
</td>
|
||||
<td class="icon"><label for="<?php echo htmlspecialchars($name);?>"><img src="<?php echo $template['icon']; ?>" /></label></td>
|
||||
<td>
|
||||
<label for="<?php echo htmlspecialchars($name);?>">
|
||||
<?php if( 0 == strcasecmp( 'Custom', $template['desc'] ) ) echo '<b>';
|
||||
if( ! $isValid ) echo "<span style=\"color: gray\"><acronym title=\"This template is not allowed in this container\">";
|
||||
echo htmlspecialchars( $template['desc'] );
|
||||
if( ! $isValid ) echo "</acronym></span>";
|
||||
if( 0 == strcasecmp( 'Custom', $template['desc'] ) ) echo '</b>'; ?>
|
||||
</label></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end foreach ?>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo $lang['proceed_gt']?>" /></center></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/creation_template.php,v 1.18 2004/10/24 23:51:49 uugdave Exp $
|
||||
|
||||
/* file: creation_template.php
|
||||
* This file simply acts as a plugin grabber for the creator templates in
|
||||
* the directory templates/creation/
|
||||
*
|
||||
* Expected POST vars:
|
||||
* server_id
|
||||
* template
|
||||
*/
|
||||
|
||||
require_once 'common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$template = http_get_value( 'template' );
|
||||
$template !== false or pla_error( $lang['ctemplate_no_template'] );
|
||||
|
||||
if( $template == 'custom' ) {
|
||||
foreach( $templates as $id => $template ) {
|
||||
if( $template['handler'] == 'custom.php' ) {
|
||||
$template = $id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isset( $templates[$template] ) or pla_error( sprintf( $lang['invalid_template'], htmlspecialchars( $template ) ) );
|
||||
$template_id = $template;
|
||||
$template = isset( $templates[$template] ) ? $templates[$template_id] : null;
|
||||
$server_id = http_get_value( 'server_id' );
|
||||
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'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$server_name = $servers[ $server_id ][ 'name' ];
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
include './header.php';
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
<h3 class="title"><?php echo $lang['createf_create_object']?></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['ctemplate_on_server']?> '<?php echo htmlspecialchars( $server_name ); ?>', <?php echo $lang['using_template']?> '<?php echo htmlspecialchars( $template['desc'] ); ?>'</h3>
|
||||
|
||||
<?php
|
||||
|
||||
$handler = 'templates/creation/' . $template['handler'];
|
||||
$handler = realpath( $handler );
|
||||
if( ! file_exists( $handler ) )
|
||||
pla_error( sprintf( $lang['template_does_not_exist'], htmlspecialchars( $template['handler'] ) ) );
|
||||
if( ! is_readable( $handler ) )
|
||||
pla_error( sprintf( $lang['template_not_readable'], htmlspecialchars( $template['handler'] ) ) );
|
||||
|
||||
include $handler;
|
||||
|
||||
echo "</body>\n</html>";
|
||||
|
||||
?>
|
@@ -1,187 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/custom_functions.php,v 1.6 2004/05/27 13:25:13 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* custom_functions.php: Choose your own adventure.
|
||||
*
|
||||
* This file is full of functions (callbacks really) that are
|
||||
* meant to be filled in by users of phpLDAPadmin (you). These functions
|
||||
* are called as the result of a phpLDAPadmin event, like adding
|
||||
* a new entry, deleting an entry, changing an attribute value, etc.
|
||||
* Consider this concept an attempt to provide something like SQL
|
||||
* triggers for LDAP users.
|
||||
*
|
||||
* This can be very handy, for example, for system administrators
|
||||
* who want to execute custom code after a user is created or deleted.
|
||||
*
|
||||
* These functions generally have 2 parameters, $server_id and $dn:
|
||||
*
|
||||
* 1. $server_id.
|
||||
* The $server_id can be used to connect to the server using
|
||||
* pla_ldap_connect( $server_id ) to fetch additional information about
|
||||
* the entry being deleted. It can also be used to call
|
||||
* get_object_attrs( $server_id, $dn ) to fetch the entry's attributes.
|
||||
*
|
||||
* 2. $dn
|
||||
* The dn is provided so users can determine where in the LDAP tree
|
||||
* this entry resides and act accordingly. For example, if the DN
|
||||
* contains "ou=development", you may want to act differently than
|
||||
* if it contains "ou=accounting".
|
||||
*
|
||||
* Types of callback functions:
|
||||
*
|
||||
* These callbacks generally fall into two categories: "pre" and "post",
|
||||
* "pre" callbacks run before an event has occurred and their return
|
||||
* value (true or false) is used to decide whether to allow the event
|
||||
* to proceed. "post" callbacks run after an event has occurred and
|
||||
* their return value (void) is ignored.
|
||||
*
|
||||
* NOTE: These custom callbacks are NOT executed for LDIF imports.
|
||||
*
|
||||
* ALSO NOTE: These callbacks are responsible for printing out error
|
||||
* messages. The calling code will die silently without notifying
|
||||
* the user why. YOU are responsible for creating output here.
|
||||
*
|
||||
* TODO: This section outlines events that phpLDAPadmin does not yet
|
||||
* support. This list includes:
|
||||
* - ldap_mod_add (ie, adding a new value to a multi-valued attribute)
|
||||
* - ldap_mod_del (ie, deleting a value from a multi-valued attribute
|
||||
* or deleting an attribute from an entry)
|
||||
* - ldap_rename (ie, renaming an entry's RDN)
|
||||
*
|
||||
* DONE: This section lists events that phpLDAPadmin *does* support.
|
||||
* This list includes:
|
||||
* - ldap_add (ie, creating new entries)
|
||||
* - ldap_delete (ie, removing entries)
|
||||
* - ldap_modify (ie, changing the value of an attribute, for both
|
||||
* multi- and single-valued attributes)
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function is executed before modifying an entry's
|
||||
* attribute. Unlike preAttrModify, this function's
|
||||
* return value is ignored. In addition to the standard
|
||||
* $server_id and $dn paramaters, this function also
|
||||
* gives you the attribute name ($attr_name), and the new
|
||||
* value that the attribute will have ($new_value). $new_value
|
||||
* may be a string or an array of strings.
|
||||
*/
|
||||
function postAttrModify( $server_id, $dn, $attr_name, $new_value )
|
||||
{
|
||||
// Fill me in
|
||||
//
|
||||
// A very simple (and lame) example:
|
||||
// if( 0 == strcasecmp( $attr_name, "userPassword" ) ) {
|
||||
// mail( "user@example.com", "Password change notification",
|
||||
// "User '$dn' has changed their password." );
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is executed before modifying an entry's
|
||||
* attribute. If it returns true, the entry is modified.
|
||||
* If it returns false, the entry is not modified.
|
||||
* In addition to the standard $server_id and $dn params,
|
||||
* this function also gives you the attribute name ($attr_name)
|
||||
* and the new value that the attribute will have ($new_value).
|
||||
* $new_value may be a string or an array of strings.
|
||||
*/
|
||||
function preAttrModify( $server_id, $dn, $attr_name, $new_value )
|
||||
{
|
||||
// Fill me in
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is executed before adding an entry's
|
||||
* attribute. If it returns true, the entry is added.
|
||||
* If it returns false, the entry is not added.
|
||||
* In addition to the standard $server_id and $dn params,
|
||||
* this function also gives you the attribute name ($attr_name)
|
||||
* and the new value that the attribute will have ($new_value).
|
||||
* $new_value may be a string or an array of strings.
|
||||
*/
|
||||
function preAttrAdd( $server_id, $dn, $attr_name, $new_value )
|
||||
{
|
||||
// Fill me in
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is executed after an entry is created.
|
||||
* Unlike preEntryCreate(), this function's return
|
||||
* value is ignored. This is very handy for executing
|
||||
* custom code after creating a user account. For example,
|
||||
* one may wish to create the user's home directory.
|
||||
* See the documentation for preEntryCreate() below for
|
||||
* the description of the $attrs parameter.
|
||||
*/
|
||||
function postEntryCreate( $server_id, $dn, $attrs )
|
||||
{
|
||||
// Fill me in
|
||||
//
|
||||
// A very simple example:
|
||||
// if( preg_match( "/^uid=(\w+),/", $dn, $user_name ) ) {
|
||||
// $user_name = $user_name[1];
|
||||
// mkdir( "/home/$user_name" );
|
||||
// } else {
|
||||
// // not a user account
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is executed before an entry is created.
|
||||
* If it returns true, the entry is created, if false is
|
||||
* returned, the entry is not created. This function has
|
||||
* the additional parameters, $attrs, which is an assoc-
|
||||
* iative array of attribute/vale pairs of the same form
|
||||
* expected by ldap_add(), example:
|
||||
*
|
||||
* Array (
|
||||
* [objectClass] => Array (
|
||||
* [0] => top
|
||||
* [1] => person
|
||||
* [2] => inetOrgPerson
|
||||
* )
|
||||
* [cn] => John
|
||||
* [sn] => Doe
|
||||
* ...
|
||||
* )
|
||||
*
|
||||
*/
|
||||
function preEntryCreate( $server_id, $dn, $attrs )
|
||||
{
|
||||
// Fill me in
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is executed before an entry is deleted.
|
||||
* If it returns true, the entry is deleted, if false
|
||||
* is returned, the entry is not deleted.
|
||||
*/
|
||||
function preEntryDelete( $server_id, $dn )
|
||||
{
|
||||
// Fill me in
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is executed after an entry is deleted.
|
||||
* Unlike preEntryDelete(), this function's return
|
||||
* value is ignored.
|
||||
*/
|
||||
function postEntryDelete( $server_id, $dn )
|
||||
{
|
||||
// Fill me in
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called, after a new session is initilaized
|
||||
*/
|
||||
function postSessionInit()
|
||||
{
|
||||
// Fill me in
|
||||
}
|
||||
|
86
delete.php
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete.php,v 1.18 2004/08/15 17:35:25 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* delete.php
|
||||
* Deletes a DN and presents a "job's done" message.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
|
||||
$dn = $_POST['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
if( $dn === null )
|
||||
pla_error( $lang['you_must_specify_a_dn'] );
|
||||
|
||||
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'] );
|
||||
dn_exists( $server_id, $dn ) or pla_error( sprintf( $lang['no_such_entry'], '<b>' . pretty_print_dn( $dn ) . '</b>' ) );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
// Check the user-defined custom callback first.
|
||||
if( true === preEntryDelete( $server_id, $dn ) ) {
|
||||
$del_result = @ldap_delete( $ds, $dn );
|
||||
} else {
|
||||
exit;
|
||||
}
|
||||
|
||||
if( $del_result )
|
||||
{
|
||||
// Custom callback
|
||||
postEntryDelete( $server_id, $dn );
|
||||
|
||||
// kill the DN from the tree browser session variable and
|
||||
// refresh the tree viewer frame (left_frame)
|
||||
|
||||
if( array_key_exists( 'tree', $_SESSION ) )
|
||||
{
|
||||
$tree = $_SESSION['tree'];
|
||||
if( isset( $tree[$server_id] ) && is_array( $tree[$server_id] ) ) {
|
||||
|
||||
// does it have children? (it shouldn't, but hey, you never know)
|
||||
if( isset( $tree[$server_id][$dn] ) )
|
||||
unset( $tree[$server_id][$dn] );
|
||||
|
||||
// search and destroy
|
||||
foreach( $tree[$server_id] as $tree_dn => $subtree )
|
||||
foreach( $subtree as $key => $sub_tree_dn )
|
||||
if( 0 == strcasecmp( $sub_tree_dn, $dn ) )
|
||||
unset( $tree[$server_id][$tree_dn][$key] );
|
||||
$_SESSION['tree'] = $tree;
|
||||
}
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
include './header.php';
|
||||
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
parent.left_frame.location.reload();
|
||||
</script>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<center><?php echo sprintf( $lang['entry_deleted_successfully'], '<b>' .pretty_print_dn($dn) . '</b>' ); ?></center>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
} else {
|
||||
pla_error( sprintf( $lang['could_not_delete_entry'], '<b>' . pretty_print_dn( $dn ) . '</b>' ),
|
||||
ldap_error( $ds ),
|
||||
ldap_errno( $ds ) );
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_attr.php,v 1.9 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* delete_attr.php
|
||||
* Deletes an attribute from an entry with NO confirmation.
|
||||
*
|
||||
* On success, redirect to edit.php
|
||||
* On failure, echo an error.
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
$dn = $_POST['dn'] ;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$attr = $_POST['attr'];
|
||||
|
||||
if( is_attr_read_only( $server_id, $attr ) )
|
||||
pla_error( sprintf( $lang['attr_is_read_only'], htmlspecialchars( $attr ) ) );
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
if( ! $attr ) pla_error( $lang['no_attr_specified'] );
|
||||
if( ! $dn ) pla_error( $lang['no_dn_specified'] );
|
||||
|
||||
$update_array = array();
|
||||
$update_array[$attr] = array();
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$res = @ldap_modify( $ds, $dn, $update_array );
|
||||
if( $res )
|
||||
{
|
||||
$redirect_url = "edit.php?server_id=$server_id&dn=$encoded_dn";
|
||||
foreach( $update_array as $attr => $junk )
|
||||
$redirect_url .= "&modified_attrs[]=$attr";
|
||||
header( "Location: $redirect_url" );
|
||||
}
|
||||
else
|
||||
{
|
||||
pla_error( $lang['could_not_perform_ldap_modify'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
|
||||
?>
|
151
delete_form.php
@@ -1,151 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_form.php,v 1.17 2004/10/21 00:14:48 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* delete_form.php
|
||||
* Displays a last chance confirmation form to delete a dn.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
$rdn = pla_explode_dn( $dn );
|
||||
$rdn = $rdn[0];
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
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'] );
|
||||
|
||||
$children = get_container_contents( $server_id, $dn,0,'(objectClass=*)',LDAP_DEREF_NEVER );
|
||||
$has_children = count($children)>0 ? true : false;
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo sprintf( $lang['delete_dn'], htmlspecialchars( $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>
|
||||
|
||||
<?php if( $has_children ) { ?>
|
||||
|
||||
<center><b><?php echo $lang['permanently_delete_children']; ?></b><br /><br />
|
||||
|
||||
<?php
|
||||
flush(); // so the user can get something on their screen while we figure out how many children this object has
|
||||
if( $has_children ) {
|
||||
// get the total number of child objects (whole sub-tree)
|
||||
$s = pla_ldap_search( $server_id, 'objectClass=*', $dn, array('dn'), 'sub' );
|
||||
$sub_tree_count = count( $s );
|
||||
}
|
||||
?>
|
||||
|
||||
<table class="delete_confirm">
|
||||
<td>
|
||||
|
||||
<p>
|
||||
<?php echo sprintf( $lang['entry_is_root_sub_tree'], $sub_tree_count ); ?>
|
||||
<small>(<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=sub"><?php echo $lang['view_entries']; ?></a>)</small>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php echo sprintf( $lang['confirm_recursive_delete'], ($sub_tree_count-1) ); ?><br />
|
||||
<br />
|
||||
<small><?php echo $lang['confirm_recursive_delete_note']; ?></small>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<form action="rdelete.php" method="post">
|
||||
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="submit" class="scary" value="<?php echo sprintf( $lang['delete_all_x_objects'], $sub_tree_count ); ?>" />
|
||||
</form>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<center>
|
||||
<form action="edit.php" method="get">
|
||||
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['cancel']; ?>" class="cancel" />
|
||||
</form>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</table>
|
||||
<?php flush(); ?>
|
||||
<br />
|
||||
<br />
|
||||
<?php echo $lang['list_of_entries_to_be_deleted']; ?><br />
|
||||
<select size="<?php echo min( 10, $sub_tree_count );?>" multiple disabled style="background:white; color:black;width:500px" >
|
||||
<?php $i=0; ?>
|
||||
<?php foreach( $s as $dn => $junk ) { ?>
|
||||
<?php $i++; ?>
|
||||
<option><?php echo $i; ?>. <?php echo htmlspecialchars( ( $dn ) ); ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
|
||||
<br />
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<center>
|
||||
|
||||
<table class="delete_confirm">
|
||||
<td>
|
||||
|
||||
<?php echo $lang['sure_permanent_delete_object']; ?><br />
|
||||
<br />
|
||||
<nobr><acronym title="<?php echo $lang['distinguished_name']; ?>"><?php echo $lang['dn']; ?></acronym>: <b><?php echo pretty_print_dn( $dn ); ?></b><nobr><br />
|
||||
<nobr><?php echo $lang['server']; ?>: <b><?php echo htmlspecialchars($server_name); ?></b></nobr><br />
|
||||
<br />
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<form action="delete.php" method="post">
|
||||
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['delete']; ?>" class="scary" />
|
||||
</center>
|
||||
</form>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<center>
|
||||
<form action="edit.php" method="get">
|
||||
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['cancel']; ?>" class="cancel" />
|
||||
</form>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</table>
|
||||
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
50
doc/CREDITS
@@ -1,50 +0,0 @@
|
||||
* Project Developers:
|
||||
|
||||
- David Smith Maintainer
|
||||
- Xavier Renard Import/Export and Samba
|
||||
- Uwe Ebel I18n
|
||||
|
||||
* Patch writers:
|
||||
|
||||
- Bayu Irawan userPassword hash, html fixes, ldap_modify fixes
|
||||
- Uwe Ebel short_open_tags fix
|
||||
- Andrew Tipton SUP support in schema parser
|
||||
- Eigil Bjørgum UTF-8 support
|
||||
- Brandon Lederer DNS entry template
|
||||
Nathan Rotschafer
|
||||
- Steve Rigler Password hash patch
|
||||
- Chris Jackson Blowfish and md5crypt passwords
|
||||
- Marius Rieder Perfected schema parser
|
||||
- Nick Burch realpath() fixes for *BSD
|
||||
- Matt Perlman Fix for IBM LDAP schema support
|
||||
- K Yoder Predefined searches
|
||||
- Piotr Tarnowski i18n fixes
|
||||
- Deon George Auto-uidNumber enhancements and many fixes
|
||||
- Pierre Belanger Speed-ups to auto-uidNumber
|
||||
|
||||
* Translators:
|
||||
|
||||
- Marius Reider, German
|
||||
Uwe Ebel,
|
||||
Dieter Kluenter
|
||||
- Xavier Renard French
|
||||
- Dave Smith English ;)
|
||||
- Richard Lucassen Dutch
|
||||
- Andreu Sanchez Spanish and Catal<61>
|
||||
- Dmitry Gorpinenko, Russian
|
||||
Aleksey Soldatov
|
||||
Sergey Saukh
|
||||
- Unknown Italian
|
||||
- Alexandre Maciel Portuguese (Brasilian)
|
||||
Elton Schroeder Fenner (CLeGi)
|
||||
- Piotr Tarnowski (DrFugazi) Polish
|
||||
- Gunnar Nystrom Swedish
|
||||
- VOROSBARANYI Zoltan, Hungarian
|
||||
SIPOS Agnes
|
||||
- Tadashi Jokagi (elf2000) Japanese
|
||||
|
||||
If you can help translate, please join the phpldapadmin-devel mailing list:
|
||||
https://lists.sourceforge.net/mailman/listinfo/phpldapadmin-devel
|
||||
|
||||
|
||||
|
343
doc/ChangeLog
@@ -1,343 +0,0 @@
|
||||
|
||||
* Version 0.9.5, 2004-12-17
|
||||
|
||||
* Notes:
|
||||
|
||||
This version adds substantial new features and several minor bug fixes as well as PHP5 support!
|
||||
|
||||
* Changes:
|
||||
|
||||
- Added PHP5 support using Zend1 compatibility options.
|
||||
- Users can now specify a format string for custom display of DNs in the tree viewer
|
||||
(see $tree_display_format in config.php.example)
|
||||
- If using http auth_type, DNs and passwords are now encrypted int he cookie using blowfish.
|
||||
- If base entry is missing, phpLDAPadmin will prompt you to create it and give you some
|
||||
sane default values to get started.
|
||||
- Added index file for viewing of all PLA icons (see phpldapadmin/images/index.php)
|
||||
- Added custom country flag icons for DNs in the form "c=us"
|
||||
- Added more custom icons (ipNetwork, Device, Room)
|
||||
- Made it easier to create the base entry of an empty tree.
|
||||
- Fixed bug related to predefined search queries with patch from Olivier Mounier
|
||||
- Added a template for mozillaOrgPerson
|
||||
- Improved error handling for non-existent or unreadable template files.
|
||||
- "Create new" now displays at the top *and* bottom of the tree viewer list if there are
|
||||
more than 10 entries in the container (make it easier for users by reducing scrolling)
|
||||
- Optimized several pages by closing the session early if not needed.
|
||||
- By request, reversed the order of first name / last name in the inetOrgPerson template.
|
||||
- Added a login_string feature for admins who have all their users in a single container,
|
||||
so they can specify a string like "uid=<username>,ou=People,dc=example,dc=com" instead
|
||||
of setting up the painful login_attr stuff.
|
||||
- Changed the delete button to be red (like phpMyAdmin) to make it more obvious.
|
||||
- Consolidated the links at the top of the tree viewer to make better use of real estate.
|
||||
- New logo!
|
||||
- Patch from Dimitre to fix unique attrs enforcement.
|
||||
- Templates can now redirect wherever they want using a hidden form input.
|
||||
- Added a "Home" button in the tree viewer to get back to the main PLA page if desired.
|
||||
- PLA now looks up the gidNumber to display group description and name in user accounst.
|
||||
- Improved the hint about structural objectClasses in the custom creation template
|
||||
- Added ability to purge caches (mostly just schema objects) and caches are auto-purged
|
||||
when the schema is viewed in the schema browser.
|
||||
- Changed the arrow icon next to objectClass values to be an information button.
|
||||
- Search results can be displayed in table format now.
|
||||
- Fixes to LDIF import.
|
||||
- Added support for exporting to VCard 2.1 format.
|
||||
- Lots of little session fixes.
|
||||
- Structural objectClasses are now shown in bold in the custom creation template.
|
||||
- Fixed lots of bugs, some big some minor:
|
||||
1025353 1037715 1029103 1026427 1025353 1020606
|
||||
1020376 1010576 1009410 1007281 1007132 1004042
|
||||
1002794 1001941 1000185 999605 999170 996842
|
||||
995362 995297 995296 994343 993875 992419
|
||||
991891 989219 984587 983375 981283 979395
|
||||
977598 974369 973520 973323 965165 964410
|
||||
962074 959950 958372 957284 954453
|
||||
|
||||
* Version 0.9.4b, 2004-05-11
|
||||
|
||||
* Notes:
|
||||
|
||||
This follow-on release fixes one critical bug contained in 0.9.4
|
||||
relating to session.auto_start and schema caching.
|
||||
|
||||
* Changes
|
||||
|
||||
- Fixed bugs (all duplicates of single bug):
|
||||
947981
|
||||
951003
|
||||
951140
|
||||
- Fixed binary attribute creation (create.php)
|
||||
|
||||
* Version 0.9.4a, 2004-05-08
|
||||
|
||||
* Notes:
|
||||
|
||||
This follow-on release fixes several critical bugs contained in 0.9.4.
|
||||
|
||||
* Changes:
|
||||
|
||||
- Fixed bugs:
|
||||
949500 Error while adding New User Account
|
||||
949500 Creating a new uid under ou=People
|
||||
948695 is_executable() error using phpldapadmin - windows
|
||||
948741 Level: E_WARNING
|
||||
948413 Undefined variable: lang (E_NOTICE) after install
|
||||
|
||||
* Version 0.9.4, 2004-05-04
|
||||
|
||||
* Notes:
|
||||
|
||||
This release adds many new features and fixes many minor bugs.
|
||||
General performance has improved, especially for handling large data
|
||||
sets. Of particular note is that users can page through search results,
|
||||
flag individual attributes as read-only, view in-line jpegPhotos in
|
||||
search results, export DSML, all from the comfort of their own language.
|
||||
phpLDAPadmin is now availble in 11 languages.
|
||||
|
||||
* Changes:
|
||||
- Fixed bug 936223 by adding more robust error-handling to the binary
|
||||
attr viewing code.
|
||||
- Improved support for Microsoft Active Direcotry
|
||||
Added many new icons and logic to detect "special" Active Directory
|
||||
objects.
|
||||
Fixed a bug which prevented phpLDAPadmin's tree viewer from
|
||||
properly browsing an Active Directory.
|
||||
- Improved support for Novell eDirectory
|
||||
Added many new icons and logic to detect Novell eDirectory (NDS)
|
||||
entries.
|
||||
- Enhanced export form
|
||||
Users can specify the type of export, line ends, search scope, and more
|
||||
from one handy form similar in appearance to phpMyAdmin export forms (though
|
||||
more simple). As a result, I cleaned up the links at the top of the default
|
||||
mod template (removed mac | win | unix links, for example).
|
||||
- Cleaned up the entry browser link
|
||||
It now better aligns itself with neighboring form elements.
|
||||
- Fixed several E_NOTICE bugs
|
||||
- Added paging to search results Search results are now paged into groups
|
||||
of 50 entries and users can step through the pages like Google. This is not
|
||||
only a nicety, but with large searches users may have waited for hours for
|
||||
their browser to render all the entries. That problem is fixed by paging.
|
||||
- DNs are pretty-printed
|
||||
DNs in the tree viewer and else-where are now "syntax-highlighted".
|
||||
- Faster schema surfing
|
||||
You can "jump to" schema elements without rendering all other elements in
|
||||
the schema browser. This is a major speed enhancement.
|
||||
- Configurable: hide "Create new"
|
||||
Thanks to a patch from Deon George, users can hide the "create new" link in the
|
||||
tree viewer if desired.
|
||||
- DSML exports
|
||||
- Various XHTML fixes supplied by Uwe Ebel.
|
||||
- More binary safety:
|
||||
get_object_attrs() is now completely binary safe. Developers can use it to
|
||||
fetch jpegPhotos and any other binary data.
|
||||
- Re-order the search criteria menu
|
||||
Users can re-order the search criteria drop-down box (for simple search
|
||||
form) as desired from the config.
|
||||
- Obfuscated passwords with ****
|
||||
Users can configure PLA to display userPasswords as ****** if desired.
|
||||
- Tree browser displays child counts
|
||||
We found a fast solution to display child counts below each node without
|
||||
having to expand the node in the tree viewer. Works great.
|
||||
- "Used by" hyperlinks
|
||||
The "used by" list in matching rules are now hyper-linked to attributes in
|
||||
the schema viewer.
|
||||
- jpegPhotos in the search results.
|
||||
When a search result includes jpegPhotos, they will be displayed inline
|
||||
with other attributes. Very handy for address books!
|
||||
- We can draw any jpeg now
|
||||
Modified the infrastrucutre to draw any jpegPhoto attribute, regardless of
|
||||
its name.
|
||||
- Added a groupOfNames template
|
||||
For editing groupOfNames and groupOfUniqueNames
|
||||
- Fixes to the entry browser
|
||||
The entry browser can be clicked and closed before it's finished loading
|
||||
- Read-only attributes
|
||||
Users can now mark certain attributes as read-only, and PLA will refuse to
|
||||
modify them (ie, objectClasses) and display them without form input fields.
|
||||
- Configurable handling of aliases and referrals
|
||||
Admins can configure how phpLDAPadmin should handle aliases and
|
||||
referrals with fine-grained control.
|
||||
- Schema caching
|
||||
Network traffic between the web server and LDAP server has been reduced
|
||||
drastically and user page loads should run much faster thanks to a
|
||||
two-level session-based and memory-based schema cache.
|
||||
- Low bandwidth mode
|
||||
Users who have a slow link between their LDAP server and web server can
|
||||
run phpLDAPadmin in low-bandwidth mode to discourage excessive network
|
||||
traffic.
|
||||
- Fixed DN explosion
|
||||
A bug in PHP's LDAP API caused common segmentation faults in
|
||||
ldap_explode_dn(). We have re-implemented this function in PHP and have
|
||||
eliminated all segmentation faults.
|
||||
- Almost complete localization
|
||||
phpLDAPadmin is 100% internationalized with the exception of creation
|
||||
templates, available in 11 languages.
|
||||
- Added support for IBM LDAP and ISODE M-Vault LDAP servers.
|
||||
- Linkable displayed DNs
|
||||
When a user views an attribute that contains a DN, an arrow will appear
|
||||
to the left side. When clicked, the user is taken to the referenced DN.
|
||||
- Recursive copy fliters
|
||||
When users copy a sub-tree, they may apply a filter to the copy such
|
||||
that only entries that match the filter will be copied.
|
||||
- Auto uidNumber enhancements
|
||||
Admins can now specify a DN to bind with when auto-searching for the next
|
||||
available uidNumber.
|
||||
- Schema code cleanups
|
||||
Applied object-oriented inheritance to schema items and cleaned up
|
||||
access functions. No affect on end user, just a developers' itch.
|
||||
- Custom creation template usability enhancements
|
||||
- Fixed session bugs
|
||||
If PHP is auto-starting sessions, we will not throw errors anymore.
|
||||
- Added new auth_type: http
|
||||
Users can now use http auth_types for form-based logins. Their
|
||||
DN/password will be stored on the server in memory rather than in
|
||||
a cookie on the client.
|
||||
- TLS fixes
|
||||
More robust coverage. If users have configured 'tls' = true in
|
||||
config.php, we use TLS for all transactions with the LDAP
|
||||
server.
|
||||
- Error handling fixes
|
||||
pla_verbose_error() is more tolerant of crappy input (ie, bad LDAP
|
||||
error codes).
|
||||
- Cleaned up default mod template
|
||||
Editing entries is now much cleaner-looking. Buttons at the top are
|
||||
in two columns. The browser doesn't have to be full-screen anymore
|
||||
to edit an entry.
|
||||
- Minor cosmetic fixes to custom creation template
|
||||
- Added phpDoc commentary to all functions in functions.php and
|
||||
schema_functions.php, and export_functions.php. This allows us to
|
||||
auto-doc the code using phpDocumentor.
|
||||
|
||||
* Version 0.9.3, 2003-12-19
|
||||
|
||||
* Notes:
|
||||
This release focused almost entirely on finding and fixing bugs.
|
||||
The schema viewer has also been streamlined to save bandwidth (and several
|
||||
endangered species), while template configuration has been moved to its
|
||||
own file located in the templates directory. Over all, phpLDAPadmin has
|
||||
been made more solid thanks to testing and reporting by hundreds of users.
|
||||
Thansk for all your reports! Special thanks goes out to Matt Perlman for
|
||||
the IBM work-around and Uwe Ebel for the enhanced schema viewer.
|
||||
* Changes:
|
||||
As this was primarily a bug-fix release, here's the list of significant
|
||||
fixes:
|
||||
862225 an E_NOTICE on delete fixed
|
||||
861730 (and many duplicates of it) an E_NOTICE on determining the
|
||||
language in 'auto' lanuage mode for browsers who don't
|
||||
set HTTP_ACCEPT_LANGUAGE (like Opera).
|
||||
861491 (and many duplicates of it) Anonymous form-based logins
|
||||
often failed due to several E_NOTICE problems.
|
||||
856832 IBM LDAP servers refernece SUP attributes by OID, not name.
|
||||
A patch was provided to accomodate this circumstance.
|
||||
860179 Another anonymous form-based login bug.
|
||||
858611 (lots of dups of this one) Fixed the error handler so that
|
||||
it will not cause a "cannot send header information" message.
|
||||
844547 A coulpe E_NOTICE bugs in the posix group creation template.
|
||||
841816 An E_NOTICE bug during creation of an entry.
|
||||
844340 A sprintf error during login
|
||||
- Many many more bug fixes.
|
||||
- The schema viewer was also streamlined.
|
||||
- Support work-around for IBM LDAP Server was added.
|
||||
|
||||
* Version 0.9.2, 2003-11-14
|
||||
|
||||
* Notes:
|
||||
This release has undergone major code hardening as we've subjected it to
|
||||
the most stringent standard of PHP error reporting. The result is
|
||||
fewer unhandled errors, improved usability, and better performance.
|
||||
We've given more attention to internationalization as well,
|
||||
and that effort is nearly 80% complete. Translators and coders are still
|
||||
needed to help complete the localization effort. We've added a whole new
|
||||
custom callback infrastructure that is event driven. Users can write their
|
||||
own custom code to be executed as the result of LDAP events. Events include
|
||||
entry creation, entry deletion, and entry modification. Users can define
|
||||
custom code to execute automatically before and after each of these events.
|
||||
See "custom_functions.php" for details and documentation. Lots of other new
|
||||
features and bug fixes are outlined in the ChangeLog. phpLDAPadmin finally
|
||||
has a roadmap included with each release. Find it in the file called "ROADMAP"
|
||||
in the root of the install. This roadmap will be constantly updated to
|
||||
list our goals for each release. Enjoy 0.9.2! As always, your feedback
|
||||
is most welcome on the development mailing list and on the SourceForge
|
||||
bug tracker.
|
||||
|
||||
* Changes:
|
||||
- Localization work continues. About 80% complete.
|
||||
- New languages: Ialian, German, Catala
|
||||
- Fixed major encoding bugs. All pages are now true UTF-8 encoded
|
||||
- Support for auto-determining user's language based on the browser
|
||||
- Custom event callbacks infrastructure (see custom_functions.php). Users can now
|
||||
define custom code to execute as a result of LDAP events (ie, new entries,
|
||||
modifications, etc).
|
||||
- Major code cleanup. Removed all E_NOTICE messages and enabled E_ALL error_reporting.
|
||||
- Added support for smd5 and ssha passwords
|
||||
- Added configurable hints throughout the application
|
||||
- Added template-based entry editing. The infrastructure is now in place to use custom
|
||||
templates for editing LDAP entries. No templates are being shipped with 0.9.2, but
|
||||
they are on the way for 0.9.3.
|
||||
- Added photo display support for non-jpegPhoto photo attributes.
|
||||
- Added mass deletion. If enabled in the configuration, users can mass-delete multiple
|
||||
entries from the tree browser with checkboxes.
|
||||
- Much improved schema retrieval code. Now PLA uses the Root DSE (or any relevant DN)
|
||||
to fetch the schema based on the RFC-complian subSchemaSubEntry value.
|
||||
- Added support for viewing schema for attributes with ";" in their names (like
|
||||
userCertificate;binary or sn;lang-fr)
|
||||
- Schema code is 100% object oriented.
|
||||
- Enhanced search code can handle large searches without running out of memory.
|
||||
- Fixed minor XSS vulnerabilities in several creation templates.
|
||||
- Enhanced the server information viewer to actively retrieve attributes that the server
|
||||
may not give voluntarily.
|
||||
- Made the tree viewer more intelligent for failed binds.
|
||||
- Added better caching of the base DN for the tree viewer, which speeds up page loads
|
||||
considerably with multiple servers all configured to auto-determine the base DN.
|
||||
- Added intelligence around password updates on the currently logged-in user entry.
|
||||
|
||||
* Version 0.9.1, 2003-09-24
|
||||
|
||||
* Notes:
|
||||
We fixed a mountain of bugs for this release and implemented the
|
||||
most popular feature requests. The result is a much more robust LDAP
|
||||
management tool that supports a wider range of harsh environments and spoken
|
||||
languages. This release was over a month in the making and it shows. We've
|
||||
had great feed back from users. Special thanks to Nick Burch, Xavier
|
||||
Renard, Uwe Ebel, Schuller Tom, and Marius Reider for their code
|
||||
contributions. Thanks to everyone who contributed code and bug reports!
|
||||
|
||||
* Changes:
|
||||
- Preliminary support for LDIF imports.
|
||||
- Binary attribute support for viewing, deleting, and adding.
|
||||
- Users can specify attributes to hide while editing entries.
|
||||
- Schema browser now displays which objectClasses each attribute is used in.
|
||||
- Preliminary multi-language support (some localization, infrastructure in place).
|
||||
- New template for creating posixGroup entries.
|
||||
- Optional read-only mode of operation.
|
||||
- Error dialog beautified.
|
||||
- Localization effort begun, now available in German and French.
|
||||
- New samba user template.
|
||||
|
||||
* Bugs fixed:
|
||||
- I18n support was made more robust (UTF-8 problems fixed in *many* places).
|
||||
- Improved LDIF exports with better LDIF comments and cleaner IE support.
|
||||
- Cleaned up code in edit.php.
|
||||
- After updates, modified attribute(s) now highlighted properly.
|
||||
- Many realpath() fixes to allow symlink installs with multiple configs.
|
||||
- Simple search form 'Starts with' '*' searches produced PHP error.
|
||||
- Entry creation now adds the new entry to the tree browser in sorted order.
|
||||
- Complete re-work of schema browser, much more efficient parser.
|
||||
- Began effort to remove all E_NOTICE notices.
|
||||
|
||||
* Version 0.9.0, 2003-08-12
|
||||
|
||||
* Notes:
|
||||
This is the first release of phpLDAPAdmin. It should be stable enough and
|
||||
ready for use on your production LDAP servers. This is still a beta release
|
||||
and the paranoid may want to wait. phpLDAPAdmin is based on an improved
|
||||
version of DaveDAP 0.8.4.
|
||||
|
||||
* Changes:
|
||||
phpLDAPAdmin was DaveDAP. Changes since DaveDAP 0.8.4 include:
|
||||
|
||||
- Better LDAP compliance when copying entries.
|
||||
- Fixed boolean attribute support.
|
||||
- jpegPhoto scaling when necessary.
|
||||
- More robust schema browser.
|
||||
- Added internal attributes support.
|
||||
- Slightly improved look and feel.
|
@@ -1,68 +0,0 @@
|
||||
Installationsanleitung von phpldapadmin auf Deutsch
|
||||
===================================================
|
||||
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/INSTALL-de.txt,v 1.3 2004/03/01 19:48:58 i18phpldapadmin Exp $
|
||||
|
||||
Die Installationsanweisung geht davon aus das:
|
||||
a) Ein Webserver (Apache, IIS, etc.)
|
||||
b) PHP 4.1.0 oder neuer (mit LDAP-Support)
|
||||
installiert sind und auch funktionieren
|
||||
|
||||
|
||||
* Installation von phpLDAPadmin in vier einfachen Schritten:
|
||||
|
||||
1. Entpacken des Archives (wenn man diesen Text lesen kann,
|
||||
dann ist das schon geschehen)
|
||||
2. Das entpackte Verzeichnis phpldapadmin sollte vom webroot
|
||||
aus erreicht werden
|
||||
3. Kopieren der 'config.php.example' nach 'config.php'
|
||||
und anpassen.
|
||||
4. Mit einem Browser auf das phpldapadmin-Verzeichnis zugreifen
|
||||
(wenn Sie das Verzeichnis sehen, dann bitte noch ein index.php
|
||||
anhaengen)
|
||||
|
||||
|
||||
* Browser Hinweise
|
||||
|
||||
phpLDAPadmin wird unter Mozilla entwickelt und sollte auch am
|
||||
Besten darunter laufen. Andere Browser (bspw. Internet Explorer)
|
||||
sollten ebenfalls funktionieren.
|
||||
Keine Tests wurden mit dem Konqueror (oder jeder andere khtml-basierende
|
||||
Browser wie Safari) oder Opera vorgenommen. Falls es zu Browser
|
||||
Inkompatibilitaet kommen sollten, dann bitte einen Fehlerreport senden.
|
||||
|
||||
|
||||
* Lizenz
|
||||
Die Verwendete Lizenz ist in der Datei LICENCE zu finden
|
||||
|
||||
|
||||
* Mitwirkende:
|
||||
|
||||
Projektentwickler:
|
||||
Bitte in der Datei INSTALL unter 'Project Developers:' nachsehen
|
||||
|
||||
Patches:
|
||||
Bitte in der Datei INSTALL unter 'Patch writers:' nachsehen
|
||||
|
||||
Uebersetzungen:
|
||||
Bitte in der Datei INSTALL unter 'Translators:' nachsehen
|
||||
|
||||
Wer in der Uebersetzung helfen moechte sollte an der Mailingliste
|
||||
phpldapadmin-devel teilnehmen:
|
||||
|
||||
https://lists.sourceforge.net/mailman/listinfo/phpldapadmin-devel
|
||||
|
||||
|
||||
* Hinweise zur Konfiguration von config.php
|
||||
Wer eine Benuetzerfuehrung auf Deutsch haben moechte sollte in der
|
||||
config.php die Zeile
|
||||
|
||||
$language = 'en';
|
||||
|
||||
mit
|
||||
|
||||
$language = 'de';
|
||||
|
||||
abaendern. Weitere Sprachen sieht man im Unterverzeichnis 'lang'
|
||||
|
||||
|
@@ -1,56 +0,0 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/INSTALL-es.txt,v 1.3 2004/03/19 20:22:54 i18phpldapadmin Exp $
|
||||
Estas instrucciones dejan por sentado que tienes una instalaci<63>n
|
||||
funcionando de:
|
||||
a. Servidor Web (Apache, IIS, etc).
|
||||
b. PHP 4.1.0 o mas nuevo (con soporte LDAP)
|
||||
|
||||
* Instalando phpLDAPadmin en 4 pasos muy simples:
|
||||
|
||||
1. Desempaqueta el archivo (si est<73>s leyendo esto, ya lo has hecho).
|
||||
2. Pon el directorio resultante 'phpldapadmin' en alg<6C>n lugar de tu
|
||||
directorio web raiz.
|
||||
3. Copia 'config.php.example' a 'config.php' y ed<65>talo para que se
|
||||
acomode a tu configuraci<63>n y tu gusto.
|
||||
4. Entonces, con el navegador ve a la direcci<63>n que contiene los archivos
|
||||
del directorio phpldapadmin.
|
||||
|
||||
* Notas del navegador
|
||||
|
||||
phpLDAP se desarroll<6C> bajo Mozilla, y ser<65> donde seguramente corra mejor.
|
||||
A<>n as<61>, las pruebas se han hecho bajo Internet Explorer, y tendr<64>a que funcionar
|
||||
bien tambi<62>n. No se ha hecho ninguna prueba con Konqueror (o cualquier navegador
|
||||
basado en kthml como Safari) o Opera. Si encuentras alguna incompatibilidad, por favor
|
||||
h<>znoslo saber.
|
||||
|
||||
* Contribuidores
|
||||
|
||||
Desarrolladores del proyecto:
|
||||
|
||||
- David Smith Mantenedor
|
||||
- Xavier Renard Master de LDIF
|
||||
- Marius Rieder Master de los Esquemas
|
||||
- Nate Rotschafer Encargado de los lanzamientos
|
||||
|
||||
Escribidores de los parches:
|
||||
|
||||
- Bayu Irawan userPassword hash, arreglos html, arreglos ldap_modify
|
||||
- Uwe Ebel arreglo short_open_tags
|
||||
- Andrew Tipton soporte SUP en el parseador del esquema
|
||||
- Eigil Bj<42>rgum soporte UTF-8
|
||||
- Brandon Lederer plantilla de entrada de DNS
|
||||
Nathan Rotschafer
|
||||
- Steve Rigler Parche para Password hash
|
||||
- Chris Jackson Contrase<73>as Blowfish y md5crypt
|
||||
- Marius Rieder Parseador avanzado de esquema
|
||||
- Nick Burch Un mont<6E>n de arreglos de realpath()
|
||||
|
||||
Traductores:
|
||||
|
||||
- Uwe Ebel Alem<65>n
|
||||
- Xavier Renard Franc<6E>s
|
||||
- Dave Smith Ingl<67>s ;)
|
||||
|
||||
Si puedes ayudar a traducir, por favor ap<61>ntate a la lista de correo phpldapadmin:
|
||||
https://lists.sourceforge.net/mailman/listinfo/phpldapadmin-devel
|
||||
|
||||
|
@@ -1,57 +0,0 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/INSTALL-fr.txt,v 1.3 2004/03/19 20:22:54 i18phpldapadmin Exp $
|
||||
Les instructions suivantes supposent une installation en <20>tat de marche de:
|
||||
a. Un serveur web (Apache, IIS, etc).
|
||||
b. PHP 4.1.0 ou une version plus r<>cente (avec le support LDAP).
|
||||
|
||||
* Installer phpLDAPadmin en quatre <20>tapes simples:
|
||||
|
||||
1. D<>-tarrer l'archive (si vous lisez ceci, c'est que vous l'avez d<>j<EFBFBD> fait).
|
||||
2. Mettre le r<>pertoire 'phpldapadmin' ainsi obtenu quelque part sous
|
||||
la racine de votre serveur web.
|
||||
3. Copier 'config.php.example' vers 'config.php' et <20>diter selon vos besoins.
|
||||
4. Ensuite, pointer votre navigateur vers le r<>pertoire phpldapadmin.
|
||||
|
||||
* Notes sur les navigateurs
|
||||
|
||||
phpLDAPadmin a <20>t<EFBFBD> developp<70> avec Mozilla et fonctionnera vraisemblablement
|
||||
mieux avec celui-ci. Cependant, des tests ont <20>t<EFBFBD> effectu<74> avec Internet Explorer
|
||||
et cela devrait fonctionner <20>galement. Aucun test n'a <20>t<EFBFBD> r<>alis<69> ni avec Konqueror
|
||||
(ou un navigateur bas<61> sur khtml comme Safari par exemple) ni avec Opera. Si
|
||||
vous trouvez une incompatibilit<69> avec votre navigateur, merci de la reporter.
|
||||
|
||||
* Contributions:
|
||||
|
||||
Developeurs:
|
||||
|
||||
- David Smith Maintenance
|
||||
- Xavier Renard Responsable LDIF
|
||||
- Marius Rieder Responsable pour les sch<63>ma LDAP
|
||||
- Nate Rotschafer Directeur des releases
|
||||
|
||||
Auteurs de patchs:
|
||||
|
||||
- Bayu Irawan hachage pour le mot de passe utilisateur,
|
||||
corrections html, corrections pour ldap_modiy
|
||||
- Uwe Ebel Corrections pour short_open_tags
|
||||
- Andrew Tipton Support pour SUP dans le parseur de sch<63>mas
|
||||
- Eigil Bj<42>rgum Support pour UTF-8
|
||||
- Brandon Lederer Patron pour les entr<74>es DNS
|
||||
Nathan Rotschafer
|
||||
- Steve Rigler Correction pour les hachages des mots de passe
|
||||
- Chris Jackson Mots de passe Blowfish et md5crypt
|
||||
- Marius Rieder Am<41>lioration du parseur de sch<63>mas
|
||||
- Nick Burch Corrections multiples pour realpath()
|
||||
|
||||
Traducteurs:
|
||||
|
||||
- Uwe Ebel & Marius Reider Allemand
|
||||
- Xavier Renard Fran<61>ais
|
||||
- Dave Smith Anglais ;)
|
||||
- Richard Lucassen N<>erlandais
|
||||
- Andreu Sanchez Espagnol et Catalan
|
||||
- Dmitry Gorpinenko Russe
|
||||
- Unknown Italien
|
||||
|
||||
Si vous pouvez aider <20> traduire phpLDAPAdmin, veuillez s'il vous pla<6C>t vous abonner
|
||||
<20> la liste de diffusion phpldapadmin-devel:
|
||||
https://lists.sourceforge.net/mailman/listinfo/phpldapadmin-devel
|
@@ -1,101 +1,2 @@
|
||||
README-translation
|
||||
==================
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/README-translation.txt,v 1.3 2004/06/03 12:45:21 uugdave Exp $
|
||||
|
||||
This readme is for translators.
|
||||
phpLDAPadmin currently supports the following languages:
|
||||
|
||||
- en, of course
|
||||
- de, german
|
||||
- es, spanish
|
||||
- fr, french
|
||||
- it, italien
|
||||
- nl, netherland
|
||||
- pl, polish
|
||||
- pt-br, portuguese (brazilian)
|
||||
- ru, russian
|
||||
- sv, swedish
|
||||
|
||||
* Where are the files located?
|
||||
|
||||
All files are in the directory:
|
||||
|
||||
phpldapadmin/lang/
|
||||
|
||||
* How are the files named?
|
||||
|
||||
Every language is named by its local representation. For example English is "en" and
|
||||
British English is "en_GB" (though phpLDAPadmin does not have an "en_GB" translation).
|
||||
|
||||
* Is the location phpldapadmin/lang/ used in the application?
|
||||
|
||||
No, there is a Makefile in phpldapadmin/lang/ that converts the
|
||||
native encoding of the language file to utf8 into the directory
|
||||
phpldapadmin/lang/recoded. For example the file
|
||||
phpldapadmin/lang/de.php is converted via the programm iconv to the
|
||||
the encoding utf8 to the file phpldapadmin/lang/recoded/de.php.
|
||||
|
||||
* Is there a rule for the form of the translation?
|
||||
|
||||
Yes, all translation is stored in an array called lang[].
|
||||
The "mother" of all translation is english (en.php).
|
||||
Use your native encoding like iso8859-1 for european
|
||||
or iso8859-2 for polish.
|
||||
Every translated string is in single quotes "'"
|
||||
Don't use html-code in the translation.
|
||||
If you need to enclose text in quotes, use a double quote '"' (no escaping required).
|
||||
|
||||
* Why shouldn't I use html-code?
|
||||
|
||||
To avoid problemens wich htmlspecialchars (which coverts "<" to "<", for example).
|
||||
To avoid JavaScript problems.
|
||||
To keep the way open for other targets like xml.
|
||||
To keep the output well formed.
|
||||
|
||||
* How could I start?
|
||||
|
||||
First, the base for translation is the CVS version.
|
||||
Checkout the CVS version and start your translation.
|
||||
Create a file that contains your translation.
|
||||
For me the easiest way was to copy the file phpldapadmin/lang/en.php
|
||||
to the phpldapadmin/lang/[new-langage].php
|
||||
That gives the way to put the original translation at the end
|
||||
as a comment. Look at the de.php and you can see what I mean.
|
||||
Add a target to Makefile so that your langugage is also converted.
|
||||
|
||||
* How could I verify that my translation is complete?
|
||||
|
||||
phpLDAPadmin contains the file phpldapadmin/check_lang_files.php
|
||||
Open it in your browser and it will tell you if your lang file has any
|
||||
omissions or extraneous strings.
|
||||
|
||||
- extra entries: if entry is not in the en.php, maybe the value was
|
||||
changed in en.php or you type in a wrong key.
|
||||
- missing entries: the entry is present in en.php but is missing in
|
||||
the translated langugage.
|
||||
|
||||
* What is zz.php and the zzz.php in the phpldapadmin/lang/ directory?
|
||||
|
||||
Well that is not really a language. That is only for developers
|
||||
and translators to make sure that all strings are translated in the
|
||||
application.
|
||||
|
||||
The zz.php replace all characters in the lang[] to Z. That helps
|
||||
in finding hardcoding translation in the the source.
|
||||
|
||||
The ZZZ.php helps you to find the used "key".
|
||||
|
||||
* How could I enable the zz and zzz language?
|
||||
|
||||
Well, one is to set $language to 'zz' or 'zzz' in the config.php file. That is not the
|
||||
best way - but the way that always works.
|
||||
|
||||
Mozilla users do this:
|
||||
* Click Edit->Preferences
|
||||
* Option Navigator->Lanugages
|
||||
Klick the button "add" and type into "Other" the
|
||||
language "zz"
|
||||
* With Move up / Move down you can change your priority.
|
||||
* With the Button "OK" you can activate your choice.
|
||||
|
||||
Do the same if you want to activate/test your translation.
|
||||
Please see http://wiki.phpldapadmin.info/Translating now for information on
|
||||
translating PLA.
|
||||
|
56
doc/ROADMAP
@@ -1,56 +0,0 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/ROADMAP,v 1.19 2004/03/25 12:50:39 uugdave Exp $
|
||||
phpLDAPadmin roadmap
|
||||
|
||||
0.9.3 planned features:
|
||||
Bugfix release.
|
||||
This release will focus on fixing bugs, adding minor features, and improving stability.
|
||||
Samba 3.0 support in samba user and machine creation templates
|
||||
Move template config to a new config file: template_config.php (or something)
|
||||
|
||||
0.9.4 planned features:
|
||||
* Complete i18n. All strings localized.
|
||||
Modification templates:
|
||||
* gropOfNames (view full DNs and browse buttons)
|
||||
* groupOfUniqueNames (view full DNs and browse buttons)
|
||||
* http auth_type (a la phpMyAdmin)
|
||||
* read-only attributes (similar to hidden attributes) in config
|
||||
* Default mod template: Add a "browse" button for attributes that store DNs.
|
||||
caveat: We don't have a way to reference form elements with "[]" in the name, causing a proble
|
||||
with our default mod template. The "browser" button is present, but cannot populate the form
|
||||
element.
|
||||
* Add output buffering when including lang files so no output is sent to the browser (which could cause problems for sessions and cookies)
|
||||
* Paging search results.
|
||||
* Anonymous binds redirect to search page with no tree viewer (as an option in config)
|
||||
* pretty-printed DNs
|
||||
* DSML exports
|
||||
* obfuscated password display
|
||||
* more linkage in the schema browser (used by links)
|
||||
* jpegs drawn in-line in searches
|
||||
* configurable read-only attributes
|
||||
* paging in search results (ie, viewing entries 1-50 of 436)
|
||||
* Configuration for templates.
|
||||
|
||||
0.9.5 planned features:
|
||||
Maybe create a class called Config with static functions for fetching configuration data (ie, Config::isServerReadOnly()).
|
||||
or: Object-oriented server and general configuration (ie, add a class Server)
|
||||
Support and test ActiveDirectory and iMail LDAP schema.
|
||||
Add link to objectClass values in default mod template to jump to that objectClass in the schema viewer.
|
||||
Make deref param modifiable in the advanced search form (LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, etc.)
|
||||
Better handling of aliases and referals (display the actual alias with aliasedObjectName or ref attrs, and don't follow or perhaps make it configurable like ldapsearch)
|
||||
Remove all HTML from language files.
|
||||
Add a random hint on the welcome page
|
||||
Add blowfish encryption to encrypt cookie-stored passwords and DNs.
|
||||
Support for modifying replica entries (using ldap_set_rebind_proc())
|
||||
Modification templates
|
||||
user
|
||||
oragnizationalUnit
|
||||
sambaUser (v 2 and 3)
|
||||
sambaMachine
|
||||
Search filter builder for simple search form (just select AND or OR for a group of criteria)
|
||||
Add mass-update feature (user provides filter and set of attrs/vals to modify)
|
||||
No-schema mode of operation (some servers simply won't give us schema. This becomes a problem for normal operation)
|
||||
i18n localization of all creation templates
|
||||
Hidden/read-only attrs on a filter-basis (ie, different users have different viewable, writable attributes)
|
||||
Serious compatibility testing for additional LDAP servers.
|
||||
|
||||
(* means an item is complete and checed into CVS)
|
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/documentation.php,v 1.7 2004/12/17 15:21:15 uugdave Exp $
|
||||
|
||||
|
||||
include './common.php';
|
||||
include './header.php';
|
||||
|
||||
echo "<body>";
|
||||
|
||||
$view = isset( $_GET['view'] ) ? $_GET['view'] : false;
|
||||
switch( $view ) {
|
||||
case 'credits':
|
||||
echo "<h3 class=\"title\">phpLDAPadmin Credits</h3>";
|
||||
echo "<pre>";
|
||||
echo "<small>";
|
||||
include 'doc/CREDITS';
|
||||
echo "</small>";
|
||||
echo "</pre>";
|
||||
echo "</body>";
|
||||
echo "</html>";
|
||||
exit;
|
||||
break;
|
||||
case 'changelog':
|
||||
echo "<h3 class=\"title\">phpLDAPadmin ChangeLog</h3>";
|
||||
echo "<pre>";
|
||||
echo "<small>";
|
||||
include 'doc/ChangeLog';
|
||||
echo "</small>";
|
||||
echo "</pre>";
|
||||
echo "</body>";
|
||||
echo "</html>";
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<h3 class="title">phpLDAPadmin documentation</h3>
|
||||
<h3 class="subtitle">Stuff you wish you already knew.</h3>
|
||||
|
||||
<h2 class="doc">Extending phpLDAPadmin</h2>
|
||||
|
||||
<h3 class="doc">Creation Templates</h3>
|
||||
<p class="doc">TODO: Write me.</p>
|
||||
|
||||
<h3 class="doc">Modification Templates</h3>
|
||||
<p class="doc">TODO: Write me.</p>
|
||||
|
||||
|
58
donate.php
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
|
||||
$donate_base_href="https://sourceforge.net/donate/index.php?group_id=61828&type=0";
|
||||
$amounts = array( 10, 20, 50, 100 );
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">Donate</h3>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<p style="text-align: center"><?php echo $lang['donation_instructions']; ?></p>
|
||||
<br />
|
||||
|
||||
<table style="width: 100%; font-size: 12px">
|
||||
<tr>
|
||||
<?php foreach( $amounts as $amount ) { ?>
|
||||
|
||||
<td align="center">
|
||||
<a
|
||||
href="<?php echo $donate_base_href; ?>&amt=<?php echo $amount; ?>"
|
||||
target="new"><img
|
||||
src="images/paypal-donate.png"
|
||||
alt="[<?php echo sprintf( $lang['donate_amount'], '$US ' . $amount ); ?>]"
|
||||
title="<?php echo sprintf( $lang['donate_amount'], '$US ' . $amount ); ?>" /></a>
|
||||
</td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<?php foreach( $amounts as $amount ) { ?>
|
||||
|
||||
<td align="center"><?php echo sprintf( $lang['donate_amount'], '$' . $amount ); ?></td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<center>
|
||||
<?php echo $lang['wish_list_option']; ?>
|
||||
<br />
|
||||
<br />
|
||||
<a href="http://www.amazon.com/gp/registry/22APPYURX48VA"><?php echo $lang['wish_list']; ?></a>
|
||||
</center>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/download_binary_attr.php,v 1.8 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
require './common.php';
|
||||
|
||||
$server_id = $_GET['server_id'];
|
||||
$dn = rawurldecode( $_GET['dn'] );
|
||||
$attr = $_GET['attr'];
|
||||
// if there are multiple values in this attribute, which one do you want to see?
|
||||
$value_num = isset( $_GET['value_num'] ) ? $_GET['value_num'] : 0;
|
||||
|
||||
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'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
dn_exists( $server_id, $dn ) or pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn ) ) );
|
||||
|
||||
$search = @ldap_read( $ds, $dn, "(objectClass=*)", array( $attr ), 0, 0, 0, get_view_deref_setting() );
|
||||
if( ! $search )
|
||||
pla_error( $lang['error_performing_search'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
$entry = ldap_first_entry( $ds, $search );
|
||||
$attrs = ldap_get_attributes( $ds, $entry );
|
||||
$attr = ldap_first_attribute( $ds, $entry, $attrs );
|
||||
$values = ldap_get_values_len( $ds, $entry, $attr );
|
||||
$count = $values['count'];
|
||||
|
||||
// Dump the binary data to the browser
|
||||
header( "Content-type: octet-stream" );
|
||||
header( "Content-disposition: attachment; filename=$attr" );
|
||||
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
|
||||
echo $values[$value_num];
|
||||
|
||||
?>
|
61
edit.php
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/edit.php,v 1.48 2004/10/14 03:33:36 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* edit.php
|
||||
* Displays the specified dn from the specified server for editing
|
||||
* in its template as determined by get_template(). This is a simple
|
||||
* shell for displaying entries. The real work is done by the templates
|
||||
* found in tempaltes/modification/
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
* - use_default_template (optional) If set, use the default template no matter what
|
||||
* - Other vars may be set and used by the modification templates
|
||||
*/
|
||||
|
||||
require_once realpath( 'common.php' );
|
||||
require_once realpath( 'templates/template_config.php' );
|
||||
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : false;
|
||||
$dn !== false or pla_error( $lang['missing_dn_in_query_string'] );
|
||||
$decoded_dn = rawurldecode( $dn );
|
||||
$encoded_dn = rawurlencode( $decoded_dn );
|
||||
|
||||
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id'] : false;
|
||||
$server_id !== false or pla_error( $lang['missing_server_id_in_query_string'] );
|
||||
|
||||
// Template authors may wish to present the user with a link back to the default, generic
|
||||
// template for editing. They may use this as the target of the href to do so.
|
||||
$default_href = "edit.php?server_id=$server_id&dn=$encoded_dn&use_default_template=true";
|
||||
|
||||
$use_default_template = isset( $_GET['use_default_template'] ) ? true : false;
|
||||
|
||||
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'] );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
if( $use_default_template ) {
|
||||
require realpath( 'templates/modification/default.php' );
|
||||
} else {
|
||||
|
||||
$template = get_template( $server_id, $dn );
|
||||
$template_file = "templates/modification/$template.php";
|
||||
if( file_exists( realpath( $template_file ) ) )
|
||||
require realpath( $template_file );
|
||||
else {
|
||||
echo "\n\n";
|
||||
echo $lang['missing_template_file'];
|
||||
echo " <b>$template_file</b>. ";
|
||||
echo $lang['using_default'];
|
||||
echo "<br />\n\n";
|
||||
require realpath( 'templates/modification/default.php' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/entry_chooser.php,v 1.16 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
require './common.php';
|
||||
|
||||
$container = isset( $_GET['container'] ) ? rawurldecode( $_GET['container'] ) : false;
|
||||
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id'] : false;
|
||||
$return_form_element = isset( $_GET['form_element'] ) ? htmlspecialchars( $_GET['form_element'] ) : null;
|
||||
|
||||
include "header.php";
|
||||
|
||||
echo "<h3 class=\"subtitle\">" . $lang['entry_chooser_title'] . "</h3>\n";
|
||||
flush();
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
function returnDN( dn )
|
||||
{
|
||||
opener.document.<?php echo $return_form_element; ?>.value = dn;
|
||||
close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
if( $container ) {
|
||||
echo $lang['server_colon_pare'] . "<b>" . htmlspecialchars( $servers[ $server_id ][ 'name' ] ) . "</b><br />\n";
|
||||
echo $lang['look_in'] . "<b>" . htmlspecialchars( $container ) . "</b><br />\n";
|
||||
}
|
||||
|
||||
/* Has the use already begun to descend into a specific server tree? */
|
||||
if( $server_id !== false && $container !== false )
|
||||
{
|
||||
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'] );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
$dn_list = get_container_contents( $server_id, $container, 0, '(objectClass=*)', get_tree_deref_setting() );
|
||||
sort( $dn_list );
|
||||
|
||||
$base_dn = $servers[ $server_id ][ 'base' ];
|
||||
if( ! $base_dn )
|
||||
$base_dn = try_to_get_root_dn( $server_id );
|
||||
|
||||
if( 0 == pla_compare_dns( $container, $base_dn ) ) {
|
||||
$parent_container = false;
|
||||
$up_href = "entry_chooser.php?form_element=$return_form_element";
|
||||
} else {
|
||||
$parent_container = get_container( $container );
|
||||
$up_href = "entry_chooser.php?form_element=$return_form_element&server_id=$server_id&container=" .
|
||||
rawurlencode( $parent_container );
|
||||
}
|
||||
echo " <a href=\"$up_href\" style=\"text-decoration:none\">" .
|
||||
"<img src=\"images/up.png\"> ". $lang['back_up_p'] ."</a><br />\n";
|
||||
|
||||
if( count( $dn_list ) == 0 )
|
||||
echo " (". $lang['no_entries'] .")<br />\n";
|
||||
else
|
||||
foreach( $dn_list as $dn ) {
|
||||
$href = "javascript:returnDN( '$dn' )";
|
||||
echo " <a href=\"entry_chooser.php?form_element=$return_form_element".
|
||||
"&server_id=$server_id&container=" .
|
||||
rawurlencode( $dn ) . "\"><img src=\"images/plus.png\" /></a> " .
|
||||
"<a href=\"$href\">" . htmlspecialchars( $dn ) . "</a><br />\n";
|
||||
}
|
||||
}
|
||||
/* draw the root of the selection tree (ie, list all the servers) */
|
||||
else
|
||||
{
|
||||
foreach( $servers as $id => $server ) {
|
||||
if( $server['host'] ) {
|
||||
echo "<b>" . htmlspecialchars( $server['name'] ) . "</b><br />\n";
|
||||
if( ! have_auth_info( $id ) )
|
||||
echo "<small> (" . $lang['not_logged_in'] . ")</small><br />";
|
||||
else {
|
||||
$dn = ( $server['base'] ? $server['base'] : try_to_get_root_dn( $id ) );
|
||||
if( ! $dn ) {
|
||||
echo "<small> (". $lang['could_not_det_base_dn'] .")</small><br />";
|
||||
} else {
|
||||
$href = "javascript:returnDN( '$dn' )";
|
||||
echo " <a href=\"entry_chooser.php?form_element=" .
|
||||
"$return_form_element&server_id=$id&container=" .
|
||||
rawurlencode( $dn ) . "\"><img src=\"images/plus.png\" /></a> " .
|
||||
"<a href=\"$href\">" . htmlspecialchars( $dn ) . "</a><br />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// added by PD. 14082003,
|
||||
// adding the element access allows it to work with javascript arrays
|
||||
|
||||
// the name of the form extracted from the first part of the URL variable.
|
||||
$formpart=substr($return_form_element,0,strpos($return_form_element,"."));
|
||||
|
||||
// the name of the element extracted from the last part of the URL variable (after the dot)
|
||||
$elmpart =substr($return_form_element,strpos($return_form_element,".")+1);
|
||||
|
||||
// rebuilt return value
|
||||
$return_form_element = $formpart . ".elements[\"" . $elmpart . "\"]";
|
||||
|
||||
?>
|
74
expand.php
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/expand.php,v 1.18 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* expand.php
|
||||
* This script alters the session variable 'tree', expanding it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*
|
||||
* Note: this script is equal and opposite to collapse.php
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
// no expire header stuff
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
// This allows us to display large sub-trees without running out of time.
|
||||
@set_time_limit( 0 );
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
|
||||
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'] );
|
||||
|
||||
initialize_session_tree();
|
||||
|
||||
$tree = $_SESSION['tree'];
|
||||
$tree_icons = $_SESSION['tree_icons'];
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$contents = get_container_contents( $server_id, $dn, 0, '(objectClass=*)', get_tree_deref_setting() );
|
||||
|
||||
usort( $contents, 'pla_compare_dns' );
|
||||
$tree[$server_id][$dn] = $contents;
|
||||
|
||||
//echo "<pre>";
|
||||
//var_dump( $contents );
|
||||
//exit;
|
||||
|
||||
foreach( $contents as $dn )
|
||||
$tree_icons[$server_id][$dn] = get_icon( $server_id, $dn );
|
||||
|
||||
$_SESSION['tree'] = $tree;
|
||||
$_SESSION['tree_icons'] = $tree_icons;
|
||||
|
||||
// This is for Opera. By putting "random junk" in the query string, it thinks
|
||||
// that it does not have a cached version of the page, and will thus
|
||||
// fetch the page rather than display the cached version
|
||||
$time = gettimeofday();
|
||||
$random_junk = md5( strtotime( 'now' ) . $time['usec'] );
|
||||
|
||||
// If cookies were disabled, build the url parameter for the session id.
|
||||
// It will be append to the url to be redirect
|
||||
$id_session_param="";
|
||||
if( SID != "" ){
|
||||
$id_session_param = "&".session_name()."=".session_id();
|
||||
}
|
||||
|
||||
session_write_close();
|
||||
|
||||
header( "Location:tree.php?foo=$random_junk#{$server_id}_{$encoded_dn}$id_session_param" );
|
||||
?>
|
93
export.php
@@ -1,93 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export.php,v 1.11 2004/10/23 21:13:15 uugdave Exp $
|
||||
|
||||
require 'export_functions.php';
|
||||
|
||||
// get the POST parameters
|
||||
$base_dn = isset($_POST['dn']) ? $_POST['dn']:NULL;
|
||||
$server_id = isset($_POST['server_id']) ? $_POST['server_id']:NULL;
|
||||
$format = isset( $_POST['format'] ) ? $_POST['format'] : "unix";
|
||||
$scope = isset($_POST['scope']) ? $_POST['scope'] : 'base';
|
||||
$filter = isset($_POST['filter']) ? $_POST['filter'] : 'objectclass=*';
|
||||
$target = isset($_POST['target']) ? $_POST['target'] : 'display';
|
||||
$save_as_file = isset( $_POST['save_as_file'] ) && $_POST['save_as_file'] == 'on';
|
||||
$attributes = array();
|
||||
// add system attributes if needed
|
||||
if( isset( $_POST['sys_attr'] ) ){
|
||||
array_push($attributes,'*');
|
||||
array_push($attributes,'+');
|
||||
}
|
||||
isset($_POST['exporter_id']) or pla_error( $lang['must_choose_export_format'] );
|
||||
$exporter_id = $_POST['exporter_id'];
|
||||
isset($exporters[$exporter_id]) or pla_error( $lang['invalid_export_format'] );
|
||||
|
||||
// do some check
|
||||
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'] );
|
||||
|
||||
// Initialisation of other variables
|
||||
$rdn = get_rdn( $base_dn );
|
||||
$friendly_rdn = get_rdn( $base_dn, 1 );
|
||||
$extension = $exporters[$exporter_id]['extension'];
|
||||
|
||||
//set the default CRLN to Unix format
|
||||
$br = "\n";
|
||||
|
||||
// default case not really needed
|
||||
switch( $format ) {
|
||||
case 'win':
|
||||
$br = "\r\n";
|
||||
break;
|
||||
case 'mac':
|
||||
$br = "\r";
|
||||
break;
|
||||
case 'unix':
|
||||
default:
|
||||
$br = "\n";
|
||||
}
|
||||
|
||||
// get the decoree,ie the source
|
||||
$plaLdapExporter = new PlaLdapExporter($server_id,$filter,$base_dn,$scope,$attributes);
|
||||
|
||||
// the decorator
|
||||
// do it that way for the moment
|
||||
$exporter = NULL;
|
||||
|
||||
switch($exporter_id){
|
||||
case 0:
|
||||
$exporter = new PlaLdifExporter($plaLdapExporter);
|
||||
break;
|
||||
case 1:
|
||||
$exporter = new PlaDsmlExporter($plaLdapExporter);
|
||||
break;
|
||||
case 2:
|
||||
$exporter = new PlaVcardExporter($plaLdapExporter);
|
||||
break;
|
||||
case 3:
|
||||
$exporter = new PlaCSVExporter($plaLdapExporter);
|
||||
break;
|
||||
default:
|
||||
// truly speaking,this default case will never be reached. See check at the bottom.
|
||||
$plaLdapExporter->pla_close();
|
||||
pla_error( $lang['no_exporter_found'] );
|
||||
}
|
||||
|
||||
// set the CLRN
|
||||
$exporter->setOutputFormat($br);
|
||||
|
||||
// prevent script from bailing early for long search
|
||||
@set_time_limit( 0 );
|
||||
|
||||
// send the header
|
||||
if( $save_as_file )
|
||||
header( "Content-type: application/download" );
|
||||
else
|
||||
header( "Content-type: text/plain" );
|
||||
header( "Content-Disposition: filename=$friendly_rdn.".$exporters[$exporter_id]['extension'] );
|
||||
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
|
||||
header( "Cache-Control: post-check=0, pre-check=0", false );
|
||||
|
||||
// and export
|
||||
$exporter->export();
|
||||
?>
|
161
export_form.php
@@ -1,161 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_form.php,v 1.19 2004/10/24 23:51:49 uugdave Exp $
|
||||
|
||||
/**
|
||||
* export_form.php
|
||||
* --------------------
|
||||
*
|
||||
* Html form to choose an export format(ldif,...)
|
||||
*
|
||||
*/
|
||||
|
||||
require 'export_functions.php';
|
||||
|
||||
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id']:NULL ;
|
||||
$format = isset( $_GET['format'] ) ? $_GET['format'] : get_line_end_format();
|
||||
$scope = isset( $_GET['scope'] ) ? $_GET['scope'] : 'base' ;
|
||||
$exporter_id = isset( $_GET['exporter_id'] ) ? $_GET['exporter_id'] : 0 ;
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
|
||||
$filter = isset( $_GET['filter'] ) ? $_GET['filter'] : '(objectClass=*)';
|
||||
$attributes = isset( $_GET['attributes'] ) ? $_GET['attributes'] : '*';
|
||||
$sys_attr = isset( $_GET['sys_attr'] ) && $_GET['sys_attr'] == 'true' ? true : false;
|
||||
|
||||
$available_formats = array(
|
||||
'unix' => 'UNIX (Linux, BSD)',
|
||||
'mac' => 'Macintosh',
|
||||
'win' => 'Windows'
|
||||
);
|
||||
|
||||
$available_scopes = array(
|
||||
'base' => $lang['scope_base'],
|
||||
'one' => $lang['scope_one'],
|
||||
'sub' => $lang['scope_sub']
|
||||
);
|
||||
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
<h3 class="title"><?php echo $lang['export']; ?></h3>
|
||||
<br />
|
||||
<center>
|
||||
<form name="export_form" action="export.php" method="POST">
|
||||
<table class="export_form">
|
||||
<tr>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang['export']; ?></legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td><?php echo $lang['server']; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if( count($servers) > 1 ){
|
||||
echo '<select name="server_id">';
|
||||
foreach( $servers as $id => $server )
|
||||
if( $server['host'] )
|
||||
echo "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . htmlspecialchars($server['name']) . "</option>\n";
|
||||
echo '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
echo '<input type="hidden" name="server_id" value="'.key($servers).'" />' .
|
||||
'<b>' . $server['name'] . '</b>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="white-space:nowrap"><?php echo $lang['base_dn']; ?></td>
|
||||
<td><nobr><input type="text" name="dn" id="dn" style="width:230px" value="<?php echo htmlspecialchars( $dn ); ?>" /> <?php draw_chooser_link( 'export_form.dn' ); ?></nobr></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="white-space: nowrap"><?php echo $lang['search_scope']; ?></span></td>
|
||||
<td>
|
||||
<?php foreach( $available_scopes as $id => $desc ) {
|
||||
$id = htmlspecialchars( $id );
|
||||
$desc = htmlspecialchars( $desc ); ?>
|
||||
|
||||
<input type="radio" name="scope" value="<?php echo $id; ?>" id="<?php echo $id; ?>"<?php if($id==$scope) echo ' checked="true"';?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang['search_filter']; ?></td>
|
||||
<td><input type="text" name="filter" style="width:300px" value="<?php echo htmlspecialchars($filter); ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="checkbox" name="sys_attr" id="sys_attr" <?php if( $sys_attr ) echo 'checked="true" '; ?>/> <label for="sys_attr"><?php echo $lang['include_system_attrs']; ?></label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="checkbox" id="save_as_file" name="save_as_file" /><label for="save_as_file"><?php echo $lang['save_as_file']; ?></label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table style="width: 100%">
|
||||
<tr><td style="width: 50%">
|
||||
<fieldset style="height: 100px">
|
||||
<legend><?php echo $lang['export_format']; ?></legend>
|
||||
|
||||
<?php foreach($exporters as $index => $exporter){?>
|
||||
|
||||
<input type="radio" name="exporter_id" value="<?php echo htmlspecialchars($index); ?>" id="<?php echo htmlspecialchars($index); ?>" <?php if($index==$exporter_id) echo ' checked="true"'; ?> />
|
||||
<label for="<?php echo htmlspecialchars( $index ); ?>"><?php echo htmlspecialchars( $exporter['desc'] ); ?></label><br />
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</fieldset>
|
||||
</td>
|
||||
<td style="width: 50%">
|
||||
<fieldset style="height: 100px">
|
||||
<legend><?php echo $lang['line_ends']; ?></legend>
|
||||
<?php foreach( $available_formats as $id => $desc ) {
|
||||
$id = htmlspecialchars( $id );
|
||||
$desc = htmlspecialchars( $desc );
|
||||
?>
|
||||
|
||||
<input type="radio" name="format" value="<?php echo $id; ?>" id="<?php echo $id; ?>"<?php if($format==$id) echo ' checked="true"'; ?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
|
||||
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<center>
|
||||
<input type="submit" name="target" value="<?php echo $lang['proceed_gt']; ?>" />
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Helper functoin for fetching the line end format.
|
||||
* @return String 'win', 'unix', or 'mac' based on the user's browser..
|
||||
*/
|
||||
function get_line_end_format()
|
||||
{
|
||||
if( is_browser_os_windows() )
|
||||
return 'win';
|
||||
elseif( is_browser_os_unix() )
|
||||
return 'unix';
|
||||
elseif( is_browser_os_mac() )
|
||||
return 'mac';
|
||||
else
|
||||
return 'unix';
|
||||
}
|
@@ -1,857 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_functions.php,v 1.20 2004/11/03 22:00:52 xrenard Exp $
|
||||
|
||||
/**
|
||||
* Fuctions and classes for exporting ldap entries to others formats
|
||||
* (LDIF,DSML,..)
|
||||
* An example is provided at the bottom of this file if you want implement yours. *
|
||||
* @package phpLDAPadmin
|
||||
* @author The phpLDAPadmin development team
|
||||
* @see export.php and export_form.php
|
||||
*/
|
||||
|
||||
// include common configuration definitions
|
||||
include('common.php');
|
||||
|
||||
// registry for the exporters
|
||||
$exporters = array();
|
||||
|
||||
$exporters[] = array('output_type'=>'ldif',
|
||||
'desc' => 'LDIF',
|
||||
'extension' => 'ldif'
|
||||
);
|
||||
|
||||
$exporters[] = array('output_type'=>'dsml',
|
||||
'desc' => 'DSML V.1',
|
||||
'extension' => 'xml'
|
||||
);
|
||||
|
||||
$exporters[] = array('output_type'=>'vcard',
|
||||
'desc' => 'VCARD 2.1',
|
||||
'extension' => 'vcf'
|
||||
);
|
||||
$exporters[] = array('output_type'=>'csv',
|
||||
'desc' => $lang['csv_spreadsheet'],
|
||||
'extension' => 'csv'
|
||||
);
|
||||
|
||||
/**
|
||||
* This class encapsulate informations about the ldap server
|
||||
* from which the export is done.
|
||||
* The following info are provided within this class:
|
||||
*
|
||||
* $server_id: the id of the server.
|
||||
* $base_dn: if the source of the export is the ldap server,
|
||||
* it indicates the base dn of the search.
|
||||
* $query_filter: if the source of the export is the ldap server,
|
||||
* it indicates the query filter for the search.
|
||||
* $scope: if the source of the export is the ldap server,
|
||||
* it indicates the scope of the search.
|
||||
* $server_host: the host name of the server.
|
||||
* $server_name: the name of the server.
|
||||
*/
|
||||
|
||||
class LdapInfo{
|
||||
|
||||
var $base_dn;
|
||||
var $query_filter;
|
||||
var $scope;
|
||||
var $server_host = NULL;
|
||||
var $server_name = NULL;
|
||||
var $server_id = NULL;
|
||||
|
||||
/**
|
||||
* Create a new LdapInfo object
|
||||
*
|
||||
* @param int $server_id the server id
|
||||
* @param String $base_dn the base_dn for the search in a ldap server
|
||||
* @param String $query_filter the query filter for the search
|
||||
* @param String scope the scope of the search in a ldap server
|
||||
*/
|
||||
|
||||
function LdapInfo($server_id,$base_dn = NULL,$query_filter = NULL,$scope = NULL){
|
||||
global $servers;
|
||||
$this->base_dn = $base_dn;
|
||||
$this->query_filter = $query_filter;
|
||||
$this->scope = $scope;
|
||||
$this->server_name = $servers[ $server_id ][ 'name' ];
|
||||
$this->server_host = $servers[ $server_id ][ 'host' ];
|
||||
$this->server_id = $server_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class represents the base class of all exporters
|
||||
* It can be subclassed directly if your intend is to write
|
||||
* a source exporter(ie. it will act only as a decoree
|
||||
* which will be wrapped by an another exporter.)
|
||||
* If you consider writting an exporter for filtering data
|
||||
* or directly display entries, please consider subclass
|
||||
* the PlaExporter
|
||||
*
|
||||
* @see PlaExporter
|
||||
*/
|
||||
|
||||
class PlaAbstractExporter{
|
||||
|
||||
/**
|
||||
* Return the number of entries
|
||||
* @return int the number of entries to be exported
|
||||
*/
|
||||
function pla_num_entries(){}
|
||||
|
||||
/**
|
||||
* Return true if there is some more entries to be processed
|
||||
* @return bool if there is some more entries to be processed
|
||||
*/
|
||||
function pla_has_entry(){}
|
||||
|
||||
/**
|
||||
* Return the entry as an array
|
||||
* @return array an entry as an array
|
||||
*/
|
||||
function pla_fetch_entry_array(){}
|
||||
|
||||
/**
|
||||
* Return the entry as an Entry object
|
||||
* @return Entry an entry as an Entry Object
|
||||
*/
|
||||
function pla_fetch_entry_object(){}
|
||||
|
||||
/**
|
||||
* Return a PlaLdapInfo Object
|
||||
* @return LdapInfo Object with info from the ldap serveur
|
||||
*/
|
||||
function pla_get_ldap_info(){}
|
||||
|
||||
/**
|
||||
* May be call when the processing is finished
|
||||
* and to free some ressources.
|
||||
* @return bool true or false if any errors is encountered
|
||||
*/
|
||||
function pla_close(){}
|
||||
|
||||
}// end PlaAbstractExporter
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PlaExporter acts a wrapper around another exporter.
|
||||
* In other words, it will act as a decorator for another decorator
|
||||
*/
|
||||
|
||||
class PlaExporter extends PlaAbstractExporter{
|
||||
// the default CRLN
|
||||
var $br="\n";
|
||||
// the wrapped $exporter
|
||||
var $exporter;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param source $source the decoree for this exporter
|
||||
*/
|
||||
function PlaExporter( $source ){
|
||||
$this->exporter = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of entries
|
||||
* @return int the number of entries to be exported
|
||||
*/
|
||||
function pla_num_entries(){
|
||||
return $this->exporter->pla_num_entries();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there is some more entries to be processed
|
||||
* @return bool if there is some more entries to be processed
|
||||
*/
|
||||
function pla_has_entry(){
|
||||
return $this->exporter->pla_has_entry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entry as an array
|
||||
* @return array an entry as an array
|
||||
*/
|
||||
function pla_fetch_entry_array(){
|
||||
return $this->exporter->pla_fetch_entry_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entry as an Entry object
|
||||
* @return Entry an entry as an Entry Object
|
||||
*/
|
||||
function pla_fetch_entry_object(){
|
||||
return $this->exporter->pla_fetch_entry_object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a PlaLdapInfo Object
|
||||
* @return LdapInfo Object with info from the ldap serveur
|
||||
*/
|
||||
function pla_get_ldap_info(){
|
||||
return $this->exporter->pla_get_ldap_info();
|
||||
}
|
||||
|
||||
/**
|
||||
* May be call when the processing is finished
|
||||
* and to free some ressources.
|
||||
* @return bool false if any errors are encountered,false otherwise
|
||||
*/
|
||||
function pla_close(){
|
||||
return $this->exporter->pla_close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to check if the attribute value should be base 64 encoded.
|
||||
* @param String $str the string to check.
|
||||
* @return bool true if the string is safe ascii, false otherwise.
|
||||
*/
|
||||
function is_safe_ascii( $str ){
|
||||
for( $i=0; $i<strlen($str); $i++ )
|
||||
if( ord( $str{$i} ) < 32 || ord( $str{$i} ) > 127 )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method use to export data.
|
||||
* Must be implemented in a sub-class if you write an exporter
|
||||
* which export data.
|
||||
* Leave it empty if you write a sub-class which do only some filtering.
|
||||
*/
|
||||
function export(){}
|
||||
|
||||
/**
|
||||
* Set the carriage return /linefeed for the export
|
||||
* @param String $br the CRLF to be set
|
||||
*/
|
||||
function setOutputFormat( $br ){
|
||||
$this->br = $br;
|
||||
}
|
||||
|
||||
}// end PlaExporter
|
||||
|
||||
|
||||
/**
|
||||
* Export data from a ldap server
|
||||
* @extends PlaAbstractExporter
|
||||
*/
|
||||
|
||||
class PlaLdapExporter extends PlaAbstractExporter{
|
||||
var $entry_id;
|
||||
var $results;
|
||||
var $server_id;
|
||||
var $scope;
|
||||
var $entry_array;
|
||||
var $num_entries;
|
||||
var $ldap_info;
|
||||
var $queryFilter;
|
||||
var $hasNext;
|
||||
var $connection_open_state;
|
||||
var $attributes;
|
||||
/**
|
||||
* Create a PlaLdapExporter object.
|
||||
* @param int $server_id the server id
|
||||
* @param String $queryFilter the queryFilter for the export
|
||||
* @param String $base_dn the base_dn for the data to export
|
||||
* @param String $scope the scope for export
|
||||
*/
|
||||
function PlaLdapExporter( $server_id , $queryFilter , $base_dn , $scope, $attributes){
|
||||
global $lang;
|
||||
$this->scope = $scope;
|
||||
$this->base_dn = $base_dn;
|
||||
$this->server_id = $server_id;
|
||||
$this->queryFilter = $queryFilter;
|
||||
// infos for the server
|
||||
$this->ldap_info = new LdapInfo($server_id,$base_dn,$queryFilter,$scope);
|
||||
// boolean to check if there is more entries
|
||||
$this->hasNext = 0;
|
||||
// boolean to check the state of the connection
|
||||
$this->connection_open_state = 0;
|
||||
|
||||
$this->attributes = $attributes;
|
||||
// connect to the server
|
||||
$this->ds = @pla_ldap_connect( $this->server_id );
|
||||
pla_ldap_connection_is_error( $this->ds );
|
||||
$this->connection_open_state = 1;
|
||||
|
||||
// get the data to be exported
|
||||
if( $this->scope == 'base' )
|
||||
$this->results = @ldap_read( $this->ds, $this->base_dn, $this->queryFilter,$this->attributes,
|
||||
0, 0, 0, get_export_deref_setting() );
|
||||
elseif( $this->scope == 'one' )
|
||||
$this->results = @ldap_list( $this->ds, $this->base_dn, $this->queryFilter, $this->attributes,
|
||||
0, 0, 0, get_export_deref_setting() );
|
||||
else // scope == 'sub'
|
||||
$this->results = @ldap_search( $this->ds, $this->base_dn, $this->queryFilter, $this->attributes,
|
||||
0, 0, 0, get_export_deref_setting() );
|
||||
|
||||
// if no result, there is a something wrong
|
||||
if( ! $this->results )
|
||||
pla_error( $lang['error_performing_search'], ldap_error( $this->ds ), ldap_errno( $this->ds ) );
|
||||
|
||||
// get the number of entries to be exported
|
||||
$this->num_entries = @ldap_count_entries( $this->ds,$this->results );
|
||||
|
||||
if( $this->entry_id = @ldap_first_entry( $this->ds,$this->results ) ){
|
||||
$this->hasNext = 1;
|
||||
}
|
||||
}//end constructor
|
||||
|
||||
/**
|
||||
* Return the entry as an array
|
||||
* @return array an entry as an array
|
||||
*/
|
||||
function pla_fetch_entry_array(){
|
||||
return $this->entry_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entry as an Entry object
|
||||
* @return Entry an entry as an Entry Object
|
||||
*/
|
||||
function pla_fetch_entry_object(){
|
||||
// to do
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a PlaLdapInfo Object
|
||||
* @return LdapInfo Object with info from the ldap serveur
|
||||
*/
|
||||
function pla_get_ldap_info(){
|
||||
return $this->ldap_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of entries
|
||||
* @return int the number of entries to be exported
|
||||
*/
|
||||
function pla_num_entries(){
|
||||
return $this->num_entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there is some more entries to be processed
|
||||
* @return bool if there is some more entries to be processed
|
||||
*/
|
||||
function pla_has_entry(){
|
||||
if( $this->hasNext ){
|
||||
unset( $this->entry_array );
|
||||
$dn = @ldap_get_dn( $this->ds,$this->entry_id );
|
||||
$this->entry_array['dn'] = $dn;
|
||||
|
||||
//get the attributes of the entry
|
||||
$attrs = @ldap_get_attributes($this->ds,$this->entry_id);
|
||||
if( $attr = @ldap_first_attribute( $this->ds,$this->entry_id,$attrs ) ){
|
||||
|
||||
//iterate over the attributes
|
||||
while( $attr ){
|
||||
if( is_attr_binary( $this->server_id,$attr ) ){
|
||||
$this->entry_array[$attr] = @ldap_get_values_len( $this->ds,$this->entry_id,$attr );
|
||||
}
|
||||
else{
|
||||
$this->entry_array[$attr] = @ldap_get_values( $this->ds,$this->entry_id,$attr );
|
||||
}
|
||||
unset( $this->entry_array[$attr]['count'] );
|
||||
$attr = @ldap_next_attribute( $this->ds,$this->entry_id,$attrs );
|
||||
}// end while attr
|
||||
|
||||
if(!$this->entry_id = @ldap_next_entry( $this->ds,$this->entry_id ) ){
|
||||
$this->hasNext = 0;
|
||||
}
|
||||
}// end if attr
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
$this->pla_close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* May be call when the processing is finished
|
||||
* and to free some ressources.
|
||||
* @return bool true or false if any errors is encountered
|
||||
*/
|
||||
function pla_close(){
|
||||
if($this->connection_open_state){
|
||||
return @ldap_close( $this->ds );
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} // end PlaLdapExporter
|
||||
|
||||
/**
|
||||
* Export entries to ldif format
|
||||
* @extends PlaExporter
|
||||
*/
|
||||
|
||||
class PlaLdifExporter extends PlaExporter{
|
||||
|
||||
// variable to keep the count of the entries
|
||||
var $counter = 0;
|
||||
|
||||
// the maximum length of the ldif line
|
||||
var $MAX_LDIF_LINE_LENGTH = 76;
|
||||
|
||||
/**
|
||||
* Create a PlaLdifExporter object
|
||||
* @param PlaAbstractExporter $exporter the source exporter
|
||||
*/
|
||||
function PlaLdifExporter( $exporter ){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export entries to ldif format
|
||||
*/
|
||||
function export(){
|
||||
$pla_ldap_info = $this->pla_get_ldap_info();
|
||||
$this->displayExportInfo($pla_ldap_info);
|
||||
|
||||
//While there is an entry, fecth the entry as an array
|
||||
while($this->pla_has_entry()){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
$this->counter++;
|
||||
|
||||
// display comment before each entry
|
||||
global $lang;
|
||||
$title_string = "# " . $lang['entry'] . " " . $this->counter . ": " . $entry['dn'] ;
|
||||
if( strlen( $title_string ) > $this->MAX_LDIF_LINE_LENGTH-3 )
|
||||
$title_string = substr( $title_string, 0, $this->MAX_LDIF_LINE_LENGTH-3 ) . "...";
|
||||
echo "$title_string$this->br";
|
||||
|
||||
// display dn
|
||||
if( $this->is_safe_ascii( $entry['dn'] ))
|
||||
$this->multi_lines_display("dn:". $entry['dn']);
|
||||
else
|
||||
$this->multi_lines_display("dn:: " . base64_encode( $entry['dn'] ));
|
||||
array_shift($entry);
|
||||
|
||||
// display the attributes
|
||||
foreach( $entry as $key => $attr ){
|
||||
foreach( $attr as $value ){
|
||||
if( !$this->is_safe_ascii($value) || is_attr_binary($pla_ldap_info->server_id,$key ) ){
|
||||
$this->multi_lines_display( $key.":: " . base64_encode( $value ) );
|
||||
}
|
||||
else{
|
||||
$this->multi_lines_display( $key.": ".$value );
|
||||
}
|
||||
}
|
||||
}// end foreach $entry
|
||||
|
||||
echo $this->br;
|
||||
// flush every 5th entry (sppeds things up a bit)
|
||||
if( 0 == $this->counter % 5 )
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
// display info related to this export
|
||||
function displayExportInfo($pla_ldap_info){
|
||||
global $lang;
|
||||
echo "version: 1$this->br$this->br";
|
||||
echo "# " . sprintf( $lang['ldif_export_for_dn'], $pla_ldap_info->base_dn ) . $this->br;
|
||||
echo "# " . sprintf( $lang['generated_on_date'], date("F j, Y g:i a") ) . $this->br;
|
||||
echo "# " . $lang['server'] . ": " .$pla_ldap_info->server_name . " (" . $pla_ldap_info->server_host . ")" . $this->br;
|
||||
echo "# " . $lang['search_scope'] . ": " . $pla_ldap_info->scope . $this->br;
|
||||
echo "# " . $lang['total_entries'] . ": " . $this->pla_num_entries() . $this->br;
|
||||
echo $this->br;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to wrap ldif lines
|
||||
* @param String $str the line to be wrapped if needed.
|
||||
*/
|
||||
function multi_lines_display( $str ){
|
||||
|
||||
$length_string = strlen($str);
|
||||
$max_length = $this->MAX_LDIF_LINE_LENGTH;
|
||||
|
||||
while ($length_string > $max_length){
|
||||
echo substr($str,0,$max_length).$this->br." ";
|
||||
$str= substr($str,$max_length,$length_string);
|
||||
$length_string = strlen($str);
|
||||
|
||||
// need to do minus one to align on the right
|
||||
// the first line with the possible following lines
|
||||
// as these will have an extra space
|
||||
$max_length = $this->MAX_LDIF_LINE_LENGTH-1;
|
||||
}
|
||||
echo $str."".$this->br;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Export entries to DSML v.1
|
||||
* @extends PlaExporter
|
||||
*/
|
||||
|
||||
class PlaDsmlExporter extends PlaExporter{
|
||||
|
||||
//not in use
|
||||
var $indent_step = 2;
|
||||
var $counter = 0;
|
||||
|
||||
/**
|
||||
* Create a PlaDsmlExporter object
|
||||
* @param PlaAbstractExporter $exporter the decoree exporter
|
||||
*/
|
||||
function PlaDsmlExporter( $exporter ){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the entries to DSML
|
||||
*/
|
||||
function export(){
|
||||
global $lang;
|
||||
$pla_ldap_info = $this->pla_get_ldap_info();
|
||||
// not very elegant, but do the job for the moment as we have just 4 level
|
||||
$directory_entries_indent = " ";
|
||||
$entry_indent= " ";
|
||||
$attr_indent = " ";
|
||||
$attr_value_indent = " ";
|
||||
|
||||
// print declaration
|
||||
echo "<?xml version=\"1.0\"?>$this->br";
|
||||
|
||||
// print root element
|
||||
echo "<dsml>$this->br";
|
||||
|
||||
// print info related to this export
|
||||
echo "<!-- " . $this->br;
|
||||
echo "# " . sprintf( $lang['dsml_export_for_dn'], $pla_ldap_info->base_dn ) . $this->br;
|
||||
echo "# " . sprintf( $lang['generated_on_date'], date("F j, Y g:i a") ) . $this->br;
|
||||
echo "# " . $lang['server'] . ": " . $pla_ldap_info->server_name . " (" . $pla_ldap_info->server_host . ")" . $this->br;
|
||||
echo "# " . $lang['search_scope'] . ": " . $pla_ldap_info->scope . $this->br;
|
||||
echo "# " . $lang['total_entries'] . ": " . $this->pla_num_entries() . $this->br;
|
||||
echo "-->" . $this->br;
|
||||
|
||||
|
||||
echo $directory_entries_indent."<directory-entries>$this->br";
|
||||
//While there is an entry, fetch the entry as an array
|
||||
while($this->pla_has_entry()){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
$this->counter++;
|
||||
// display dn
|
||||
echo $entry_indent."<entry dn=\"". htmlspecialchars( $entry['dn'] ) ."\">".$this->br;
|
||||
array_shift($entry);
|
||||
|
||||
// echo the objectclass attributes first
|
||||
if(isset($entry['objectClass'])){
|
||||
echo $attr_indent."<objectClass>".$this->br;
|
||||
foreach($entry['objectClass'] as $ocValue){
|
||||
echo $attr_value_indent."<oc-value>$ocValue</oc-value>".$this->br;
|
||||
}
|
||||
echo $attr_indent."</objectClass>".$this->br;
|
||||
unset($entry['objectClass']);
|
||||
}
|
||||
|
||||
$binary_mode = 0;
|
||||
// display the attributes
|
||||
foreach($entry as $key=>$attr){
|
||||
echo $attr_indent."<attr name=\"$key\">".$this->br;
|
||||
|
||||
// if the attribute is binary, set the flag $binary_mode to true
|
||||
$binary_mode = is_attr_binary($pla_ldap_info->server_id,$key)?1:0;
|
||||
|
||||
foreach($attr as $value){
|
||||
echo $attr_value_indent."<value>".($binary_mode?base64_encode( $value): htmlspecialchars( $value ) )."</value>".$this->br;
|
||||
}
|
||||
echo $attr_indent."</attr>".$this->br;
|
||||
}// end foreach $entry
|
||||
echo $entry_indent."</entry>".$this->br;
|
||||
|
||||
// flush every 5th entry (speeds things up a bit)
|
||||
if( 0 == $this->counter % 5 )
|
||||
flush();
|
||||
}
|
||||
echo $directory_entries_indent."</directory-entries>$this->br";
|
||||
echo "</dsml>".$this->br;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PlaVcardExporter extends PlaExporter{
|
||||
|
||||
// mappping one to one attribute
|
||||
var $vcardMapping = array('cn' => 'FN',
|
||||
'title' => 'TITLE',
|
||||
'homePhone' => 'TEL;HOME',
|
||||
'mobile' => 'TEL;CELL',
|
||||
'mail' => 'EMAIL;Internet',
|
||||
'labeledURI' =>'URL',
|
||||
'o' => 'ORG',
|
||||
'audio' => 'SOUND',
|
||||
'facsmileTelephoneNumber' =>'TEL;WORK;HOME;VOICE;FAX',
|
||||
'jpegPhoto' => 'PHOTO;ENCODING=BASE64',
|
||||
'businessCategory' => 'ROLE',
|
||||
'description' => 'NOTE'
|
||||
);
|
||||
|
||||
var $deliveryAddress = array("postOfficeBox",
|
||||
"street",
|
||||
"l",
|
||||
"st",
|
||||
"postalCode",
|
||||
"c");
|
||||
|
||||
function PlaVcardExporter($exporter){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* When doing an exporter, the method export need to be overriden.
|
||||
* A basic implementation is provided here. Customize to your need
|
||||
**/
|
||||
|
||||
function export(){
|
||||
|
||||
// With the method pla->get_ldap_info,
|
||||
// you have access to some values related
|
||||
// to you ldap server
|
||||
$ldap_info = $this->pla_get_ldap_info();
|
||||
$base_dn = $ldap_info->base_dn;
|
||||
$server_id = $ldap_info->server_id;
|
||||
$scope = $ldap_info->scope;
|
||||
$server_name = $ldap_info->server_name;
|
||||
$server_host = $ldap_info->server_host;
|
||||
|
||||
while( $this->pla_has_entry() ){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
|
||||
//fetch the dn
|
||||
$dn = $entry['dn'];
|
||||
unset( $entry['dn'] );
|
||||
|
||||
// check the attributes needed for the delivery address
|
||||
// field
|
||||
$addr = "ADR:";
|
||||
foreach( $this->deliveryAddress as $attr_name ){
|
||||
if( isset( $entry[$attr_name] ) ){
|
||||
$addr .= $entry[$attr_name][0];
|
||||
unset($entry[$attr_name]);
|
||||
}
|
||||
$addr .= ';';
|
||||
}
|
||||
echo "BEGIN:VCARD$this->br";
|
||||
|
||||
// loop for the attributes
|
||||
foreach( $entry as $attr_name=>$attr_values ){
|
||||
|
||||
// if an attribute of the ldap entry exist
|
||||
// in the mapping array for vcard
|
||||
if( isset( $this->vcardMapping[$attr_name] ) ){
|
||||
|
||||
// case of organisation. Need to append the
|
||||
// possible ou attribute
|
||||
if( 0 == strcasecmp( $attr_name , 'o' )){
|
||||
echo $this->vcardMapping[$attr_name].":$attr_values[0]";
|
||||
if( isset($entry['ou'] ) )
|
||||
foreach( $entry['ou'] as $ou_value ){
|
||||
echo ";$ou_value";
|
||||
}
|
||||
}
|
||||
// the attribute is binary. (to do : need to fold the line)
|
||||
else if( 0 == strcasecmp( $attr_name,'audio') || 0 == strcasecmp( $attr_name,'jpegPhoto') ){
|
||||
echo $this->vcardMapping[$attr_name].":$this->br";
|
||||
echo " ".base64_encode( $attr_values[0]);
|
||||
}
|
||||
/* else if( $attr_name == "sn"){
|
||||
echo $this->vcardMapping[$attr_name].":$attr_values[0]";
|
||||
}
|
||||
elseif( $attr_name == "homePostalAddress"){
|
||||
}*/
|
||||
// else just print the value with the relevant attribute name
|
||||
else{
|
||||
echo $this->vcardMapping[$attr_name].":$attr_values[0]";
|
||||
}
|
||||
echo $this->br;
|
||||
}
|
||||
}
|
||||
// need to check
|
||||
echo "UID:$dn";
|
||||
echo $this->br;
|
||||
echo "VERSION:2.1";
|
||||
echo $this->br;
|
||||
echo $addr;
|
||||
echo $this->br;
|
||||
echo "END:VCARD";
|
||||
echo $this->br;
|
||||
}// end while
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Export to cvs format
|
||||
*
|
||||
* @author Glen Ogilvie
|
||||
*/
|
||||
|
||||
class PlaCSVExporter extends PlaExporter{
|
||||
|
||||
function PlaCSVExporter($exporter){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* When doing an exporter, the method export need to be overriden.
|
||||
* A basic implementation is provided here. Customize to your need
|
||||
**/
|
||||
|
||||
var $separator = ",";
|
||||
var $qualifier = '"';
|
||||
var $multivalue_separator = " | ";
|
||||
var $escapeCode = '"';
|
||||
|
||||
function export(){
|
||||
|
||||
// With the method pla->get_ldap_info,
|
||||
// you have access to some values related
|
||||
// to you ldap server
|
||||
$ldap_info = $this->pla_get_ldap_info();
|
||||
$base_dn = $ldap_info->base_dn;
|
||||
$server_id = $ldap_info->server_id;
|
||||
$scope = $ldap_info->scope;
|
||||
$server_name = $ldap_info->server_name;
|
||||
$server_host = $ldap_info->server_host;
|
||||
|
||||
$entries = array();
|
||||
$headers = array();
|
||||
|
||||
// go thru and find all the attribute names first. This is needed, because, otherwise we have
|
||||
// no idea as to which search attributes were actually populated with data
|
||||
while( $this->pla_has_entry() ) {
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
foreach (array_keys($entry) as $key) {
|
||||
if (!in_array($key, $headers))
|
||||
array_push($headers,$key);
|
||||
}
|
||||
array_push($entries, $entry);
|
||||
}
|
||||
|
||||
$num_headers = count($headers);
|
||||
|
||||
// print out the headers
|
||||
for ($i = 0; $i < $num_headers; $i++) {
|
||||
echo $this->qualifier. $headers[$i].$this->qualifier;
|
||||
if ($i < $num_headers-1)
|
||||
echo $this->separator;
|
||||
}
|
||||
|
||||
array_shift($headers);
|
||||
$num_headers--;
|
||||
|
||||
echo $this->br;
|
||||
|
||||
// loop on every entry
|
||||
foreach ($entries as $entry) {
|
||||
|
||||
//print the dn
|
||||
$dn = $entry['dn'];
|
||||
unset( $entry['dn'] );
|
||||
echo $this->qualifier. $this->LdapEscape($dn).$this->qualifier.$this->separator;
|
||||
|
||||
// print the attributes
|
||||
for($j=0;$j<$num_headers;$j++){
|
||||
|
||||
$attr_name = $headers[$j];
|
||||
|
||||
echo $this->qualifier;
|
||||
if (key_exists($attr_name, $entry)) {
|
||||
$binary_attribute = is_attr_binary( $server_id, $attr_name )?1:0;
|
||||
|
||||
$attr_values = $entry[$attr_name];
|
||||
|
||||
$num_attr_values = count( $attr_values );
|
||||
for( $i=0 ; $i<$num_attr_values; $i++){
|
||||
if($binary_attribute)
|
||||
echo base64_encode($attr_values[$i]);
|
||||
else
|
||||
echo $this->LdapEscape($attr_values[$i]);
|
||||
|
||||
if($i < $num_attr_values - 1)
|
||||
echo $this->multivalue_separator;
|
||||
|
||||
}
|
||||
}// end if key
|
||||
echo $this->qualifier;
|
||||
if( $j < $num_headers - 1 )
|
||||
echo $this->separator;
|
||||
}
|
||||
echo $this->br;
|
||||
}
|
||||
}//end export
|
||||
|
||||
// function to escape data, where the qualifier happens to also
|
||||
// be in the data.
|
||||
function LdapEscape ($var) {
|
||||
return str_replace($this->qualifier, $this->escapeCode.$this->qualifier, $var);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class MyCustomExporter extends PlaExporter{
|
||||
|
||||
function MyCutsomExporter($exporter){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* When doing an exporter, the method export need to be overriden.
|
||||
* A basic implementation is provided here. Customize to your need
|
||||
**/
|
||||
|
||||
|
||||
function export(){
|
||||
|
||||
// With the method pla->get_ldap_info,
|
||||
// you have access to some values related
|
||||
// to you ldap server
|
||||
$ldap_info = $this->pla_get_ldap_info();
|
||||
$base_dn = $ldap_info->base_dn;
|
||||
$server_id = $ldap_info->server_id;
|
||||
$scope = $ldap_info->scope;
|
||||
$server_name = $ldap_info->server_name;
|
||||
$server_host = $ldap_info->server_host;
|
||||
|
||||
|
||||
// Just a simple loop. For each entry
|
||||
// do your custom export
|
||||
// see PlaLdifExporter or PlaDsmlExporter as an example
|
||||
while( $this->pla_has_entry() ){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
|
||||
//fetch the dn
|
||||
$dn = $entry['dn'];
|
||||
unset( $entry['dn'] );
|
||||
|
||||
// loop for the attributes
|
||||
foreach( $entry as $attr_name=>$attr_values ){
|
||||
foreach( $attr_values as $value ){
|
||||
|
||||
// simple example
|
||||
// echo "Attribute Name:".$attr_name;
|
||||
// echo " - value:".$value;
|
||||
// echo $this->br;
|
||||
}
|
||||
}
|
||||
|
||||
}// end while
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
3661
functions.php
33
header.php
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/header.php,v 1.14 2004/10/24 23:51:49 uugdave Exp $
|
||||
|
||||
// We want to get $language into scope in case we were included
|
||||
// from within a function
|
||||
global $language;
|
||||
|
||||
// text/xml won't work with MSIE, but is very useful for debugging xhtml code.
|
||||
//@header( "Content-type: text/xml; charset=\"UTF-8\"" );
|
||||
@header( "Content-type: text/html; charset=\"UTF-8\"" );
|
||||
|
||||
// XML version and encoding for well-behaved browsers
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
|
||||
?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language; ?>" lang="<?php echo $language; ?>" dir="ltr">
|
||||
<head>
|
||||
<title>phpLDAPadmin</title>
|
||||
<link rel="stylesheet" href="style.css" media="screen" />
|
||||
<?php
|
||||
if( isset( $server_id ) ) {
|
||||
$custom_file = get_custom_file( $server_id, 'style.css' );
|
||||
if( strcmp( $custom_file, 'style.css' ) != 0 ) { ?>
|
||||
<link rel="stylesheet" href="<?php echo $custom_file ?>" media="screen" />
|
||||
<?php } } ?>
|
||||
<script src="entry_chooser.js" type="text/javascript"></script>
|
||||
<script src="ie_png_work_around.js" type="text/javascript"></script>
|
||||
<script src="search_util.js" type="text/javascript"></script>
|
||||
<script src="generic_utils.js" type="text/javascript"></script>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
</head>
|
21
help.php
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">Help</h3>
|
||||
<br />
|
||||
<center>
|
||||
<p>Do you have a problem or question?</p>
|
||||
<p>Perhaps you are new to LDAP and need a little guidance?</p>
|
||||
<p>Help is only one click away. Visit the online <a href="http://www.phpldapadmin.com/forum">phpLDAPadmin support forum</a>.</p>
|
||||
<br />
|
||||
<p>(Note that paying members will receive priority support, so <a target="new" href="https://www.phpldapadmin.com/product_info.php/products_id/28">buy your membership</a> today.)</p>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
167
htdocs/add_attr.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.18.2.7 2005/12/09 23:32:37 wurley Exp $
|
||||
|
||||
/**
|
||||
* Adds an attribute/value pair to an object
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as POST vars:
|
||||
* - dn
|
||||
* - attr
|
||||
* - val
|
||||
* - binary
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @todo: For boolean attributes, convert the response to TRUE/FALSE.
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( _('You cannot perform updates while server is in read-only mode') );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( _('Not enough information to login to server. Please check your configuration.') );
|
||||
|
||||
$attr = $_POST['attr'];
|
||||
$val = isset( $_POST['val'] ) ? $_POST['val'] : false;;
|
||||
$dn = $_POST['dn'] ;
|
||||
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
|
||||
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
|
||||
if( ! $is_binary_val && $val == "" ) {
|
||||
pla_error( _('You left the attribute value blank. Please go back and try again.') );
|
||||
}
|
||||
|
||||
// special case for binary attributes (like jpegPhoto and userCertificate):
|
||||
// we must go read the data from the file and override $val with the binary data
|
||||
// Secondly, we must check if the ";binary" option has to be appended to the name
|
||||
// of the attribute.
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($dn,$attr,array($val))) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$ldapserver->server_id,$attr,$badattr);
|
||||
pla_error(sprintf( _('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
if( $is_binary_val ) {
|
||||
if( 0 == $_FILES['val']['size'] )
|
||||
pla_error( _('The file you chose is either empty or does not exist. Please go back and try again.') );
|
||||
|
||||
if( ! is_uploaded_file( $_FILES['val']['tmp_name'] ) ) {
|
||||
|
||||
if( isset( $_FILES['val']['error'] ) )
|
||||
|
||||
switch($_FILES['val']['error']) {
|
||||
case 0: //no error; possible file attack!
|
||||
pla_error( _('Security error: The file being uploaded may be malicious.') );
|
||||
break;
|
||||
|
||||
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
pla_error( _('The file you uploaded is too large. Please check php.ini, upload_max_size setting') );
|
||||
break;
|
||||
|
||||
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form
|
||||
pla_error( _('The file you uploaded is too large. Please check php.ini, upload_max_size setting') );
|
||||
break;
|
||||
|
||||
case 3: //uploaded file was only partially uploaded
|
||||
pla_error( _('The file you selected was only partially uploaded, likley due to a network error.') );
|
||||
break;
|
||||
|
||||
case 4: //no file was uploaded
|
||||
pla_error( _('You left the attribute value blank. Please go back and try again.') );
|
||||
break;
|
||||
|
||||
default: //a default error, just in case! :)
|
||||
pla_error( _('Security error: The file being uploaded may be malicious.') );
|
||||
break;
|
||||
}
|
||||
|
||||
else
|
||||
pla_error( _('Security error: The file being uploaded may be malicious.') );
|
||||
}
|
||||
|
||||
$file = $_FILES['val']['tmp_name'];
|
||||
$f = fopen( $file, 'r' );
|
||||
$binary_data = fread( $f, filesize( $file ) );
|
||||
fclose( $f );
|
||||
|
||||
$val = $binary_data;
|
||||
|
||||
if( is_binary_option_required( $ldapserver, $attr ) )
|
||||
$attr .= ";binary";
|
||||
}
|
||||
|
||||
/* Automagically hash new userPassword attributes according to the
|
||||
chosen in config.php. */
|
||||
if( 0 == strcasecmp( $attr, 'userpassword' ) ) {
|
||||
if (trim($ldapserver->default_hash) != '' ) {
|
||||
$enc_type = $ldapserver->default_hash;
|
||||
$val = password_hash( $val, $enc_type );
|
||||
}
|
||||
}
|
||||
|
||||
elseif (strcasecmp($attr,'sambaNTPassword') == 0) {
|
||||
$sambapassword = new smbHash;
|
||||
$val = $sambapassword->nthash($val);
|
||||
}
|
||||
|
||||
elseif (strcasecmp($attr,'sambaLMPassword') == 0) {
|
||||
$sambapassword = new smbHash;
|
||||
$val = $sambapassword->lmhash($val);
|
||||
}
|
||||
|
||||
$new_entry = array( $attr => $val );
|
||||
$result = $ldapserver->attrModify($dn,$new_entry);
|
||||
|
||||
if ($result)
|
||||
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=%s',
|
||||
$ldapserver->server_id,$encoded_dn,$encoded_attr));
|
||||
|
||||
else
|
||||
pla_error( _('Failed to add the attribute.'),$ldapserver->error(),$ldapserver->errno() );
|
||||
|
||||
/**
|
||||
* Check if we need to append the ;binary option to the name
|
||||
* of some binary attribute
|
||||
*
|
||||
* @param object $ldapserver Server Object that the attribute is in.
|
||||
* @param attr $attr Attribute to test to see if it requires ;binary added to it.
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
function is_binary_option_required( $ldapserver, $attr ) {
|
||||
|
||||
// list of the binary attributes which need the ";binary" option
|
||||
$binary_attributes_with_options = array(
|
||||
// Superior: Ldapv3 Syntaxes (1.3.6.1.4.1.1466.115.121.1)
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => "userCertificate",
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => "caCertificate",
|
||||
'1.3.6.1.4.1.1466.115.121.1.10' => "crossCertificatePair",
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => "certificateRevocationList",
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => "authorityRevocationList",
|
||||
// Superior: Netscape Ldap attributes types (2.16.840.1.113730.3.1)
|
||||
'2.16.840.1.113730.3.1.40' => "userSMIMECertificate"
|
||||
);
|
||||
|
||||
// quick check by attr name (short circuits the schema check if possible)
|
||||
//foreach( $binary_attributes_with_options as $oid => $name )
|
||||
//if( 0 == strcasecmp( $attr, $name ) )
|
||||
//return true;
|
||||
|
||||
$schema_attr = $ldapserver->getSchemaAttribute($attr);
|
||||
if( ! $schema_attr )
|
||||
return false;
|
||||
|
||||
$syntax = $schema_attr->getSyntaxOID();
|
||||
if( isset( $binary_attributes_with_options[ $syntax ] ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
?>
|
197
htdocs/add_attr_form.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.13.2.2 2005/12/09 14:27:32 wurley Exp $
|
||||
|
||||
/**
|
||||
* Displays a form for adding an attribute/value to an LDAP entry.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( _('You cannot perform updates while server is in read-only mode') );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( _('Not enough information to login to server. Please check your configuration.') );
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$rdn = get_rdn( $dn );
|
||||
|
||||
$friendly_attrs = process_friendly_attr_table();
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo sprintf( _('Add new attribute'), htmlspecialchars( $rdn ) ); ?></b></h3>
|
||||
<h3 class="subtitle"><?php echo _('Server'); ?>: <b><?php echo $ldapserver->name; ?></b> <?php echo _('Distinguished Name'); ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
|
||||
|
||||
<?php $attrs = $ldapserver->getDNAttrs($dn);
|
||||
|
||||
$oclasses = $ldapserver->getDNAttr($dn,'objectClass');
|
||||
if( ! is_array( $oclasses ) )
|
||||
$oclasses = array( $oclasses );
|
||||
|
||||
$avail_attrs = array();
|
||||
|
||||
$schema_oclasses = $ldapserver->SchemaObjectClasses($dn);
|
||||
foreach( $oclasses as $oclass ) {
|
||||
$schema_oclass = $ldapserver->getSchemaObjectClass($oclass,$dn);
|
||||
|
||||
if( $schema_oclass && 0 == strcasecmp( '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 ($ldapserver->isAttrBinary($attr)) {
|
||||
$avail_binary_attrs[] = $attr;
|
||||
unset( $avail_attrs[ $i ] );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<br />
|
||||
|
||||
<center>
|
||||
|
||||
<?php echo _('Add new attribute');
|
||||
|
||||
if( is_array( $avail_attrs ) && count( $avail_attrs ) > 0 ) { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<form action="add_attr.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
|
||||
|
||||
<select name="attr">
|
||||
|
||||
<?php $attr_select_html = '';
|
||||
usort($avail_attrs,"sortAttrs");
|
||||
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 _('Add'); ?>" class="update_dn" />
|
||||
</form>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<small>(<?php echo _('no new attributes available for this entry'); ?>)</small>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php echo _('Add new binary attribute');
|
||||
if( count( $avail_binary_attrs ) > 0 ) { ?>
|
||||
|
||||
<!-- Form to add a new BINARY attribute to this entry -->
|
||||
<form action="add_attr.php" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
||||
<input type="hidden" name="binary" value="true" />
|
||||
<br />
|
||||
|
||||
<select name="attr">
|
||||
|
||||
<?php $attr_select_html = '';
|
||||
|
||||
usort($avail_binary_attrs,"sortAttrs");
|
||||
|
||||
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 _('Add'); ?>" class="update_dn" />
|
||||
|
||||
<?php if( ! ini_get( 'file_uploads' ) )
|
||||
echo "<br><small><b>" . _('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.') . "</b></small><br>";
|
||||
|
||||
else
|
||||
echo "<br><small><b>" . sprintf( _('Maximum file size: %s'), ini_get( 'upload_max_filesize' ) ) . "</b></small><br>";
|
||||
?>
|
||||
|
||||
</form>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<small>(<?php echo _('no new binary attributes available for this entry'); ?>)</small>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Given an attribute $x, this returns true if it is NOT already specified
|
||||
* in the current entry, returns false otherwise.
|
||||
*
|
||||
* @param attr $x
|
||||
* @return bool
|
||||
* @ignore
|
||||
*/
|
||||
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;
|
||||
}
|
||||
?>
|
64
htdocs/add_oclass.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass.php,v 1.17.2.5 2005/12/09 23:32:37 wurley Exp $
|
||||
|
||||
/**
|
||||
* Adds an objectClass to the specified dn.
|
||||
*
|
||||
* Note, this does not do any schema violation checking. That is
|
||||
* performed in add_oclass_form.php.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - new_oclass
|
||||
* - new_attrs (array, if any)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( _('You cannot perform updates while server is in read-only mode') );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( _('Not enough information to login to server. Please check your configuration.') );
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$new_oclass = unserialize( rawurldecode( $_POST['new_oclass'] ) );
|
||||
$new_attrs = $_POST['new_attrs'];
|
||||
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
|
||||
if ($ldapserver->isAttrReadOnly('objectClass'))
|
||||
pla_error( "ObjectClasses are flagged as read only in the phpLDAPadmin configuration." );
|
||||
|
||||
$new_entry = array();
|
||||
$new_entry['objectClass'] = $new_oclass;
|
||||
|
||||
$new_attrs_entry = array();
|
||||
$new_oclass_entry = array( 'objectClass' => $new_oclass );
|
||||
|
||||
if( is_array( $new_attrs ) && count( $new_attrs ) > 0 )
|
||||
foreach( $new_attrs as $attr => $val ) {
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($dn,$attr,array($val))) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',
|
||||
$ldapserver->server_id,$attr,$badattr);
|
||||
pla_error(sprintf( _('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
$new_entry[ $attr ] = $val;
|
||||
}
|
||||
|
||||
$add_res = $ldapserver->attrModify($dn,$new_entry);
|
||||
|
||||
if (! $add_res)
|
||||
pla_error(_('Could not perform ldap_mod_add operation.'),$ldapserver->error(),$ldapserver->errno());
|
||||
|
||||
else
|
||||
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=objectclass',$ldapserver->server_id,$encoded_dn));
|
||||
?>
|
137
htdocs/add_oclass_form.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass_form.php,v 1.23.2.6 2005/12/09 23:32:37 wurley Exp $
|
||||
|
||||
/**
|
||||
* This page may simply add the objectClass and take you back to the edit page,
|
||||
* but, in one condition it may prompt the user for input. That condition is this:
|
||||
*
|
||||
* If the user has requested to add an objectClass that requires a set of
|
||||
* attributes with 1 or more not defined by the object. In that case, we will
|
||||
* present a form for the user to add those attributes to the object.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as REQUEST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - new_oclass
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @todo If an attribute expects a DN, show the dn browser.
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
require './common.php';
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( _('You cannot perform updates while server is in read-only mode') );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( _('Not enough information to login to server. Please check your configuration.') );
|
||||
|
||||
if (! isset($_REQUEST['new_oclass']))
|
||||
pla_error( _('You did not select any ObjectClasses for this object. Please go back and do so.'));
|
||||
|
||||
$new_oclass = $_REQUEST['new_oclass'];
|
||||
$dn = rawurldecode( $_REQUEST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
|
||||
/* Ensure that the object has defined all MUST attrs for this objectClass.
|
||||
* If it hasn't, present a form to have the user enter values for all the
|
||||
* newly required attrs. */
|
||||
|
||||
$entry = $ldapserver->getDNAttrs($dn,true);
|
||||
|
||||
$current_attrs = array();
|
||||
foreach( $entry as $attr => $junk )
|
||||
$current_attrs[] = strtolower($attr);
|
||||
|
||||
// grab the required attributes for the new objectClass
|
||||
$schema_oclasses = $ldapserver->SchemaObjectClasses();
|
||||
$must_attrs = array();
|
||||
foreach( $new_oclass as $oclass_name ) {
|
||||
$oclass = $ldapserver->getSchemaObjectClass($oclass_name);
|
||||
if( $oclass )
|
||||
$must_attrs = array_merge( $must_attrs, $oclass->getMustAttrNames( $schema_oclasses ) );
|
||||
}
|
||||
$must_attrs = array_unique( $must_attrs );
|
||||
|
||||
// We don't want any of the attr meta-data, just the string
|
||||
//foreach( $must_attrs as $i => $attr )
|
||||
//$must_attrs[$i] = $attr->getName();
|
||||
|
||||
// build a list of the attributes that this new objectClass requires,
|
||||
// but that the object does not currently contain
|
||||
$needed_attrs = array();
|
||||
foreach( $must_attrs as $attr ) {
|
||||
$attr = $ldapserver->getSchemaAttribute($attr);
|
||||
|
||||
//echo "<pre>"; var_dump( $attr ); echo "</pre>";
|
||||
|
||||
// First, check if one of this attr's aliases is already an attribute of this entry
|
||||
foreach( $attr->getAliases() as $alias_attr_name )
|
||||
if( in_array( strtolower( $alias_attr_name ), $current_attrs ) )
|
||||
|
||||
// Skip this attribute since it's already in the entry
|
||||
continue;
|
||||
|
||||
if( in_array( strtolower($attr->getName()), $current_attrs ) )
|
||||
continue;
|
||||
|
||||
// We made it this far, so the attribute needs to be added to this entry in order
|
||||
// to add this objectClass
|
||||
$needed_attrs[] = $attr;
|
||||
}
|
||||
|
||||
if( count( $needed_attrs ) > 0 ) {
|
||||
include './header.php'; ?>
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo _('New Required Attributes'); ?></h3>
|
||||
<h3 class="subtitle"><?php echo _('This action requires you to add') . ' ' . count($needed_attrs) .
|
||||
' ' . _('new attributes'); ?></h3>
|
||||
|
||||
<small>
|
||||
|
||||
<?php echo _('Instructions: In order to add these objectClass(es) to this entry, you must specify');
|
||||
echo ' ' . count( $needed_attrs ) . ' ' . _('new attributes') . ' ';
|
||||
echo _('that this objectClass requires. You can do so in this form.'); ?>
|
||||
|
||||
</small>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<form action="add_oclass.php" method="post">
|
||||
<input type="hidden" name="new_oclass" value="<?php echo rawurlencode( serialize( $new_oclass ) ); ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
|
||||
|
||||
<table class="edit_dn" cellspacing="0">
|
||||
<tr><th colspan="2"><?php echo _('New Required Attributes'); ?></th></tr>
|
||||
|
||||
<?php foreach( $needed_attrs as $count => $attr ) { ?>
|
||||
|
||||
<tr><td class="attr"><b><?php echo htmlspecialchars($attr->getName()); ?></b></td></tr>
|
||||
<tr><td class="val"><input type="text" name="new_attrs[<?php echo htmlspecialchars($attr->getName()); ?>]" value="" size="40" /></tr>
|
||||
<?php } ?>
|
||||
|
||||
</table>
|
||||
<br />
|
||||
<br />
|
||||
<center><input type="submit" value="<?php echo _('Add ObjectClass and Attributes'); ?>" /></center>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php } else {
|
||||
|
||||
$add_res = $ldapserver->attrModify($dn,array('objectClass'=>$new_oclass));
|
||||
if (! $add_res)
|
||||
pla_error("Could not perform ldap_mod_add operation.",
|
||||
$ldapserver->error(),$ldapserver->errno());
|
||||
else
|
||||
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=objectClass',
|
||||
$ldapserver->server_id,$encoded_dn));
|
||||
|
||||
}
|
||||
?>
|
74
htdocs/add_value.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.19.2.5 2005/12/09 23:32:37 wurley Exp $
|
||||
|
||||
/**
|
||||
* Adds a value to an attribute for a given dn.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - attr (rawurlencoded) the attribute to which we are adding a value
|
||||
* - new_value (form element)
|
||||
* - binary
|
||||
*
|
||||
* On success, redirect to the edit_dn page. On failure, echo an error.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( _('You cannot perform updates while server is in read-only mode') );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( _('Not enough information to login to server. Please check your configuration.') );
|
||||
|
||||
$attr = $_POST['attr'];
|
||||
$new_value = $_POST['new_value'];
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
|
||||
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
|
||||
if ($ldapserver->isAttrReadOnly($attr))
|
||||
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars( $attr )));
|
||||
|
||||
// special case for binary attributes:
|
||||
// we must go read the data from the file.
|
||||
if( $is_binary_val ) {
|
||||
$file = $_FILES['new_value']['tmp_name'];
|
||||
|
||||
$f = fopen( $file, 'r' );
|
||||
$binary_value = fread( $f, filesize( $file ) );
|
||||
fclose( $f );
|
||||
|
||||
$new_value = $binary_value;
|
||||
}
|
||||
|
||||
$new_entry = array( $attr => $new_value );
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($dn,$attr,$new_entry)) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$ldapserver->server_id,$attr,$badattr);
|
||||
pla_error(sprintf( _('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
// Call the custom callback for each attribute modification
|
||||
// and verify that it should be modified.
|
||||
if( run_hook ( 'pre_attr_add', array ( 'server_id' => $ldapserver->server_id, 'dn' => $dn, 'attr_name' => $attr,
|
||||
'new_value' => $new_entry ) ) ) {
|
||||
|
||||
$add_result = $ldapserver->attrModify($dn,$new_entry);
|
||||
|
||||
if (! $add_result)
|
||||
pla_error(_('Could not perform ldap_mod_add operation.'),
|
||||
$ldapserver->error(),$ldapserver->errno());
|
||||
}
|
||||
|
||||
header(sprintf('Location: template_engine.php?server_id=%s&dn=%s&modified_attrs[]=%s',
|
||||
$ldapserver->server_id,$encoded_dn,$encoded_attr));
|
||||
?>
|
205
htdocs/add_value_form.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.34.2.5 2007/01/27 12:51:47 wurley Exp $
|
||||
|
||||
/**
|
||||
* Displays a form to allow the user to enter a new value to add
|
||||
* to the existing list of values for a multi-valued attribute.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - attr (rawurlencoded) the attribute to which we are adding a value
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$attr = $_GET['attr'];
|
||||
$dn = isset($_GET['dn']) ? $_GET['dn'] : null;
|
||||
$encoded_dn = rawurlencode($dn);
|
||||
$encoded_attr = rawurlencode($attr);
|
||||
|
||||
if (! is_null($dn))
|
||||
$rdn = get_rdn($dn);
|
||||
else
|
||||
$rdn = null;
|
||||
|
||||
$current_values = $ldapserver->getDNAttr($dn,$attr);
|
||||
if ($current_values) {
|
||||
if (! is_array($current_values))
|
||||
$current_values = array($current_values);
|
||||
|
||||
$num_current_values = count($current_values);
|
||||
|
||||
} else {
|
||||
$current_values = array();
|
||||
$num_current_values = 0;
|
||||
}
|
||||
|
||||
$is_object_class = (strcasecmp($attr, 'objectClass') == 0) ? true : false;
|
||||
|
||||
if ($is_object_class) {
|
||||
# fetch all available objectClasses and remove those from the list that are already defined in the entry
|
||||
$schema_oclasses = $ldapserver->SchemaObjectClasses();
|
||||
|
||||
foreach($current_values as $oclass)
|
||||
unset($schema_oclasses[strtolower($oclass)]);
|
||||
|
||||
} else {
|
||||
$schema_attr = $ldapserver->getSchemaAttribute($attr);
|
||||
}
|
||||
|
||||
include './header.php';
|
||||
|
||||
echo '<body>';
|
||||
printf('<h3 class="title">%s <b>%s</b> %s <b>%s</b></h3>',
|
||||
_('Add new'),htmlspecialchars($attr),_('value to'),htmlspecialchars($rdn));
|
||||
printf('<h3 class="subtitle">%s <b>%s</b> %s: <b>%s</b></h3>',
|
||||
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
|
||||
|
||||
printf('%s <b>%s</b> %s <b>%s</b>:',
|
||||
_('Current list of'),$num_current_values,_('values for attribute'),htmlspecialchars($attr));
|
||||
|
||||
if ($num_current_values) {
|
||||
if ($ldapserver->isJpegPhoto($attr)) {
|
||||
|
||||
echo '<table><tr><td>';
|
||||
draw_jpeg_photos($ldapserver, $dn, $attr, false);
|
||||
echo '</td></tr></table>';
|
||||
|
||||
# <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
|
||||
printf('<p><small>%s</small></p>',
|
||||
_('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.'));
|
||||
# <!-- End of temporary warning -->
|
||||
|
||||
} elseif ($ldapserver->isAttrBinary($attr)) {
|
||||
echo '<ul>';
|
||||
|
||||
if (is_array($vals)) {
|
||||
for ($i=1; $i<=count($vals); $i++) {
|
||||
$href = sprintf('download_binary_attr.php?server_id=%s&dn=%s&attr=%s&value_num=%s',
|
||||
$ldapserver->server_id,$encoded_dn,$attr,$i-1);
|
||||
|
||||
printf('<li><a href="%s"><img src="images/save.png" />%s (%s)</a></li>',
|
||||
$href,_('download value'),$i);
|
||||
}
|
||||
|
||||
} else {
|
||||
$href = sprintf('download_binary_attr.php?server_id=%s&dn=%s&attr=%s',
|
||||
$ldapserver->server_id,$encoded_dn,$attr);
|
||||
printf('<li><a href="%s"><img src="images/save.png" />%s</a></li>',
|
||||
$href,_('download value'));
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
# <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
|
||||
printf('<p><small>%s</small></p>',
|
||||
_('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.'));
|
||||
# <!-- End of temporary warning -->
|
||||
|
||||
} else {
|
||||
echo '<ul class="current_values">';
|
||||
|
||||
if (is_array($current_values)) {
|
||||
if (strcasecmp($attr,'userPassword') == 0) {
|
||||
foreach ($current_values as $key => $value) {
|
||||
if (obfuscate_password_display(get_enc_type($value)))
|
||||
echo '<li><span style="white-space: nowrap;">'.preg_replace('/./','*',$value).'<br /></li>';
|
||||
else
|
||||
echo '<li><span style="white-space: nowrap;">'.htmlspecialchars($value).'<br /></li>';
|
||||
}
|
||||
|
||||
} else {
|
||||
foreach ($current_values as $val)
|
||||
printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($val));
|
||||
}
|
||||
|
||||
} else {
|
||||
printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($current_values));
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
}
|
||||
} else {
|
||||
echo '<br /><br />';
|
||||
}
|
||||
|
||||
echo _('Enter the value you would like to add:');
|
||||
echo '<br /><br />';
|
||||
|
||||
if ($is_object_class) {
|
||||
echo '<form action="add_oclass_form.php" method="post" class="new_value">';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$encoded_dn);
|
||||
|
||||
echo '<select name="new_oclass[]" multiple="true" size="15">';
|
||||
foreach ($schema_oclasses as $name => $oclass) {
|
||||
# exclude any structural ones, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
|
||||
if ($oclass->getType() == 'structural')
|
||||
continue;
|
||||
|
||||
printf('<option value="%s">%s</option>',$oclass->getName(),$oclass->getName());
|
||||
}
|
||||
echo '</select>';
|
||||
|
||||
echo '<br />';
|
||||
printf('<input type="submit" value="%s" />',_('Add new ObjectClass'));
|
||||
echo '<br />';
|
||||
|
||||
if ($config->GetValue('appearance','show_hints'))
|
||||
printf('<small><br /><img src="images/light.png" /><span class="hint">%s</span></small>',
|
||||
_('Note: You may be required to enter new attributes that these objectClass(es) require'));
|
||||
|
||||
} else {
|
||||
echo '<form action="add_value.php" method="post" class="new_value" name="new_value_form">';
|
||||
|
||||
if ($ldapserver->isAttrBinary($attr))
|
||||
echo 'enctype="multipart/form-data"';
|
||||
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$encoded_dn);
|
||||
printf('<input type="hidden" name="attr" value="%s" />',$encoded_attr);
|
||||
|
||||
if ($ldapserver->isAttrBinary($attr)) {
|
||||
echo '<input type="file" name="new_value" />';
|
||||
echo '<input type="hidden" name="binary" value="true" />';
|
||||
|
||||
} else {
|
||||
if ($ldapserver->isMultiLineAttr($attr)) {
|
||||
echo '<textarea name="new_value" rows="3" cols="30"></textarea>';
|
||||
} else {
|
||||
printf('<input type="text"%s name="new_value" size="40" value="" />',
|
||||
($schema_attr->getMaxLength() ? sprintf(' maxlength="%s"',$schema_attr->getMaxLength()) : ''));
|
||||
|
||||
# draw the "browse" button next to this input box if this attr houses DNs:
|
||||
if ($ldapserver->isDNAttr($attr))
|
||||
draw_chooser_link("new_value_form.new_value", false);
|
||||
}
|
||||
}
|
||||
|
||||
printf('<input type="submit" name="submit" value="%s" />',_('Add New Value'));
|
||||
echo '<br />';
|
||||
|
||||
if ($schema_attr->getDescription())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Description'),$schema_attr->getDescription());
|
||||
|
||||
if ($schema_attr->getType())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Syntax'),$schema_attr->getType());
|
||||
|
||||
if ($schema_attr->getMaxLength())
|
||||
printf('<small><b>%s:</b> %s %s</small><br />',
|
||||
_('Maximum Length'),number_format($schema_attr->getMaxLength()),_('characters'));
|
||||
|
||||
echo '</form>';
|
||||
}
|
||||
echo '</body></html>';
|
||||
?>
|
33
htdocs/collapse.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/collapse.php,v 1.13.4.2 2007/03/18 03:16:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* This script alters the session variable 'tree', collapsing it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* Note: this script is equal and opposite to expand.php
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$tree = get_cached_item($ldapserver->server_id,'tree');
|
||||
$tree['browser'][$dn]['open'] = false;
|
||||
set_cached_item($ldapserver->server_id,'tree','null',$tree);
|
||||
|
||||
/* If cookies were disabled, build the url parameter for the session id.
|
||||
It will be append to the url to be redirect */
|
||||
$id_session_param = '';
|
||||
if (SID != '')
|
||||
$id_session_param = sprintf('&%s=%s',session_name(),session_id());
|
||||
|
||||
header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param));
|
||||
?>
|
5
htdocs/common.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
# This is a temporary file
|
||||
@define('LIBDIR',sprintf('%s/',realpath('../lib/')));
|
||||
require LIBDIR.'common.php';
|
||||
?>
|
588
htdocs/compare.php
Normal file
@@ -0,0 +1,588 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.12.2.6 2007/01/27 12:38:59 wurley Exp $
|
||||
|
||||
/**
|
||||
* Compare two DNs - the destination DN is editable.
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
* @todo: Must fix dc/domainComponent evaluation.
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn_src = isset($_POST['dn_src']) ? $_POST['dn_src'] : null;
|
||||
$dn_dst = isset($_POST['dn_dst']) ? $_POST['dn_dst'] : null;
|
||||
|
||||
$encoded_dn_src = rawurlencode($dn_src);
|
||||
$encoded_dn_dst = rawurlencode($dn_dst);
|
||||
|
||||
$server_id_src = (isset($_POST['server_id_src']) ? $_POST['server_id_src'] : '');
|
||||
$server_id_dst = (isset($_POST['server_id_dst']) ? $_POST['server_id_dst'] : '');
|
||||
|
||||
$ldapserver_src = $ldapservers->Instance($server_id_src);
|
||||
if (! $ldapserver_src->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$ldapserver_dst = $ldapservers->Instance($server_id_dst);
|
||||
if (! $ldapserver_src->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
if (! $ldapserver_src->dnExists($dn_src))
|
||||
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_src)));
|
||||
if (! $ldapserver_dst->dnExists($dn_dst))
|
||||
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_dst)));
|
||||
|
||||
$friendly_attrs = process_friendly_attr_table();
|
||||
|
||||
$attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$config->GetValue('deref','view'));
|
||||
$attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$config->GetValue('deref','view'));
|
||||
|
||||
# Get a list of all attributes.
|
||||
$attrs_all = array_keys($attrs_src);
|
||||
foreach ($attrs_dst as $key => $val)
|
||||
if (! in_array($key,$attrs_all))
|
||||
$attrs_all[] = $key;
|
||||
|
||||
include './header.php';
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<table class="comp_dn" border=0>
|
||||
<tr><td colspan=6>
|
||||
<h3 class="title"><?php echo _('Comparing the following DNs'); ?></h3>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=2 width=20%>
|
||||
<h3 class="subtitle"><?php echo _('Attribute'); ?><br /> </h3>
|
||||
</td>
|
||||
<td colspan=2 width=40%>
|
||||
<h3 class="subtitle"><?php echo _('Server'); ?>: <b><?php echo $ldapserver_src->name; ?></b><br /><?php echo _('Distinguished Name');?>: <b><?php echo htmlspecialchars(($dn_src)); ?></b></h3>
|
||||
</td>
|
||||
<td colspan=2 width=40%>
|
||||
<h3 class="subtitle"><?php echo _('Server'); ?>: <b><?php echo $ldapserver_dst->name; ?></b><br /><?php echo _('Distinguished Name');?>: <b><?php echo htmlspecialchars(($dn_dst)); ?></b></h3>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=6 align=right>
|
||||
<form action="compare.php" method="post" name="compare_form">
|
||||
<input type="hidden" name="server_id_src" value="<?php echo $ldapserver_dst->server_id; ?>" />
|
||||
<input type="hidden" name="server_id_dst" value="<?php echo $ldapserver_src->server_id; ?>" />
|
||||
<input type="hidden" name="dn_src" value="<?php echo htmlspecialchars($dn_dst); ?>" />
|
||||
<input type="hidden" name="dn_dst" value="<?php echo htmlspecialchars($dn_src); ?>" />
|
||||
<input type="submit" value="<?php echo _('Switch Entry'); ?>" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if (! $attrs_all || ! is_array($attrs_all)) {
|
||||
printf('<tr><td colspan="2">(%s)</td></tr>',_('This entry has no attributes'));
|
||||
print '</table>';
|
||||
print '</html>';
|
||||
die();
|
||||
}
|
||||
|
||||
sort($attrs_all);
|
||||
|
||||
# Work through each of the attributes.
|
||||
foreach ($attrs_all as $attr) {
|
||||
flush();
|
||||
|
||||
# If this is the DN, get the next attribute.
|
||||
if (! strcasecmp($attr,'dn'))
|
||||
continue;
|
||||
|
||||
# Has the config.php specified that this attribute is to be hidden or shown?
|
||||
if ($ldapserver_src->isAttrHidden($attr) || $ldapserver_dst->isAttrHidden($attr))
|
||||
continue;
|
||||
?>
|
||||
|
||||
<!-- Begin Attribute -->
|
||||
<tr>
|
||||
|
||||
<?php foreach (array('src','dst') as $side) { ?>
|
||||
|
||||
<?php
|
||||
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly()) { ?>
|
||||
|
||||
<form action="update_confirm.php" method="post" name="edit_form">
|
||||
<input type="hidden" name="server_id" value="<?php echo $ldapserver_dst->server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $dn_dst; ?>" />
|
||||
|
||||
<?php }
|
||||
|
||||
$schema_attr_src = $ldapserver_src->getSchemaAttribute($attr,$dn_src);
|
||||
$schema_attr_dst = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
|
||||
|
||||
# Setup the $attr_note, which will be displayed to the right of the attr name (if any)
|
||||
$attr_note = '';
|
||||
$required_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 = sprintf('<acronym title="%s">alias</acronym>',sprintf(_('Note: \'%s\' is an alias for \'%s\''),$attr_display,$attr));
|
||||
|
||||
} else {
|
||||
$attr_note = '';
|
||||
$attr_display = $attr;
|
||||
}
|
||||
|
||||
# is this attribute required by an objectClass?
|
||||
$required_by = '';
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
$ldapserver = $ldapserver_src;
|
||||
if ($schema_attr_src)
|
||||
foreach ($schema_attr_src->getRequiredByObjectClasses() as $required)
|
||||
if (isset($attrs_src['objectClass']) && in_array(strtolower($required),arrayLower($attrs_src['objectClass'])))
|
||||
$required_by .= $required . ' ';
|
||||
|
||||
# It seems that some LDAP servers (Domino) returns attributes in lower case?
|
||||
elseif (isset($attrs_src['objectclass']) && in_array(strtolower($required),arrayLower($attrs_src['objectclass'])))
|
||||
$required_by .= $required . ' ';
|
||||
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
$ldapserver = $ldapserver_dst;
|
||||
if ($schema_attr_dst)
|
||||
foreach ($schema_attr_dst->getRequiredByObjectClasses() as $required)
|
||||
if (isset($attrs_dst['objectClass']) && in_array(strtolower($required),arrayLower($attrs_dst['objectClass'])))
|
||||
$required_by .= $required . ' ';
|
||||
|
||||
# It seems that some LDAP servers (Domino) returns attributes in lower case?
|
||||
elseif (isset($attrs_dst['objectclass']) && in_array(strtolower($required),arrayLower($attrs_dst['objectclass'])))
|
||||
$required_by .= $required . ' ';
|
||||
break;
|
||||
}
|
||||
|
||||
if ($side == 'src') { ?>
|
||||
<td class="attr">
|
||||
<?php $schema_href="schema.php?server_id=$server_id_src&view=attributes&viewvalue=".real_attr_name($attr); ?>
|
||||
<b><a title="<?php echo sprintf(_('Click to view the schema definition for attribute type \'%s\''),$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>
|
||||
</td>
|
||||
<?php }
|
||||
|
||||
if ($required_by) {
|
||||
$required_note .= sprintf('<acronym title="%s">%s</acronym>',sprintf(_('Required attribute for objectClass(es) %s'),$required_by),_('required'));
|
||||
?>
|
||||
<td colspan=2 class="attr_note">
|
||||
<sup><small><?php echo $required_note; ?></small></sup>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td colspan=2 class="attr_note"> </td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($ldapserver->isAttrReadOnly($attr)) { ?>
|
||||
<small>(<acronym title="<?php echo _('This attribute has been flagged as read only by the phpLDAPadmin administrator'); ?>"><?php echo _('read only'); ?></acronym>)</small>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
<!-- End of Attribute -->
|
||||
|
||||
<!-- Begin Values -->
|
||||
<tr>
|
||||
|
||||
<?php
|
||||
foreach (array('src','dst') as $side) {
|
||||
$vals = null; ?>
|
||||
|
||||
|
||||
<?php
|
||||
# If this attribute isnt set, then show a blank.
|
||||
$toJump = 0;
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
print '<td colspan=2> </td><td class="attr">';
|
||||
|
||||
if (! isset($attrs_src[$attr])) {
|
||||
echo "<small><". _('No Value')."></small></td>";
|
||||
$toJump = 1;
|
||||
continue;
|
||||
} else
|
||||
$vals = $attrs_src[$attr];
|
||||
|
||||
$ldapserver = $ldapserver_src;
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
print '<td colspan=2> </td><td class="val">';
|
||||
|
||||
if (! isset($attrs_dst[$attr])) {
|
||||
echo "<small><". _('No Value')."></small></td>";
|
||||
$toJump = 1;
|
||||
continue;
|
||||
} else
|
||||
$vals = $attrs_dst[$attr];
|
||||
|
||||
$ldapserver = $ldapserver_dst;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($toJump) continue;
|
||||
if (! is_array($vals))
|
||||
$vals = array($vals);
|
||||
|
||||
/*
|
||||
* Is this attribute a jpegPhoto?
|
||||
*/
|
||||
if ($ldapserver->isJpegPhoto($attr)) {
|
||||
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
// Don't draw the delete buttons if there is more than one jpegPhoto
|
||||
// (phpLDAPadmin can't handle this case yet)
|
||||
draw_jpeg_photos($ldapserver,$dn_src,$attr,false);
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
if ($ldapserver_dst->isReadOnly() || $ldapserver_dst->isAttrReadOnly($attr))
|
||||
draw_jpeg_photos($ldapserver,$dn_dst,$attr,false);
|
||||
else
|
||||
draw_jpeg_photos($ldapserver,$dn_dst,$attr,true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// proceed to the next attribute
|
||||
echo "</td>\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is this attribute binary?
|
||||
*/
|
||||
if ($ldapserver->isAttrBinary($attr)) {
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
$href = sprintf("download_binary_attr.php?server_id=%s&dn=%s&attr=%s",$ldapserver->server_id,$encoded_dn_src,$attr);
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
$href = sprintf("download_binary_attr.php?server_id=%s&dn=%s&attr=%s",$ldapserver->server_id,$encoded_dn_dst,$attr);
|
||||
break;
|
||||
}
|
||||
?>
|
||||
|
||||
<small>
|
||||
|
||||
<?php echo _('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 _('download value'); ?>(<?php echo $i; ?>)</a><br />
|
||||
|
||||
<?php } } else { ?>
|
||||
<a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo _('download value'); ?></a><br />
|
||||
|
||||
<?php }
|
||||
|
||||
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! $ldapserver->isAttrReadOnly($attr)) { ?>
|
||||
|
||||
<a href="javascript:deleteAttribute('<?php echo $attr; ?>');" style="color:red;"><img src="images/trash.png" /> <?php echo _('delete attribute'); ?></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</small>
|
||||
</td>
|
||||
|
||||
<?php 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 ($side == 'dst' && ($ldapserver->isReadOnly() || $ldapserver->isAttrReadOnly($attr))) {
|
||||
if (is_array($vals)) {
|
||||
foreach ($vals as $i => $val) {
|
||||
if (trim($val) == "")
|
||||
echo "<span style=\"color:red\">[" . _('empty') . "]</span><br />\n";
|
||||
|
||||
elseif (0 == strcasecmp($attr,'userPassword') && $config->GetValue('appearance','obfuscate_password_display'))
|
||||
echo preg_replace('/./','*',$val) . "<br />";
|
||||
|
||||
else
|
||||
echo htmlspecialchars($val) . "<br />";
|
||||
}
|
||||
|
||||
// @todo: redundant - $vals is always an array.
|
||||
} else {
|
||||
if (0 == strcasecmp($attr,'userPassword') && $config->GetValue('appearance','obfuscate_password_display'))
|
||||
echo preg_replace('/./','*',$vals) . "<br />";
|
||||
else
|
||||
echo $vals . "<br />";
|
||||
}
|
||||
echo "</td>";
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is this a userPassword attribute?
|
||||
*/
|
||||
if (! 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);
|
||||
}
|
||||
|
||||
if ($side == 'dst') { ?>
|
||||
|
||||
<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($enc_type)) {
|
||||
echo htmlspecialchars(preg_replace('/./','*',$user_password));
|
||||
} else {
|
||||
echo htmlspecialchars($user_password);
|
||||
} ?>
|
||||
|
||||
<br />
|
||||
|
||||
<?php if ($side == 'dst') { ?>
|
||||
|
||||
<input style="width: 260px" type="password" name="new_values[userpassword]" value="<?php echo htmlspecialchars($user_password); ?>" />
|
||||
|
||||
<?php echo enc_type_select_list($enc_type);
|
||||
|
||||
} ?>
|
||||
|
||||
<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 _('Check password'); ?></a></small>
|
||||
|
||||
</td>
|
||||
|
||||
<?php continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is this a boolean attribute?
|
||||
*/
|
||||
if ($ldapserver->isAttrBoolean($attr)) {
|
||||
$val = $vals[0];
|
||||
|
||||
if ($side = 'dst') {?>
|
||||
|
||||
<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 _('true'); ?></option>
|
||||
<option value="FALSE"<?php echo ($val=='FALSE' ? ' selected' : ''); ?>><?php echo _('false'); ?></option>
|
||||
<option value="">(<?php echo _('none, remove value'); ?>)</option>
|
||||
</select>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<?php continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* End of special case attributes (non plain text).
|
||||
*/
|
||||
|
||||
foreach ($vals as $i => $val) {
|
||||
|
||||
if ($side == 'dst') {
|
||||
$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 _('View the schema description for this objectClass'); ?>" href="schema.php?server_id=<?php echo $ldapserver->server_id; ?>&view=objectClasses&viewvalue=<?php echo htmlspecialchars($val); ?>"><img src="images/info.png" /></a>
|
||||
|
||||
<?php $schema_object = $ldapserver->getSchemaObjectClass($val);
|
||||
|
||||
if ($schema_object->getType() == 'structural') {
|
||||
echo "$val <small>(<acronym title=\"" . sprintf(_('This is a structural ObjectClass and cannot be removed.')) . "\">" . _('structural') . "</acronym>)</small><br />";
|
||||
|
||||
if ($side == 'dst') {?>
|
||||
|
||||
<input type="hidden" name="<?php echo $input_name; ?>" id="<?php echo $input_id; ?>" value="<?php echo htmlspecialchars($val); ?>" />
|
||||
|
||||
<?php }
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) { ?>
|
||||
|
||||
<a title="<?php echo sprintf(_('Go to %s'),htmlspecialchars($val)); ?>" href="template_engine.php?server_id=<?php echo $ldapserver->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 }
|
||||
|
||||
if ($ldapserver->isMultiLineAttr($attr,$val)) {
|
||||
|
||||
if ($side == 'dst') {?>
|
||||
<textarea class="val" rows="3" cols="30" name="<?php echo $input_name; ?>" id="<?php echo $input_id; ?>"><?php echo htmlspecialchars($val); ?></textarea>
|
||||
|
||||
<?php } else {
|
||||
echo htmlspecialchars($val);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ($side == 'dst') {?>
|
||||
|
||||
<input type="text" class="val" name="<?php echo $input_name; ?>" id="<?php echo $input_id; ?>" value="<?php echo htmlspecialchars($val); ?>" />
|
||||
|
||||
<?php } else {
|
||||
echo htmlspecialchars($val);
|
||||
}
|
||||
}
|
||||
|
||||
// draw a link for popping up the entry browser if this is the type of attribute
|
||||
// that houses DNs.
|
||||
if ($ldapserver->isDNAttr($attr))
|
||||
draw_chooser_link("edit_form.$input_id",false); ?>
|
||||
|
||||
<br />
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<?php } /* end foreach value */ ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
/* Draw the "add value" link under the list of values for this attributes */
|
||||
|
||||
if (! $ldapserver_dst->isReadOnly()) {
|
||||
|
||||
// First check if the required objectClass is in this DN
|
||||
$isOK = 0;
|
||||
$src_oclass = array();
|
||||
$attr_object = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
|
||||
foreach ($attr_object->used_in_object_classes as $oclass) {
|
||||
if (in_array(strtolower($oclass),arrayLower($attrs_dst['objectClass']))) {
|
||||
$isOK = 1;
|
||||
break;
|
||||
} else {
|
||||
// Find oclass that the source has that provides this attribute.
|
||||
if (in_array($oclass,$attrs_src['objectClass']))
|
||||
$src_oclass[] = $oclass;
|
||||
}
|
||||
}
|
||||
|
||||
print "<tr><td colspan=2></td><td colspan=2> </td><td> </td><td>";
|
||||
if (! $isOK) {
|
||||
|
||||
if (count($src_oclass) == 1) {
|
||||
$add_href = sprintf('add_oclass_form.php?server_id=%s&dn=%s&new_oclass=%s',
|
||||
$ldapserver_dst->server_id,$encoded_dn_dst,$src_oclass[0]);
|
||||
} else {
|
||||
$add_href = sprintf('add_value_form.php?server_id=%s&dn=%s&attr=objectClass',
|
||||
$ldapserver_dst->server_id,$encoded_dn_dst);
|
||||
}
|
||||
|
||||
if ($attr == 'objectClass')
|
||||
printf('<div class="add_oclass">(<a href="%s" title="%s">%s</a>)</div>',$add_href,_('Add ObjectClass and Attributes'),_('add value'));
|
||||
else
|
||||
printf('<div class="add_oclass">(<a href="%s" title="%s">%s</a>)</div>',$add_href,sprintf(_('You need one of the following ObjectClass(es) to add this attribute %s.'),implode(" ",$src_oclass)),_('Add new ObjectClass'));
|
||||
|
||||
} else {
|
||||
if (! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) {
|
||||
|
||||
$add_href = sprintf('add_value_form.php?server_id=%s&dn=%s&attr=%s',
|
||||
$ldapserver_dst->server_id,$encoded_dn_dst,rawurlencode($attr));
|
||||
|
||||
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',
|
||||
$add_href,sprintf(_('Add an additional value to attribute \'%s\''),$attr),_('add value'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print "</td></tr>"; ?>
|
||||
|
||||
</td>
|
||||
|
||||
<?php flush(); ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } /* End foreach ($attrs as $attr => $vals) */
|
||||
|
||||
if (! $ldapserver_dst->isReadOnly()) { ?>
|
||||
|
||||
<td colspan="2"> </td><td colspan=2><center><input type="submit" value="<?php echo _('Save Changes'); ?>" /></center></td></tr></form>
|
||||
|
||||
<?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 _('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 $ldapserver_dst->server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $dn_dst; ?>" />
|
||||
<input type="hidden" name="attr" value="FILLED IN BY JAVASCRIPT" />
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
78
htdocs/compare_form.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare_form.php,v 1.2.4.3 2006/04/29 03:15:34 wurley Exp $
|
||||
|
||||
/**
|
||||
* Compares to DN entries side by side.
|
||||
*
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn = (isset($_GET['dn']) ? $_GET['dn'] : '');
|
||||
$rdn = get_rdn($dn);
|
||||
$select_server_html = server_select_list($ldapserver->server_id,true,'server_id_dst');
|
||||
|
||||
include './header.php';
|
||||
|
||||
echo '<body>';
|
||||
|
||||
printf('<h3 class="title">%s %s</h3>',_('Compare another DN with'),htmlspecialchars($rdn));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b>',_('Server'),$ldapserver->name);
|
||||
if ($dn)
|
||||
printf(' %s: <b>%s</b>',_('Distinguished Name'),htmlspecialchars($dn));
|
||||
echo '</h3>';
|
||||
echo "\n";
|
||||
|
||||
echo '<center>';
|
||||
printf('%s <b>%s</b> %s<br />',_('Compare'),htmlspecialchars($rdn),_('with '));
|
||||
|
||||
echo '<form action="compare.php" method="post" name="compare_form">';
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$ldapserver->server_id);
|
||||
echo "\n";
|
||||
|
||||
echo '<table style="border-spacing: 10px">';
|
||||
echo "\n";
|
||||
echo '<tr><td>';
|
||||
|
||||
if (! $dn) {
|
||||
printf('<acronym title="%s">%s</acronym>:',_('Compare this DN with another'),_('Source DN'));
|
||||
echo '</td><td>';
|
||||
printf('<input type="text" name="dn_src" size="45" value="%s" />',htmlspecialchars($dn));
|
||||
draw_chooser_link('compare_form.dn_src','true',$rdn);
|
||||
|
||||
} else
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($dn));
|
||||
|
||||
echo '</td></tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',_('Compare this DN with another'),_('Destination DN'));
|
||||
echo '<td>';
|
||||
echo '<input type="text" name="dn_dst" size="45" value="" />';
|
||||
draw_chooser_link('compare_form.dn_dst','true','');
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),$select_server_html);
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" align="right"><input type="submit" value="%s" /></td></tr>',_('Compare'));
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
echo '</center>';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
?>
|
189
htdocs/copy.php
Normal file
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.36.2.12 2007/03/18 01:31:19 wurley Exp $
|
||||
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* Vars that come in as POST vars
|
||||
* - source_dn (rawurlencoded)
|
||||
* - new_dn (form element)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$server_id_src = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$server_id_dst = (isset($_POST['dest_server_id']) ? $_POST['dest_server_id'] : '');
|
||||
|
||||
$ldapserver_src = $ldapservers->Instance($server_id_src);
|
||||
$ldapserver_dst = $ldapservers->Instance($server_id_dst);
|
||||
|
||||
if ($ldapserver_dst->isReadOnly())
|
||||
pla_error(_('Destination server is currently READ-ONLY.'));
|
||||
|
||||
if (! $ldapserver_src->haveAuthInfo() || ! $ldapserver_dst->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn_src = $_POST['old_dn'];
|
||||
$dn_dst = $_POST['new_dn'];
|
||||
$do_recursive = (isset($_POST['recursive']) && $_POST['recursive'] == 'on') ? true : false;
|
||||
$do_remove = (isset($_POST['remove']) && $_POST['remove'] == 'yes') ? true : false;
|
||||
|
||||
include './header.php';
|
||||
|
||||
# Error checking
|
||||
if (0 == strlen(trim($dn_dst)))
|
||||
pla_error(_('You left the destination DN blank.'));
|
||||
|
||||
if (pla_compare_dns($dn_src,$dn_dst) == 0 && $server_id_src == $server_id_dst)
|
||||
pla_error(_('The source and destination DN are the same.'));
|
||||
|
||||
if ($ldapserver_dst->dnExists($dn_dst))
|
||||
pla_error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($dn_dst)));
|
||||
|
||||
if (! $ldapserver_dst->dnExists(get_container($dn_dst)))
|
||||
pla_error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($dn_dst))));
|
||||
|
||||
if ($do_recursive) {
|
||||
$filter = isset($_POST['filter']) ? $_POST['filter'] : '(objectClass=*)';
|
||||
|
||||
# Build a tree similar to that of the tree browser to give to r_copy_dn
|
||||
$snapshot_tree = array();
|
||||
print '<body>';
|
||||
printf('<h3 class="title">%s%s</h3>',_('Copying '),htmlspecialchars($dn_src));
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Recursive copy progress'));
|
||||
print '<br /><br />';
|
||||
print '<small>';
|
||||
print _('Building snapshot of tree to copy... ');
|
||||
|
||||
flush();
|
||||
|
||||
$snapshot_tree = build_tree($ldapserver_src,$dn_src,array(),$filter);
|
||||
printf('<span style="color:green">%s</span><br />',_('Success'));
|
||||
flush();
|
||||
|
||||
# Prevent script from bailing early on a long delete
|
||||
@set_time_limit(0);
|
||||
|
||||
$copy_result = r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshot_tree,$dn_src,$dn_dst);
|
||||
print '</small>';
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst);
|
||||
}
|
||||
|
||||
if ($copy_result) {
|
||||
$edit_url = sprintf('template_engine.php?server_id=%s&dn=%s',$server_id_dst,rawurlencode($dn_dst));
|
||||
$new_rdn = get_rdn($dn_dst);
|
||||
$container = get_container($dn_dst);
|
||||
|
||||
printf('<center>%s<a href="%s">%s</a></center>',_('Copy successful! Would you like to '),$edit_url,_('view the new entry'));
|
||||
echo '<!-- refresh the tree view (with the new DN renamed) and redirect to the edit_dn page -->';
|
||||
echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>';
|
||||
echo '</body></html>';
|
||||
|
||||
if ($do_remove) {
|
||||
sleep(2);
|
||||
$delete_url = sprintf('delete_form.php?server_id=%s&dn=%s',$server_id_src,rawurlencode($dn_src));
|
||||
echo '<!-- redirect to the delete form -->';
|
||||
printf('<script type="text/javascript" language="javascript">parent.right_frame.location="%s" </script>',$delete_url);
|
||||
}
|
||||
}
|
||||
|
||||
function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_dst) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('r_copy_dn: Entered with (%s,%s,%s,%s,%s)',1,
|
||||
$ldapserver_src->server_id,$ldapserver_dst->server_id,$snapshottree,$root_dn,$dn_dst);
|
||||
|
||||
printf('<span style="white-space: nowrap;">%s %s...',_('Copying'),htmlspecialchars($root_dn));
|
||||
flush();
|
||||
|
||||
$copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$root_dn,$dn_dst);
|
||||
|
||||
if (! $copy_result)
|
||||
return false;
|
||||
|
||||
printf('<span style="color:green">%s</span><br />',_('Success'));
|
||||
flush();
|
||||
|
||||
$children = isset($snapshottree[$root_dn]) ? $snapshottree[$root_dn] : null;
|
||||
if (is_array($children) && count($children) > 0) {
|
||||
foreach($children as $child_dn) {
|
||||
$child_rdn = get_rdn($child_dn);
|
||||
$new_dest_dn = sprintf('%s,%s',$child_rdn,$dn_dst);
|
||||
r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$child_dn,$new_dest_dn);
|
||||
}
|
||||
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('copy_dn: Entered with (%s,%s,%s,%s)',17,
|
||||
$ldapserver_src->server_id,$ldapserver_dst->server_id,$dn_src,$dn_dst);
|
||||
|
||||
$new_entry = $ldapserver_src->getDNAttrs($dn_src);
|
||||
|
||||
# modify the prefix-value (ie "bob" in cn=bob) to match the destination DN's value.
|
||||
$rdn_attr = substr($dn_dst,0,strpos($dn_dst,'='));
|
||||
$rdn_value = get_rdn($dn_dst);
|
||||
$rdn_value = substr($rdn_value,strpos($rdn_value,'=') + 1);
|
||||
$new_entry[$rdn_attr] = $rdn_value;
|
||||
|
||||
# don't need a dn attribute in the new entry
|
||||
unset($new_entry['dn']);
|
||||
|
||||
# Check the user-defined custom call back first
|
||||
if (run_hook('pre_entry_create',
|
||||
array ('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry))) {
|
||||
|
||||
$add_result = $ldapserver_dst->add($dn_dst,$new_entry);
|
||||
if (! $add_result) {
|
||||
run_hook('post_entry_create',
|
||||
array('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry));
|
||||
|
||||
echo '</small><br /><br />';
|
||||
pla_error(_('Failed to copy DN: ').$dn_dst,$ldapserver_dst->error(),$ldapserver_dst->errno());
|
||||
}
|
||||
|
||||
return $add_result;
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $ldapserver
|
||||
* @param dn $dn
|
||||
* @param array $tree
|
||||
* @param string $filter
|
||||
*/
|
||||
function build_tree($ldapserver,$dn,$buildtree) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('build_tree: Entered with (%s,%s,%s)',1,
|
||||
$ldapserver->server_id,$dn,$buildtree);
|
||||
|
||||
# we search all children, not only the visible children in the tree
|
||||
$children = $ldapserver->getContainerContents($dn,0);
|
||||
|
||||
if (is_array($children) && count($children) > 0) {
|
||||
$buildtree[$dn] = $children;
|
||||
foreach ($children as $child_dn)
|
||||
$buildtree = build_tree($ldapserver,$child_dn,$buildtree);
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('build_tree: Returning (%s)',1,$buildtree);
|
||||
|
||||
return $buildtree;
|
||||
}
|
||||
?>
|
122
htdocs/copy_form.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.24.4.5 2006/04/29 03:27:41 wurley Exp $
|
||||
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in via GET variables
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn = $_GET['dn'] ;
|
||||
$rdn = get_rdn($dn);
|
||||
$attrs = $ldapserver->getDNAttrs($dn);
|
||||
$select_server_html = server_select_list($ldapserver->server_id,true,'dest_server_id');
|
||||
$children = $ldapserver->getContainerContents($dn);
|
||||
|
||||
include './header.php';
|
||||
|
||||
# Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if (is_array($children) && count($children) > 0) { ?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
//<!--
|
||||
function toggle_disable_filter_field(recursive_checkbox)
|
||||
{
|
||||
if (recursive_checkbox.checked) {
|
||||
recursive_checkbox.form.remove.disabled = false;
|
||||
recursive_checkbox.form.filter.disabled = false;
|
||||
} else {
|
||||
recursive_checkbox.form.remove.disabled = true;
|
||||
recursive_checkbox.form.remove.checked = false;
|
||||
recursive_checkbox.form.filter.disabled = true;
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
echo '<body>';
|
||||
|
||||
printf('<h3 class="title">%s %s</h3>',_('Copy'),htmlspecialchars($rdn));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>',_('Server'),$ldapserver->name,
|
||||
_('Distinguished Name'),htmlspecialchars($dn));
|
||||
echo "\n";
|
||||
|
||||
echo '<center>';
|
||||
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),htmlspecialchars($rdn),_('to a new object'));
|
||||
|
||||
echo '<form action="copy.php" method="post" name="copy_form">';
|
||||
printf('<input type="hidden" name="old_dn" value="%s" />',htmlspecialchars($dn));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
echo "\n";
|
||||
|
||||
echo '<table style="border-spacing: 10px">';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('The full DN of the new entry to be created when copying the source entry'),_('Destination DN'));
|
||||
printf('<td><input type="text" name="new_dn" size="45" value="%s" />',htmlspecialchars($dn));
|
||||
draw_chooser_link('copy_form.new_dn','true',htmlspecialchars($rdn));
|
||||
echo '</td></tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Destination Server'),$select_server_html);
|
||||
echo "\n";
|
||||
|
||||
if (is_array($children) && count($children) > 0) {
|
||||
echo '<tr>';
|
||||
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy'));
|
||||
echo '<td><input type="checkbox" id="recursive" name="recursive" onClick="toggle_disable_filter_field(this)" />';
|
||||
printf('<small>(%s)</small></td>',_('Recursively copy all children of this object as well.'));
|
||||
echo '</tr>'."\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',_('When performing a recursive copy, only copy those entries which match this filter'),_('Filter'));
|
||||
echo '<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />';
|
||||
echo '</tr>'."\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td>%s</td>',_('Delete after copy (move):'));
|
||||
echo '<td><input type="checkbox" name="remove" value="yes"/ disabled>';
|
||||
printf('<small>(%s)</small)</td>',_('Make sure your filter (above) will select all child records.'));
|
||||
echo '</tr>';
|
||||
|
||||
} else {
|
||||
printf('<tr><td>%s</td><td><input type="checkbox" name="remove" value="yes"/></td></tr>',_('Delete after copy (move):'));
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" align="right"><input type="submit" value="%s" /></td></tr>',_('Copy '));
|
||||
echo "\n";
|
||||
echo '</table></form>';
|
||||
echo "\n";
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">';
|
||||
echo '<!--';
|
||||
echo '/* If the user uses the back button, this way we draw the filter field properly. */';
|
||||
echo 'toggle_disable_filter_field(document.copy_form.recursive);';
|
||||
echo '//-->';
|
||||
echo '</script>';
|
||||
|
||||
if ($config->GetValue('appearance','show_hints'))
|
||||
printf('<small><img src="images/light.png" alt="Light" /><span class="hint">%s</span></small>',_('Hint: Copying between different servers only works if there are no schema violations'));
|
||||
|
||||
echo '</center></body></html>';
|
||||
?>
|
160
htdocs/create.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.44.2.6 2006/02/19 02:57:01 wurley Exp $
|
||||
|
||||
/**
|
||||
* Creates a new object.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as POST vars:
|
||||
* - new_dn
|
||||
* - attrs (an array of attributes)
|
||||
* - vals (an array of values for the above attrs)
|
||||
* - required_attrs (an array with indices being the attributes,
|
||||
* and the values being their respective values)
|
||||
* - object_classes (rawurlencoded, and serialized array of objectClasses)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
* @todo: posixgroup with empty memberlist generates an error.
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$new_dn = isset($_POST['new_dn']) ? $_POST['new_dn'] : null;
|
||||
$required_attrs = isset($_POST['required_attrs']) ? $_POST['required_attrs'] : false;
|
||||
$object_classes = unserialize(rawurldecode($_POST['object_classes']));
|
||||
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : false;
|
||||
|
||||
# See if there are any presubmit values to work out.
|
||||
if (isset($_POST['presubmit']) && count($_POST['presubmit']) && isset($_POST['template'])) {
|
||||
$templates = new Templates($ldapserver->server_id);
|
||||
$template = $templates->GetTemplate($_POST['template']);
|
||||
|
||||
foreach ($_POST['presubmit'] as $attr) {
|
||||
$_POST['attrs'][] = $attr;
|
||||
$_POST['form'][$attr] = $templates->EvaluateDefault($ldapserver,$template['attribute'][$attr]['presubmit'],$_POST['container']);
|
||||
$_POST['vals'][] = $_POST['form'][$attr];
|
||||
}
|
||||
|
||||
# @todo: This section needs to be cleaned up, and will be when the old templates are removed. In the mean time...
|
||||
# Rebuild the $_POST['attrs'] & $_POST['vals'], as they can be inconsistent.
|
||||
unset($_POST['attrs']);
|
||||
unset($_POST['vals']);
|
||||
foreach ($_POST['form'] as $attr => $val) {
|
||||
$_POST['attrs'][] = $attr;
|
||||
$_POST['vals'][] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$vals = isset($_POST['vals']) ? $_POST['vals'] : array();
|
||||
$attrs = isset($_POST['attrs']) ? $_POST['attrs'] : array();
|
||||
|
||||
# build the new entry
|
||||
$new_entry = array();
|
||||
if (isset($required_attrs) && is_array($required_attrs)) {
|
||||
foreach ($required_attrs as $attr => $val) {
|
||||
if ($val == '')
|
||||
pla_error(sprintf(_('You left the value blank for required attribute (%s).'),htmlspecialchars($attr)));
|
||||
|
||||
$new_entry[$attr][] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($attrs) && is_array($attrs)) {
|
||||
foreach ($attrs as $i => $attr) {
|
||||
|
||||
if ($ldapserver->isAttrBinary($attr)) {
|
||||
if (isset($_FILES['vals']['name'][$i]) && $_FILES['vals']['name'][$i] != '' ) {
|
||||
|
||||
# read in the data from the file
|
||||
$file = $_FILES['vals']['tmp_name'][$i];
|
||||
$f = fopen($file,'r');
|
||||
$binary_data = fread($f,filesize($file));
|
||||
fclose($f);
|
||||
|
||||
$val = $binary_data;
|
||||
$new_entry[$attr][] = $val;
|
||||
|
||||
} elseif (isset($_SESSION['submitform'][$attr])) {
|
||||
$new_entry[$attr][] = $_SESSION['submitform'][$attr];
|
||||
unset($_SESSION['submitform'][$attr]);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (is_array($vals[$i])) {
|
||||
|
||||
# If the array has blank entries, then ignore them.
|
||||
foreach ($vals[$i] as $value) {
|
||||
if (trim($value))
|
||||
$new_entry[$attr][] = $value;
|
||||
}
|
||||
|
||||
} else {
|
||||
$val = isset($vals[$i]) ? $vals[$i] : '';
|
||||
|
||||
if ('' !== trim($val))
|
||||
$new_entry[$attr][] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$new_entry['objectClass'] = $object_classes;
|
||||
if (! in_array('top',$new_entry['objectClass']))
|
||||
$new_entry['objectClass'][] = 'top';
|
||||
|
||||
foreach ($new_entry as $attr => $vals) {
|
||||
# Check to see if this is a unique Attribute
|
||||
if ($badattr = $ldapserver->checkUniqueAttr($new_dn,$attr,$vals)) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',
|
||||
$ldapserver->server_id,$attr,$badattr);
|
||||
pla_error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$new_dn,$search_href));
|
||||
}
|
||||
|
||||
if (! $ldapserver->isAttrBinary($attr))
|
||||
if (is_array($vals))
|
||||
foreach ($vals as $i => $v)
|
||||
$new_entry[$attr][$i] = $v;
|
||||
else
|
||||
$new_entry[$attr] = $vals;
|
||||
}
|
||||
|
||||
# Check the user-defined custom call back first
|
||||
if (run_hook('pre_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>$new_dn,'attrs'=>$new_entry)))
|
||||
$add_result = $ldapserver->add($new_dn,$new_entry);
|
||||
|
||||
if ($add_result) {
|
||||
run_hook('post_entry_create',array('server_id'=>$ldapserver->server_id,'dn'=>$new_dn,'attrs'=>$new_entry));
|
||||
|
||||
if ($redirect)
|
||||
$redirect_url = $redirect;
|
||||
else
|
||||
$redirect_url = sprintf('template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,rawurlencode($new_dn));
|
||||
|
||||
echo '<html><head>';
|
||||
$tree = get_cached_item($ldapserver->server_id,'tree');
|
||||
$container = get_container($new_dn);
|
||||
|
||||
if ((isset($tree['browser'][$container]['open']) && $tree['browser'][$container]['open']) ||
|
||||
in_array($new_dn,$ldapserver->getBaseDN())) {
|
||||
|
||||
echo '<!-- refresh the tree view (with the new DN renamed) and redirect to the edit_dn page -->';
|
||||
printf('<script language="javascript">parent.left_frame.location.reload();location.href="%s"</script>',$redirect_url);
|
||||
}
|
||||
|
||||
printf('<meta http-equiv="refresh" content="0; url=%s" />',$redirect_url);
|
||||
echo '</head><body>';
|
||||
printf('%s <a href="%s">%s</a>.',_('Redirecting...'),$redirect_url,_('here'));
|
||||
echo '</body></html>';
|
||||
|
||||
} else {
|
||||
pla_error(_('Could not add the object to the LDAP server.'),$ldapserver->error(),$ldapserver->errno());
|
||||
}
|
||||
?>
|
134
htdocs/create_form.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/Attic/create_form.php,v 1.31.2.5 2005/12/31 04:21:37 wurley Exp $
|
||||
|
||||
/**
|
||||
* The menu where the user chooses an RDN, Container, and Template for creating a new entry.
|
||||
* After submitting this form, the user is taken to their chosen Template handler.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as GET vars
|
||||
* - container (rawurlencoded) (optional)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$container = $_REQUEST['container'];
|
||||
$server_menu_html = server_select_list($ldapserver->server_id,true);
|
||||
|
||||
include './header.php';
|
||||
|
||||
echo '<body>';
|
||||
|
||||
printf('<h3 class="title">%s</h3>',_('Create Object'));
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Choose a template'));
|
||||
printf('<center><h3>%s</h3></center>',_('Select a template for the creation process'));
|
||||
|
||||
echo '<form action="template_engine.php" method="post">';
|
||||
printf('<input type="hidden" name="container" value="%s" />',htmlspecialchars($container));
|
||||
|
||||
echo '<table class="create">';
|
||||
printf('<tr><td class="heading">%s:</td><td>%s</td></tr>',_('Server'),$server_menu_html);
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td class="heading">%s:</td>',_('Template'));
|
||||
echo '<td>';
|
||||
|
||||
echo '<table class="template_display">';
|
||||
echo '<tr><td>';
|
||||
|
||||
echo '<table class="templates">';
|
||||
|
||||
$i = -1;
|
||||
|
||||
$template_xml = new Templates($ldapserver->server_id);
|
||||
$templates = $template_xml->_template;
|
||||
|
||||
# Remove non-visable templates.
|
||||
foreach ($templates as $index => $template)
|
||||
if (isset($template['visible']) && (! $template['visible']))
|
||||
unset ($templates[$index]);
|
||||
|
||||
$templates['custom']['title'] = 'Custom';
|
||||
$templates['custom']['icon'] = 'images/object.png';
|
||||
|
||||
$count = count($templates);
|
||||
foreach ($templates as $name => $template) {
|
||||
$i++;
|
||||
|
||||
# If the template doesnt have a title, we'll use the desc field.
|
||||
$template['desc'] = isset($template['title']) ? $template['title'] : $template['desc'];
|
||||
|
||||
# Balance the columns properly
|
||||
if ((count($templates) % 2 == 0 && $i == intval($count / 2)) ||
|
||||
(count($templates) % 2 == 1 && $i == intval($count / 2) + 1))
|
||||
|
||||
echo '</table></td><td><table class="templates">';
|
||||
|
||||
# Check and see if this template should be shown in the list
|
||||
$isValid = false;
|
||||
|
||||
if (isset($template['regexp'])) {
|
||||
if (@preg_match('/'.$template['regexp'].'/i',$container))
|
||||
$isValid = true;
|
||||
} else
|
||||
$isValid = true;
|
||||
|
||||
if (isset($template['invalid']) && $template['invalid'])
|
||||
$isValid = false;
|
||||
|
||||
echo '<tr>';
|
||||
if (! $isValid || (isset($template['handler']) && ! file_exists(TMPLDIR.'creation/'.$template['handler'])))
|
||||
echo '<td class="icon"><img src="images/error.png" /></td>';
|
||||
else
|
||||
printf('<td><input type="radio" name="template" value="%s" id="%s" %s /></td>',
|
||||
htmlspecialchars($name),htmlspecialchars($name),
|
||||
! $isValid ? 'disabled' : (strcasecmp('Custom',$name) ? '' : 'checked'));
|
||||
|
||||
printf('<td class="icon"><label for="%s"><img src="%s" /></label></td>',
|
||||
htmlspecialchars($name),$template['icon']);
|
||||
|
||||
printf('<td class="name"><label for="%s">',
|
||||
htmlspecialchars($name));
|
||||
|
||||
if (strcasecmp('Custom', $template['desc']) == 0)
|
||||
echo '<b>';
|
||||
|
||||
if (! $isValid)
|
||||
if (isset($template['invalid']) && $template['invalid'])
|
||||
printf('<span style="color: gray"><acronym title="%s">',
|
||||
isset($template['invalid_reason']) ? $template['invalid_reason'] :
|
||||
_('This template has been disabled in the XML file.'));
|
||||
else
|
||||
printf('<span style="color: gray"><acronym title="%s">',
|
||||
_('This template is not allowed in this container.'));
|
||||
|
||||
echo htmlspecialchars($template['desc']);
|
||||
|
||||
if (! $isValid) echo '</acronym></span>';
|
||||
if (strcasecmp('Custom', $template['desc']) == 0)
|
||||
echo '</b>';
|
||||
|
||||
echo '</label></td></tr>';
|
||||
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</td></tr></table>';
|
||||
echo '</td></tr>';
|
||||
|
||||
printf('<tr><td colspan="2"><center><input type="submit" name="submit" value="%s" /></center></td></tr>',
|
||||
htmlspecialchars(_('Proceed >>')));
|
||||
|
||||
echo '</table>';
|
||||
echo '</form></body></html>';
|
||||
?>
|
@@ -1,10 +1,16 @@
|
||||
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/style.css,v 1.40 2004/10/23 21:13:16 uugdave Exp $ */
|
||||
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.44.4.3 2008/11/28 14:21:37 wurley Exp $ */
|
||||
span.hint {
|
||||
font-size: small;
|
||||
font-weight: normal;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
span.warning {
|
||||
font-size: small;
|
||||
font-weight: normal;
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
span.x-small {
|
||||
font-size: x-small;
|
||||
}
|
||||
@@ -29,7 +35,7 @@ table.schema_attr th {
|
||||
padding: 5px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: 125%;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
table.schema_attr td {
|
||||
@@ -81,7 +87,7 @@ table.error tr td h2 {
|
||||
}
|
||||
|
||||
table.error tr td.img {
|
||||
vertical-align: center;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
width: 20px;
|
||||
}
|
||||
@@ -130,7 +136,7 @@ table.template_display tr td {
|
||||
|
||||
table.templates tr td {
|
||||
text-align: left;
|
||||
vertical-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table.templates tr {
|
||||
@@ -143,7 +149,7 @@ table.templates td.icon {
|
||||
|
||||
table.exporters tr td {
|
||||
text-align: left;
|
||||
vertical-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table.exporters tr {
|
||||
@@ -157,7 +163,7 @@ a img {
|
||||
body {
|
||||
font-family: arial, helvetica, sans-serif;
|
||||
background-color: white;
|
||||
font-size: 12pt;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
table.tree tr.login td {
|
||||
@@ -198,7 +204,7 @@ table.tree tr.server td {
|
||||
padding-top: 15px;
|
||||
padding-bottom: 0px;
|
||||
vertical-align: top;
|
||||
font-size: 20px;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
@@ -206,7 +212,7 @@ table.tree td.icon {
|
||||
text-align: center;
|
||||
padding: 0px;
|
||||
width: 14px;
|
||||
font-size: 1px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
table.tree td.rdn {
|
||||
@@ -261,7 +267,7 @@ h3.title {
|
||||
background-color: #018;
|
||||
border: 1px solid black;
|
||||
font-weight: normal;
|
||||
font-size: 150%;
|
||||
font-size: 140%;
|
||||
}
|
||||
|
||||
h3.subtitle {
|
||||
@@ -278,11 +284,32 @@ h3.subtitle {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.comp_dn {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
empty-cells: show;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
table.comp_dn tr {
|
||||
width: 200px;
|
||||
}
|
||||
table.comp_dn tr td.attr {
|
||||
background-color: #eee;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.comp_dn tr td.attr_note {
|
||||
text-align: right;
|
||||
background-color: #eee;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
table.edit_dn {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
empty-cells: show;
|
||||
width: 500px;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
table.edit_dn input {
|
||||
@@ -290,14 +317,14 @@ table.edit_dn input {
|
||||
}
|
||||
|
||||
table.edit_dn input.val {
|
||||
font-size: 14px;
|
||||
font-size: 12px;
|
||||
width: 350px;
|
||||
font-family: arial, helvetica, sans-serif
|
||||
font-family: arial, helvetica, sans-serif;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
table.edit_dn textarea.val {
|
||||
font-size: 14px;
|
||||
font-size: 12px;
|
||||
width: 350px;
|
||||
font-family: arial, helvetica, sans-serif;
|
||||
background-color: white;
|
||||
@@ -335,9 +362,9 @@ table.edit_dn tr td.attr a:hover {
|
||||
|
||||
table.edit_dn tr td.val {
|
||||
text-align: left;
|
||||
vertical-align: center;
|
||||
vertical-align: middle;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 80px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
|
||||
@@ -391,7 +418,7 @@ input.update_dn {
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 10pt;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
form.edit_dn {
|
||||
@@ -406,7 +433,7 @@ h4.oclass {
|
||||
margin-top: 8px;
|
||||
font-weight: normal;
|
||||
border: 1px solid black;
|
||||
font-size: 140%;
|
||||
font-size: 120%;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@@ -567,6 +594,11 @@ table.create td.heading {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
table.create td.name {
|
||||
font-size: 11px;
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
div.add_value {
|
||||
font-size: 10pt;
|
||||
margin: 0px;
|
||||
@@ -605,16 +637,27 @@ p.doc {
|
||||
table.export_form {
|
||||
font-size: 75%;
|
||||
width: 400px;
|
||||
border-spacing: 10px;
|
||||
border-collapse: separate;
|
||||
border-spacing: 10px;
|
||||
border-collapse: separate;
|
||||
}
|
||||
|
||||
table.export_form tr td {
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
table.form tr td {
|
||||
vertical-align: top;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
|
||||
.attribute_failed {
|
||||
color: red;
|
||||
}
|
||||
|
||||
img.chooser {
|
||||
/* This makes the chooser image line up properly when placed next to a form element in a table cell*/
|
||||
vertical-align: bottom;
|
55
htdocs/delete.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.24.2.3 2005/12/11 08:21:03 wurley Exp $
|
||||
|
||||
/**
|
||||
* Deletes a DN and presents a "job's done" message.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn = $_POST['dn'];
|
||||
|
||||
if (is_null($dn))
|
||||
pla_error(_('You must specify a DN'));
|
||||
|
||||
if (! $ldapserver->dnExists($dn))
|
||||
pla_error(sprintf(_('No such entry: %s'),'<b>'.pretty_print_dn($dn).'</b>'));
|
||||
|
||||
# Check the user-defined custom callback first.
|
||||
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)))
|
||||
$del_result = $ldapserver->delete($dn);
|
||||
else
|
||||
pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($dn).'</b>'));
|
||||
|
||||
if ($del_result) {
|
||||
# Custom callback
|
||||
run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn));
|
||||
|
||||
include './header.php';
|
||||
echo '<body>';
|
||||
|
||||
echo '<script type="text/javascript" language="javascript">parent.left_frame.location.reload();</script>';
|
||||
echo '<br /><br />';
|
||||
printf('<center>'._('Entry %s deleted successfully.').'</center>','<b>'.pretty_print_dn($dn).'</b>');
|
||||
echo '</body>';
|
||||
|
||||
} else {
|
||||
pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($dn).'</b>'),
|
||||
$ldapserver->error(),$ldapserver->errno());
|
||||
}
|
||||
echo '</html>';
|
||||
?>
|
54
htdocs/delete_attr.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.14.2.5 2005/12/09 14:29:37 wurley Exp $
|
||||
|
||||
/**
|
||||
* Deletes an attribute from an entry with NO confirmation.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
*
|
||||
* On success, redirect to template_engine.php
|
||||
* On failure, echo an error.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn = isset($_POST['dn']) ? $_POST['dn'] : null;
|
||||
$attr = isset($_POST['attr']) ? $_POST['attr'] : null;
|
||||
|
||||
if (! $dn)
|
||||
pla_error(_('No DN specified'));
|
||||
|
||||
if (! $attr)
|
||||
pla_error(_('No attribute name specified.'));
|
||||
|
||||
$encoded_dn = rawurlencode($dn);
|
||||
|
||||
if ($ldapserver->isAttrReadOnly($attr))
|
||||
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($attr)));
|
||||
|
||||
$update_array = array();
|
||||
$update_array[$attr] = array();
|
||||
|
||||
$res = $ldapserver->modify($dn,$update_array);
|
||||
if ($res) {
|
||||
$redirect_url = sprintf('template_engine.php?server_id=%s&dn=%s',$ldapserver->server_id,$encoded_dn);
|
||||
|
||||
foreach($update_array as $attr => $junk)
|
||||
$redirect_url .= "&modified_attrs[]=$attr";
|
||||
|
||||
header("Location: $redirect_url");
|
||||
|
||||
} else {
|
||||
pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno());
|
||||
}
|
||||
?>
|
153
htdocs/delete_form.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.20.4.6 2006/04/29 04:05:14 wurley Exp $
|
||||
|
||||
/**
|
||||
* delete_form.php
|
||||
* Displays a last chance confirmation form to delete a dn.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$children = $ldapserver->getContainerContents($dn,0,'(objectClass=*)',LDAP_DEREF_NEVER);
|
||||
$has_children = count($children) > 0 ? true : false;
|
||||
|
||||
include './header.php';
|
||||
|
||||
echo '<body>';
|
||||
printf('<h3 class="title">'._('Delete %s').'</h3>',htmlspecialchars(get_rdn($dn)));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b> %s: <b>%s</b></h3>',
|
||||
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
|
||||
echo "\n";
|
||||
|
||||
echo '<center>';
|
||||
|
||||
if ($has_children) {
|
||||
printf('<b>%s</b><br /><br />',_('Permanently delete all children also?'));
|
||||
flush();
|
||||
|
||||
# get the total number of child objects (whole sub-tree)
|
||||
$s = $ldapserver->search(null,dn_escape($dn),'objectClass=*',array('dn'));
|
||||
$sub_tree_count = count($s);
|
||||
|
||||
echo '<table class="delete_confirm">';
|
||||
echo '<tr>';
|
||||
echo '<td><p>';
|
||||
printf(_('This entry is the root of a sub-tree containing %s entries.'),$sub_tree_count);
|
||||
printf('<small>(<a href="search.php?search=true&server_id=%s&filter=%s&base_dn=%s&form=advanced&scope=sub">%s</a>)</small>',
|
||||
$ldapserver->server_id,rawurlencode('objectClass=*'),rawurlencode($dn),_('view entries'));
|
||||
echo '<br /><br />';
|
||||
|
||||
printf(_('phpLDAPadmin can recursively delete this entry and all %s of its children. See below for a list of all the entries that this action will delete. Do you want to do this?'),($sub_tree_count-1));
|
||||
echo '<br /><br />';
|
||||
|
||||
printf('<small>%s</small>',
|
||||
_('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.'));
|
||||
echo '<br /><br />';
|
||||
echo "\n";
|
||||
|
||||
echo '<table width="100%">';
|
||||
echo '<tr>';
|
||||
echo '<td><center>';
|
||||
echo '<form action="rdelete.php" method="post">';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="submit" class="scary" value="%s" />',sprintf(_('Delete all %s objects'),$sub_tree_count));
|
||||
echo '</form>';
|
||||
echo '</center></td>';
|
||||
|
||||
echo '<td><center>';
|
||||
echo '<form action="template_engine.php" method="get">';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel'));
|
||||
echo '</form>';
|
||||
echo '</center></td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
|
||||
flush();
|
||||
|
||||
echo '<br /><br />';
|
||||
echo _('List of entries to be deleted:');
|
||||
echo '<br />';
|
||||
|
||||
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,$sub_tree_count));
|
||||
$i=0;
|
||||
foreach ($s as $dn => $junk) {
|
||||
$i++;
|
||||
printf('<option>%s. %s</option>',$i,htmlspecialchars(dn_unescape($dn)));
|
||||
}
|
||||
echo '</select>';
|
||||
echo "\n";
|
||||
|
||||
} else {
|
||||
echo '<table class="delete_confirm">';
|
||||
echo '<tr>';
|
||||
|
||||
echo '<td nowrap>';
|
||||
echo _('Are you sure you want to permanently delete this object?');
|
||||
echo '<br /><br />';
|
||||
|
||||
printf('<acronym title="%s">%s</acronym>: <b>%s</b>',_('Distinguished Name'),_('DN'),pretty_print_dn($dn));
|
||||
echo '<br />';
|
||||
printf('%s: <b>%s</b>',_('Server'),htmlspecialchars($ldapserver->name));
|
||||
echo '<br /><br />';
|
||||
echo "\n";
|
||||
|
||||
echo '<table width="100%">';
|
||||
echo '<tr>';
|
||||
|
||||
echo '<td><center>';
|
||||
echo '<form action="delete.php" method="post">';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="submit" name="submit" value="%s" class="scary" />',_('Delete'));
|
||||
echo '</form>';
|
||||
|
||||
echo '</center></td>';
|
||||
|
||||
echo '<td><center>';
|
||||
echo '<form action="template_engine.php" method="get">';
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
||||
printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel'));
|
||||
echo '</form>';
|
||||
|
||||
echo '</center></td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
echo '</center>';
|
||||
echo '<br />';
|
||||
echo '</body>';
|
||||
echo '</html>';
|
||||
?>
|
39
htdocs/download_binary_attr.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.13.2.3 2005/12/08 11:49:28 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
if ($ldapserver->isReadOnly())
|
||||
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn = rawurldecode($_GET['dn']);
|
||||
$attr = $_GET['attr'];
|
||||
|
||||
# if there are multiple values in this attribute, which one do you want to see?
|
||||
$value_num = isset($_GET['value_num']) ? $_GET['value_num'] : null;
|
||||
|
||||
if (! $ldapserver->dnExists($dn))
|
||||
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn)));
|
||||
|
||||
$search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$config->GetValue('deref','view'));
|
||||
|
||||
# Dump the binary data to the browser
|
||||
header('Content-type: octet-stream');
|
||||
header("Content-disposition: attachment; filename=$attr");
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
if ($value_num && is_array($search[$attr][$dn]))
|
||||
echo $search[$dn][$attr][$value_num];
|
||||
else
|
||||
echo $search[$dn][$attr];
|
||||
?>
|
117
htdocs/entry_chooser.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.27.2.5 2008/11/28 14:21:37 wurley Exp $
|
||||
|
||||
/**
|
||||
* Display a selection (popup window) to pick a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$container = isset($_GET['container']) ? rawurldecode($_GET['container']) : false;
|
||||
$return_form_element = isset($_GET['form_element']) ? htmlspecialchars($_GET['form_element']) : null;
|
||||
$rdn = isset($_GET['rdn']) ? htmlspecialchars($_GET['rdn']) : null;
|
||||
|
||||
include "./header.php";
|
||||
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Entry Chooser'));
|
||||
flush();
|
||||
?>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
function returnDN(dn) {
|
||||
opener.document.<?php echo $return_form_element; ?>.value = dn;
|
||||
close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
if ($container) {
|
||||
printf('%s<b>%s</b>',_('Server: '),htmlspecialchars($ldapserver->name));
|
||||
echo '<br />';
|
||||
printf('%s<b>%s</b>',_('Looking in: '),htmlspecialchars($container));
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
/* Has the use already begun to descend into a specific server tree? */
|
||||
if (isset($ldapserver) && $container !== false) {
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$dn_list = $ldapserver->getContainerContents($container,0,'(objectClass=*)',$config->GetValue('deref','tree'));
|
||||
sort($dn_list);
|
||||
|
||||
foreach ($ldapserver->getBaseDN() as $base_dn) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('entry_chooser.php: Comparing BaseDN [%s] with container [%s]',64,$base_dn,$container);
|
||||
|
||||
if (! pla_compare_dns($container,$base_dn)) {
|
||||
$parent_container = false;
|
||||
$up_href = sprintf('entry_chooser.php?form_element=%s&rdn=%s',$return_form_element,$rdn);
|
||||
break;
|
||||
|
||||
} else {
|
||||
$parent_container = get_container($container);
|
||||
$up_href = sprintf('entry_chooser.php?form_element=%s&rdn=%s&server_id=%s&container=%s',
|
||||
$return_form_element,$rdn,$ldapserver->server_id,rawurlencode($parent_container));
|
||||
}
|
||||
}
|
||||
|
||||
echo ' ';
|
||||
printf('<a href="%s" style="text-decoration:none"><img src="images/up.png" /> %s</a>',$up_href,_('Back Up...'));
|
||||
echo '<br />';
|
||||
|
||||
if (! count($dn_list))
|
||||
printf(' (%s)<br />',_('no entries'));
|
||||
|
||||
else
|
||||
foreach ($dn_list as $dn) {
|
||||
$href = sprintf("javascript:returnDN('%s%s')",
|
||||
($rdn ? '"'.htmlspecialchars(dn_js_escape($rdn)).',"' : ''),
|
||||
htmlspecialchars(dn_js_escape($dn)));
|
||||
echo ' ';
|
||||
printf('<a href="entry_chooser.php?server_id=%s&form_element=%s&rdn=%s&container=%s"><img src="images/plus.png" /></a>',
|
||||
$ldapserver->server_id,$return_form_element,$rdn,rawurlencode($dn));
|
||||
|
||||
printf('<a href="%s">%s</a>',$href,htmlspecialchars($dn));
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
/* draw the root of the selection tree (ie, list all the servers) */
|
||||
} else {
|
||||
foreach ($ldapservers->GetServerList() as $id) {
|
||||
|
||||
$ldapserver = $ldapservers->Instance($id);
|
||||
|
||||
if ($ldapserver->isVisible()) {
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
continue;
|
||||
|
||||
else {
|
||||
printf('<b>%s</b>',htmlspecialchars($ldapserver->name));
|
||||
echo '<br />';
|
||||
foreach ($ldapserver->getBaseDN() as $dn) {
|
||||
if (! $dn) {
|
||||
printf('<small> (%s)</small><br />',_('Could not determine base DN'));
|
||||
|
||||
} else {
|
||||
$href = sprintf("javascript:returnDN('%s%s')",($rdn ? "$rdn," : ''),$dn);
|
||||
|
||||
echo ' ';
|
||||
printf('<a href="entry_chooser.php?server_id=%s&form_element=%s&rdn=%s&container=%s"><img src="images/plus.png" /></a> ',
|
||||
$ldapserver->server_id,$return_form_element,$rdn,rawurlencode($dn));
|
||||
|
||||
printf('<a href="%s">%s</a>',$href,htmlspecialchars($dn));
|
||||
echo '<br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
45
htdocs/expand.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/expand.php,v 1.22.4.3 2007/03/18 03:16:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* This script alters the session variable 'tree', expanding it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Variables that come in via common.php
|
||||
* - server_id
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
*
|
||||
* Note: this script is equal and opposite to collapse.php
|
||||
* @package phpLDAPadmin
|
||||
* @see collapse.php
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
no_expire_header();
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
# This allows us to display large sub-trees without running out of time.
|
||||
@set_time_limit(0);
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
|
||||
# We dont need this result, as we'll use the SESSION value when we call tree.php
|
||||
$ldapserver->getContainerContents($dn,0,'(objectClass=*)',$config->GetValue('deref','tree'));
|
||||
|
||||
$tree = get_cached_item($ldapserver->server_id,'tree');
|
||||
$tree['browser'][$dn]['open'] = true;
|
||||
set_cached_item($ldapserver->server_id,'tree','null',$tree);
|
||||
|
||||
/* If cookies were disabled, build the url parameter for the session id.
|
||||
It will be append to the url to be redirect */
|
||||
$id_session_param = '';
|
||||
if (SID != '')
|
||||
$id_session_param = sprintf('&%s=%s',session_name(),session_id());
|
||||
|
||||
header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param));
|
||||
?>
|
111
htdocs/export.php
Executable file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.15.4.6 2005/12/10 12:03:44 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
# Fix a bug with IE:
|
||||
ini_set('session.cache_limiter','');
|
||||
|
||||
require './common.php';
|
||||
require LIBDIR.'export_functions.php';
|
||||
|
||||
if (! $ldapserver->haveAuthInfo())
|
||||
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
||||
|
||||
$base_dn = isset($_POST['dn']) ? $_POST['dn']:NULL;
|
||||
$format = isset($_POST['format']) ? $_POST['format'] : 'unix';
|
||||
$scope = isset($_POST['scope']) ? $_POST['scope'] : 'base';
|
||||
$filter = isset($_POST['filter']) ? $_POST['filter'] : 'objectclass=*';
|
||||
$target = isset($_POST['target']) ? $_POST['target'] : 'display';
|
||||
$save_as_file = isset($_POST['save_as_file']) && $_POST['save_as_file'] == 'on';
|
||||
|
||||
if (isset($_POST['filter'])) {
|
||||
preg_replace('/\s+/','',$_POST['filter']);
|
||||
$attributes = split(',',preg_replace('/\s+/','',$_POST['attributes']));
|
||||
|
||||
} else {
|
||||
$attributes = array();
|
||||
}
|
||||
|
||||
# add system attributes if needed
|
||||
if (isset($_POST['sys_attr'])) {
|
||||
array_push($attributes,'*');
|
||||
array_push($attributes,'+');
|
||||
}
|
||||
|
||||
isset($_POST['exporter_id']) or pla_error(_('You must choose an export format.'));
|
||||
$exporter_id = $_POST['exporter_id'];
|
||||
isset($exporters[$exporter_id]) or pla_error(_('Invalid export format'));
|
||||
|
||||
# Initialisation of other variables
|
||||
$friendly_rdn = get_rdn($base_dn,1);
|
||||
$extension = $exporters[$exporter_id]['extension'];
|
||||
|
||||
# default case not really needed
|
||||
switch ($format) {
|
||||
case 'win':
|
||||
$br = "\r\n";
|
||||
break;
|
||||
case 'mac':
|
||||
$br = "\r";
|
||||
break;
|
||||
case 'unix':
|
||||
default:
|
||||
$br = "\n";
|
||||
}
|
||||
|
||||
# get the decoree,ie the source
|
||||
$plaLdapExporter = new PlaLdapExporter($ldapserver->server_id,$filter,$base_dn,$scope,$attributes);
|
||||
|
||||
# the decorator do it that way for the moment
|
||||
$exporter = null;
|
||||
|
||||
switch ($exporter_id) {
|
||||
case 0:
|
||||
$exporter = new PlaLdifExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$exporter = new PlaDsmlExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$exporter = new PlaVcardExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$exporter = new PlaCSVExporter($plaLdapExporter);
|
||||
break;
|
||||
|
||||
default:
|
||||
# truly speaking,this default case will never be reached. See check at the bottom.
|
||||
pla_error(_('No available exporter found.'));
|
||||
}
|
||||
|
||||
# set the CLRN
|
||||
$exporter->setOutputFormat($br);
|
||||
|
||||
if (isset($_REQUEST['compress']) && $_REQUEST['compress'] = 'on')
|
||||
$exporter->compress(true);
|
||||
|
||||
# prevent script from bailing early for long search
|
||||
@set_time_limit(0);
|
||||
|
||||
# send the header
|
||||
if ($save_as_file)
|
||||
header('Content-type: application/download');
|
||||
else
|
||||
header('Content-type: text/plain');
|
||||
|
||||
header(sprintf('Content-Disposition: filename="%s.%s"',$friendly_rdn,$exporters[$exporter_id]['extension'].($exporter->isCompressed()?'.gz':'')));
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
|
||||
# and export
|
||||
$exporter->export();
|
||||
?>
|
165
htdocs/export_form.php
Executable file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.22.4.7 2007/03/18 03:16:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* export_form.php
|
||||
* Html form to choose an export format(ldif,...)
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require LIBDIR.'export_functions.php';
|
||||
|
||||
$format = isset($_GET['format']) ? $_GET['format'] : get_line_end_format();
|
||||
$scope = isset($_GET['scope']) ? $_GET['scope'] : 'base' ;
|
||||
$exporter_id = isset($_GET['exporter_id']) ? $_GET['exporter_id'] : 0 ;
|
||||
$dn = isset($_GET['dn']) ? $_GET['dn'] : null;
|
||||
$filter = isset($_GET['filter']) ? $_GET['filter'] : '(objectClass=*)';
|
||||
$attributes = isset($_GET['attributes']) ? $_GET['attributes'] : '*';
|
||||
$sys_attr = isset($_GET['sys_attr']) && $_GET['sys_attr'] == 'true' ? true : false;
|
||||
|
||||
$available_formats = array (
|
||||
'unix' => 'UNIX (Linux, BSD)',
|
||||
'mac' => 'Macintosh',
|
||||
'win' => 'Windows'
|
||||
);
|
||||
|
||||
$available_scopes = array (
|
||||
'base' => _('Base (base dn only)'),
|
||||
'one' => _('One (one level beneath base)'),
|
||||
'sub' => _('Sub (entire subtree)')
|
||||
);
|
||||
|
||||
|
||||
include './header.php';
|
||||
|
||||
echo '<body>';
|
||||
printf('<h3 class="title">%s</h3>',_('Export'));
|
||||
echo '<br />';
|
||||
echo '<center>';
|
||||
echo '<form name="export_form" action="export.php" method="post">';
|
||||
echo '<table class="export_form">';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
|
||||
echo '<fieldset>';
|
||||
printf('<legend>%s</legend>',_('Export'));
|
||||
|
||||
echo '<table>';
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),server_select_list());
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td style="white-space:nowrap">%s</td>',_('Base DN'));
|
||||
printf('<td><span style="white-space: nowrap;"><input type="text" name="dn" id="dn" style="width:230px" value="%s" /> ',htmlspecialchars($dn));
|
||||
draw_chooser_link('export_form.dn');
|
||||
echo '</span></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><span style="white-space: nowrap">%s</span></td>',_('Search Scope'));
|
||||
|
||||
echo '<td>';
|
||||
|
||||
foreach ($available_scopes as $id => $desc)
|
||||
printf('<input type="radio" name="scope" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
|
||||
htmlspecialchars($id),htmlspecialchars($id),($id == $scope) ? 'checked="true"' : '',
|
||||
htmlspecialchars($id),htmlspecialchars($desc));
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr><td>%s</td><td><input type="text" name="filter" style="width:300px" value="%s" /></td></tr>',
|
||||
_('Search Filter'),htmlspecialchars($filter));
|
||||
|
||||
printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300px" value="%s" /></td></tr>',
|
||||
_('Show Attributtes'),htmlspecialchars($attributes));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>',
|
||||
$sys_attr ? 'checked="true" ' : '',_('Include system attributes'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="save_as_file" name="save_as_file" onclick="toggle_disable_field_saveas(this)" /> <label for="save_as_file">%s</label></td></tr>',
|
||||
_('Save as file'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="compress" name="compress" disabled /> <label for="compress">%s</label></td></tr>',
|
||||
_('Compress'));
|
||||
|
||||
echo '</table>';
|
||||
echo '</fieldset>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
|
||||
echo '<table style="width: 100%">';
|
||||
echo '<tr><td style="width: 50%">';
|
||||
echo '<fieldset style="height: 100px">';
|
||||
|
||||
printf('<legend>%s</legend>',_('Export format'));
|
||||
|
||||
foreach ($exporters as $index => $exporter) {
|
||||
printf('<input type="radio" name="exporter_id" id="exporter_id_%s" value="%s"%s />',
|
||||
htmlspecialchars($index),htmlspecialchars($index),($index==$exporter_id) ? ' checked="true"' : '');
|
||||
printf('<label for="%s">%s</label><br />',
|
||||
htmlspecialchars($index),htmlspecialchars($exporter['desc']));
|
||||
}
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</td>';
|
||||
echo '<td style="width: 50%">';
|
||||
echo '<fieldset style="height: 100px">';
|
||||
|
||||
printf('<legend>%s</legend>',_('Line ends'));
|
||||
foreach ($available_formats as $id => $desc)
|
||||
printf('<input type="radio" name="format" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
|
||||
htmlspecialchars($id),htmlspecialchars($id),($format==$id) ? ' checked="true"' : '',
|
||||
htmlspecialchars($id),htmlspecialchars($desc));
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2">';
|
||||
printf('<center><input type="submit" name="target" value="%s" /></center>',
|
||||
htmlspecialchars(_('Proceed >>')));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
echo '</form>';
|
||||
echo '</center>';
|
||||
|
||||
/**
|
||||
* Helper functoin for fetching the line end format.
|
||||
* @return String 'win', 'unix', or 'mac' based on the user's browser..
|
||||
*/
|
||||
function get_line_end_format() {
|
||||
if (is_browser_os_windows())
|
||||
return 'win';
|
||||
elseif (is_browser_os_unix())
|
||||
return 'unix';
|
||||
elseif (is_browser_os_mac())
|
||||
return 'mac';
|
||||
else
|
||||
return 'unix';
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
function toggle_disable_field_saveas(id) {
|
||||
if (id.checked) {
|
||||
id.form.compress.disabled = false;
|
||||
} else {
|
||||
id.form.compress.disabled = true;
|
||||
id.form.compress.checked = false;
|
||||
}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
58
htdocs/header.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.21.2.4 2006/04/29 03:14:45 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/* We want to get $language into scope in case we were included
|
||||
from within a function */
|
||||
$language = isset($config) ? $language = $config->GetValue('appearance','language') : 'auto';
|
||||
|
||||
# text/xml won't work with MSIE, but is very useful for debugging xhtml code.
|
||||
# header('Content-type: text/xml; charset="UTF-8"');
|
||||
@header('Content-type: text/html; charset="UTF-8"');
|
||||
|
||||
# XML version and encoding for well-behaved browsers
|
||||
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
|
||||
|
||||
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'."\n";
|
||||
echo '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
|
||||
|
||||
printf('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="%s" lang="%s" dir="ltr">',$language,$language);
|
||||
echo "\n\n";
|
||||
|
||||
echo '<head>';
|
||||
|
||||
if (isset($config) && $pagetitle = $config->GetValue('appearance','page_title'))
|
||||
printf('<title>phpLDAPadmin - %s</title>',$pagetitle);
|
||||
else
|
||||
echo '<title>phpLDAPadmin</title>';
|
||||
|
||||
printf('<link type="text/css" rel="stylesheet" href="%sstyle.css" media="screen" />',CSSDIR);
|
||||
|
||||
if (isset($server_id)) {
|
||||
$custom_file = get_custom_file($server_id,'style.css',CSSDIR);
|
||||
|
||||
if (strcmp($custom_file,'style.css') != 0)
|
||||
printf('<link type="text/css" rel="stylesheet" href="%s" media="screen" />',$custom_file);
|
||||
}
|
||||
|
||||
printf('<script type="text/javascript" src="%sentry_chooser.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sie_png_work_around.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%ssearch_util.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sgeneric_utils.js"></script>',JSDIR);
|
||||
printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sdate_selector.js"></script>',JSDIR);
|
||||
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>',JSDIR);
|
||||
|
||||
if (isset($meta_refresh_variable))
|
||||
printf('<meta http-equiv="refresh" content="%s" />',$meta_refresh_variable);
|
||||
|
||||
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
|
||||
echo '</head>';
|
||||
echo "\n\n";
|
||||
?>
|
28
htdocs/help.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/Attic/help.php,v 1.5 2005/02/26 12:35:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
include './common.php';
|
||||
include './header.php';
|
||||
|
||||
$forum_href = get_href( 'forum' );
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">Help</h3>
|
||||
<br />
|
||||
<center>
|
||||
<p>Do you have a problem or question?</p>
|
||||
<p>Perhaps you are new to LDAP and need a little guidance?</p>
|
||||
<p>Help is only one click away. Visit the online <a href="<?php echo $forum_href; ?>">phpLDAPadmin support forum</a>.</p>
|
||||
<br />
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 528 B After Width: | Height: | Size: 528 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
BIN
htdocs/images/calendar.png
Normal file
After Width: | Height: | Size: 478 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
BIN
htdocs/images/compare.png
Normal file
After Width: | Height: | Size: 665 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |