Compare commits
5 Commits
RELEASE-0.
...
RELEASE-0.
Author | SHA1 | Date | |
---|---|---|---|
|
bc6a3bea7a | ||
|
0074652abf | ||
|
e126518f60 | ||
|
7ff3528665 | ||
|
d12096bbd3 |
18
INSTALL
@@ -14,8 +14,24 @@ in the "doc" directory.
|
||||
3. Copy 'config.php.example' to 'config.php' and edit to taste.
|
||||
4. Then, point your browser to the phpldapadmin directory.
|
||||
|
||||
* For help
|
||||
* For additional help
|
||||
|
||||
See the files in the "doc" directory.
|
||||
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.
|
||||
|
||||
|
167
add_attr.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr.php,v 1.13 2005/04/15 11:46:41 wurley Exp $
|
||||
|
||||
/**
|
||||
* Adds an attribute/value pair to an object
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn
|
||||
* - server_id
|
||||
* - attr
|
||||
* - val
|
||||
* - binary
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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( $lang['left_attr_blank'] );
|
||||
}
|
||||
|
||||
// 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( $ldapserver, $dn, $attr, array($val) ) ) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$server_id,$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'] );
|
||||
break;
|
||||
|
||||
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
pla_error( $lang['uploaded_file_too_big'] );
|
||||
break;
|
||||
|
||||
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form
|
||||
pla_error( $lang['uploaded_file_too_big'] );
|
||||
break;
|
||||
|
||||
case 3: //uploaded file was only partially uploaded
|
||||
pla_error( $lang['uploaded_file_partial'] );
|
||||
break;
|
||||
|
||||
case 4: //no file was uploaded
|
||||
pla_error( $lang['left_attr_blank'] );
|
||||
break;
|
||||
|
||||
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( $ldapserver, $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( in_array( $attr,array('sambantpassword','sambalmpassword') ) ){
|
||||
$mkntPassword = new MkntPasswdUtil();
|
||||
$mkntPassword->createSambaPasswords( $val );
|
||||
$val = $mkntPassword->valueOf($attr);
|
||||
}
|
||||
|
||||
$new_entry = array( $attr => $val );
|
||||
$result = @ldap_mod_add( $ldapserver->connect(), $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($ldapserver->connect()),ldap_errno($ldapserver->connect()) );
|
||||
|
||||
/**
|
||||
* Check if we need to append the ;binary option to the name
|
||||
* of some binary attribute
|
||||
*
|
||||
* @param int $server_id Server ID 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 = get_schema_attribute( $ldapserver, $attr );
|
||||
if( ! $schema_attr )
|
||||
return false;
|
||||
|
||||
$syntax = $schema_attr->getSyntaxOID();
|
||||
if( isset( $binary_attributes_with_options[ $syntax ] ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
?>
|
199
add_attr_form.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr_form.php,v 1.11 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
/**
|
||||
* Displays a form for adding an attribute/value to an LDAP entry.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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( $lang['add_new_attribute'], htmlspecialchars( $rdn ) ); ?></b></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $ldapserver->name; ?></b> <?php echo $lang['distinguished_name']; ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
|
||||
|
||||
<?php $attrs = get_object_attrs( $ldapserver, $dn );
|
||||
|
||||
$oclasses = get_object_attr( $ldapserver, $dn, 'objectClass' );
|
||||
if( ! is_array( $oclasses ) )
|
||||
$oclasses = array( $oclasses );
|
||||
|
||||
$avail_attrs = array();
|
||||
|
||||
$schema_oclasses = get_schema_objectclasses( $ldapserver, $dn );
|
||||
foreach( $oclasses as $oclass ) {
|
||||
$schema_oclass = get_schema_objectclass( $ldapserver, $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( $ldapserver, $attr ) ) {
|
||||
$avail_binary_attrs[] = $attr;
|
||||
unset( $avail_attrs[ $i ] );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<br />
|
||||
|
||||
<center>
|
||||
|
||||
<?php echo $lang['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 $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'];
|
||||
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.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
?>
|
@@ -1,32 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* add_oclass.php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass.php,v 1.14 2005/03/20 04:43:36 wurley Exp $
|
||||
|
||||
/**
|
||||
* 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:
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
* - new_oclass
|
||||
* - new_attrs (array, if any)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
if( is_attr_read_only( $ldapserver, 'objectClass' ) )
|
||||
pla_error( "ObjectClasses are flagged as read only in the phpLDAPadmin configuration." );
|
||||
|
||||
$new_entry = array();
|
||||
$new_entry['objectClass'] = $new_oclass;
|
||||
@@ -35,23 +44,27 @@ $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 )
|
||||
$new_entry[ $attr ] = $val;
|
||||
foreach( $new_attrs as $attr => $val ) {
|
||||
|
||||
//echo "<pre>";
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $ldapserver, $dn, $attr, array($val) ) ) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$server_id,$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 ) or pla_error( $lang['could_not_connect'] );
|
||||
$add_res = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
$add_res = @ldap_mod_add( $ldapserver->connect(), $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" );
|
||||
}
|
||||
if( ! $add_res ) {
|
||||
pla_error( $lang['could_not_perform_ldap_mod_add'],ldap_error($ldapserver->connect()),ldap_errno($ldapserver->connect()) );
|
||||
|
||||
} else {
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=objectclass" );
|
||||
}
|
||||
?>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass_form.php,v 1.18 2005/03/12 14:03:36 wurley 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:
|
||||
*
|
||||
@@ -9,89 +9,106 @@
|
||||
* 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:
|
||||
* Variables that come in as REQUEST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
* - new_oclass
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
require './common.php';
|
||||
|
||||
require 'common.php';
|
||||
$server_id = (isset($_REQUEST['server_id']) ? $_REQUEST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
$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 ) )
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
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_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 = get_object_attrs( $server_id, $dn, true );
|
||||
$entry = get_object_attrs( $ldapserver, $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 );
|
||||
$oclass = get_schema_objectclass( $ldapserver, $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();
|
||||
//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 )
|
||||
if( ! in_array( strtolower($attr), $current_attrs ) )
|
||||
$needed_attrs[] = $attr;
|
||||
foreach( $must_attrs as $attr ) {
|
||||
$attr = get_schema_attribute( $ldapserver, $attr->getName() );
|
||||
|
||||
if( count( $needed_attrs ) > 0 )
|
||||
{
|
||||
include 'header.php'; ?>
|
||||
//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>
|
||||
<h3 class="subtitle"><?php echo $lang['requires_to_add'] . ' ' . count($needed_attrs) .
|
||||
' ' . $lang['new_attributes']; ?></h3>
|
||||
|
||||
<small>
|
||||
<?php
|
||||
echo $lang['new_required_attrs_instructions'];
|
||||
|
||||
<?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 ) { ?>
|
||||
<?php if( $count % 2 == 0 ) { ?>
|
||||
<tr class="row1">
|
||||
<?php } else { ?>
|
||||
<tr class="row2">
|
||||
<?php } ?>
|
||||
<td class="attr"><b><?php echo htmlspecialchars($attr); ?></b></td>
|
||||
<td class="val"><input type="text" name="new_attrs[<?php echo htmlspecialchars($attr); ?>]" value="" size="40" />
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<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 />
|
||||
@@ -102,17 +119,14 @@ if( count( $needed_attrs ) > 0 )
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( "Could not connect to LDAP server." );
|
||||
$add_res = @ldap_mod_add( $ds, $dn, array( 'objectClass' => $new_oclass ) );
|
||||
<?php } else {
|
||||
|
||||
$add_res = @ldap_mod_add( $ldapserver->connect(), $dn, array( 'objectClass' => $new_oclass ) );
|
||||
if( ! $add_res )
|
||||
pla_error( "Could not perform ldap_mod_add operation.", ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
pla_error( "Could not perform ldap_mod_add operation.",
|
||||
ldap_error( $ldapserver->connect() ),ldap_errno( $ldapserver->connect() ) );
|
||||
else
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn" );
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=objectClass" );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -1,55 +1,74 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value.php,v 1.17 2005/03/12 10:42:27 wurley 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
|
||||
* - attr (rawurlencoded) the attribute to which we are adding a value
|
||||
* - server_id
|
||||
* - new_value (form element)
|
||||
* - binary
|
||||
* - binary
|
||||
*
|
||||
* On success, redirect to the edit_dn page.
|
||||
* On failure, echo an error.
|
||||
* On success, redirect to the edit_dn page. On failure, echo an error.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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'];
|
||||
$new_value = utf8_encode($new_value);
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
if( is_attr_read_only( $ldapserver, $attr ) )
|
||||
pla_error(sprintf($lang['attr_is_read_only'],htmlspecialchars( $attr )));
|
||||
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
|
||||
// special case for binary attributes:
|
||||
// special case for binary attributes:
|
||||
// we must go read the data from the file.
|
||||
if( $is_binary_val )
|
||||
{
|
||||
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 );
|
||||
|
||||
$add_result = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $ldapserver, $dn, $attr, $new_entry ) ) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$server_id,$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( run_hook ( 'pre_attr_add', array ( 'server_id' => $server_id, 'dn' => $dn, 'attr_name' => $attr,
|
||||
'new_value' => $new_entry ) ) ) {
|
||||
|
||||
$add_result = @ldap_mod_add( $ldapserver->connect(), $dn, $new_entry );
|
||||
|
||||
if( ! $add_result )
|
||||
pla_error( $lang['could_not_perform_ldap_mod_add'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
pla_error( $lang['could_not_perform_ldap_mod_add'], ldap_error( $ldapserver->connect() ), ldap_errno( $ldapserver->connect() ) );
|
||||
}
|
||||
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=$encoded_attr" );
|
||||
|
||||
|
@@ -1,108 +1,135 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value_form.php,v 1.29 2005/03/12 14:03:36 wurley 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
|
||||
* - attr (rawurlencoded) the attribute to which we are adding a value
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
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'];
|
||||
$attr = $_GET['attr'];
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
$current_values = get_object_attr( $server_id, $dn, $attr );
|
||||
$num_current_values = ( is_array($current_values) ? count($current_values) : 1 );
|
||||
$is_object_class = ( 0 == strcasecmp( $attr, 'objectClass' ) ) ? true : false;
|
||||
$is_jpeg_photo = ( 0 == strcasecmp( $attr, 'jpegPhoto' ) ) ? true : false;
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
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'] );
|
||||
$attr = $_GET['attr'];
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
|
||||
if( null != $dn ) {
|
||||
$rdn = get_rdn( $dn );
|
||||
|
||||
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 );
|
||||
$rdn = null;
|
||||
}
|
||||
|
||||
include 'header.php'; ?>
|
||||
$current_values = get_object_attr( $ldapserver, $dn, $attr );
|
||||
$num_current_values = ( is_array($current_values) ? count($current_values) : 0 );
|
||||
$is_object_class = ( 0 == strcasecmp( $attr, 'objectClass' ) ) ? true : false;
|
||||
$is_jpeg_photo = is_jpeg_photo( $ldapserver, $attr ); //( 0 == strcasecmp( $attr, 'jpegPhoto' ) ) ? 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 = get_schema_objectclasses( $ldapserver );
|
||||
|
||||
foreach( $current_values as $oclass )
|
||||
unset( $schema_oclasses[ strtolower( $oclass ) ] );
|
||||
|
||||
} else {
|
||||
$schema_attr = get_schema_attribute( $ldapserver, $attr );
|
||||
}
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">
|
||||
<?php echo $lang['add_new']; ?>
|
||||
<b><?php echo htmlspecialchars($attr); ?></b>
|
||||
<b><?php echo htmlspecialchars($attr); ?></b>
|
||||
<?php echo $lang['value_to']; ?>
|
||||
<b><?php echo htmlentities($rdn); ?></b></h3>
|
||||
<b><?php echo htmlspecialchars($rdn); ?></b></h3>
|
||||
|
||||
<h3 class="subtitle">
|
||||
<?php echo $lang['server']; ?>:
|
||||
<b><?php echo $server_name; ?></b>
|
||||
<?php echo $lang['server']; ?>:
|
||||
<b><?php echo $ldapserver->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['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 ); ?>
|
||||
</td></table>
|
||||
|
||||
<!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
|
||||
<?php if ($num_current_values) { ?>
|
||||
<?php if( $is_jpeg_photo ) { ?>
|
||||
|
||||
<table><tr><td>
|
||||
<?php draw_jpeg_photos( $ldapserver, $dn, $attr, false ); ?>
|
||||
</td></tr></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 ) ) { ?>
|
||||
|
||||
<?php } else if( is_attr_binary( $ldapserver, $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"; ?>
|
||||
|
||||
<?php 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',
|
||||
$server_id,$encoded_dn,$attr,$i-1); ?>
|
||||
|
||||
<li><a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo $lang['download_value'] . ' ' . $i; ?>)</a></li>
|
||||
<?php }
|
||||
|
||||
} else {
|
||||
$href = sprintf('download_binary_attr.php?server_id=%s&dn=%s&attr=%s',$server_id,$encoded_dn,$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 -->
|
||||
<!-- 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 ) { ?>
|
||||
<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 } ?>
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } else { ?>
|
||||
<li><nobr><?php echo htmlspecialchars(($current_values)); ?></nobr></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<br />
|
||||
<br />
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $lang['enter_value_to_add']; ?>
|
||||
<br />
|
||||
@@ -115,45 +142,59 @@ include 'header.php'; ?>
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
<select name="new_oclass">
|
||||
|
||||
<?php foreach( $schema_oclasses as $name => $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="Add new objectClass" />
|
||||
|
||||
</select>
|
||||
<input type="submit" value="<?php echo $lang['add_new_objectclass']; ?>" />
|
||||
|
||||
<br />
|
||||
<?php if( show_hints() ) { ?>
|
||||
<small>
|
||||
<br />
|
||||
<img src="images/light.png" /><?php echo $lang['new_required_attrs_note']; ?>
|
||||
<img src="images/light.png" /><span class="hint"><?php echo $lang['new_required_attrs_note']; ?></span>
|
||||
</small>
|
||||
<?php } ?>
|
||||
<?php }
|
||||
|
||||
<?php } else { ?>
|
||||
} else { ?>
|
||||
|
||||
<form action="add_value.php" method="post" class="new_value" name="new_value_form"<?php
|
||||
if( is_attr_binary( $ldapserver, $attr ) ) echo "enctype=\"multipart/form-data\""; ?>>
|
||||
|
||||
<form action="add_value.php" method="post" class="new_value" <?php
|
||||
if( is_attr_binary( $server_id, $attr ) ) echo "enctype=\"multipart/form-data\""; ?>>
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
<input type="hidden" name="attr" value="<?php echo $encoded_attr; ?>" />
|
||||
|
||||
<?php if( is_attr_binary( $server_id, $attr ) ) { ?>
|
||||
<input type="file" name="new_value" />
|
||||
<input type="hidden" name="binary" value="true" />
|
||||
<?php } else { ?>
|
||||
<input type="text" <?php
|
||||
if( $schema_attr->getMaxLength() )
|
||||
echo "maxlength=\"" . $schema_attr->getMaxLength() . "\" ";
|
||||
?>name="new_value" size="40" value="" />
|
||||
<?php } ?>
|
||||
<?php if( is_attr_binary( $ldapserver, $attr ) ) { ?>
|
||||
<input type="file" name="new_value" />
|
||||
<input type="hidden" name="binary" value="true" />
|
||||
|
||||
<input type="submit" name="submit" value="Add New Value" />
|
||||
<?php } else {
|
||||
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( $ldapserver, $attr ) )
|
||||
draw_chooser_link( "new_value_form.new_value", false ); ?>
|
||||
|
||||
<?php }
|
||||
} ?>
|
||||
|
||||
<input type="submit" name="submit" value="<?php echo $lang['add_new_value']; ?>" />
|
||||
<br />
|
||||
|
||||
<?php if( $schema_attr->getDescription() ) { ?>
|
||||
<small><b>Description:</b> <?php echo $schema_attr->getDescription(); ?></small><br />
|
||||
<small><b><?php echo $lang['desc']; ?>:</b> <?php echo $schema_attr->getDescription(); ?></small><br />
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $schema_attr->getType() ) { ?>
|
||||
@@ -161,7 +202,7 @@ include 'header.php'; ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $schema_attr->getMaxLength() ) { ?>
|
||||
<small><b>Max length:</b> <?php echo number_format( $schema_attr->getMaxLength() ); ?> characters</small><br />
|
||||
<small><b><?php echo $lang['maximum_length']; ?>:</b> <?php echo number_format( $schema_attr->getMaxLength() ); ?> <?php echo $lang['characters']; ?></small><br />
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
475
blowfish.php
Normal file
@@ -0,0 +1,475 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/blowfish.php,v 1.3 2005/02/25 13:44:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* The Cipher_blowfish:: class implements the Cipher interface enryption data
|
||||
* using the Blowfish algorithm.
|
||||
*
|
||||
* $Horde: horde/lib/Cipher/blowfish.php,v 1.2.2.3 2003/01/03 13:23:22 jan Exp $
|
||||
*
|
||||
* Copyright 2002-2003 Mike Cochrane <mike@graftonhall.co.nz>
|
||||
*
|
||||
* See the enclosed file COPYING for license information (LGPL). If you
|
||||
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
|
||||
*
|
||||
* @author Mike Cochrane <mike@graftonhall.co.nz>
|
||||
* @version $Revision: 1.3 $
|
||||
* @since Horde 2.2
|
||||
* @package horde.cipher
|
||||
*/
|
||||
/**
|
||||
* @package horde.cipher
|
||||
*/
|
||||
|
||||
// Change for phpMyAdmin by lem9:
|
||||
//class Horde_Cipher_blowfish extends Horde_Cipher {
|
||||
class Horde_Cipher_blowfish {
|
||||
|
||||
/* Pi Array */
|
||||
var $p = array(
|
||||
0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
|
||||
0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
|
||||
0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
|
||||
0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
|
||||
0x9216D5D9, 0x8979FB1B);
|
||||
|
||||
/* S Boxes */
|
||||
var $s1 = array(
|
||||
0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
|
||||
0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
|
||||
0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
|
||||
0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
|
||||
0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
|
||||
0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
|
||||
0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
|
||||
0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
|
||||
0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
|
||||
0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
|
||||
0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
|
||||
0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
|
||||
0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
|
||||
0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
|
||||
0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
|
||||
0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
|
||||
0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
|
||||
0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
|
||||
0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
|
||||
0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
|
||||
0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
|
||||
0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
|
||||
0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
|
||||
0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
|
||||
0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
|
||||
0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
|
||||
0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
|
||||
0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
|
||||
0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
|
||||
0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
|
||||
0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
|
||||
0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
|
||||
0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
|
||||
0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
|
||||
0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
|
||||
0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
|
||||
0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
|
||||
0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
|
||||
0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
|
||||
0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
|
||||
0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
|
||||
0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
|
||||
0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
|
||||
0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
|
||||
0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
|
||||
0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
|
||||
0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
|
||||
0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
|
||||
0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
|
||||
0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
|
||||
0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
|
||||
0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
|
||||
0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
|
||||
0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
|
||||
0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
|
||||
0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
|
||||
0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
|
||||
0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
|
||||
0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
|
||||
0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
|
||||
0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
|
||||
0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
|
||||
0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
|
||||
0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A);
|
||||
var $s2 = array(
|
||||
0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
|
||||
0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
|
||||
0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
|
||||
0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
|
||||
0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
|
||||
0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
|
||||
0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
|
||||
0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
|
||||
0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
|
||||
0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
|
||||
0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
|
||||
0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
|
||||
0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
|
||||
0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
|
||||
0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
|
||||
0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
|
||||
0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
|
||||
0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
|
||||
0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
|
||||
0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
|
||||
0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
|
||||
0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
|
||||
0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
|
||||
0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
|
||||
0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
|
||||
0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
|
||||
0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
|
||||
0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
|
||||
0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
|
||||
0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
|
||||
0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
|
||||
0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
|
||||
0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
|
||||
0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
|
||||
0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
|
||||
0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
|
||||
0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
|
||||
0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
|
||||
0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
|
||||
0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
|
||||
0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
|
||||
0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
|
||||
0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
|
||||
0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
|
||||
0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
|
||||
0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
|
||||
0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
|
||||
0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
|
||||
0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
|
||||
0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
|
||||
0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
|
||||
0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
|
||||
0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
|
||||
0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
|
||||
0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
|
||||
0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
|
||||
0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
|
||||
0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
|
||||
0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
|
||||
0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
|
||||
0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
|
||||
0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
|
||||
0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
|
||||
0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7);
|
||||
var $s3 = array(
|
||||
0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
|
||||
0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
|
||||
0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
|
||||
0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
|
||||
0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
|
||||
0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
|
||||
0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
|
||||
0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
|
||||
0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
|
||||
0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
|
||||
0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
|
||||
0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
|
||||
0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
|
||||
0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
|
||||
0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
|
||||
0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
|
||||
0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
|
||||
0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
|
||||
0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
|
||||
0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
|
||||
0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
|
||||
0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
|
||||
0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
|
||||
0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
|
||||
0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
|
||||
0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
|
||||
0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
|
||||
0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
|
||||
0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
|
||||
0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
|
||||
0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
|
||||
0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
|
||||
0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
|
||||
0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
|
||||
0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
|
||||
0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
|
||||
0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
|
||||
0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
|
||||
0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
|
||||
0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
|
||||
0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
|
||||
0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
|
||||
0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
|
||||
0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
|
||||
0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
|
||||
0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
|
||||
0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
|
||||
0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
|
||||
0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
|
||||
0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
|
||||
0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
|
||||
0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
|
||||
0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
|
||||
0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
|
||||
0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
|
||||
0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
|
||||
0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
|
||||
0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
|
||||
0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
|
||||
0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
|
||||
0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
|
||||
0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
|
||||
0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
|
||||
0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0);
|
||||
var $s4 = array(
|
||||
0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
|
||||
0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
|
||||
0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
|
||||
0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
|
||||
0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
|
||||
0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
|
||||
0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
|
||||
0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
|
||||
0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
|
||||
0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
|
||||
0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
|
||||
0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
|
||||
0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
|
||||
0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
|
||||
0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
|
||||
0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
|
||||
0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
|
||||
0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
|
||||
0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
|
||||
0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
|
||||
0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
|
||||
0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
|
||||
0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
|
||||
0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
|
||||
0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
|
||||
0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
|
||||
0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
|
||||
0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
|
||||
0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
|
||||
0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
|
||||
0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
|
||||
0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
|
||||
0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
|
||||
0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
|
||||
0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
|
||||
0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
|
||||
0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
|
||||
0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
|
||||
0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
|
||||
0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
|
||||
0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
|
||||
0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
|
||||
0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
|
||||
0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
|
||||
0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
|
||||
0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
|
||||
0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
|
||||
0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
|
||||
0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
|
||||
0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
|
||||
0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
|
||||
0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
|
||||
0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
|
||||
0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
|
||||
0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
|
||||
0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
|
||||
0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
|
||||
0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
|
||||
0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
|
||||
0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
|
||||
0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
|
||||
0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
|
||||
0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
|
||||
0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6);
|
||||
|
||||
/* The number of rounds to do */
|
||||
var $_rounds = 16;
|
||||
|
||||
/* Constructor */
|
||||
function Cipher_blowfish($params = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the key to be used for en/decryption
|
||||
*
|
||||
* @param String $key The key to use
|
||||
*/
|
||||
function setKey($key)
|
||||
{
|
||||
$key = $this->_formatKey($key);
|
||||
$keyPos = $keyXor = 0;
|
||||
|
||||
$iMax = count($this->p);
|
||||
$keyLen = count($key);
|
||||
for ($i = 0; $i < $iMax; $i++) {
|
||||
for ($t = 0; $t < 4; $t++) {
|
||||
$keyXor = ($keyXor << 8) | (($key[$keyPos]) & 0x0ff);
|
||||
if (++$keyPos == $keyLen) {
|
||||
$keyPos = 0;
|
||||
}
|
||||
}
|
||||
$this->p[$i] = $this->p[$i] ^ $keyXor;
|
||||
}
|
||||
|
||||
$encZero = array('L' => 0, 'R' => 0);
|
||||
for ($i = 0; $i + 1 < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->p[$i] = $encZero['L'];
|
||||
$this->p[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s1);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s1[$i] = $encZero['L'];
|
||||
$this->s1[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s2);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s2[$i] = $encZero['L'];
|
||||
$this->s2[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s3);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s3[$i] = $encZero['L'];
|
||||
$this->s3[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
$iMax = count($this->s4);
|
||||
for ($i = 0; $i < $iMax; $i += 2) {
|
||||
$encZero = $this->_encryptBlock($encZero['L'], $encZero['R']);
|
||||
$this->s4[$i] = $encZero['L'];
|
||||
$this->s4[$i + 1] = $encZero['R'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of the blocks that this cipher needs
|
||||
*
|
||||
* @return Integer The number of characters per block
|
||||
*/
|
||||
function getBlockSize()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt a block on data.
|
||||
*
|
||||
* @param String $block The data to encrypt
|
||||
* @param optional String $key The key to use
|
||||
*
|
||||
* @return String the encrypted output
|
||||
*/
|
||||
function encryptBlock($block, $key = null)
|
||||
{
|
||||
if (!is_null($key)) {
|
||||
$this->setKey($key);
|
||||
}
|
||||
|
||||
list($L, $R) = array_values(unpack('N*', $block));
|
||||
$parts = $this->_encryptBlock($L, $R);
|
||||
return pack("NN", $parts['L'], $parts['R']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt a block on data.
|
||||
*
|
||||
* @param String $L The data to encrypt.
|
||||
* @param String $R The data to encrypt.
|
||||
*
|
||||
* @return String The encrypted output.
|
||||
*/
|
||||
function _encryptBlock($L, $R)
|
||||
{
|
||||
$L ^= $this->p[0];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[1];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[2];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[3];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[4];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[5];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[6];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[7];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[8];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[9];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[10];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[11];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[12];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[13];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[14];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[15];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[16];
|
||||
$R ^= $this->p[17];
|
||||
|
||||
return array('L' => $R, 'R' => $L);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypt a block on data.
|
||||
*
|
||||
* @param String $block The data to decrypt
|
||||
* @param optional String $key The key to use
|
||||
*
|
||||
* @return String the decrypted output
|
||||
*/
|
||||
function decryptBlock($block, $key = null)
|
||||
{
|
||||
if (!is_null($key)) {
|
||||
$this->setKey($key);
|
||||
}
|
||||
|
||||
list($L, $R) = array_values(unpack('N*', $block));
|
||||
|
||||
$L ^= $this->p[17];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[16];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[15];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[14];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[13];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[12];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[11];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[10];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[9];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[8];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[7];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[6];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[5];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[4];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[3];
|
||||
$R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[2];
|
||||
$L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[1];
|
||||
|
||||
$decrypted = pack("NN", $R ^ $this->p[0], $L);
|
||||
return $decrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a text key into an array.
|
||||
*
|
||||
* @return array The key.
|
||||
*/
|
||||
function _formatKey($key)
|
||||
{
|
||||
return array_values(unpack('C*', $key));
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -1,42 +1,82 @@
|
||||
|
||||
<?php
|
||||
// phpldapadmin/check_lang_files.php, $Revision: 1.4 $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/check_lang_files.php,v 1.11 2005/02/25 13:44:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* Test script to check that $lang variables in each language file.
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
echo "<html><head><title>phpldapadmin - check of translation</title></head><body>";
|
||||
echo "<h1>Incomplete or Erroneous Language Files</h1>\n\n";
|
||||
$CHECKLANG=$_REQUEST['CHECKLANG'];
|
||||
|
||||
include realpath( 'lang/en.php' );
|
||||
include realpath( './lang/en.php' );
|
||||
$english_lang = $lang;
|
||||
unset( $lang );
|
||||
$lang_dir = realpath( '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";
|
||||
if ($CHECKLANG)
|
||||
printf("<h1>Checking language files %s</h1>\n\n",$CHECKLANG);
|
||||
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;
|
||||
if( $file == 'en.php' // is the mother of all language-files
|
||||
|| $file == 'auto.php' // and ignore auto.php
|
||||
)
|
||||
continue;
|
||||
echo "<h2>$file</h2>";
|
||||
echo "<ol>";
|
||||
unset( $lang );
|
||||
$lang = array();
|
||||
include realpath( $lang_dir.'/'.$file );
|
||||
$has_errors = false;
|
||||
if ($CHECKLANG=="" || $file===$CHECKLANG ){
|
||||
echo "<h2><A HREF='?CHECKLANG=$file'>$file</A></h2>\n";
|
||||
echo "<ol>\n";
|
||||
foreach( $english_lang as $key => $string )
|
||||
if( ! isset( $lang[ $key ] ) ) {
|
||||
$has_errors = true;
|
||||
echo "<li>missing entry: <tt>$key</tt></li>";
|
||||
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>";
|
||||
echo "<li>extra entry: <tt>$key</tt></li>\n";
|
||||
}
|
||||
if( ! $has_errors )
|
||||
echo "(No errors)";
|
||||
echo "</ol>";
|
||||
echo "(No errors)\n";
|
||||
}
|
||||
echo "</ol>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
44
collapse.php
@@ -1,38 +1,35 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/collapse.php,v 1.12 2005/02/25 13:44:05 wurley Exp $
|
||||
|
||||
/*
|
||||
* collapse.php
|
||||
/**
|
||||
* This script alters the session variable 'tree', collapsing it
|
||||
* at the dn specified in the query string.
|
||||
* 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
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
//$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
//if( ! $ldapserver->haveAuthInfo())
|
||||
// pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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();
|
||||
|
||||
session_start();
|
||||
|
||||
// dave commented this out since it was being triggered for weird reasons
|
||||
//session_is_registered( 'tree' ) or pla_error( "Your session tree is not registered. That's weird. Shouldn't ever happen".
|
||||
// ". Just go back and it should be fixed automagically." );
|
||||
|
||||
$tree = $_SESSION['tree'];
|
||||
|
||||
// and remove this instance of the dn as well
|
||||
unset( $tree[$server_id][$dn] );
|
||||
|
||||
$_SESSION['tree'] = $tree;
|
||||
session_write_close();
|
||||
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
|
||||
@@ -42,10 +39,9 @@ $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();
|
||||
}
|
||||
$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" );
|
||||
?>
|
||||
|
153
common.php
@@ -1,46 +1,54 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/common.php,v 1.59 2005/03/16 11:20:23 wurley 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.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
// 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)
|
||||
error_reporting( E_ALL );
|
||||
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 );
|
||||
|
||||
// We require this version or newer (use @ to surpress errors if we are included twice)
|
||||
@define( 'REQUIRED_PHP_VERSION', '4.1.0' );
|
||||
@define( 'HTTPS_PORT', 443 );
|
||||
|
||||
// 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." );
|
||||
require realpath( 'config.php' );
|
||||
ob_end_clean();
|
||||
/**
|
||||
* For PHP5 backward/forward compatibility
|
||||
*/
|
||||
if( ! defined( 'E_STRICT' ) ) {
|
||||
define( 'E_STRICT', 2048 );
|
||||
}
|
||||
|
||||
// General functions (pla_ldap_search(), pla_error(), get_object_attrs(), etc.)
|
||||
is_readable( realpath( 'functions.php' ) )
|
||||
or pla_error( "Cannot read the file 'functions.php' its permissions are too strict." );
|
||||
ob_start();
|
||||
require_once realpath( 'functions.php' );
|
||||
ob_end_clean();
|
||||
/** 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 );
|
||||
|
||||
// Functions for reading the server schema (get_schema_object_classes(), etc.)
|
||||
is_readable( realpath( 'schema_functions.php' ) )
|
||||
or pla_error( "Cannot read the file 'schema_functions.php' its permissions are too strict." );
|
||||
// General functions needed to proceed (pla_ldap_search(), pla_error(), get_object_attrs(), etc.)
|
||||
ob_start();
|
||||
require_once realpath( 'schema_functions.php' );
|
||||
ob_end_clean();
|
||||
|
||||
// Functions that can be defined by the user (preEntryDelete(), postEntryDelete(), etc.)
|
||||
is_readable( realpath( 'custom_functions.php' ) )
|
||||
or pla_error( "Cannot read the file 'custom_functions.php' its permissions are too strict." );
|
||||
ob_start();
|
||||
require_once realpath( 'custom_functions.php' );
|
||||
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()
|
||||
@@ -51,16 +59,48 @@ set_error_handler( 'pla_error_handler' );
|
||||
// based on the user-configured language.
|
||||
$lang = array();
|
||||
|
||||
// Little bit of sanity checking
|
||||
if( ! file_exists( realpath( 'lang/recoded' ) ) ) {
|
||||
pla_error( "Your install of phpLDAPadmin is missing the 'lang/recoded' directory. This should not happen. You can try running 'make' in the lang directory" );
|
||||
// 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();
|
||||
}
|
||||
|
||||
// use English as a base-line (in case the selected language is missing strings)
|
||||
if( file_exists( realpath( 'lang/recoded/en.php' ) ) )
|
||||
include realpath( 'lang/recoded/en.php' );
|
||||
else
|
||||
pla_error( "Error! Missing recoded English language file. Run 'make' in the lang/ directory." );
|
||||
$required_files = array(
|
||||
// The base English language strings
|
||||
'./lang/recoded/en.php',
|
||||
// Functions for talking to LDAP servers.
|
||||
'./server_functions.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',
|
||||
// Functions for sending syslog messages
|
||||
'./syslog.php',
|
||||
// Functions for running various hooks
|
||||
'./hooks.php',
|
||||
// Functions for timeout and automatic logout feature
|
||||
'./timeout_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() )
|
||||
run_hook ( 'post_session_init', array () );
|
||||
|
||||
// Language configuration. Auto or specified?
|
||||
// Shall we attempt to auto-determine the language?
|
||||
@@ -77,17 +117,20 @@ if( isset( $language ) ) {
|
||||
$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 ) {
|
||||
@@ -95,10 +138,12 @@ if( isset( $language ) ) {
|
||||
$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" );
|
||||
} else {
|
||||
pla_error( "Could not read language file 'lang/recoded/$language.php'. Either the file
|
||||
does not exist, or permissions do not allow phpLDAPadmin to read it." );
|
||||
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." );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +154,7 @@ if( ! isset( $templates ) || ! is_array( $templates ) )
|
||||
$templates = array();
|
||||
|
||||
// Always including the 'custom' template (the most generic and flexible)
|
||||
$templates['custom'] =
|
||||
$templates['custom'] =
|
||||
array( 'desc' => 'Custom',
|
||||
'icon' => 'images/object.png',
|
||||
'handler' => 'custom.php' );
|
||||
@@ -117,21 +162,19 @@ $templates['custom'] =
|
||||
// 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 ) ) {
|
||||
if( ! function_exists( "array_stripslashes" ) ) {
|
||||
function array_stripslashes(&$array) {
|
||||
if( is_array( $array ) )
|
||||
while ( list( $key ) = each( $array ) )
|
||||
if ( is_array( $array[$key] ) && $key != $array )
|
||||
array_stripslashes( $array[$key] );
|
||||
else
|
||||
$array[$key] = stripslashes( $array[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
array_stripslashes($_REQUEST);
|
||||
array_stripslashes($_GET);
|
||||
array_stripslashes($_POST);
|
||||
array_stripslashes($_COOKIE);
|
||||
array_stripslashes($_FILES);
|
||||
$slashes_stripped = true;
|
||||
}
|
||||
|
||||
// Update $_SESSION[ 'activity' ]
|
||||
// for timeout and automatic logout feature
|
||||
if ( isset($_REQUEST['server_id']) ) {
|
||||
$ldapserver = new LDAPServer($_REQUEST['server_id']);
|
||||
if ( $ldapserver->haveAuthInfo() )
|
||||
set_lastactivity( $ldapserver );
|
||||
}
|
||||
?>
|
||||
|
559
compare.php
Normal file
@@ -0,0 +1,559 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/compare.php,v 1.4 2005/03/18 07:24:30 wurley Exp $
|
||||
|
||||
/**
|
||||
* Compare two DNs - the destination DN is editable.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
*/
|
||||
/**
|
||||
* @todo Dont allow adding values if the objectclass doesnt exist.
|
||||
* @todo Show what objectclass needs to be added to add a value.
|
||||
*/
|
||||
|
||||
require realpath( '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 = new LDAPServer($server_id_src);
|
||||
if( ! $ldapserver_src->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$ldapserver_dst = new LDAPServer($server_id_dst);
|
||||
if( ! $ldapserver_src->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
dn_exists( $ldapserver_src, $dn_src ) or pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn_src ) ) );
|
||||
dn_exists( $ldapserver_dst, $dn_dst ) or pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn_dst ) ) );
|
||||
|
||||
$friendly_attrs = process_friendly_attr_table();
|
||||
|
||||
$attrs_src = get_object_attrs( $ldapserver_src, $dn_src, false, get_view_deref_setting() );
|
||||
$attrs_dst = get_object_attrs( $ldapserver_dst, $dn_dst, false, get_view_deref_setting() );
|
||||
|
||||
# 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=4>
|
||||
<h3 class="title"><?php echo $lang['comparing']; ?></h3>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $ldapserver_src->name; ?></b> <?php echo $lang['distinguished_name'];?>: <b><?php echo htmlspecialchars( ( $dn_src ) ); ?></b></h3>
|
||||
</td>
|
||||
<td colspan=2>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $ldapserver_dst->name; ?></b> <?php echo $lang['distinguished_name'];?>: <b><?php echo htmlspecialchars( ( $dn_dst ) ); ?></b></h3>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=3><td 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 $lang['switch_entry']; ?>" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if( ! $attrs_all || ! is_array( $attrs_all ) ) {
|
||||
echo "<tr><td colspan=\"2\">(" . $lang['no_attributes'] . ")</td></tr>\n";
|
||||
echo "</table>";
|
||||
echo "</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( is_attr_hidden( $ldapserver_src, $attr) || is_attr_hidden( $ldapserver_dst, $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 = get_schema_attribute( $ldapserver_src, $attr, $dn_src );
|
||||
$schema_attr_dst = get_schema_attribute( $ldapserver_dst, $attr, $dn_dst );
|
||||
|
||||
// Setup the $attr_note, which will be displayed to the right of the attr name (if any)
|
||||
$attr_note = '';
|
||||
|
||||
// is there a user-friendly translation available for this attribute?
|
||||
if( isset( $friendly_attrs[ strtolower( $attr ) ] ) ) {
|
||||
$attr_display = $friendly_attrs[ strtolower( $attr ) ];
|
||||
$attr_note = "<acronym title=\"" . sprintf( $lang['alias_for'], $attr_display, $attr ) . "\">alias</acronym>";
|
||||
} else {
|
||||
$attr_note = "";
|
||||
$attr_display = $attr;
|
||||
}
|
||||
|
||||
// is this attribute required by an objectClass?
|
||||
$required_by = '';
|
||||
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( $required_by ) {
|
||||
if( trim( $attr_note ) )
|
||||
$attr_note .= ', ';
|
||||
$attr_note .= "<acronym title=\"" . sprintf( $lang['required_for'], $required_by ) . "\">" . $lang['required'] . "</acronym> ";
|
||||
} ?>
|
||||
|
||||
<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( $lang['attr_name_tooltip'], $attr ) ?>" href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a></b>
|
||||
</td>
|
||||
|
||||
<td class="attr_note">
|
||||
<sup><small><?php echo $attr_note; ?></small></sup>
|
||||
|
||||
<?php if( is_attr_read_only( $ldapserver, $attr ) ) { ?>
|
||||
<small>(<acronym title="<?php echo $lang['read_only_tooltip']; ?>"><?php echo $lang['read_only']; ?></acronym>)</small>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
<!-- End of Attribute -->
|
||||
|
||||
<!-- Begin Values -->
|
||||
<tr>
|
||||
|
||||
<?php
|
||||
foreach (array('src','dst') as $side) {
|
||||
$vals = null; ?>
|
||||
|
||||
<td> </td><td class="val">
|
||||
|
||||
<?php // If this attribute isnt set, then show a blank.
|
||||
$toJump = 0;
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
if (! isset($attrs_src[$attr])) {
|
||||
echo "<small><". $lang['no_value']."></small></td>";
|
||||
$toJump = 1;
|
||||
continue;
|
||||
} else
|
||||
$vals = $attrs_src[$attr];
|
||||
|
||||
$ldapserver = $ldapserver_src;
|
||||
break;
|
||||
case 'dst':
|
||||
if (! isset($attrs_dst[$attr])) {
|
||||
echo "<small><". $lang['no_value']."></small></td>";
|
||||
$toJump = 1;
|
||||
continue;
|
||||
} else
|
||||
$vals = $attrs_dst[$attr];
|
||||
|
||||
$ldapserver = $ldapserver_dst;
|
||||
break;
|
||||
}
|
||||
if ($toJump) continue;
|
||||
|
||||
/*
|
||||
* Is this attribute a jpegPhoto?
|
||||
*/
|
||||
if( is_jpeg_photo( $ldapserver, $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() || is_attr_read_only( $ldapserver_dst, $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( is_attr_binary( $ldapserver, $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 $lang['binary_value']; ?><br />
|
||||
|
||||
<?php if( count( $vals ) > 1 ) { for( $i=1; $i<=count($vals); $i++ ) { ?>
|
||||
<a href="<?php echo $href . "&value_num=$i"; ?>"><img
|
||||
src="images/save.png" /> <?php echo $lang['download_value']; ?>(<?php echo $i; ?>)</a><br />
|
||||
|
||||
<?php } } else { ?>
|
||||
<a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo $lang['download_value']; ?></a><br />
|
||||
|
||||
<?php }
|
||||
|
||||
if( $side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! is_attr_read_only( $ldapserver, $attr ) ) { ?>
|
||||
|
||||
<a href="javascript:deleteAttribute( '<?php echo $attr; ?>' );" style="color:red;"><img src="images/trash.png" /> <?php echo $lang['delete_attribute']; ?></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</small>
|
||||
</td>
|
||||
|
||||
<?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() || is_attr_read_only( $ldapserver, $attr )) ) {
|
||||
if( is_array( $vals ) ) {
|
||||
foreach( $vals as $i => $val ) {
|
||||
if( trim( $val ) == "" )
|
||||
echo "<span style=\"color:red\">[" . $lang['empty'] . "]</span><br />\n";
|
||||
|
||||
elseif( 0 == strcasecmp( $attr, 'userPassword' ) && obfuscate_password_display() )
|
||||
echo preg_replace( '/./', '*', $val ) . "<br />";
|
||||
|
||||
else
|
||||
echo htmlspecialchars( $val ) . "<br />";
|
||||
}
|
||||
|
||||
} else {
|
||||
if( 0 == strcasecmp( $attr, 'userPassword' ) && obfuscate_password_display() )
|
||||
echo preg_replace( '/./', '*', $vals ) . "<br />";
|
||||
else
|
||||
echo $vals . "<br />";
|
||||
}
|
||||
echo "</td>";
|
||||
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() || is_null( $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 $lang['t_check_pass']; ?></a></small>
|
||||
|
||||
</td>
|
||||
|
||||
<?php continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is this a boolean attribute?
|
||||
*/
|
||||
if( is_attr_boolean( $ldapserver, $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 $lang['true']; ?></option>
|
||||
<option value="FALSE"<?php echo ($val=='FALSE' ? ' selected' : ''); ?>><?php echo $lang['false']; ?></option>
|
||||
<option value="">(<?php echo $lang['none_remove_value']; ?>)</option>
|
||||
</select>
|
||||
|
||||
<?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 $lang['view_schema_for_oclass']; ?>" 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 = get_schema_objectclass( $ldapserver, $val);
|
||||
|
||||
if ($schema_object->type == 'structural') {
|
||||
echo "$val <small>(<acronym title=\"" . sprintf( $lang['structural_object_class_cannot_remove'] ) . "\">" . $lang['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 ) || is_dn_attr( $ldapserver, $attr ) ) { ?>
|
||||
|
||||
<a title="<?php echo sprintf( $lang['go_to_dn'], htmlspecialchars($val) ); ?>" href="edit.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( is_multi_line_attr( $attr, $val, $ldapserver->server_id ) ) {
|
||||
|
||||
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( is_dn_attr( $ldapserver, $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 = get_schema_attribute( $ldapserver_dst, $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> </td><td>";
|
||||
if (! $isOK) {
|
||||
|
||||
if (count($src_oclass) == 1) {
|
||||
$add_href = "add_oclass_form.php?server_id=$ldapserver_dst->server_id&dn=$encoded_dn_dst&new_oclass=$src_oclass[0]";
|
||||
} else {
|
||||
$add_href = "add_value_form.php?server_id=$ldapserver_dst->server_id&dn=$encoded_dn_dst&attr=objectClass";
|
||||
}
|
||||
|
||||
if ($attr == 'objectClass')
|
||||
printf('<div class="add_oclass">(<a href="%s" title="%s">%s</a>)</div>',$add_href,$lang['add_oclass_and_attrs'],$lang['add_value']);
|
||||
else
|
||||
printf('<div class="add_oclass">(<a href="%s" title="%s">%s</a>)</div>',$add_href,sprintf($lang['need_oclass'], implode(" ",$src_oclass)),$lang['add_new_objectclass']);
|
||||
|
||||
} else {
|
||||
if(! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) {
|
||||
|
||||
$add_href = "add_value_form.php?server_id=$ldapserver_dst->server_id&dn=$encoded_dn_dst&attr=" . rawurlencode( $attr );
|
||||
|
||||
echo "<div class=\"add_value\">(<a href=\"$add_href\" title=\"" . sprintf( $lang['add_value_tooltip'], $attr ) . "\">" . $lang['add_value'] . "</a>)</div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 $lang['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 $lang['really_delete_attribute']; ?> '" + attrName + "'?" ) ) {
|
||||
document.delete_attribute_form.attr.value = attrName;
|
||||
document.delete_attribute_form.submit();
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
|
||||
<!-- This form is submitted by JavaScript when the user clicks "Delete attribute" on a binary attribute -->
|
||||
<form name="delete_attribute_form" action="delete_attr.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $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>
|
82
compare_form.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/compare_form.php,v 1.1 2005/03/12 14:03:36 wurley Exp $
|
||||
|
||||
/**
|
||||
* Compares to DN entries side by side.
|
||||
*
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$dn = (isset($_GET['dn']) ? $_GET['dn'] : '');
|
||||
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$rdn = get_rdn( $dn );
|
||||
$container = get_container( $dn );
|
||||
|
||||
$attrs = get_object_attrs( $ldapserver, $dn );
|
||||
$select_server_html = server_select_list($server_id,true,'server_id_dst');
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo $lang['compare_dn']. ' ' . $rdn; ?></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $ldapserver->name; ?></b>
|
||||
<?php if ($dn) { ?>
|
||||
<?php echo $lang['distinguished_name']?>: <b><?php echo $dn; ?></b>
|
||||
<?php } ?>
|
||||
</h3>
|
||||
|
||||
<center>
|
||||
<?php echo $lang['compare']; ?> <b><?php echo htmlspecialchars( $rdn ); ?></b> <?php echo $lang['with']; ?>:<br />
|
||||
<br />
|
||||
|
||||
<form action="compare.php" method="post" name="compare_form">
|
||||
<input type="hidden" name="server_id_src" value="<?php echo $server_id; ?>" />
|
||||
|
||||
<table style="border-spacing: 10px">
|
||||
<tr>
|
||||
<?php if (! $dn) { ?>
|
||||
<td><acronym title="<?php echo $lang['compf_dn_tooltip']; ?>"><?php echo $lang['compf_source_dn']; ?></acronym>:</td>
|
||||
<td>
|
||||
<input type="text" name="dn_src" size="45" value="<?php echo htmlspecialchars( $dn ); ?>" />
|
||||
<?php draw_chooser_link( 'compare_form.dn_src', 'true', $rdn ); ?></td>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="dn_src" value="<?php echo htmlspecialchars( $dn ); ?>" />
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><acronym title="<?php echo $lang['compf_dn_tooltip']; ?>"><?php echo $lang['copyf_dest_dn']; ?></acronym>:</td>
|
||||
<td>
|
||||
<input type="text" name="dn_dst" size="45" value="" />
|
||||
<?php draw_chooser_link( 'compare_form.dn_dst', 'true', '' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $lang['copyf_dest_server']?>:</td>
|
||||
<td><?php echo $select_server_html; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="<?php echo $lang['compare']; ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
@@ -11,65 +11,150 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 */
|
||||
$servers[$i]['host'] = 'ldap.example.com'; /* Examples: 'ldap.example.com',
|
||||
'ldaps://ldap.example.com/'
|
||||
Note: Leave blank to remove it from the list
|
||||
of servers in the tree viewer*/
|
||||
$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) */
|
||||
$servers[$i]['auth_type'] = 'config'; /* 2 options: 'form': you will be prompted, and
|
||||
a cookie stored with your login dn and
|
||||
password. 'config': specify your login dn
|
||||
and password here. In both cases, use caution! */
|
||||
$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';
|
||||
/* For anonymous binds, leave the
|
||||
login_dn and login_pass blank */
|
||||
$servers[$i]['login_pass'] = 'secret'; /* Your password (only if you specified 'config'
|
||||
for 'auth_type' */
|
||||
$servers[$i]['tls'] = false; /* Use TLS to connect. Requires PHP 4.2 or newer */
|
||||
$servers[$i]['default_hash'] = 'crypt'; /* Default password hashing algorith;
|
||||
One of md5, ssha, sha, md5crpyt, smd5, blowfish or
|
||||
/* 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 'form' as the auth_type above,
|
||||
you can optionally specify here an attribute
|
||||
to use when logging in. If you enter 'uid',
|
||||
then login as 'dsmith', phpLDAPadmin will
|
||||
search for uid=dsmith and log in as such. Leave
|
||||
blank or specify 'dn' to use full DN for
|
||||
logging in .*/
|
||||
$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
|
||||
display or permit any modification to the
|
||||
LDAP server. */
|
||||
$servers[$i]['enable_auto_uid_numbers'] = false;
|
||||
/* This feature allows phpLDAPadmin to
|
||||
$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_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. */
|
||||
/* 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 */
|
||||
|
||||
// $servers[$i]['only_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' );
|
||||
/* 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! */
|
||||
// $servers[$i]['visible'] = false;
|
||||
/* Set this if you dont want this LDAP server to show in the tree */
|
||||
// $servers[$i]['session_timeout'] = 5;
|
||||
/* 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 ) */
|
||||
|
||||
// If you want to configure additional LDAP servers, do so below.
|
||||
$i++;
|
||||
@@ -81,19 +166,24 @@ $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'] = '';
|
||||
$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_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';
|
||||
$servers[$i]['unique_attrs_dn'] = '';
|
||||
$servers[$i]['unique_attrs_dn_pass'] = '';
|
||||
|
||||
// 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
|
||||
// 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
|
||||
|
||||
@@ -101,8 +191,65 @@ $jpeg_temp_dir = "/tmp"; // Example for Unix systems
|
||||
/** Appearance and Behavior **/
|
||||
/** **/
|
||||
|
||||
// The language setting. If you set this to 'auto', phpLDAPadmin will
|
||||
// attempt to determine your language automatically. Otherwise, available
|
||||
// Whenever we display a date use this format.
|
||||
$date_format = "%A %e %B %Y";
|
||||
|
||||
// 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.
|
||||
@@ -116,7 +263,12 @@ $enable_mass_delete = false;
|
||||
// when a user logs in to a server anonymously
|
||||
$anonymous_bind_implies_read_only = true;
|
||||
|
||||
// If you used auth_type 'form' in the servers list, you can adjust how long the cookie will last
|
||||
// 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
|
||||
|
||||
@@ -132,21 +284,46 @@ $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 correlating
|
||||
// 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 correlates to the list directly above. If you want to present more readable names
|
||||
// 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 summary
|
||||
$search_result_attributes = "dn, cn";
|
||||
// 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 **/
|
||||
@@ -160,6 +337,28 @@ $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 **/
|
||||
/** **/
|
||||
@@ -168,7 +367,66 @@ $friendly_attrs[ 'telephoneNumber' ] = 'Phone';
|
||||
// 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';
|
||||
|
||||
|
||||
?>
|
||||
|
185
copy.php
@@ -1,47 +1,59 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy.php,v 1.31 2005/03/14 11:46:24 wurley 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
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
|
||||
session_start();
|
||||
$source_server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$dest_server_id = (isset($_POST['dest_server_id']) ? $_POST['dest_server_id'] : '');
|
||||
|
||||
$ldapserver_source = new LDAPServer($source_server_id);
|
||||
$ldapserver_dest = new LDAPServer($dest_server_id);
|
||||
|
||||
if( $ldapserver_dest->isReadOnly() )
|
||||
pla_error( $lang['copy_server_read_only'] );
|
||||
|
||||
if( ! $ldapserver_source->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
if( ! $ldapserver_dest->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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;
|
||||
$remove = ( isset( $_POST['remove'] ) && $_POST['remove'] == 'yes' ) ? true : false;
|
||||
$encoded_dn = rawurlencode( $source_dn );
|
||||
|
||||
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';
|
||||
include './header.php';
|
||||
|
||||
/* Error checking */
|
||||
if( 0 == strlen( trim( $dest_dn ) ) )
|
||||
pla_error( $lang['copy_dest_dn_blank'] );
|
||||
if( dn_exists( $dest_server_id, $dest_dn ) )
|
||||
pla_error( sprintf( $lang['copy_dest_already_exists'], $dest_dn ) );
|
||||
if( ! dn_exists( $dest_server_id, get_container( $dest_dn ) ) )
|
||||
pla_error( sprintf( $lang['copy_dest_container_does_not_exist'], get_container($dest_dn) ) );
|
||||
|
||||
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( $ldapserver_dest, $dest_dn ) )
|
||||
pla_error( sprintf( $lang['copy_dest_already_exists'], pretty_print_dn( $dest_dn ) ) );
|
||||
|
||||
if( ! dn_exists( $ldapserver_dest, 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";
|
||||
@@ -50,99 +62,103 @@ if( $do_recursive ) {
|
||||
echo "<br /><br />";
|
||||
echo "<small>\n";
|
||||
echo $lang['copy_building_snapshot'];
|
||||
|
||||
flush();
|
||||
build_tree( $source_server_id, $source_dn, $snapshot_tree );
|
||||
|
||||
build_tree( $ldapserver_source, $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 );
|
||||
$copy_result = r_copy_dn( $ldapserver_source, $ldapserver_dest, $snapshot_tree, $source_dn, $dest_dn );
|
||||
echo "</small>\n";
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn( $source_server_id, $source_dn, $dest_server_id, $dest_dn );
|
||||
$copy_result = copy_dn( $ldapserver_source, $source_dn, $ldapserver_dest, $dest_dn );
|
||||
}
|
||||
|
||||
if( $copy_result )
|
||||
{
|
||||
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( session_is_registered( 'tree' ) )
|
||||
{
|
||||
|
||||
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] ) )
|
||||
{
|
||||
|
||||
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 );
|
||||
$tree_icons[$dest_server_id][$dest_dn] = get_icon( $ldapserver_dest, $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 -->
|
||||
<center>
|
||||
<?php echo $lang['copy_successful_like_to']. "<a href=\"$edit_url\">" . $lang['copy_view_new_entry'] ."</a>"?>
|
||||
</center>
|
||||
<!-- 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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php if ($remove) {
|
||||
sleep(2);
|
||||
$delete_url = "delete_form.php?server_id=$dest_server_id&dn=" .rawurlencode( $source_dn ); ?>
|
||||
|
||||
<!-- redirect to the delete form -->
|
||||
<script language="javascript">
|
||||
parent.left_frame.location.reload();
|
||||
parent.right_frame.location="<?php echo $delete_url; ?>"
|
||||
</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
|
||||
{
|
||||
<?php }
|
||||
|
||||
} else {
|
||||
exit;
|
||||
}
|
||||
|
||||
function r_copy_dn( $source_server_id, $dest_server_id, $tree, $root_dn, $dest_dn )
|
||||
{
|
||||
function r_copy_dn( $ldapserver_source, $ldapserver_dest, $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 ) {
|
||||
$copy_result = copy_dn( $ldapserver_source, $root_dn, $ldapserver_dest, $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 )
|
||||
{
|
||||
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 );
|
||||
r_copy_dn( $ldapserver_source, $ldapserver_dest, $tree, $child_dn, $new_dest_dn );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} 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 ) or pla_error( $lang['could_not_connect'] );
|
||||
$attrs = get_object_attrs( $source_server_id, $source_dn );
|
||||
function copy_dn( $ldapserver_source, $source_dn, $ldapserver_dest, $dest_dn ) {
|
||||
global $lang;
|
||||
|
||||
$attrs = get_object_attrs( $ldapserver_source, $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, '=' ) );
|
||||
@@ -153,28 +169,39 @@ function copy_dn( $source_server_id, $source_dn, $dest_server_id, $dest_dn )
|
||||
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 ) );
|
||||
}
|
||||
if( true === run_hook ( 'pre_entry_create',
|
||||
array ( 'server_id' => $ldapserver_dest->server_id, 'dn' => $dest_dn, 'attrs' => $new_entry ) ) ) {
|
||||
|
||||
$add_result = @ldap_add( $ldapserver_dest->connect(), $dest_dn, $new_entry );
|
||||
if( ! $add_result ) {
|
||||
run_hook ( 'post_entry_create', array ( 'server_id' => $ldapserver_dest->server_id,
|
||||
'dn' => $dest_dn, 'attrs' => $new_entry ) );
|
||||
|
||||
echo "</small><br /><br />";
|
||||
pla_error( $lang['copy_failed'] . $dest_dn, ldap_error( $ldapserver_dest->connect() ), ldap_errno( $ldapserver_dest->connect() ) );
|
||||
}
|
||||
|
||||
return $add_result;
|
||||
|
||||
return $add_result;
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function build_tree( $source_server_id, $root_dn, &$tree )
|
||||
/**
|
||||
* @param object $ldapserver
|
||||
* @param dn $root_dn
|
||||
* @param unknown $tree
|
||||
* @param string $filter
|
||||
*/
|
||||
function build_tree( $ldapserver, $root_dn, &$tree, $filter='(objectClass=*)' )
|
||||
{
|
||||
$children = get_container_contents( $source_server_id, $root_dn );
|
||||
if( is_array( $children ) && count( $children ) > 0 )
|
||||
{
|
||||
$children = get_container_contents( $ldapserver, $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 );
|
||||
build_tree( $ldapserver, $child_dn, $tree, $filter );
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
108
copy_form.php
@@ -1,87 +1,125 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy_form.php,v 1.22 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
/*
|
||||
* copy_form.php
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$dn = $_GET['dn'] ;
|
||||
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
$rdn = pla_explode_dn( $dn );
|
||||
$container = $rdn[ 1 ];
|
||||
for( $i=2; $i<count($rdn)-1; $i++ )
|
||||
$container .= ',' . $rdn[$i];
|
||||
$rdn = $rdn[0];
|
||||
$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( $ldapserver, $dn );
|
||||
$select_server_html = server_select_list($server_id,true,'dest_server_id');
|
||||
$children = get_container_contents( $ldapserver, $dn );
|
||||
|
||||
$attrs = get_object_attrs( $server_id, $dn );
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
include './header.php';
|
||||
|
||||
$select_server_html = "";
|
||||
foreach( $servers as $id => $server )
|
||||
{
|
||||
if( $server['host'] )
|
||||
// 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 )
|
||||
{
|
||||
$select_server_html .= "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . $server['name'] . "</option>\n";
|
||||
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>
|
||||
|
||||
$children = get_container_contents( $server_id, $dn );
|
||||
|
||||
include 'header.php'; ?>
|
||||
<?php } ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo $lang['copyf_title_copy'] . $rdn; ?></h3>
|
||||
<h3 class="subtitle">Server: <b><?php echo $server_name; ?></b> <?php echo $lang['distinguished_name']?>: <b><?php echo $dn; ?></b></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $ldapserver->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>
|
||||
<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>
|
||||
<?php draw_chooser_link( 'copy_form.new_dn', 'true', $rdn ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $lang['copyf_dest_server']?>:</td>
|
||||
<td><select name="dest_server_id"><?php echo $select_server_html; ?></select></td>
|
||||
<td><?php echo $select_server_html; ?></td>
|
||||
</tr>
|
||||
<?php if( show_hints() ) {?>
|
||||
<tr>
|
||||
<td colspan="2"><small><img src="images/light.png" /><?php echo $lang['copyf_note']?></small></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( is_array( $children ) && count( $children ) > 0 ) { ?>
|
||||
<tr>
|
||||
<td colspan="2"><input type="checkbox" name="recursive" />
|
||||
<?php echo $lang['copyf_recursive_copy']?></td>
|
||||
<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>
|
||||
<tr>
|
||||
<td><?php echo $lang['delete_after_copy']; ?></td>
|
||||
<td><input type="checkbox" name="remove" value="yes"/ disabled>
|
||||
<small>(<?php echo $lang['delete_after_copy_warn']; ?>)</small)</td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td><?php echo $lang['delete_after_copy']; ?></td>
|
||||
<td><input type="checkbox" name="remove" value="yes"/></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tr>
|
||||
<td colspan="2" align="right"><input type="submit" value="Copy" /></td>
|
||||
<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>
|
||||
|
137
create.php
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create.php,v 1.32 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
/*
|
||||
* create.php
|
||||
/**
|
||||
* Creates a new object.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
@@ -12,51 +12,62 @@
|
||||
* and the values being their respective values)
|
||||
* - object_classes (rawurlencoded, and serialized array of objectClasses)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
require realpath( './common.php' );
|
||||
|
||||
$server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$new_dn = isset( $_POST['new_dn'] ) ? $_POST['new_dn'] : null;
|
||||
$encoded_dn = rawurlencode( $new_dn );
|
||||
$server_id = $_POST['server_id'];
|
||||
$vals = $_POST['vals'];
|
||||
$attrs = $_POST['attrs'];
|
||||
$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;
|
||||
|
||||
$encoded_dn = rawurlencode( $new_dn );
|
||||
$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 ][] = utf8_encode( $val );
|
||||
$new_entry[ $attr ][] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if( isset( $vals ) && is_array( $vals ) ) {
|
||||
foreach( $vals as $i => $val ) {
|
||||
$attr = $attrs[$i];
|
||||
if( is_attr_binary( $server_id, $attr ) ) {
|
||||
if( $_FILES['vals']['name'][$i] != '' ) {
|
||||
if( isset( $attrs ) && is_array( $attrs ) ) {
|
||||
foreach( $attrs as $i => $attr ) {
|
||||
if( is_attr_binary( $ldapserver, $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 ][] = utf8_encode( $val );
|
||||
$new_entry[ $attr ][] = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,71 +76,83 @@ $new_entry['objectClass'] = $object_classes;
|
||||
if( ! in_array( 'top', $new_entry['objectClass'] ) )
|
||||
$new_entry['objectClass'][] = 'top';
|
||||
|
||||
// UTF-8 magic. Must decode the values that have been passed to us
|
||||
foreach( $new_entry as $attr => $vals )
|
||||
if( ! is_attr_binary( $server_id, $attr ) )
|
||||
foreach( $new_entry as $attr => $vals ) {
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $ldapserver, $new_dn, $attr, $vals ) ) {
|
||||
$search_href = sprintf('search.php?search=true&form=advanced&server_id=%s&filter=%s=%s',$server_id,$attr,$badattr);
|
||||
pla_error(sprintf( $lang['unique_attr_failed'],$attr,$badattr,$new_dn,$search_href ) );
|
||||
}
|
||||
|
||||
if( ! is_attr_binary( $ldapserver, $attr ) )
|
||||
if( is_array( $vals ) )
|
||||
foreach( $vals as $i => $v )
|
||||
$new_entry[ $attr ][ $i ] = utf8_decode( $v );
|
||||
else
|
||||
$new_entry[ $attr ] = utf8_decode( $vals );
|
||||
$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 );
|
||||
|
||||
// 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 );
|
||||
$edit_url="edit.php?server_id=$server_id&dn=" . rawurlencode( $new_dn );
|
||||
if( true === run_hook ( 'pre_entry_create', array ( 'server_id' => $server_id,'dn' => $new_dn,'attrs' => $new_entry ) ) )
|
||||
$add_result = @ldap_add( $ldapserver->connect(), $new_dn, $new_entry );
|
||||
|
||||
// update the session tree to reflect the change
|
||||
session_start();
|
||||
if( session_is_registered( 'tree' ) )
|
||||
{
|
||||
else {
|
||||
pla_error( $lang['create_could_not_add'] );
|
||||
exit;
|
||||
}
|
||||
|
||||
if( $add_result ) {
|
||||
run_hook ( 'post_entry_create', array ( 'server_id' => $server_id, 'dn' => $new_dn, 'attrs' => $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 );
|
||||
$tree_icons[$server_id][$new_dn] = get_icon( $ldapserver, $new_dn );
|
||||
}
|
||||
|
||||
$_SESSION['tree'] = $tree;
|
||||
$_SESSION['tree_icons'] = $tree_icons;
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<?php if( isset( $tree[$server_id][$container] ) ) { ?>
|
||||
|
||||
<!-- 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>
|
||||
<?php if( isset( $tree[$server_id][$container] ) || $new_dn == $servers[$server_id]['base'] ) { ?>
|
||||
|
||||
<?php } ?>
|
||||
<!-- 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>
|
||||
|
||||
<meta http-equiv="refresh" content="0; url=<?php echo $edit_url; ?>" />
|
||||
<?php } ?>
|
||||
|
||||
<meta http-equiv="refresh" content="0; url=<?php echo $redirect_url; ?>" />
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $lang['create_redirecting'] ?>... <a href="<?php echo $edit_url; ?>"><?php echo $lang['create_here']?></a>.
|
||||
|
||||
<?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 ) );
|
||||
}
|
||||
|
||||
<?php } else {
|
||||
pla_error( $lang['create_could_not_add'], ldap_error( $ldapserver->connect() ), ldap_errno( $ldapserver->connect() ) );
|
||||
}
|
||||
?>
|
||||
|
158
create_form.php
@@ -1,104 +1,134 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create_form.php,v 1.22 2005/02/25 13:44:05 wurley 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)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = $_REQUEST['server_id'];
|
||||
$server_id = (isset($_REQUEST['server_id']) ? $_REQUEST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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'] );
|
||||
$server_menu_html = server_select_list($server_id,true);
|
||||
|
||||
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 = '<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' : '' ) . '>';
|
||||
$server_menu_html .= $server['name'] . '</option>';
|
||||
}
|
||||
}
|
||||
$server_menu_html .= '</select>';
|
||||
|
||||
include 'header.php'; ?>
|
||||
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">
|
||||
<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">Server:</td>
|
||||
<td class="heading"><?php echo $lang['server']; ?>:</td>
|
||||
<td><?php echo $server_menu_html; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="heading">Template:</td>
|
||||
<td class="heading"><?php echo $lang['template']; ?>:</td>
|
||||
<td>
|
||||
|
||||
<table class="template_display">
|
||||
<tr>
|
||||
<td>
|
||||
<table class="templates">
|
||||
|
||||
<?php foreach( $templates as $name => $template ) {
|
||||
<?php $count = count( $templates );
|
||||
$i = -1;
|
||||
|
||||
// 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;
|
||||
}
|
||||
foreach( $templates as $name => $template ) {
|
||||
$i++;
|
||||
|
||||
if ($isValid) {
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="radio"
|
||||
name="template"
|
||||
value="<?php echo htmlspecialchars($name);?>"
|
||||
id="<?php echo htmlspecialchars($name); ?>"
|
||||
<?php if( 0 == strcasecmp( 'Custom', $name ) ) { ?>
|
||||
checked
|
||||
<?php } ?>
|
||||
/></td>
|
||||
<td><label for="<?php echo htmlspecialchars($name);?>">
|
||||
<img src="<?php echo $template['icon']; ?>" /></label></td>
|
||||
<td><label for="<?php echo htmlspecialchars($name);?>">
|
||||
<?php echo htmlspecialchars( $template['desc'] ); ?></label></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
} // end if
|
||||
|
||||
} // end foreach ?>
|
||||
// Balance the columns properly
|
||||
if( ( count( $templates ) % 2 == 0 && $i == intval( $count / 2 ) ) ||
|
||||
( count( $templates ) % 2 == 1 && $i == intval( $count / 2 ) + 1 ) )
|
||||
|
||||
</table>
|
||||
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;
|
||||
} ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<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>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo $lang['createf_proceed']?> >>" /></center></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</form>
|
||||
<tr>
|
||||
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo $lang['proceed_gt']?>" /></center></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,51 +1,68 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/creation_template.php,v 1.22 2005/03/12 00:57:17 wurley 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
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require_once 'common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
isset( $_POST['template'] ) or pla_error( 'You must choose a template' );
|
||||
$template = $_POST['template'];
|
||||
isset( $templates[$template] ) or pla_error( 'Invalid template: ' . htmlspecialchars( $template ) );
|
||||
$template = isset( $templates[$template] ) ? $templates[$template] : null;
|
||||
$server_id = $_POST['server_id'];
|
||||
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'] );
|
||||
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$server_name = $servers[ $server_id ][ 'name' ];
|
||||
$server_id = (isset($_REQUEST['server_id']) ? $_REQUEST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
include 'header.php';
|
||||
$template = (isset($_REQUEST['template']) ? $_REQUEST['template'] : null);
|
||||
! is_null($template) 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;
|
||||
|
||||
if ( ! array_key_exists('no_header', $template ) ) {
|
||||
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 ); ?>',
|
||||
using template '<?php echo htmlspecialchars( $template['desc'] ); ?>'</h3>
|
||||
<h3 class="subtitle"><?php echo $lang['ctemplate_on_server']?> '<?php echo htmlspecialchars( $ldapserver->name ); ?>', <?php echo $lang['using_template']?> '<?php echo htmlspecialchars( $template['desc'] ); ?>'</h3>
|
||||
|
||||
<?php
|
||||
|
||||
if( ! isset( $_POST['template'] ) )
|
||||
pla_error( $lang['ctemplate_no_template'] );
|
||||
<?php }
|
||||
|
||||
$handler = 'templates/creation/' . $template['handler'];
|
||||
$handler = realpath( $handler );
|
||||
if( file_exists( $handler ) )
|
||||
include $handler;
|
||||
else
|
||||
pla_error( $lang['ctemplate_config_handler'] . " <b>" . htmlspecialchars( $template['handler'] ) .
|
||||
"</b> " . $lang['ctemplate_handler_does_not_exist']);
|
||||
|
||||
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;
|
||||
|
||||
if ( ! array_key_exists('no_header', $template ) ) {
|
||||
echo "</body>\n</html>";
|
||||
}
|
||||
?>
|
||||
|
@@ -1,7 +1,12 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/custom_functions.php,v 1.8 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
/*
|
||||
* custom_functions.php: Choose your own adventure.
|
||||
/**
|
||||
* CUSTOM_FUCTIONS has been DEPRECIATED, please use the hooks functions now.
|
||||
* Let the phpLDAPadmin developers know if you REALLY need this - it will be removed
|
||||
* in future releases.
|
||||
*
|
||||
* custom_functions.php:
|
||||
*
|
||||
* This file is full of functions (callbacks really) that are
|
||||
* meant to be filled in by users of phpLDAPadmin (you). These functions
|
||||
@@ -54,6 +59,9 @@
|
||||
* - ldap_delete (ie, removing entries)
|
||||
* - ldap_modify (ie, changing the value of an attribute, for both
|
||||
* multi- and single-valued attributes)
|
||||
* @deprecated
|
||||
* @see hooks.php
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -84,6 +92,7 @@ function postAttrModify( $server_id, $dn, $attr_name, $new_value )
|
||||
* 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.
|
||||
* @deprecated
|
||||
*/
|
||||
function preAttrModify( $server_id, $dn, $attr_name, $new_value )
|
||||
{
|
||||
@@ -91,6 +100,22 @@ function preAttrModify( $server_id, $dn, $attr_name, $new_value )
|
||||
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.
|
||||
* @deprecated
|
||||
*/
|
||||
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
|
||||
@@ -99,6 +124,7 @@ function preAttrModify( $server_id, $dn, $attr_name, $new_value )
|
||||
* one may wish to create the user's home directory.
|
||||
* See the documentation for preEntryCreate() below for
|
||||
* the description of the $attrs parameter.
|
||||
* @deprecated
|
||||
*/
|
||||
function postEntryCreate( $server_id, $dn, $attrs )
|
||||
{
|
||||
@@ -132,6 +158,7 @@ function postEntryCreate( $server_id, $dn, $attrs )
|
||||
* ...
|
||||
* )
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function preEntryCreate( $server_id, $dn, $attrs )
|
||||
{
|
||||
@@ -143,6 +170,7 @@ function preEntryCreate( $server_id, $dn, $attrs )
|
||||
* 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.
|
||||
* @deprecated
|
||||
*/
|
||||
function preEntryDelete( $server_id, $dn )
|
||||
{
|
||||
@@ -154,9 +182,19 @@ function preEntryDelete( $server_id, $dn )
|
||||
* This function is executed after an entry is deleted.
|
||||
* Unlike preEntryDelete(), this function's return
|
||||
* value is ignored.
|
||||
* @deprecated
|
||||
*/
|
||||
function postEntryDelete( $server_id, $dn )
|
||||
{
|
||||
// Fill me in
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called, after a new session is initilaized
|
||||
* @deprecated
|
||||
*/
|
||||
function postSessionInit()
|
||||
{
|
||||
// Fill me in
|
||||
}
|
||||
?>
|
||||
|
69
delete.php
@@ -1,69 +1,73 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete.php,v 1.21 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
/*
|
||||
* delete.php
|
||||
/**
|
||||
* Deletes a DN and presents a "job's done" message.
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
|
||||
$server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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'] );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
dn_exists( $ldapserver, $dn ) or pla_error( sprintf( $lang['no_such_entry'], '<b>' . pretty_print_dn( $dn ) . '</b>' ) );
|
||||
|
||||
// Check the user-defined custom callback first.
|
||||
if( true === preEntryDelete( $server_id, $dn ) ) {
|
||||
$del_result = @ldap_delete( $ds, $dn );
|
||||
if( true === run_hook ( 'pre_entry_delete', array ( 'server_id' => $server_id, 'dn' => $dn ) ) ) {
|
||||
$del_result = @ldap_delete( $ldapserver->connect(), $dn );
|
||||
|
||||
} else {
|
||||
exit;
|
||||
pla_error( sprintf( $lang['could_not_delete_entry'], '<b>' . pretty_print_dn( $dn ) . '</b>' ));
|
||||
}
|
||||
|
||||
if( $del_result )
|
||||
{
|
||||
if( $del_result ) {
|
||||
|
||||
// Custom callback
|
||||
postEntryDelete( $server_id, $dn );
|
||||
run_hook ( 'post_entry_delete', array ( 'server_id' => $server_id, 'dn' => $dn ) );
|
||||
|
||||
// kill the DN from the tree browser session variable and
|
||||
// refresh the tree viewer frame (left_frame)
|
||||
|
||||
session_start();
|
||||
if( session_is_registered( 'tree' ) )
|
||||
{
|
||||
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)
|
||||
// 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 ) )
|
||||
if( 0 == strcasecmp( $sub_tree_dn, $dn ) )
|
||||
unset( $tree[$server_id][$tree_dn][$key] );
|
||||
|
||||
$_SESSION['tree'] = $tree;
|
||||
}
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<script language="javascript">
|
||||
parent.left_frame.location.reload();
|
||||
@@ -71,13 +75,10 @@ if( $del_result )
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<center><?php echo sprintf( $lang['entry_deleted_successfully'], $dn ); ?></center>
|
||||
<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'], htmlspecialchars( utf8_decode( $dn ) ) ),
|
||||
ldap_error( $ds ),
|
||||
ldap_errno( $ds ) );
|
||||
<?php } else {
|
||||
pla_error( sprintf( $lang['could_not_delete_entry'], '<b>' . pretty_print_dn( $dn ) . '</b>' ),
|
||||
ldap_error( $ldapserver->connect() ), ldap_errno( $ldapserver->connect() ) );
|
||||
}
|
||||
?>
|
||||
|
@@ -1,42 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* delete_attr.php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_attr.php,v 1.11 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
/**
|
||||
* Deletes an attribute from an entry with NO confirmation.
|
||||
*
|
||||
* On success, redirect to edit.php
|
||||
* On failure, echo an error.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = $_POST['server_id'];
|
||||
$server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$dn = $_POST['dn'] ;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$attr = $_POST['attr'];
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( "You cannot perform updates while server is in read-only mode" );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
if( ! $attr ) pla_error( "No attribute name specified in POST variables" );
|
||||
if( ! $dn ) pla_error( "No DN name specified in POST variables" );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
|
||||
if( is_attr_read_only( $ldapserver, $attr ) )
|
||||
pla_error( sprintf( $lang['attr_is_read_only'], htmlspecialchars( $attr ) ) );
|
||||
|
||||
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 );
|
||||
$res = @ldap_modify( $ds, $dn, $update_array );
|
||||
if( $res )
|
||||
{
|
||||
|
||||
$res = @ldap_modify( $ldapserver->connect(), $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( "Could not perform ldap_modify operation.", ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
|
||||
header( "Location: $redirect_url" );
|
||||
|
||||
} else {
|
||||
pla_error( $lang['could_not_perform_ldap_modify'], ldap_error( $ldapserver->connect() ), ldap_errno( $ldapserver->connect() ) );
|
||||
}
|
||||
?>
|
||||
|
206
delete_form.php
@@ -1,158 +1,154 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_form.php,v 1.19 2005/03/05 06:27:06 wurley 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
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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'];
|
||||
$children = get_container_contents( $ldapserver,$dn,0,'(objectClass=*)',LDAP_DEREF_NEVER );
|
||||
$has_children = count($children) > 0 ? true : false;
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( "You cannot perform updates while server is in read-only mode" );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
|
||||
$children = get_container_contents( $server_id, $dn );
|
||||
$has_children = count($children)>0 ? true : false;
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">Delete <b><?php echo htmlspecialchars( ( $rdn ) ); ?></b></h3>
|
||||
<h3 class="subtitle">Server: <b><?php echo $server_name; ?></b> Distinguished Name: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
|
||||
<h3 class="title"><?php echo sprintf( $lang['delete_dn'], htmlspecialchars( $rdn ) ); ?></b></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $ldapserver->name; ?></b> <?php echo $lang['distinguished_name']; ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
|
||||
|
||||
<?php if( 0 == strcasecmp( $dn, $servers[$server_id]['base'] ) ) { ?>
|
||||
<?php if( $has_children ) { ?>
|
||||
|
||||
<center><b>You cannot delete the base <acronym title="Distinguished Name">DN</acronym> entry of the LDAP server.</b></center>
|
||||
</body>
|
||||
</html>
|
||||
<?php exit; ?>
|
||||
<center><b><?php echo $lang['permanently_delete_children']; ?></b><br /><br />
|
||||
|
||||
<?php } ?>
|
||||
<?php flush(); // so the user can get something on their screen while we figure out how many children this object has
|
||||
|
||||
|
||||
<?php if( $has_children ) { ?>
|
||||
|
||||
<center><b>Permanently delete all children also?</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' );
|
||||
$s = pla_ldap_search( $ldapserver, 'objectClass=*', $dn, array('dn'), 'sub' );
|
||||
$sub_tree_count = count( $s );
|
||||
}
|
||||
?>
|
||||
|
||||
<table class="delete_confirm">
|
||||
<td>
|
||||
|
||||
<p>This object is the root of a sub-tree containing <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 ($sub_tree_count); ?> objects</a>
|
||||
|
||||
phpLDAPadmin can recursively delete this object and all <?php echo ($sub_tree_count-1); ?> of its children. See below for a list of DNs
|
||||
that this will delete. Do you want to do this?<br />
|
||||
<br />
|
||||
<small>Note: This is potentially very dangerous and you do this at your own risk. This operation cannot be undone.
|
||||
Take into consideration aliases and other such things that may cause problems.</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="Delete all <?php echo ($sub_tree_count); ?> objects" />
|
||||
</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="Cancel" class="cancel" />
|
||||
</form>
|
||||
</center>
|
||||
<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>
|
||||
</center>
|
||||
</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>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</table>
|
||||
|
||||
<?php flush(); ?>
|
||||
<br />
|
||||
<br />
|
||||
A list of all the <?php echo ($sub_tree_count); ?> <acronym title="Distinguished Name">DN</acronym>s that this action will delete:<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 } ?>
|
||||
<?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;
|
||||
foreach( $s as $dn => $junk ) {
|
||||
$i++; ?>
|
||||
|
||||
<option><?php echo $i; ?>. <?php echo htmlspecialchars( ( $dn ) ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
<br />
|
||||
|
||||
<?php } else { ?>
|
||||
<?php } else { ?>
|
||||
|
||||
<center>
|
||||
|
||||
<table class="delete_confirm">
|
||||
<td>
|
||||
|
||||
Are you sure you want to permanently delete this object?<br />
|
||||
<br />
|
||||
<nobr><acronym title="Distinguished Name">DN</acronym>: <b><?php echo htmlspecialchars(($dn)); ?></b><nobr><br />
|
||||
<nobr>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 $dn; ?>" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="submit" name="submit" value="Delete It" 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="Cancel" class="cancel" />
|
||||
</form>
|
||||
</center>
|
||||
<?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($ldapserver->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" />
|
||||
</form>
|
||||
</center>
|
||||
</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>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</table>
|
||||
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
|
52
doc/CREDITS
@@ -1,10 +1,11 @@
|
||||
|
||||
* Project Creator:
|
||||
- David Smith
|
||||
|
||||
* Project Developers:
|
||||
|
||||
- David Smith Maintainer
|
||||
- Xavier Renard LDIF master
|
||||
- Marius Rieder Schema master
|
||||
- Nate Rotschafer Release manager
|
||||
- Deon George Maintainer
|
||||
- Xavier Renard Import/Export and Samba
|
||||
- Uwe Ebel I18n
|
||||
|
||||
* Patch writers:
|
||||
|
||||
@@ -16,20 +17,39 @@
|
||||
Nathan Rotschafer
|
||||
- Steve Rigler Password hash patch
|
||||
- Chris Jackson Blowfish and md5crypt passwords
|
||||
- Marius Rieder Enhanced schema parser
|
||||
- Nick Burch Many realpath() fixes
|
||||
- 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
|
||||
- Benjamin Drieu Syslog, Hooks and other fixes
|
||||
- Samuel Tran User login restriction
|
||||
- Daniel van Eeden Unicode, CSS fixes
|
||||
- Piotr Tarnowski More locatisation fixes
|
||||
- Tomas Kuliavas Improved password encoding functions
|
||||
|
||||
* Translators:
|
||||
|
||||
- Uwe Ebel & Marius Reider German
|
||||
- Xavier Renard French
|
||||
- Dave Smith English ;)
|
||||
- Richard Lucassen Dutch
|
||||
- Andreu Sanchez Spanish and Catal<61>
|
||||
- Dmitry Gorpinenko Russian
|
||||
- Unknown Italian
|
||||
|
||||
- Marius Reider, German
|
||||
Uwe Ebel,
|
||||
Dieter Kluenter
|
||||
- Xavier Renard French
|
||||
- Dave Smith English ;)
|
||||
- Richard Lucassen Dutch
|
||||
- Andreu Sanchez Spanish and Català
|
||||
- Dmitry Gorpinenko, Russian
|
||||
Aleksey Soldatov
|
||||
Sergey Saukh
|
||||
- Unknown Italian, Tain, Simplified Chinese
|
||||
- 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
|
||||
|
||||
|
288
doc/ChangeLog
@@ -1,3 +1,267 @@
|
||||
* Version 0.9.6, 2005-04-03
|
||||
|
||||
* Summary:
|
||||
The main goals for this version was to close all the outstanding bugs and apply all the submitted patchs
|
||||
on sourceforge. All the sourceforge easy to do RFE's where also included.
|
||||
|
||||
* Notes:
|
||||
- Added support for mulpiple Base DN's
|
||||
- Added support to log for syslog (Benjamin Drieu)
|
||||
- Added hooks feature to replace custom functions (Benjamin Drieu)
|
||||
- Entry chooser now auto adds rdn entry for copy/move operations (wigi2)
|
||||
- Initial support for AD Schema Retrieval
|
||||
- Added login restriction (Samuel Tran)
|
||||
- Added support to move objects (aka Copy then Delete) (wigi2)
|
||||
- No longer show + next to objects that have no children in tree viewer (when hide_configuration_management=true)
|
||||
- Added date evaluation to shadow attributes (shadowAccount)
|
||||
- Added Enhancement to show attributes in a specifc order (Samuel Tran)
|
||||
- Added Server Info OID descriptions
|
||||
- Added new feature to compare two DNs
|
||||
- Binary SID to text SID feature for MSAD objectSid entries.
|
||||
- Added session timeout feature (Samuel Tran)
|
||||
|
||||
* New Languages:
|
||||
- Taiwan (Anonymous)
|
||||
- Simplfied Chinese (Anonymous)
|
||||
|
||||
* Changes:
|
||||
- LDAP server configuration is being moved into an Object LDAPServer, all future interactions should
|
||||
use this object class from now on.
|
||||
- Some more conversions of english static text into language files.
|
||||
- Some code cleanup, excess whitespace removal, etc...
|
||||
- Tags for phpdoc updated.
|
||||
- Added cvs header to files missing the header.
|
||||
- LDIF Import function improvements (Xavier Renard)
|
||||
- UniqueAttrs fix, now showing actual value (in multi value attribs) that breaches uniqueness
|
||||
- Fixed check_lang_files when register_globals=off
|
||||
- css fixes (Daniel van Eeden)
|
||||
- More locatisation fixes (Piotr Tarnowski)
|
||||
- Schema functions all use cached entries now by default
|
||||
- Improved password encoding functions (Tomas Kuliavas)
|
||||
- If auth_type = session, then dn and password is also blowfish encrypted
|
||||
- Prettied up the icon index (Dave Smith)
|
||||
- Make the rdn not editable in the default template.
|
||||
|
||||
* Fixes:
|
||||
- password_check when magic_quotes_gpc is on.
|
||||
- Misc fixes (Benjamin Drieu)
|
||||
- Fix searchs when searching for values with brackets
|
||||
- Unicode fixes (Daniel van Eeden)
|
||||
- View jpeg photo minor security fix (Dave Smith)
|
||||
- Check password link missing in read-only mode
|
||||
|
||||
* Sourceforge bug fixes:
|
||||
1117099 1117316 1120048 1150947 1152962 1153360 1055401 1158148 1161425
|
||||
|
||||
|
||||
* 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:
|
||||
@@ -13,18 +277,18 @@
|
||||
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
|
||||
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.
|
||||
|
@@ -1,13 +1,18 @@
|
||||
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 und funktioniert
|
||||
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 geschechen)
|
||||
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'
|
||||
@@ -43,19 +48,21 @@ installiert und funktioniert
|
||||
Bitte in der Datei INSTALL unter 'Translators:' nachsehen
|
||||
|
||||
Wer in der Uebersetzung helfen moechte sollte an der Mailingliste
|
||||
phpldapadmin-devel teilnehmen.
|
||||
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
|
||||
Wer eine Benuetzerfuehrung auf Deutsch haben moechte sollte in der
|
||||
config.php die Zeile
|
||||
|
||||
$language = 'en';
|
||||
|
||||
mit
|
||||
|
||||
$language = 'de';
|
||||
|
||||
abaendern. Andere Sprachen sieht man im Unterverzeichnis 'lang'
|
||||
abaendern. Weitere Sprachen sieht man im Unterverzeichnis 'lang'
|
||||
|
||||
|
||||
|
@@ -1,25 +1,26 @@
|
||||
Estas instrucciones dejan por sentado que tienes una instalaci<63>n
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/INSTALL-es.txt,v 1.4 2005/02/06 00:37:15 wurley Exp $
|
||||
Estas instrucciones dejan por sentado que tienes una instalació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<EFBFBD>s leyendo esto, ya lo has hecho).
|
||||
2. Pon el directorio resultante 'phpldapadmin' en alg<EFBFBD>n lugar de tu
|
||||
1. Desempaqueta el archivo (si estás leyendo esto, ya lo has hecho).
|
||||
2. Pon el directorio resultante 'phpldapadmin' en algún lugar de tu
|
||||
directorio web raiz.
|
||||
3. Copia 'config.php.example' a 'config.php' y ed<EFBFBD>talo para que se
|
||||
acomode a tu configuraci<EFBFBD>n y tu gusto.
|
||||
4. Entonces, con el navegador ve a la direcci<EFBFBD>n que contiene los archivos
|
||||
3. Copia 'config.php.example' a 'config.php' y edítalo para que se
|
||||
acomode a tu configuración y tu gusto.
|
||||
4. Entonces, con el navegador ve a la dirección que contiene los archivos
|
||||
del directorio phpldapadmin.
|
||||
|
||||
* Notas del navegador
|
||||
|
||||
phpLDAP se desarroll<EFBFBD> bajo Mozilla, y ser<EFBFBD> donde seguramente corra mejor.
|
||||
A<EFBFBD>n as<EFBFBD>, las pruebas se han hecho bajo Internet Explorer, y tendr<EFBFBD>a que funcionar
|
||||
bien tambi<EFBFBD>n. No se ha hecho ninguna prueba con Konqueror (o cualquier navegador
|
||||
phpLDAP se desarrolló bajo Mozilla, y será donde seguramente corra mejor.
|
||||
Aún así, las pruebas se han hecho bajo Internet Explorer, y tendría que funcionar
|
||||
bien tambié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<EFBFBD>znoslo saber.
|
||||
háznoslo saber.
|
||||
|
||||
* Contribuidores
|
||||
|
||||
@@ -35,21 +36,21 @@ funcionando de:
|
||||
- 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<EFBFBD>rgum soporte UTF-8
|
||||
- Eigil Bjørgum soporte UTF-8
|
||||
- Brandon Lederer plantilla de entrada de DNS
|
||||
Nathan Rotschafer
|
||||
- Steve Rigler Parche para Password hash
|
||||
- Chris Jackson Contrase<EFBFBD>as Blowfish y md5crypt
|
||||
- Chris Jackson Contraseñas Blowfish y md5crypt
|
||||
- Marius Rieder Parseador avanzado de esquema
|
||||
- Nick Burch Un mont<EFBFBD>n de arreglos de realpath()
|
||||
- Nick Burch Un montón de arreglos de realpath()
|
||||
|
||||
Traductores:
|
||||
|
||||
- Uwe Ebel Alem<EFBFBD>n
|
||||
- Xavier Renard Franc<EFBFBD>s
|
||||
- Dave Smith Ingl<EFBFBD>s ;)
|
||||
- Uwe Ebel Alemán
|
||||
- Xavier Renard Francés
|
||||
- Dave Smith Inglés ;)
|
||||
|
||||
Si puedes ayudar a traducir, por favor ap<EFBFBD>ntate a la lista de correo phpldapadmin:
|
||||
Si puedes ayudar a traducir, por favor apúntate a la lista de correo phpldapadmin:
|
||||
https://lists.sourceforge.net/mailman/listinfo/phpldapadmin-devel
|
||||
|
||||
|
||||
|
@@ -1,22 +1,23 @@
|
||||
Les instructions suivantes supposent une installation en <20>tat de marche de:
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/INSTALL-fr.txt,v 1.4 2005/02/06 00:37:15 wurley Exp $
|
||||
Les instructions suivantes supposent une installation en état de marche de:
|
||||
a. Un serveur web (Apache, IIS, etc).
|
||||
b. PHP 4.1.0 ou une version plus r<EFBFBD>cente (avec le support LDAP).
|
||||
b. PHP 4.1.0 ou une version plus récente (avec le support LDAP).
|
||||
|
||||
* Installer phpLDAPadmin en quatre <EFBFBD>tapes simples:
|
||||
* Installer phpLDAPadmin en quatre étapes simples:
|
||||
|
||||
1. D<EFBFBD>-tarrer l'archive (si vous lisez ceci, c'est que vous l'avez d<EFBFBD>j<EFBFBD> fait).
|
||||
2. Mettre le r<EFBFBD>pertoire 'phpldapadmin' ainsi obtenu quelque part sous
|
||||
1. Dé-tarrer l'archive (si vous lisez ceci, c'est que vous l'avez déjà 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 <EFBFBD>diter selon vos besoins.
|
||||
4. Ensuite, pointer votre navigateur vers le r<EFBFBD>pertoire phpldapadmin.
|
||||
3. Copier 'config.php.example' vers 'config.php' et éditer selon vos besoins.
|
||||
4. Ensuite, pointer votre navigateur vers le répertoire phpldapadmin.
|
||||
|
||||
* Notes sur les navigateurs
|
||||
|
||||
phpLDAPadmin a <EFBFBD>t<EFBFBD> developp<EFBFBD> avec Mozilla et fonctionnera vraisemblablement
|
||||
mieux avec celui-ci. Cependant, des tests ont <EFBFBD>t<EFBFBD> effectu<EFBFBD> avec Internet Explorer
|
||||
et cela devrait fonctionner <EFBFBD>galement. Aucun test n'a <EFBFBD>t<EFBFBD> r<EFBFBD>alis<EFBFBD> ni avec Konqueror
|
||||
(ou un navigateur bas<EFBFBD> sur khtml comme Safari par exemple) ni avec Opera. Si
|
||||
vous trouvez une incompatibilit<EFBFBD> avec votre navigateur, merci de la reporter.
|
||||
phpLDAPadmin a été developpé avec Mozilla et fonctionnera vraisemblablement
|
||||
mieux avec celui-ci. Cependant, des tests ont été effectué avec Internet Explorer
|
||||
et cela devrait fonctionner également. Aucun test n'a été réalisé ni avec Konqueror
|
||||
(ou un navigateur basé sur khtml comme Safari par exemple) ni avec Opera. Si
|
||||
vous trouvez une incompatibilité avec votre navigateur, merci de la reporter.
|
||||
|
||||
* Contributions:
|
||||
|
||||
@@ -24,7 +25,7 @@ Les instructions suivantes supposent une installation en
|
||||
|
||||
- David Smith Maintenance
|
||||
- Xavier Renard Responsable LDIF
|
||||
- Marius Rieder Responsable pour les sch<EFBFBD>ma LDAP
|
||||
- Marius Rieder Responsable pour les schéma LDAP
|
||||
- Nate Rotschafer Directeur des releases
|
||||
|
||||
Auteurs de patchs:
|
||||
@@ -32,25 +33,25 @@ Les instructions suivantes supposent une installation en
|
||||
- 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<EFBFBD>mas
|
||||
- Eigil Bj<EFBFBD>rgum Support pour UTF-8
|
||||
- Brandon Lederer Patron pour les entr<EFBFBD>es DNS
|
||||
- Andrew Tipton Support pour SUP dans le parseur de schémas
|
||||
- Eigil Bjørgum Support pour UTF-8
|
||||
- Brandon Lederer Patron pour les entré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<EFBFBD>lioration du parseur de sch<EFBFBD>mas
|
||||
- Marius Rieder Amélioration du parseur de schémas
|
||||
- Nick Burch Corrections multiples pour realpath()
|
||||
|
||||
Traducteurs:
|
||||
|
||||
- Uwe Ebel & Marius Reider Allemand
|
||||
- Xavier Renard Fran<EFBFBD>ais
|
||||
- Xavier Renard Français
|
||||
- Dave Smith Anglais ;)
|
||||
- Richard Lucassen N<EFBFBD>erlandais
|
||||
- Richard Lucassen Néerlandais
|
||||
- Andreu Sanchez Espagnol et Catalan
|
||||
- Dmitry Gorpinenko Russe
|
||||
- Unknown Italien
|
||||
|
||||
Si vous pouvez aider <EFBFBD> traduire phpLDAPAdmin, veuillez s'il vous pla<EFBFBD>t vous abonner
|
||||
<EFBFBD> la liste de diffusion phpldapadmin-devel:
|
||||
Si vous pouvez aider à traduire phpLDAPAdmin, veuillez s'il vous plaît vous abonner
|
||||
à la liste de diffusion phpldapadmin-devel:
|
||||
https://lists.sourceforge.net/mailman/listinfo/phpldapadmin-devel
|
||||
|
101
doc/README-translation.txt
Normal file
@@ -0,0 +1,101 @@
|
||||
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.
|
37
doc/ROADMAP
@@ -1,37 +0,0 @@
|
||||
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.
|
||||
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)
|
||||
Search filter builder for simple search form (just select AND or OR for a group of criteria)
|
||||
Modification templates
|
||||
user
|
||||
oragnizationalUnit
|
||||
posixGroup (view full DNs and browse buttons)
|
||||
sambaUser (v 2 and 3)
|
||||
sambaMachine
|
||||
http auth_type (a la phpMyAdmin)
|
||||
read-only attributes (similar to hidden attributes) in config
|
||||
Support and test ActiveDirectory and iMail LDAP schema.
|
||||
Support for modifying replica entries (using ldap_set_rebind_proc())
|
||||
Add blowfish encryption to encrypt cookie-stored passwords and DNs.
|
||||
Default mod template: Add a "browse" button for attributes that store DNs.
|
||||
Add output buffering when including lang files so no output is sent to the browser (which could cause problems for sessions and cookies)
|
||||
Add a random hint on the welcome page
|
||||
Paging search results.
|
||||
Anonymous binds redirect to search page with no tree viewer (as an option in config)
|
||||
Remove all HTML from language files.
|
||||
|
||||
0.9.5 planned features:
|
||||
Hidden/read-only attrs on a filter-basis (ie, different users have different viewable, writable attributes)
|
||||
Seious compatibility testing for additional LDAP servers.
|
||||
Configuration for templates.
|
||||
Template instances with unique config.
|
||||
Object Oriented migration for server and general configuration (ie, add a class Server)
|
1218
doc/hooks.sgml
Normal file
67
doc/pla-test-i18n.ldif
Normal file
@@ -0,0 +1,67 @@
|
||||
# $Header: /cvsroot/phpldapadmin/phpldapadmin/doc/pla-test-i18n.ldif,v 1.4 2004/03/19 20:22:54 i18phpldapadmin Exp $
|
||||
# This is a Test-File for characters / encoding
|
||||
# 1. Change the
|
||||
# ,dc=example,dc=com
|
||||
# to avalue for your organisation
|
||||
# 2. Import it with phpldapadmin
|
||||
#
|
||||
# pla-i18n, example.com
|
||||
#
|
||||
dn: ou=pla-i18n,dc=example,dc=com
|
||||
ou: pla-i18n
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
|
||||
# pl, pla-i18n, example.com
|
||||
dn: ou=pl,ou=pla-i18n,dc=example,dc=com
|
||||
description:: IGRvcMOza2k=
|
||||
description:: xITFu8WaxbnEhsWDxYHDk8SYIMSFxbzFm8W6xIfFhMWCw7PEmQ==
|
||||
description:: V3NrYXrDs3drYQ==
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
ou: pl
|
||||
|
||||
# ru, pla-i18n, example.com
|
||||
dn: ou=ru,ou=pla-i18n,dc=example,dc=com
|
||||
description:: 0LfQstGD0YfQuNGCINC/0L7QtNC+0LHQvdC+
|
||||
description:: 0J/RgNC+0YHRgtCw0Y8g0YTQvtGA0LzQsCDQv9C+0LjRgdC6
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
ou: ru
|
||||
|
||||
# jp, pla-i18n, example.com
|
||||
dn: ou=jp,ou=pla-i18n,dc=example,dc=com
|
||||
ou: jp
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
description:: SVNPLTIwMjItSlDjga7lpJrlm73nsY3oqIDoqp7jgbjjga7mi6HlvLXmgKc=
|
||||
|
||||
# pt-br, pla-i18n, example.com
|
||||
dn: ou=pt-br,ou=pla-i18n,dc=example,dc=com
|
||||
ou: pt-br
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
description:: VmVyIGFzIHJlcXVpc2nDp8O1ZXMgZW0gYWJlcnRv
|
||||
|
||||
# de, pla-i18n, example.com
|
||||
dn: ou=de,ou=pla-i18n,dc=example,dc=com
|
||||
ou: de
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
description:: U29uZGVyemVpY2hlbiDDtsOkw7zDnyDDlsOEw5w=
|
||||
description:: w5bDliDDnMOcIMOEw4Q=
|
||||
|
||||
# sv, pla-i18n, example.com
|
||||
dn: ou=sv,ou=pla-i18n,dc=example,dc=com
|
||||
ou: sv
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
description:: U8O2a29tZsOlbmc=
|
||||
description:: bMOldGVyIHNvbQ==
|
||||
|
||||
# ca, pla-i18n, example.com
|
||||
dn: ou=ca,ou=pla-i18n,dc=example,dc=com
|
||||
ou: ca
|
||||
objectClass: top
|
||||
objectClass: organizationalUnit
|
||||
description:: RXMgdGluZHLDoSBxdWUgY29uZmlybWFyIGFxdWVzdGEgZGVjaXNpw7M=
|
15
doc/test_encoding.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# $Header: /cvsroot/phpldapadmin/phpldapadmin/doc/test_encoding.sh,v 1.1 2005/02/06 00:37:15 wurley Exp $
|
||||
# $Id: test_encoding.sh,v 1.1 2005/02/06 00:37:15 wurley Exp $
|
||||
# Written by: Daniel van Eeden <daniel_e@dds.nl>
|
||||
# Purpose: test utf-8 encoding
|
||||
|
||||
for file in `find . -type f ! -name \*png ! -name \*jpg | egrep -v "^./lang/"`
|
||||
do
|
||||
output=`iconv ${file} -o /dev/null 2>&1`
|
||||
err=$?
|
||||
output=`echo ${output} | cut -d: -f2`
|
||||
if [ ${err} != "0" ]; then
|
||||
echo "${file}:${output}"
|
||||
fi
|
||||
done
|
@@ -1,7 +1,16 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/documentation.php,v 1.8 2005/02/25 13:44:06 wurley Exp $
|
||||
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
include './common.php';
|
||||
include './header.php';
|
||||
|
||||
echo "<body>";
|
||||
|
||||
$view = isset( $_GET['view'] ) ? $_GET['view'] : false;
|
||||
switch( $view ) {
|
||||
@@ -41,5 +50,3 @@ switch( $view ) {
|
||||
|
||||
<h3 class="doc">Modification Templates</h3>
|
||||
<p class="doc">TODO: Write me.</p>
|
||||
|
||||
|
||||
|
52
donate.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/donate.php,v 1.7 2005/02/26 12:35:05 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
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 />
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,28 +1,45 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/download_binary_attr.php,v 1.10 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
require 'common.php';
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( $ldapserver->isReadOnly() )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( "Coult not connect to LDAP server." );
|
||||
dn_exists( $ldapserver, $dn ) or
|
||||
pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn ) ) );
|
||||
|
||||
$search = ldap_read( $ds, $dn, "(objectClass=*)", array( $attr ), 0, 200, 0, LDAP_DEREF_ALWAYS );
|
||||
$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 );
|
||||
$search = @ldap_read( $ldapserver->connect(),$dn,"(objectClass=*)",array($attr),0,0,0,get_view_deref_setting() );
|
||||
if( ! $search )
|
||||
pla_error( $lang['error_performing_search'],ldap_error($ldapserver->connect()),ldap_errno($ldapserver->connect()) );
|
||||
|
||||
$entry = ldap_first_entry( $ldapserver->connect(),$search );
|
||||
$attrs = ldap_get_attributes( $ldapserver->connect(),$entry );
|
||||
$attr = ldap_first_attribute( $ldapserver->connect(),$entry,$attrs );
|
||||
$values = ldap_get_values_len( $ldapserver->connect(),$entry,$attr );
|
||||
$count = $values['count'];
|
||||
unset( $values['count'] );
|
||||
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];
|
||||
|
||||
// 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];
|
||||
?>
|
||||
|
40
edit.php
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/edit.php,v 1.52 2005/03/05 06:27:06 wurley 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
|
||||
@@ -12,41 +12,49 @@
|
||||
* - 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
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
require realpath( 'templates/template_config.php' );
|
||||
require_once realpath( 'common.php' );
|
||||
require_once realpath( 'templates/template_config.php' );
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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'] );
|
||||
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
|
||||
if( $use_default_template ) {
|
||||
require realpath( 'templates/modification/default.php' );
|
||||
} else {
|
||||
|
||||
$template = get_template( $server_id, $dn );
|
||||
} else {
|
||||
$template = get_template( $ldapserver, $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 $lang['missing_template_file'];
|
||||
echo " <b>$template_file</b>. ";
|
||||
echo $lang['using_default'];
|
||||
echo "<br />\n\n";
|
||||
require realpath( 'templates/modification/default.php' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
114
emuhash_functions.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/emuhash_functions.php,v 1.6 2005/03/25 00:59:48 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package other
|
||||
*/
|
||||
/*******************************************************************************
|
||||
* emuhash - partly emulates the php mhash functions
|
||||
* version: 2004040701
|
||||
*
|
||||
* (c) 2004 - Simon Matter <simon.matter@invoca.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* Do we have builtin mhash support in this PHP version ? */
|
||||
/******************************************************************************/
|
||||
|
||||
if( ! function_exists( 'mhash' ) && ! function_exists( 'mhash_keygen_s2k' ) ) {
|
||||
if( ! isset( $emuhash_openssl ) )
|
||||
$emuhash_openssl = '/usr/bin/openssl';
|
||||
|
||||
// don't create mhash functions if we don't have a working openssl
|
||||
if( ! file_exists( $emuhash_openssl ) )
|
||||
unset( $emuhash_openssl );
|
||||
|
||||
elseif ( function_exists( 'is_executable' ) && ! is_executable( $emuhash_openssl ) )
|
||||
unset( $emuhash_openssl );
|
||||
|
||||
else {
|
||||
|
||||
if( ! isset( $emuhash_temp_dir ) )
|
||||
$emuhash_temp_dir = '/tmp';
|
||||
|
||||
/******************************************************************************/
|
||||
/* Define constants used in the mhash emulation code. */
|
||||
/******************************************************************************/
|
||||
|
||||
define('MHASH_MD5', 'md5');
|
||||
define('MHASH_SHA1', 'sha1');
|
||||
define('MHASH_RIPEMD160', 'rmd160');
|
||||
|
||||
/******************************************************************************/
|
||||
/* Functions to emulate parts of php-mash. */
|
||||
/******************************************************************************/
|
||||
|
||||
function openssl_hash( $openssl_hash_id, $password_clear ) {
|
||||
global $emuhash_openssl, $emuhash_temp_dir;
|
||||
|
||||
$current_magic_quotes = get_magic_quotes_runtime();
|
||||
set_magic_quotes_runtime( 0 );
|
||||
$tmpfile = tempnam( $emuhash_temp_dir, "emuhash" );
|
||||
$pwhandle = fopen( $tmpfile, "w" );
|
||||
|
||||
if( ! $pwhandle )
|
||||
pla_error( "Unable to create a temporary file '$tmpfile' to create hashed password" );
|
||||
|
||||
fwrite( $pwhandle, $password_clear );
|
||||
fclose( $pwhandle );
|
||||
$cmd = $emuhash_openssl . ' ' . $openssl_hash_id . ' -binary < ' . $tmpfile;
|
||||
$prog = popen( $cmd, "r" );
|
||||
$pass = fread( $prog, 1024 );
|
||||
pclose( $prog );
|
||||
unlink( $tmpfile );
|
||||
set_magic_quotes_runtime( $current_magic_quotes );
|
||||
|
||||
return $pass;
|
||||
}
|
||||
|
||||
function mhash( $hash_id, $password_clear ) {
|
||||
switch( $hash_id ) {
|
||||
case MHASH_MD5:
|
||||
$emuhash = openssl_hash( MHASH_MD5, $password_clear );
|
||||
break;
|
||||
|
||||
case MHASH_SHA1:
|
||||
$emuhash = openssl_hash( MHASH_SHA1, $password_clear );
|
||||
break;
|
||||
|
||||
case MHASH_RIPEMD160:
|
||||
$emuhash = openssl_hash( MHASH_RIPEMD160, $password_clear );
|
||||
break;
|
||||
|
||||
default:
|
||||
$emuhash = FALSE;
|
||||
}
|
||||
|
||||
return $emuhash;
|
||||
}
|
||||
|
||||
function mhash_keygen_s2k( $hash_id, $password_clear, $salt, $bytes ) {
|
||||
return substr(pack("H*", bin2hex(mhash($hash_id, ($salt . $password_clear)))), 0, $bytes);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -1,6 +1,7 @@
|
||||
function dnChooserPopup( form_element )
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/entry_chooser.js,v 1.3 2005/02/10 12:34:26 wurley Exp $
|
||||
function dnChooserPopup(form_element,rdn)
|
||||
{
|
||||
mywindow=open('entry_chooser.php','myname','resizable=no,width=600,height=370,scrollbars=1');
|
||||
mywindow.location.href = 'entry_chooser.php?form_element=' + form_element;
|
||||
mywindow.location.href = 'entry_chooser.php?form_element=' + form_element + '&rdn=' + rdn;
|
||||
if (mywindow.opener == null) mywindow.opener = self;
|
||||
}
|
||||
|
@@ -1,73 +1,100 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/entry_chooser.php,v 1.23 2005/03/25 16:30:21 wurley Exp $
|
||||
|
||||
require 'common.php';
|
||||
/**
|
||||
* Display a selection (popup window) to pick a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$container = isset( $_GET['container'] ) ? rawurldecode( $_GET['container'] ) : false;
|
||||
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id'] : false;
|
||||
$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";
|
||||
include "./header.php";
|
||||
|
||||
echo "<h3 class=\"subtitle\">Automagic Entry Chooser</h3>\n";
|
||||
echo "<h3 class=\"subtitle\">" . $lang['entry_chooser_title'] . "</h3>\n";
|
||||
flush(); ?>
|
||||
|
||||
if( $container ) {
|
||||
echo $lang['server_colon_pare'] . "<b>" . htmlspecialchars( $servers[ $server_id ][ 'name' ] ) . "</b><br />\n";
|
||||
<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'] );
|
||||
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$dn_list = get_container_contents( $server_id, $container );
|
||||
if( $server_id !== false && $container !== false ) {
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$dn_list = get_container_contents( $ldapserver, $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 );
|
||||
foreach ($ldapserver->getBaseDN() as $base_dn) {
|
||||
debug_log(sprintf('%s: Comparing BaseDN [%s] with container [%s]','entry_chooser.php',$base_dn,$container),9);
|
||||
if( 0 == 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;
|
||||
|
||||
if( $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 );
|
||||
} 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,$server_id,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".
|
||||
$href = sprintf("javascript:returnDN( '%s%s' )",($rdn ? "$rdn," : ''),$dn);
|
||||
echo " <a href=\"entry_chooser.php?form_element=$return_form_element&rdn=$rdn".
|
||||
"&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
|
||||
{
|
||||
} 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 />";
|
||||
|
||||
$ldapserver = new LDAPServer($id);
|
||||
|
||||
if( $ldapserver->isVisible() ) {
|
||||
|
||||
if( ! $ldapserver->haveAuthInfo() )
|
||||
continue;
|
||||
|
||||
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";
|
||||
echo "<b>" . htmlspecialchars( $ldapserver->name ) . "</b><br />\n";
|
||||
foreach ($ldapserver->getBaseDN() as $dn) {
|
||||
if( ! $dn ) {
|
||||
echo "<small> (". $lang['could_not_det_base_dn'] .")</small><br />";
|
||||
} else {
|
||||
$href = sprintf("javascript:returnDN( '%s%s' )",($rdn ? "$rdn," : ''),$dn);
|
||||
echo " <a href=\"entry_chooser.php?form_element=" .
|
||||
"$return_form_element&rdn=$rdn&server_id=$id&container=" .
|
||||
rawurlencode( $dn ) . "\"><img src=\"images/plus.png\" /></a> " .
|
||||
"<a href=\"$href\">" . htmlspecialchars( $dn ) . "</a><br />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,13 +112,4 @@ $elmpart =substr($return_form_element,strpos($return_form_element,".")+1);
|
||||
|
||||
// rebuilt return value
|
||||
$return_form_element = $formpart . ".elements[\"" . $elmpart . "\"]";
|
||||
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
function returnDN( dn )
|
||||
{
|
||||
opener.document.<?php echo $return_form_element; ?>.value = dn;
|
||||
close();
|
||||
}
|
||||
</script>
|
||||
|
46
expand.php
@@ -1,18 +1,28 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/expand.php,v 1.20 2005/03/05 06:27:06 wurley Exp $
|
||||
|
||||
/*
|
||||
* expand.php
|
||||
/**
|
||||
* This script alters the session variable 'tree', expanding it
|
||||
* at the dn specified in the query string.
|
||||
* 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
|
||||
* @package phpLDAPadmin
|
||||
* @see collapse.php
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
// no expire header stuff
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
@@ -21,34 +31,29 @@ 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'] );
|
||||
|
||||
session_start();
|
||||
|
||||
// dave commented this out since it was being triggered without reason in rare cases
|
||||
//session_is_registered( 'tree' ) or pla_error( "Your session tree is not registered. That's weird. Should never happen".
|
||||
// ". Just go back and it should be fixed automagically." );
|
||||
initialize_session_tree();
|
||||
|
||||
$tree = $_SESSION['tree'];
|
||||
$tree_icons = $_SESSION['tree_icons'];
|
||||
|
||||
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$contents = get_container_contents( $server_id, $dn );
|
||||
$contents = get_container_contents( $ldapserver, $dn, 0, '(objectClass=*)', get_tree_deref_setting() );
|
||||
|
||||
usort( $contents, 'pla_compare_dns' );
|
||||
$tree[$server_id][$dn] = $contents;
|
||||
|
||||
//echo "<pre>";
|
||||
//var_dump( $contents );
|
||||
//exit;
|
||||
|
||||
usort( $contents, 'pla_compare_dns' );
|
||||
$tree[$server_id][$dn] = $contents;
|
||||
|
||||
foreach( $contents as $dn )
|
||||
$tree_icons[$server_id][$dn] = get_icon( $server_id, $dn );
|
||||
$tree_icons[$server_id][$dn] = get_icon( $ldapserver, $dn );
|
||||
|
||||
$_SESSION['tree'] = $tree;
|
||||
$_SESSION['tree_icons'] = $tree_icons;
|
||||
@@ -62,9 +67,8 @@ $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();
|
||||
}
|
||||
if( SID != "" )
|
||||
$id_session_param = "&".session_name()."=".session_id();
|
||||
|
||||
session_write_close();
|
||||
|
||||
|
102
export.php
Executable file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export.php,v 1.13 2005/03/05 04:26:25 wurley Exp $
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
require 'export_functions.php';
|
||||
|
||||
// get the POST parameters
|
||||
$server_id = (isset($_POST['server_id']) ? $_POST['server_id'] : '');
|
||||
$ldapserver = new LDAPServer($server_id);
|
||||
|
||||
if( ! $ldapserver->haveAuthInfo())
|
||||
pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$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';
|
||||
|
||||
// add system attributes if needed
|
||||
$attributes = array();
|
||||
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'] );
|
||||
|
||||
// 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();
|
||||
?>
|
164
export_form.php
Executable file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_form.php,v 1.20 2005/02/25 13:44:06 wurley Exp $
|
||||
|
||||
/**
|
||||
* export_form.php
|
||||
* --------------------
|
||||
*
|
||||
* Html form to choose an export format(ldif,...)
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
/**
|
||||
*/
|
||||
|
||||
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';
|
||||
}
|
875
export_functions.php
Executable file
@@ -0,0 +1,875 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_functions.php,v 1.26 2005/03/21 12:43:17 wurley 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.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
class LdapExportInfo extends LDAPServer{
|
||||
|
||||
var $base_dn;
|
||||
var $query_filter;
|
||||
var $scope;
|
||||
|
||||
/**
|
||||
* Create a new LdapExportInfo 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 LdapExportInfo($server_id,$base_dn = NULL,$query_filter = NULL,$scope = NULL){
|
||||
// Call our parent to initialise.
|
||||
parent::LDAPServer($server_id);
|
||||
|
||||
// global $servers;
|
||||
$this->base_dn = $base_dn;
|
||||
$this->query_filter = $query_filter;
|
||||
$this->scope = $scope;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
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
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
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
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
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 $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 LdapExportInfo($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->attributes = $attributes;
|
||||
// connect to the server
|
||||
$this->ds = $this->ldap_info->connect();
|
||||
// @todo test whether we need to call pla_ldap_connection_is_error here.
|
||||
//pla_ldap_connection_is_error( $this->ds );
|
||||
|
||||
// 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,$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
|
||||
* @todo This could break something, so need to add a method to LDAPServer to close connection and reset $connected.
|
||||
*/
|
||||
function pla_close(){
|
||||
// if($this->ldap_info->connected){
|
||||
// return @ldap_close( $this->ds );
|
||||
// }
|
||||
// else{
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
} // end PlaLdapExporter
|
||||
|
||||
/**
|
||||
* Export entries to ldif format
|
||||
* @extends PlaExporter
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
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,$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->name . " (" . $pla_ldap_info->host . ")" . $this->br;
|
||||
echo "# " . $lang['search_scope'] . ": " . $pla_ldap_info->scope . $this->br;
|
||||
echo "# " . $lang['search_filter'] . ": " . $pla_ldap_info->query_filter . $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
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
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->name . " (" . $pla_ldap_info->host . ")" . $this->br;
|
||||
echo "# " . $lang['search_scope'] . ": " . $pla_ldap_info->scope . $this->br;
|
||||
echo "# " . $lang['search_filter'] . ": " . $pla_ldap_info->query_filter . $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,$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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
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->name;
|
||||
$server_host = $ldap_info->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
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
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->name;
|
||||
$server_host = $ldap_info->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( $ldap_info, $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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
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->name;
|
||||
$server_host = $ldap_info->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
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
3632
functions.php
21
generic_utils.js
Normal file
@@ -0,0 +1,21 @@
|
||||
function trim(inputString) {
|
||||
// Removes leading and trailing spaces from the passed string. Also removes
|
||||
// consecutive spaces and replaces it with one space. If something besides
|
||||
// a string is passed in (null, custom object, etc.) then return the input.
|
||||
if (typeof inputString != "string") { return inputString; }
|
||||
var retValue = inputString;
|
||||
var ch = retValue.substring(0, 1);
|
||||
while (ch == " ") { // Check for spaces at the beginning of the string
|
||||
retValue = retValue.substring(1, retValue.length);
|
||||
ch = retValue.substring(0, 1);
|
||||
}
|
||||
ch = retValue.substring(retValue.length-1, retValue.length);
|
||||
while (ch == " ") { // Check for spaces at the end of the string
|
||||
retValue = retValue.substring(0, retValue.length-1);
|
||||
ch = retValue.substring(retValue.length-1, retValue.length);
|
||||
}
|
||||
while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
|
||||
retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings
|
||||
}
|
||||
return retValue; // Return the trimmed string back to the user
|
||||
}
|
41
header.php
@@ -1,11 +1,20 @@
|
||||
<?php
|
||||
// We want to get $language into scope in case we were included
|
||||
// from within a function
|
||||
global $language;
|
||||
@header( "Content-type: text/html; charset=\"UTF-8\"" );
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/header.php,v 1.15 2005/02/25 13:44:06 wurley Exp $
|
||||
|
||||
// XML version and encoding for well-behaved browsers
|
||||
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
|
||||
/**
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
// 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"
|
||||
@@ -13,8 +22,18 @@
|
||||
<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" />
|
||||
<script src="entry_chooser.js"></script>
|
||||
<script src="search_util.js"></script>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<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>
|
||||
|
28
help.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/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>
|
186
hooks.php
Normal file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/hooks.php,v 1.6 2005/04/15 13:16:59 wurley Exp $
|
||||
|
||||
/**
|
||||
* Functions related to hooks management.
|
||||
*
|
||||
* @author Benjamin Drieu <benjamin.drieu@fr.alcove.com> and Alcôve
|
||||
* @package phpLDAPadmin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA
|
||||
*/
|
||||
|
||||
if ( ! isset($hooks) ) {
|
||||
/** This variable contains all hooks that are defined. */
|
||||
$hooks = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two arrays by numerically comparing their 'prority'
|
||||
* value. Standard `cmp-like' function.
|
||||
*
|
||||
* @param a First element to compare.
|
||||
* @param b Second element to compare.
|
||||
*
|
||||
* @return -1 if priority of first element is smaller than second
|
||||
* element priority. 1 otherwise.
|
||||
*/
|
||||
function sort_array_by_priority ( $a, $b ) {
|
||||
return ( ( $a['priority'] < $b['priority'] ) ? -1 : 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs procedures attached to a hook.
|
||||
*
|
||||
* @param hook_name Name of hook to run.
|
||||
* @param args Array of optional arguments set by
|
||||
* phpldapadmin. It is normally in a form known
|
||||
* by call_user_func_array() :
|
||||
* <pre>[ 'server_id' => 0,
|
||||
* 'dn' => 'uid=epoussa,ou=tech,o=corp,o=fr' ]</pre>
|
||||
*
|
||||
* @return true if all procedures returned true, false otherwise.
|
||||
*/
|
||||
function run_hook ( $hook_name, $args ) {
|
||||
global $hooks;
|
||||
|
||||
$debug = 0;
|
||||
syslog_debug ( "Running hook $hook_name." );
|
||||
|
||||
if ( ! array_key_exists ( $hook_name, $hooks ) ) {
|
||||
syslog_notice ( "Hook '$hook_name' not defined !\n" );
|
||||
return true;
|
||||
}
|
||||
|
||||
unset ( $rollbacks );
|
||||
$rollbacks = array ();
|
||||
reset ( $hooks[$hook_name] );
|
||||
|
||||
/** Execution of procedures attached is done using a numeric order
|
||||
* since all procedures have been attached to the hook with a
|
||||
* numerical weight. */
|
||||
while ( list ( $key, $hook ) = each ( $hooks[$hook_name] ) ) {
|
||||
array_push ( $rollbacks, $hook['rollback_function'] );
|
||||
syslog_debug ( "Calling " . $hook['hook_function'] . "\n" );
|
||||
$result = call_user_func_array ( $hook['hook_function'], $args );
|
||||
syslog_notice ( "Called " . $hook['hook_function'] . "\n" );
|
||||
|
||||
/** If a procedure fails, its optional rollback is executed with
|
||||
* the same arguments. After that, all rollbacks from
|
||||
* previously executed procedures are executed in the reverse
|
||||
* order. */
|
||||
if ( $result != true ) {
|
||||
syslog_debug ( "Function " . $hook['hook_function'] . " returned $result\n" );
|
||||
|
||||
while ( $rollbacks ) {
|
||||
$rollback = array_pop ( $rollbacks );
|
||||
|
||||
if ( $rollback != false ) {
|
||||
syslog_debug ( "Executing rollback $rollback\n" );
|
||||
call_user_func_array ( $rollback, $args );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a procedure to a hook for later execution.
|
||||
*
|
||||
* @param hook_name Name of the hook.
|
||||
* @param priority Numeric priority. Lowest means
|
||||
* procedure will be executed before.
|
||||
* @param hook_function Name of the php function called upon
|
||||
* hook trigger.
|
||||
* @param rollback_function Name of the php rollback function
|
||||
* called upon failure.
|
||||
*/
|
||||
function add_hook ( $hook_name, $priority, $hook_function, $rollback_function ) {
|
||||
global $hooks;
|
||||
|
||||
if ( ! array_key_exists ( $hook_name, $hooks ) ) {
|
||||
$hooks[$hook_name] = array();
|
||||
}
|
||||
|
||||
array_push ( $hooks[$hook_name], array ( 'priority' => $priority, 'hook_function' => $hook_function,
|
||||
'rollback_function' => $rollback_function ) );
|
||||
|
||||
uasort ( $hooks[$hook_name], "sort_array_by_priority" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a procedure from a hook, based on a filter.
|
||||
*
|
||||
* @param hook_name Name of the hook.
|
||||
* @param priority Numeric priority. If set, all
|
||||
* procedures of that priority will be
|
||||
* removed.
|
||||
* @param hook_function Name of the procedure function. If
|
||||
* set, all procedures that call this
|
||||
* function will be removed.
|
||||
* @param rollback_function Name of the php rollback function
|
||||
* called upon failure. If set, all
|
||||
* procedures that call this function
|
||||
* as a rollback will be removed.
|
||||
*/
|
||||
function remove_hook ( $hook_name, $priority, $hook_function, $rollback_function ) {
|
||||
global $hooks;
|
||||
|
||||
if ( array_key_exists ( $hook_name, $hooks ) ) {
|
||||
reset ( $hooks[$hook_name] );
|
||||
|
||||
while ( list ( $key, $hook ) = each ( $hooks[$hook_name] ) ) {
|
||||
if ( ( $priority >= 0 && $priority == $hook['priority'] ) ||
|
||||
( $hook_function && $hook_function == $hook['hook_function'] ) ||
|
||||
( $rollback_function && $rollback_function == $hook['rollback_function'] ) ) {
|
||||
unset ( $hooks[$hook_name][$key] );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all procedures from a hook.
|
||||
*
|
||||
* @param hook_name Name of hook to clear.
|
||||
*/
|
||||
function clear_hooks ( $hook_name ) {
|
||||
global $hooks;
|
||||
|
||||
if ( array_key_exists ( $hook_name, $hooks ) ) {
|
||||
unset ( $hooks[$hook_name] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Evaluating user-made hooks */
|
||||
if ( is_dir('hooks') ) {
|
||||
$dir = dir ('hooks');
|
||||
|
||||
while (false !== ($entry = $dir -> read() ) ) {
|
||||
if ( is_file ("hooks/$entry") and eregi ('php[0-9]?$', $entry) ) {
|
||||
require_once "hooks/$entry";
|
||||
}
|
||||
}
|
||||
|
||||
$dir -> close();
|
||||
}
|
||||
|
||||
?>
|
29
ie_png_work_around.js
Normal file
@@ -0,0 +1,29 @@
|
||||
function fixIEPNG( img )
|
||||
{
|
||||
img.style.filter =
|
||||
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
|
||||
+ img.src + "', enabled=true)";
|
||||
img.src="blank.gif";
|
||||
}
|
||||
|
||||
function checkPNGs()
|
||||
{
|
||||
// test to see if the browser is IE
|
||||
var agent = navigator.userAgent.toLowerCase();
|
||||
var is_ie = (( agent.indexOf("msie") != -1 ) &&
|
||||
( agent.indexOf("opera") == -1 ));
|
||||
|
||||
// if IE, use DirectX to correctly display a PNG
|
||||
if ( !is_ie ) return;
|
||||
|
||||
// go through each image in the page and fix them
|
||||
for ( var i = 0; i < document.images.length; i++ )
|
||||
{
|
||||
// only if the image is a png
|
||||
var img = document.images[ i ];
|
||||
if ( img.src.indexOf( "png" ) != -1 )
|
||||
fixIEPNG( img );
|
||||
}
|
||||
}
|
||||
|
||||
checkPNGs();
|
BIN
images/add.png
Normal file
After Width: | Height: | Size: 528 B |
BIN
images/catalog.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 342 B |
BIN
images/compare.png
Normal file
After Width: | Height: | Size: 665 B |
BIN
images/countries/af.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/al.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/am.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/an.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ao.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ar.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/at.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/au.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/aw.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/az.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ba.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bb.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bd.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/be.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bf.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bg.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bh.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bi.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bj.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bm.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bn.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bo.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/br.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bs.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bt.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bw.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/by.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/bz.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ca.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cf.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cg.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ch.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ci.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ck.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cl.png
Normal file
After Width: | Height: | Size: 253 B |
BIN
images/countries/cm.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cn.png
Normal file
After Width: | Height: | Size: 624 B |
BIN
images/countries/co.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cr.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cu.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cv.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cy.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/cz.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/de.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/dk.png
Normal file
After Width: | Height: | Size: 1.0 KiB |