RELEASE 0.9.5
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.
|
||||
|
||||
|
141
add_attr.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr.php,v 1.10 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_attr.php
|
||||
* Adds an attribute/value pair to an object
|
||||
*
|
||||
* Variables that come in as POST vars:
|
||||
* - dn
|
||||
* - server_id
|
||||
* - attr
|
||||
* - val
|
||||
* - binary
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = $_POST['server_id'];
|
||||
$attr = $_POST['attr'];
|
||||
$val = isset( $_POST['val'] ) ? $_POST['val'] : false;;
|
||||
$dn = $_POST['dn'] ;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
|
||||
|
||||
if( ! $is_binary_val && $val == "" ) {
|
||||
pla_error( $lang['left_attr_blank'] );
|
||||
}
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
// special case for binary attributes (like jpegPhoto and userCertificate):
|
||||
// we must go read the data from the file and override $val with the binary data
|
||||
// Secondly, we must check if the ";binary" option has to be appended to the name
|
||||
// of the attribute.
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $dn, $attr, array($val) ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
if( $is_binary_val ) {
|
||||
if( 0 == $_FILES['val']['size'] )
|
||||
pla_error( $lang['file_empty'] );
|
||||
if( ! is_uploaded_file( $_FILES['val']['tmp_name'] ) ) {
|
||||
if( isset( $_FILES['val']['error'] ) )
|
||||
switch($_FILES['val']['error']){
|
||||
case 0: //no error; possible file attack!
|
||||
pla_error( $lang['invalid_file'] );
|
||||
case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini
|
||||
pla_error( $lang['uploaded_file_too_big'] );
|
||||
case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form
|
||||
pla_error( $lang['uploaded_file_too_big'] );
|
||||
case 3: //uploaded file was only partially uploaded
|
||||
pla_error( $lang['uploaded_file_partial'] );
|
||||
case 4: //no file was uploaded
|
||||
pla_error( $lang['left_attr_blank'] );
|
||||
default: //a default error, just in case! :)
|
||||
pla_error( $lang['invalid_file'] );
|
||||
break;
|
||||
}
|
||||
else
|
||||
pla_error( $lang['invalid_file'] );
|
||||
}
|
||||
$file = $_FILES['val']['tmp_name'];
|
||||
$f = fopen( $file, 'r' );
|
||||
$binary_data = fread( $f, filesize( $file ) );
|
||||
fclose( $f );
|
||||
$val = $binary_data;
|
||||
|
||||
if( is_binary_option_required( $server_id, $attr ) )
|
||||
$attr .=";binary";
|
||||
}
|
||||
|
||||
// Automagically hash new userPassword attributes according to the
|
||||
// chosen in config.php.
|
||||
if( 0 == strcasecmp( $attr, 'userpassword' ) )
|
||||
{
|
||||
if( isset( $servers[$server_id]['default_hash'] ) &&
|
||||
$servers[$server_id]['default_hash'] != '' )
|
||||
{
|
||||
$enc_type = $servers[$server_id]['default_hash'];
|
||||
$val = password_hash( $val, $enc_type );
|
||||
}
|
||||
}
|
||||
elseif( ( 0 == strcasecmp( $attr , 'sambantpassword' ) || 0 == strcasecmp( $attr , 'sambalmpassword') ) ){
|
||||
$mkntPassword = new MkntPasswdUtil();
|
||||
$mkntPassword->createSambaPasswords( $val );
|
||||
$val = $mkntPassword->valueOf($attr);
|
||||
}
|
||||
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$new_entry = array( $attr => $val );
|
||||
$result = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
|
||||
if( $result )
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=$encoded_attr" );
|
||||
else
|
||||
pla_error( $lang['failed_to_add_attr'], ldap_error( $ds ) , ldap_errno( $ds ) );
|
||||
|
||||
// check if we need to append the ;binary option to the name
|
||||
// of some binary attribute
|
||||
|
||||
function is_binary_option_required( $server_id, $attr ){
|
||||
|
||||
// list of the binary attributes which need the ";binary" option
|
||||
$binary_attributes_with_options = array(
|
||||
// Superior: Ldapv3 Syntaxes (1.3.6.1.4.1.1466.115.121.1)
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => "userCertificate",
|
||||
'1.3.6.1.4.1.1466.115.121.1.8' => "caCertificate",
|
||||
'1.3.6.1.4.1.1466.115.121.1.10' => "crossCertificatePair",
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => "certificateRevocationList",
|
||||
'1.3.6.1.4.1.1466.115.121.1.9' => "authorityRevocationList",
|
||||
// Superior: Netscape Ldap attributes types (2.16.840.1.113730.3.1)
|
||||
'2.16.840.1.113730.3.1.40' => "userSMIMECertificate"
|
||||
);
|
||||
|
||||
// quick check by attr name (short circuits the schema check if possible)
|
||||
//foreach( $binary_attributes_with_options as $oid => $name )
|
||||
//if( 0 == strcasecmp( $attr, $name ) )
|
||||
//return true;
|
||||
|
||||
$schema_attr = get_schema_attribute( $server_id, $attr );
|
||||
if( ! $schema_attr )
|
||||
return false;
|
||||
|
||||
$syntax = $schema_attr->getSyntaxOID();
|
||||
if( isset( $binary_attributes_with_options[ $syntax ] ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
174
add_attr_form.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr_form.php,v 1.9 2004/09/15 12:31:52 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_attr_form.php
|
||||
* Displays a form for adding an attribute/value to an LDAP entry.
|
||||
*
|
||||
* Variables that come in as GET vars:
|
||||
* - dn (rawurlencoded)
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
$rdn = get_rdn( $dn );
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
$friendly_attrs = process_friendly_attr_table();
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo sprintf( $lang['add_new_attribute'], htmlspecialchars( $rdn ) ); ?></b></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $server_name; ?></b> <?php echo $lang['distinguished_name']; ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
|
||||
|
||||
<?php
|
||||
|
||||
$attrs = get_object_attrs( $server_id, $dn );
|
||||
$oclasses = get_object_attr( $server_id, $dn, 'objectClass' );
|
||||
if( ! is_array( $oclasses ) )
|
||||
$oclasses = array( $oclasses );
|
||||
$avail_attrs = array();
|
||||
$schema_oclasses = get_schema_objectclasses( $server_id, $dn );
|
||||
foreach( $oclasses as $oclass ) {
|
||||
$schema_oclass = get_schema_objectclass( $server_id, $oclass, $dn );
|
||||
if( $schema_oclass && 0 == strcasecmp( 'objectclass', get_class( $schema_oclass ) ) )
|
||||
$avail_attrs = array_merge( $schema_oclass->getMustAttrNames( $schema_oclasses ),
|
||||
$schema_oclass->getMayAttrNames( $schema_oclasses ),
|
||||
$avail_attrs );
|
||||
}
|
||||
|
||||
$avail_attrs = array_unique( $avail_attrs );
|
||||
$avail_attrs = array_filter( $avail_attrs, "not_an_attr" );
|
||||
sort( $avail_attrs );
|
||||
|
||||
$avail_binary_attrs = array();
|
||||
foreach( $avail_attrs as $i => $attr ) {
|
||||
if( is_attr_binary( $server_id, $attr ) ) {
|
||||
$avail_binary_attrs[] = $attr;
|
||||
unset( $avail_attrs[ $i ] );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<br />
|
||||
<center>
|
||||
|
||||
|
||||
<?php echo $lang['add_new_attribute']; ?>
|
||||
|
||||
<?php if( is_array( $avail_attrs ) && count( $avail_attrs ) > 0 ) { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<form action="add_attr.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
|
||||
|
||||
<select name="attr"><?php
|
||||
|
||||
$attr_select_html = '';
|
||||
usort($avail_attrs,"sortAttrs");
|
||||
foreach( $avail_attrs as $a ) {
|
||||
// is there a user-friendly translation available for this attribute?
|
||||
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
|
||||
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
|
||||
htmlspecialchars($a) . ")";
|
||||
} else {
|
||||
$attr_display = htmlspecialchars( $a );
|
||||
}
|
||||
echo $attr_display;
|
||||
$attr_select_html .= "<option>$attr_display</option>\n";
|
||||
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
|
||||
} ?>
|
||||
</select>
|
||||
<input type="text" name="val" size="20" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['add']; ?>" class="update_dn" />
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<small>(<?php echo $lang['no_new_attrs_available']; ?>)</small>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php echo $lang['add_new_binary_attr']; ?>
|
||||
<?php if( count( $avail_binary_attrs ) > 0 ) { ?>
|
||||
<!-- Form to add a new BINARY attribute to this entry -->
|
||||
<form action="add_attr.php" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
||||
<input type="hidden" name="binary" value="true" />
|
||||
<br />
|
||||
<select name="attr">
|
||||
<?php
|
||||
$attr_select_html = '';
|
||||
usort($avail_binary_attrs,"sortAttrs");
|
||||
foreach( $avail_binary_attrs as $a ) {
|
||||
// is there a user-friendly translation available for this attribute?
|
||||
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
|
||||
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
|
||||
htmlspecialchars($a) . ")";
|
||||
} else {
|
||||
$attr_display = htmlspecialchars( $a );
|
||||
}
|
||||
|
||||
echo $attr_display;
|
||||
$attr_select_html .= "<option>$attr_display</option>\n";
|
||||
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
|
||||
} ?>
|
||||
</select>
|
||||
<input type="file" name="val" size="20" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['add']; ?>" class="update_dn" />
|
||||
<?php
|
||||
if( ! ini_get( 'file_uploads' ) )
|
||||
echo "<br><small><b>" . $lang['warning_file_uploads_disabled'] . "</b></small><br>";
|
||||
else
|
||||
echo "<br><small><b>" . sprintf( $lang['max_file_size'], ini_get( 'upload_max_filesize' ) ) . "</b></small><br>";
|
||||
?>
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<small>(<?php echo $lang['no_new_binary_attrs_available']; ?>)</small>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Given an attribute $x, this returns true if it is NOT already specified
|
||||
* in the current entry, returns false otherwise.
|
||||
*/
|
||||
function not_an_attr( $x )
|
||||
{
|
||||
global $attrs;
|
||||
//return ! isset( $attrs[ strtolower( $x ) ] );
|
||||
foreach( $attrs as $attr => $values )
|
||||
if( 0 == strcasecmp( $attr, $x ) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass.php,v 1.11 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
/*
|
||||
* add_oclass.php
|
||||
* Adds an objectClass to the specified dn.
|
||||
@ -14,7 +16,7 @@
|
||||
* - new_attrs (array, if any)
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@ -22,6 +24,8 @@ $new_oclass = $_POST['new_oclass'];
|
||||
$server_id = $_POST['server_id'];
|
||||
$new_attrs = $_POST['new_attrs'];
|
||||
|
||||
if( is_attr_read_only( $server_id, 'objectClass' ) )
|
||||
pla_error( "ObjectClasses are flagged as read only in the phpLDAPadmin configuration." );
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
@ -35,14 +39,23 @@ $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 )
|
||||
foreach( $new_attrs as $attr => $val ) {
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $dn, $attr, array($val) ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
$new_entry[ $attr ] = $val;
|
||||
}
|
||||
|
||||
//echo "<pre>";
|
||||
//print_r( $new_entry );
|
||||
//exit;
|
||||
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$add_res = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
|
||||
if( ! $add_res )
|
||||
@ -51,7 +64,7 @@ if( ! $add_res )
|
||||
}
|
||||
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,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass_form.php,v 1.15 2004/10/22 13:58:59 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_oclass_form.php
|
||||
@ -15,7 +17,7 @@
|
||||
* - new_oclass
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@ -45,19 +47,31 @@ 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 ) )
|
||||
foreach( $must_attrs as $attr ) {
|
||||
$attr = get_schema_attribute( $server_id, $attr->getName() );
|
||||
//echo "<pre>"; var_dump( $attr ); echo "</pre>";
|
||||
// First, check if one of this attr's aliases is already an attribute of this entry
|
||||
foreach( $attr->getAliases() as $alias_attr_name )
|
||||
if( in_array( strtolower( $alias_attr_name ), $current_attrs ) )
|
||||
// Skip this attribute since it's already in the entry
|
||||
continue;
|
||||
if( in_array( strtolower($attr->getName()), $current_attrs ) )
|
||||
continue;
|
||||
|
||||
// We made it this far, so the attribute needs to be added to this entry in order
|
||||
// to add this objectClass
|
||||
$needed_attrs[] = $attr;
|
||||
}
|
||||
|
||||
if( count( $needed_attrs ) > 0 )
|
||||
{
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo $lang['new_required_attrs']; ?></h3>
|
||||
@ -83,14 +97,8 @@ if( count( $needed_attrs ) > 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>
|
||||
<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>
|
||||
@ -106,12 +114,13 @@ if( count( $needed_attrs ) > 0 )
|
||||
}
|
||||
else
|
||||
{
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( "Could not connect to LDAP server." );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$add_res = @ldap_mod_add( $ds, $dn, array( 'objectClass' => $new_oclass ) );
|
||||
if( ! $add_res )
|
||||
pla_error( "Could not perform ldap_mod_add operation.", ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
else
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn" );
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=objectClass" );
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value.php,v 1.13 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_value.php
|
||||
@ -14,7 +16,7 @@
|
||||
* On failure, echo an error.
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@ -22,16 +24,18 @@ $attr = $_POST['attr'];
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
$server_id = $_POST['server_id'];
|
||||
$new_value = $_POST['new_value'];
|
||||
$new_value = utf8_encode($new_value);
|
||||
$is_binary_val = isset( $_POST['binary'] ) ? true : false;
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
if( is_attr_read_only( $server_id, $attr ) )
|
||||
pla_error( "The attribute '" . htmlspecialchars( $attr ) . "' is flagged as read only in the phpLDAPadmin configuration." );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
// special case for binary attributes:
|
||||
// we must go read the data from the file.
|
||||
@ -46,10 +50,21 @@ if( $is_binary_val )
|
||||
|
||||
$new_entry = array( $attr => $new_value );
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $dn, $attr, $new_entry ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$dn,$search_href ) );
|
||||
}
|
||||
|
||||
// Call the custom callback for each attribute modification
|
||||
// and verify that it should be modified.
|
||||
if( preAttrAdd( $server_id, $dn, $attr, $new_entry ) ) {
|
||||
|
||||
$add_result = @ldap_mod_add( $ds, $dn, $new_entry );
|
||||
|
||||
if( ! $add_result )
|
||||
pla_error( $lang['could_not_perform_ldap_mod_add'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
|
||||
header( "Location: edit.php?server_id=$server_id&dn=$encoded_dn&modified_attrs[]=$encoded_attr" );
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value_form.php,v 1.26 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* add_value_form.php
|
||||
@ -11,26 +13,29 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$server_id = $_GET['server_id'];
|
||||
$rdn = pla_explode_dn( $dn );
|
||||
$rdn = $rdn[0];
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
if( null != $dn ) {
|
||||
$rdn = get_rdn( $dn );
|
||||
} else {
|
||||
$rdn = null;
|
||||
}
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
$attr = $_GET['attr'];
|
||||
$encoded_attr = rawurlencode( $attr );
|
||||
$current_values = get_object_attr( $server_id, $dn, $attr );
|
||||
$num_current_values = ( is_array($current_values) ? count($current_values) : 1 );
|
||||
$is_object_class = ( 0 == strcasecmp( $attr, 'objectClass' ) ) ? true : false;
|
||||
$is_jpeg_photo = ( 0 == strcasecmp( $attr, 'jpegPhoto' ) ) ? true : false;
|
||||
$is_jpeg_photo = is_jpeg_photo( $server_id, $attr ); //( 0 == strcasecmp( $attr, 'jpegPhoto' ) ) ? true : false;
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
if( $is_object_class ) {
|
||||
// fetch all available objectClasses and remove those from the list that are already defined in the entry
|
||||
@ -41,7 +46,7 @@ if( $is_object_class ) {
|
||||
$schema_attr = get_schema_attribute( $server_id, $attr );
|
||||
}
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
@ -49,7 +54,7 @@ include 'header.php'; ?>
|
||||
<?php echo $lang['add_new']; ?>
|
||||
<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>
|
||||
@ -61,7 +66,7 @@ include 'header.php'; ?>
|
||||
<?php if( $is_jpeg_photo ) { ?>
|
||||
|
||||
<table><td>
|
||||
<?php draw_jpeg_photos( $server_id, $dn ); ?>
|
||||
<?php draw_jpeg_photos( $server_id, $dn, $attr, false ); ?>
|
||||
</td></table>
|
||||
|
||||
<!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
|
||||
@ -115,25 +120,29 @@ 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 } else { ?>
|
||||
|
||||
<form action="add_value.php" method="post" class="new_value" <?php
|
||||
<form action="add_value.php" method="post" class="new_value" name="new_value_form"<?php
|
||||
if( is_attr_binary( $server_id, $attr ) ) echo "enctype=\"multipart/form-data\""; ?>>
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="dn" value="<?php echo $encoded_dn; ?>" />
|
||||
@ -142,18 +151,24 @@ include 'header.php'; ?>
|
||||
<?php if( is_attr_binary( $server_id, $attr ) ) { ?>
|
||||
<input type="file" name="new_value" />
|
||||
<input type="hidden" name="binary" value="true" />
|
||||
<?php } else { ?>
|
||||
<?php if( is_multi_line_attr( $attr, $server_id ) ) { ?>
|
||||
<textarea name="new_value" rows="3" cols="30"></textarea>
|
||||
<?php } else { ?>
|
||||
<input type="text" <?php
|
||||
if( $schema_attr->getMaxLength() )
|
||||
echo "maxlength=\"" . $schema_attr->getMaxLength() . "\" ";
|
||||
?>name="new_value" size="40" value="" />
|
||||
?>name="new_value" size="40" value="" /><?php
|
||||
// draw the "browse" button next to this input box if this attr houses DNs:
|
||||
if( is_dn_attr( $server_id, $attr ) ) draw_chooser_link( "new_value_form.new_value", false ); ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<input type="submit" name="submit" value="Add New Value" />
|
||||
<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 +176,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>
|
||||
|
471
blowfish.php
Normal file
@ -0,0 +1,471 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.1 $
|
||||
* @since Horde 2.2
|
||||
* @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,75 @@
|
||||
|
||||
<?php
|
||||
// phpldapadmin/check_lang_files.php, $Revision: 1.4 $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/check_lang_files.php,v 1.9 2004/05/23 21:53:08 i18phpldapadmin Exp $
|
||||
?>
|
||||
<?php
|
||||
// phpldapadmin/check_lang_files.php, $Revision: 1.9 $
|
||||
|
||||
echo "<html><head><title>phpldapadmin - check of translation</title></head><body>";
|
||||
echo "<h1>Incomplete or Erroneous Language Files</h1>\n\n";
|
||||
|
||||
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";
|
||||
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>";
|
||||
echo "<h2><A HREF='?CHECKLANG=$file'>$file</A></h2>\n";
|
||||
echo "<ol>\n";
|
||||
unset( $lang );
|
||||
$lang = array();
|
||||
include realpath( $lang_dir.'/'.$file );
|
||||
$has_errors = false;
|
||||
if ($CHECKLANG=="" || $file===$CHECKLANG ){
|
||||
foreach( $english_lang as $key => $string )
|
||||
if( ! isset( $lang[ $key ] ) ) {
|
||||
$has_errors = true;
|
||||
echo "<li>missing entry: <tt>$key</tt></li>";
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
19
collapse.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/collapse.php,v 1.11 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* collapse.php
|
||||
@ -12,7 +14,7 @@
|
||||
* Note: this script is equal and opposite to expand.php
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@ -20,19 +22,10 @@ $server_id = $_GET['server_id'];
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
|
||||
session_start();
|
||||
initialize_session_tree();
|
||||
|
||||
// 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
|
||||
|
117
common.php
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/common.php,v 1.55 2004/10/14 20:32:48 uugdave Exp $
|
||||
|
||||
/*
|
||||
* common.php
|
||||
@ -6,41 +7,46 @@
|
||||
* include this file at the top of every PHP file.
|
||||
*/
|
||||
|
||||
// Work-around to get PLA to work in PHP5
|
||||
if( phpversion() >= "5" )
|
||||
ini_set( "zend.ze1_compatibility_mode", 1 );
|
||||
|
||||
// Turn on all notices and warnings. This helps us write cleaner code (we hope at least)
|
||||
if( phpversion() >= "5" )
|
||||
// E_DEBUG is PHP5 specific and prevents warnings about using 'var' to declar class members
|
||||
error_reporting( 'E_DEBUG' );
|
||||
else
|
||||
// For PHP4
|
||||
error_reporting( E_ALL );
|
||||
|
||||
// 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' );
|
||||
if( ! file_exists( realpath( './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' );
|
||||
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 +57,41 @@ 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 managing the session (pla_session_start(), etc.)
|
||||
'./session_functions.php',
|
||||
// Functions for reading the server schema (get_schema_object_classes(), etc.)
|
||||
'./schema_functions.php',
|
||||
// Functions that can be defined by the user (preEntryDelete(), postEntryDelete(), etc.)
|
||||
'./custom_functions.php',
|
||||
// Functions for hashing passwords with OpenSSL binary (only if mhash not present)
|
||||
'./emuhash_functions.php' );
|
||||
|
||||
|
||||
// Include each required file and check for sanity.
|
||||
foreach( $required_files as $file_name ) {
|
||||
file_exists( realpath( $file_name ) )
|
||||
or pla_error( "Fatal error: Required file '$file_name' does not exist." );
|
||||
is_readable( realpath( $file_name ) )
|
||||
or pla_error( "Fatal error: Cannot read the file '$file_name', its permissions are too strict." );
|
||||
ob_start();
|
||||
require_once realpath( $file_name );
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
if( pla_session_start() )
|
||||
postSessionInit();
|
||||
|
||||
// Language configuration. Auto or specified?
|
||||
// Shall we attempt to auto-determine the language?
|
||||
@ -83,7 +114,9 @@ if( isset( $language ) ) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@ -95,10 +128,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" );
|
||||
ob_end_clean();
|
||||
} 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." );
|
||||
does not exist, or its permissions do not allow phpLDAPadmin to read it." );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -117,20 +152,10 @@ $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($_GET);
|
||||
array_stripslashes($_POST);
|
||||
array_stripslashes($_COOKIE);
|
||||
array_stripslashes($_FILES);
|
||||
$slashes_stripped = true;
|
||||
}
|
||||
|
||||
|
@ -11,43 +11,92 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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*/
|
||||
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. */
|
||||
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! */
|
||||
(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,
|
||||
$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',
|
||||
then login as 'dsmith', phpLDAPadmin will
|
||||
search for uid=dsmith and log in as such. Leave
|
||||
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 .*/
|
||||
logging in. Note also that if your LDAP server requires
|
||||
you to login to perform searches, you can enter
|
||||
the DN to use when searching in 'login_dn' and
|
||||
'login_pass' above. You may also specify 'string', in which case
|
||||
you can provide a string to use for logging users
|
||||
in. See 'login_string' directly below. */
|
||||
$servers[$i]['login_string'] = 'uid=<username>,ou=People,dc=example,dc=com';
|
||||
/* If you specified 'cookie' or 'session' as the auth_type above,
|
||||
and you specified 'string' for 'login_attr' above, you must provide
|
||||
a string here for logging users in. If, for example, I
|
||||
I have a lot of user entries with DNs like
|
||||
"uid=dsmith,ou=People,dc=example,dc=com", then I can specify a string
|
||||
"uid=<username>,ou=People,dc=example,dc=com" and my users can login with
|
||||
their user names alone, i.e., "dsmith" in this case. */
|
||||
$servers[$i]['login_class'] = ''; /* If 'login_attr' is used above such that phpLDAPadmin will
|
||||
search for your DN at login, you may restrict the search to
|
||||
a specific objectClass. E.g., set this to 'posixAccount' or
|
||||
'inetOrgPerson', depending upon your setup. */
|
||||
$servers[$i]['read_only'] = false; /* Specify true If you want phpLDAPadmin to not
|
||||
display or permit any modification to the
|
||||
LDAP server. */
|
||||
$servers[$i]['show_create'] = true; /* Specify false if you do not want phpLDAPadmin to
|
||||
draw the 'Create new' links in the tree viewer. */
|
||||
$servers[$i]['enable_auto_uid_numbers'] = false;
|
||||
/* This feature allows phpLDAPadmin to
|
||||
automatically determine the next
|
||||
@ -69,7 +118,27 @@ $servers[$i]['auto_uid_number_min'] = 1000;
|
||||
$servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com';
|
||||
/* The DN of the uidPool entry when 'uidpool'
|
||||
mechanism is used above. */
|
||||
$servers[$i]['auto_uid_number_search_dn'] = '';
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user
|
||||
ID when searching for the uidnumber. The idea is, this user id would
|
||||
have full (readonly) access to uidnumber in your ldap directory (the
|
||||
logged in user may not), so that you can be guaranteed to get a unique
|
||||
uidnumber for your directory. */
|
||||
$servers[$i]['auto_uid_number_search_dn_pass'] = '';
|
||||
/* The password for the dn above. */
|
||||
$servers[$i]['disable_anon_bind'] = false;
|
||||
/* Disable the anonymous login. */
|
||||
$servers[$i]['custom_pages_prefix'] = 'custom_';
|
||||
/* Use customized page with prefix when available. */
|
||||
|
||||
$servers[$i]['unique_attrs_dn'] = '';
|
||||
/* If you set this, then phpldapadmin will bind to LDAP with this user
|
||||
when testing for unique attributes (as set in unique_attrs array). If you
|
||||
want to enforce unique attributes, than this id should have full (readonly)
|
||||
access to the attributes in question (the logged in user may not have
|
||||
enough access) */
|
||||
$servers[$i]['unique_attrs_dn_pass'] = '';
|
||||
/* The password for the dn above */
|
||||
|
||||
// If you want to configure additional LDAP servers, do so below.
|
||||
$i++;
|
||||
@ -81,9 +150,12 @@ $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';
|
||||
@ -101,6 +173,60 @@ $jpeg_temp_dir = "/tmp"; // Example for Unix systems
|
||||
/** Appearance and Behavior **/
|
||||
/** **/
|
||||
|
||||
// Set this to true if you want to hide the Request New Feature and Report bugs.
|
||||
$hide_configuration_management = false;
|
||||
|
||||
|
||||
// A format string used to display enties in the tree viewer (left-hand side)
|
||||
// You can use special tokens to draw the entries as you wish. You can even mix in HTML to format the string
|
||||
// Here are all the tokens you can use:
|
||||
// %rdn - draw the RDN of the entry (ie, "cn=Dave")
|
||||
// %dn - draw the DN of the entry (ie, "cn=Dave,ou=People,dc=example,dc=com"
|
||||
// %rdnValue - draw the value of the RDN (ie, instead of "cn=Dave", just draw "Dave")
|
||||
// %[attrname]- draw the value (or values) of the specified attribute.
|
||||
// examle: %gidNumber
|
||||
$tree_display_format = '%rdn';
|
||||
//
|
||||
// Examples:
|
||||
//
|
||||
// To draw the gidNumber and uidNumber to the right of the RDN in a small, gray font:
|
||||
//$tree_display_format = '%rdn <small style="color:gray">( %gidNumber / %uidNumber )</span>';
|
||||
// To draw the full DN of each entry:
|
||||
//$tree_display_format = '%dn';
|
||||
// To draw the objectClasses to the right in parenthesis:
|
||||
//$tree_display_format = '%rdn <small style="color: gray">( %objectClass )</small>';
|
||||
// To draw the user-friendly RDN value (ie, instead of "cn=Dave", just draw "Dave"):
|
||||
//$tree_display_format = '%rdnValue';
|
||||
|
||||
|
||||
// Aliases and Referrrals
|
||||
//
|
||||
// Similar to ldapsearh's -a option, the following options allow you to configure
|
||||
// how phpLDAPadmin will treat aliases and referrals in the LDAP tree.
|
||||
// For the following four settings, avaialable options include:
|
||||
//
|
||||
// LDAP_DEREF_NEVER - aliases are never dereferenced (eg, the contents of
|
||||
// the alias itself are shown and not the referenced entry).
|
||||
// LDAP_DEREF_SEARCHING - aliases should be dereferenced during the search but
|
||||
// not when locating the base object of the search.
|
||||
// LDAP_DEREF_FINDING - aliases should be dereferenced when locating the base
|
||||
// object but not during the search.
|
||||
// LDAP_DEREF_ALWAYS - aliases should be dereferenced always (eg, the contents
|
||||
// of the referenced entry is shown and not the aliasing entry)
|
||||
|
||||
// How to handle references and aliases in the search form. See above for options.
|
||||
$search_deref = LDAP_DEREF_ALWAYS;
|
||||
|
||||
// How to handle references and aliases in the tree viewer. See above for options.
|
||||
$tree_deref = LDAP_DEREF_NEVER;
|
||||
|
||||
// How to handle references and aliases for exports. See above for options.
|
||||
$export_deref = LDAP_DEREF_NEVER;
|
||||
|
||||
// How to handle references and aliases when viewing entries. See above for options.
|
||||
$view_deref = LDAP_DEREF_NEVER;
|
||||
|
||||
|
||||
// The language setting. If you set this to 'auto', phpLDAPadmin will
|
||||
// attempt to determine your language automatically. Otherwise, available
|
||||
// lanaguages are: 'ct', 'de', 'en', 'es', 'fr', 'it', 'nl', and 'ru'
|
||||
@ -116,6 +242,11 @@ $enable_mass_delete = false;
|
||||
// when a user logs in to a server anonymously
|
||||
$anonymous_bind_implies_read_only = true;
|
||||
|
||||
// Set to true if you want phpLDAPadmin to redirect anonymous
|
||||
// users to a search form with no tree viewer on the left after
|
||||
// logging in.
|
||||
$anonymous_bind_redirect_no_tree = false;
|
||||
|
||||
// If you used auth_type 'form' in the servers list, you can adjust how long the cookie will last
|
||||
// (default is 0 seconds, which expires when you close the browser)
|
||||
$cookie_time = 0; // seconds
|
||||
@ -132,21 +263,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 **/
|
||||
@ -168,7 +324,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';
|
||||
|
||||
|
||||
?>
|
||||
|
36
copy.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy.php,v 1.25 2004/08/15 17:35:25 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* copy.php
|
||||
@ -12,8 +14,6 @@
|
||||
|
||||
require realpath( 'common.php' );
|
||||
|
||||
session_start();
|
||||
|
||||
$source_dn = $_POST['old_dn'];
|
||||
$dest_dn = $_POST['new_dn'];
|
||||
$encoded_dn = rawurlencode( $source_dn );
|
||||
@ -29,19 +29,20 @@ 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( $dest_server_id, $dest_dn ) )
|
||||
pla_error( sprintf( $lang['copy_dest_already_exists'], pretty_print_dn( $dest_dn ) ) );
|
||||
if( ! dn_exists( $dest_server_id, get_container( $dest_dn ) ) )
|
||||
pla_error( sprintf( $lang['copy_dest_container_does_not_exist'], pretty_print_dn( get_container($dest_dn) ) ) );
|
||||
|
||||
if( $do_recursive ) {
|
||||
$filter = isset( $_POST['filter'] ) ? $_POST['filter'] : '(objectClass=*)';
|
||||
// build a tree similar to that of the tree browser to give to r_copy_dn
|
||||
$snapshot_tree = array();
|
||||
echo "<body>\n";
|
||||
@ -51,7 +52,7 @@ if( $do_recursive ) {
|
||||
echo "<small>\n";
|
||||
echo $lang['copy_building_snapshot'];
|
||||
flush();
|
||||
build_tree( $source_server_id, $source_dn, $snapshot_tree );
|
||||
build_tree( $source_server_id, $source_dn, $snapshot_tree, $filter );
|
||||
echo " <span style=\"color:green\">" . $lang['success'] . "</span><br />\n";
|
||||
flush();
|
||||
|
||||
@ -69,8 +70,11 @@ 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] ) )
|
||||
@ -92,7 +96,7 @@ if( $copy_result )
|
||||
</script>
|
||||
<br />
|
||||
<center>
|
||||
<?php echo $lang['copy_successful_like_to']. "<a href=\"$edit_url\">" . $lang['copy_view_new_entry'] ."</a>?"?>
|
||||
<?php echo $lang['copy_successful_like_to']. "<a href=\"$edit_url\">" . $lang['copy_view_new_entry'] ."</a>"?>
|
||||
</center>
|
||||
<br />
|
||||
<br />
|
||||
@ -141,7 +145,10 @@ function r_copy_dn( $source_server_id, $dest_server_id, $tree, $root_dn, $dest_d
|
||||
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'] );
|
||||
|
||||
$ds = pla_ldap_connect( $dest_server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
$attrs = get_object_attrs( $source_server_id, $source_dn );
|
||||
$new_entry = $attrs;
|
||||
// modify the prefix-value (ie "bob" in cn=bob) to match the destination DN's value.
|
||||
@ -167,14 +174,13 @@ function copy_dn( $source_server_id, $source_dn, $dest_server_id, $dest_dn )
|
||||
}
|
||||
}
|
||||
|
||||
function build_tree( $source_server_id, $root_dn, &$tree )
|
||||
function build_tree( $source_server_id, $root_dn, &$tree, $filter='(objectClass=*)' )
|
||||
{
|
||||
$children = get_container_contents( $source_server_id, $root_dn );
|
||||
$children = get_container_contents( $source_server_id, $root_dn, 0, $filter );
|
||||
if( is_array( $children ) && count( $children ) > 0 )
|
||||
{
|
||||
$tree[ $root_dn ] = $children;
|
||||
foreach( $children as $child_dn )
|
||||
build_tree( $source_server_id, $child_dn, $tree );
|
||||
build_tree( $source_server_id, $child_dn, $tree, $filter );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy_form.php,v 1.19 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* copy_form.php
|
||||
@ -8,16 +10,13 @@
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$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'] );
|
||||
@ -26,22 +25,43 @@ $attrs = get_object_attrs( $server_id, $dn );
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
$select_server_html = "";
|
||||
if (count($servers)>1){
|
||||
$select_server_html .= '<select name="dest_server_id">';
|
||||
foreach( $servers as $id => $server )
|
||||
{
|
||||
if( $server['host'] )
|
||||
{
|
||||
$select_server_html .= "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . $server['name'] . "</option>\n";
|
||||
}
|
||||
$select_server_html .= "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . htmlspecialchars($server['name']) . "</option>\n";
|
||||
$select_server_html .= '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
$select_server_html .= '<input type="hidden" name="dest_server_id" value="'.key($servers).'">' .
|
||||
'<b>' . $server['name'] . '</b>';
|
||||
}
|
||||
|
||||
$children = get_container_contents( $server_id, $dn );
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php';
|
||||
|
||||
// Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if( is_array( $children ) && count( $children ) > 0 ) { ?>
|
||||
<script language="javascript">
|
||||
//<!--
|
||||
function toggle_disable_filter_field( recursive_checkbox )
|
||||
{
|
||||
if( recursive_checkbox.checked ) {
|
||||
recursive_checkbox.form.filter.disabled = false;
|
||||
} else {
|
||||
recursive_checkbox.form.filter.disabled = true;
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title"><?php echo $lang['copyf_title_copy'] . $rdn; ?></h3>
|
||||
<h3 class="subtitle">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 $server_name; ?></b> <?php echo $lang['distinguished_name']?>: <b><?php echo $dn; ?></b></h3>
|
||||
|
||||
<center>
|
||||
<?php echo $lang['copyf_title_copy'] ?><b><?php echo htmlspecialchars( $rdn ); ?></b> <?php echo $lang['copyf_to_new_object']?>:<br />
|
||||
@ -50,7 +70,7 @@ include 'header.php'; ?>
|
||||
<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>
|
||||
@ -61,27 +81,39 @@ include 'header.php'; ?>
|
||||
|
||||
<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>
|
||||
<?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>
|
||||
|
53
create.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create.php,v 1.29 2004/10/28 13:37:39 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* create.php
|
||||
@ -14,15 +16,16 @@
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
require realpath( './common.php' );
|
||||
|
||||
$new_dn = isset( $_POST['new_dn'] ) ? $_POST['new_dn'] : null;
|
||||
$encoded_dn = rawurlencode( $new_dn );
|
||||
$server_id = $_POST['server_id'];
|
||||
$vals = $_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;
|
||||
$container = get_container( $new_dn );
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
@ -37,15 +40,14 @@ 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( isset( $attrs ) && is_array( $attrs ) ) {
|
||||
foreach( $attrs as $i => $attr ) {
|
||||
if( is_attr_binary( $server_id, $attr ) ) {
|
||||
if( $_FILES['vals']['name'][$i] != '' ) {
|
||||
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' );
|
||||
@ -55,8 +57,9 @@ if( isset( $vals ) && is_array( $vals ) ) {
|
||||
$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,18 +68,26 @@ $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 )
|
||||
foreach( $new_entry as $attr => $vals ) {
|
||||
|
||||
// Check to see if this is a unique Attribute
|
||||
if( $badattr = checkUniqueAttr( $server_id, $new_dn, $attr, $vals ) ) {
|
||||
$search_href='search.php?search=true&form=advanced&server_id=' . $server_id . '&filter=' . $attr . '=' . $badattr;
|
||||
pla_error(sprintf( $lang['unique_attr_failed'] , $attr,$badattr,$new_dn,$search_href ) );
|
||||
}
|
||||
|
||||
if( ! is_attr_binary( $server_id, $attr ) )
|
||||
if( is_array( $vals ) )
|
||||
foreach( $vals as $i => $v )
|
||||
$new_entry[ $attr ][ $i ] = utf8_decode( $v );
|
||||
$new_entry[ $attr ][ $i ] = $v;
|
||||
else
|
||||
$new_entry[ $attr ] = utf8_decode( $vals );
|
||||
$new_entry[ $attr ] = $vals;
|
||||
}
|
||||
|
||||
//echo "<pre>"; var_dump( $new_dn );print_r( $new_entry ); echo "</pre>";
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
// Check the user-defined custom call back first
|
||||
if( true === preEntryCreate( $server_id, $new_dn, $new_entry ) )
|
||||
@ -86,11 +97,12 @@ else
|
||||
if( $add_result )
|
||||
{
|
||||
postEntryCreate( $server_id, $new_dn, $new_entry );
|
||||
$edit_url="edit.php?server_id=$server_id&dn=" . rawurlencode( $new_dn );
|
||||
if( $redirect )
|
||||
$redirect_url = $redirect;
|
||||
else
|
||||
$redirect_url = "edit.php?server_id=$server_id&dn=" . rawurlencode( $new_dn );
|
||||
|
||||
// update the session tree to reflect the change
|
||||
session_start();
|
||||
if( session_is_registered( 'tree' ) )
|
||||
if( array_key_exists( 'tree', $_SESSION ) )
|
||||
{
|
||||
$tree = $_SESSION['tree'];
|
||||
$tree_icons = $_SESSION['tree_icons'];
|
||||
@ -109,20 +121,21 @@ if( $add_result )
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<?php if( isset( $tree[$server_id][$container] ) ) { ?>
|
||||
<?php if( isset( $tree[$server_id][$container] ) || $new_dn == $servers[$server_id]['base'] ) { ?>
|
||||
|
||||
<!-- refresh the tree view (with the new DN renamed)
|
||||
and redirect to the edit_dn page -->
|
||||
<script language="javascript">
|
||||
parent.left_frame.location.reload();
|
||||
location.href='<?php echo $redirect_url; ?>';
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<meta http-equiv="refresh" content="0; url=<?php echo $edit_url; ?>" />
|
||||
<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
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create_form.php,v 1.21 2004/10/28 13:37:39 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* create_form.php
|
||||
@ -10,7 +12,7 @@
|
||||
* - container (rawurlencoded) (optional)
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = $_REQUEST['server_id'];
|
||||
@ -25,17 +27,25 @@ 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">';
|
||||
$server_menu_html = '';
|
||||
if (count($servers)>1){
|
||||
$server_menu_html .= '<select name="server_id">';
|
||||
$js_dn_list = '';
|
||||
foreach( $servers as $id => $server ) {
|
||||
if( $server['host'] ) {
|
||||
$server_menu_html .= '<option value="'.$id.'"' . ( $id==$server_id? ' selected' : '' ) . '>';
|
||||
$server_menu_html .= '<option value="'.$id.'"' . ( $id==$server_id? ' selected="true"' : '' ) . '>';
|
||||
$server_menu_html .= $server['name'] . '</option>';
|
||||
}
|
||||
}
|
||||
$server_menu_html .= '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
$server_menu_html .= '<input type="hidden" name="server_id" value="'.key($servers).'" />' .
|
||||
'<b>' . $server['name'] . '</b>';
|
||||
}
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
@ -46,16 +56,27 @@ include 'header.php'; ?>
|
||||
<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;
|
||||
foreach( $templates as $name => $template ) {
|
||||
$i++;
|
||||
// Balance the columns properly
|
||||
if( ( count( $templates ) % 2 == 0 && $i == intval( $count / 2 ) ) ||
|
||||
( count( $templates ) % 2 == 1 && $i == intval( $count / 2 ) + 1 ) )
|
||||
echo "</table></td><td><table class=\"templates\">";
|
||||
// Check and see if this template should be shown in the list
|
||||
$isValid = false;
|
||||
if( isset($template['regexp'] ) ) {
|
||||
@ -66,34 +87,35 @@ include 'header.php'; ?>
|
||||
$isValid = true;
|
||||
}
|
||||
|
||||
if ($isValid) {
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="radio"
|
||||
name="template"
|
||||
value="<?php echo htmlspecialchars($name);?>"
|
||||
<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>
|
||||
<?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 if
|
||||
|
||||
} // end foreach ?>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo $lang['createf_proceed']?> >>" /></center></td>
|
||||
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo $lang['proceed_gt']?>" /></center></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/creation_template.php,v 1.18 2004/10/24 23:51:49 uugdave Exp $
|
||||
|
||||
/* file: creation_template.php
|
||||
* This file simply acts as a plugin grabber for the creator templates in
|
||||
@ -10,42 +10,53 @@
|
||||
* template
|
||||
*/
|
||||
|
||||
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 ) );
|
||||
$template = http_get_value( 'template' );
|
||||
$template !== false or pla_error( $lang['ctemplate_no_template'] );
|
||||
|
||||
if( $template == 'custom' ) {
|
||||
foreach( $templates as $id => $template ) {
|
||||
if( $template['handler'] == 'custom.php' ) {
|
||||
$template = $id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isset( $templates[$template] ) or pla_error( sprintf( $lang['invalid_template'], htmlspecialchars( $template ) ) );
|
||||
$template_id = $template;
|
||||
$template = isset( $templates[$template] ) ? $templates[$template_id] : null;
|
||||
$server_id = http_get_value( 'server_id' );
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$server_name = $servers[ $server_id ][ 'name' ];
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
|
||||
include 'header.php';
|
||||
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( $server_name ); ?>', <?php echo $lang['using_template']?> '<?php echo htmlspecialchars( $template['desc'] ); ?>'</h3>
|
||||
|
||||
<?php
|
||||
|
||||
if( ! isset( $_POST['template'] ) )
|
||||
pla_error( $lang['ctemplate_no_template'] );
|
||||
|
||||
$handler = 'templates/creation/' . $template['handler'];
|
||||
$handler = realpath( $handler );
|
||||
if( file_exists( $handler ) )
|
||||
if( ! file_exists( $handler ) )
|
||||
pla_error( sprintf( $lang['template_does_not_exist'], htmlspecialchars( $template['handler'] ) ) );
|
||||
if( ! is_readable( $handler ) )
|
||||
pla_error( sprintf( $lang['template_not_readable'], htmlspecialchars( $template['handler'] ) ) );
|
||||
|
||||
include $handler;
|
||||
else
|
||||
pla_error( $lang['ctemplate_config_handler'] . " <b>" . htmlspecialchars( $template['handler'] ) .
|
||||
"</b> " . $lang['ctemplate_handler_does_not_exist']);
|
||||
|
||||
echo "</body>\n</html>";
|
||||
|
||||
?>
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/custom_functions.php,v 1.6 2004/05/27 13:25:13 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* custom_functions.php: Choose your own adventure.
|
||||
@ -91,6 +93,21 @@ 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.
|
||||
*/
|
||||
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
|
||||
@ -160,3 +177,11 @@ function postEntryDelete( $server_id, $dn )
|
||||
// Fill me in
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called, after a new session is initilaized
|
||||
*/
|
||||
function postSessionInit()
|
||||
{
|
||||
// Fill me in
|
||||
}
|
||||
|
||||
|
15
delete.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete.php,v 1.18 2004/08/15 17:35:25 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* delete.php
|
||||
@ -23,8 +25,10 @@ if( is_server_read_only( $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'] );
|
||||
dn_exists( $server_id, $dn ) or pla_error( sprintf( $lang['no_such_entry'], '<b>' . pretty_print_dn( $dn ) . '</b>' ) );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
// Check the user-defined custom callback first.
|
||||
if( true === preEntryDelete( $server_id, $dn ) ) {
|
||||
@ -41,8 +45,7 @@ if( $del_result )
|
||||
// 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] ) ) {
|
||||
@ -61,7 +64,7 @@ if( $del_result )
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
include 'header.php';
|
||||
include './header.php';
|
||||
|
||||
?>
|
||||
|
||||
@ -71,13 +74,13 @@ 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 ) ) ),
|
||||
pla_error( sprintf( $lang['could_not_delete_entry'], '<b>' . pretty_print_dn( $dn ) . '</b>' ),
|
||||
ldap_error( $ds ),
|
||||
ldap_errno( $ds ) );
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_attr.php,v 1.9 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* delete_attr.php
|
||||
@ -8,7 +10,7 @@
|
||||
* On failure, echo an error.
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
@ -16,16 +18,19 @@ $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_attr_read_only( $server_id, $attr ) )
|
||||
pla_error( sprintf( $lang['attr_is_read_only'], htmlspecialchars( $attr ) ) );
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( "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" );
|
||||
pla_error( $lang['no_updates_in_read_only_mode'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
if( ! $attr ) pla_error( $lang['no_attr_specified'] );
|
||||
if( ! $dn ) pla_error( $lang['no_dn_specified'] );
|
||||
|
||||
$update_array = array();
|
||||
$update_array[$attr] = array();
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$res = @ldap_modify( $ds, $dn, $update_array );
|
||||
if( $res )
|
||||
{
|
||||
@ -36,7 +41,7 @@ if( $res )
|
||||
}
|
||||
else
|
||||
{
|
||||
pla_error( "Could not perform ldap_modify operation.", ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
pla_error( $lang['could_not_perform_ldap_modify'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_form.php,v 1.17 2004/10/21 00:14:48 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* delete_form.php
|
||||
@ -9,7 +11,7 @@
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@ -19,34 +21,24 @@ $rdn = $rdn[0];
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
if( is_server_read_only( $server_id ) )
|
||||
pla_error( "You cannot perform updates while server is in read-only mode" );
|
||||
pla_error( $lang['no_updates_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." );
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
$children = get_container_contents( $server_id, $dn );
|
||||
$children = get_container_contents( $server_id, $dn,0,'(objectClass=*)',LDAP_DEREF_NEVER );
|
||||
$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>
|
||||
|
||||
<?php if( 0 == strcasecmp( $dn, $servers[$server_id]['base'] ) ) { ?>
|
||||
|
||||
<center><b>You cannot delete the base <acronym title="Distinguished Name">DN</acronym> entry of the LDAP server.</b></center>
|
||||
</body>
|
||||
</html>
|
||||
<?php exit; ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<h3 class="title"><?php echo sprintf( $lang['delete_dn'], htmlspecialchars( $rdn ) ); ?></b></h3>
|
||||
<h3 class="subtitle"><?php echo $lang['server']; ?>: <b><?php echo $server_name; ?></b> <?php echo $lang['distinguished_name']; ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3>
|
||||
|
||||
<?php if( $has_children ) { ?>
|
||||
|
||||
<center><b>Permanently delete all children also?</b><br /><br />
|
||||
<center><b><?php echo $lang['permanently_delete_children']; ?></b><br /><br />
|
||||
|
||||
<?php
|
||||
flush(); // so the user can get something on their screen while we figure out how many children this object has
|
||||
@ -60,13 +52,16 @@ if( $has_children ) {
|
||||
<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 />
|
||||
<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 />
|
||||
<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 />
|
||||
|
||||
<?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%">
|
||||
@ -76,16 +71,16 @@ Take into consideration aliases and other such things that may cause problems.</
|
||||
<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" />
|
||||
<input type="submit" class="scary" value="<?php echo sprintf( $lang['delete_all_x_objects'], $sub_tree_count ); ?>" />
|
||||
</form>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<center>
|
||||
<form action="edit.php" method="get">
|
||||
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
||||
<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="Cancel" class="cancel" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['cancel']; ?>" class="cancel" />
|
||||
</form>
|
||||
</center>
|
||||
</td>
|
||||
@ -96,7 +91,7 @@ Take into consideration aliases and other such things that may cause problems.</
|
||||
<?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 />
|
||||
<?php echo $lang['list_of_entries_to_be_deleted']; ?><br />
|
||||
<select size="<?php echo min( 10, $sub_tree_count );?>" multiple disabled style="background:white; color:black;width:500px" >
|
||||
<?php $i=0; ?>
|
||||
<?php foreach( $s as $dn => $junk ) { ?>
|
||||
@ -115,19 +110,19 @@ A list of all the <?php echo ($sub_tree_count); ?> <acronym title="Distinguished
|
||||
<table class="delete_confirm">
|
||||
<td>
|
||||
|
||||
Are you sure you want to permanently delete this object?<br />
|
||||
<?php echo $lang['sure_permanent_delete_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 />
|
||||
<nobr><acronym title="<?php echo $lang['distinguished_name']; ?>"><?php echo $lang['dn']; ?></acronym>: <b><?php echo pretty_print_dn( $dn ); ?></b><nobr><br />
|
||||
<nobr><?php echo $lang['server']; ?>: <b><?php echo htmlspecialchars($server_name); ?></b></nobr><br />
|
||||
<br />
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<form action="delete.php" method="post">
|
||||
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
|
||||
<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="Delete It" class="scary" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['delete']; ?>" class="scary" />
|
||||
</center>
|
||||
</form>
|
||||
</td>
|
||||
@ -137,7 +132,7 @@ Are you sure you want to permanently delete this object?<br />
|
||||
<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" />
|
||||
<input type="submit" name="submit" value="<?php echo $lang['cancel']; ?>" class="cancel" />
|
||||
</form>
|
||||
</center>
|
||||
</td>
|
||||
@ -154,5 +149,3 @@ Are you sure you want to permanently delete this object?<br />
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
|
33
doc/CREDITS
@ -1,10 +1,8 @@
|
||||
|
||||
* Project Developers:
|
||||
|
||||
- David Smith Maintainer
|
||||
- Xavier Renard LDIF master
|
||||
- Marius Rieder Schema master
|
||||
- Nate Rotschafer Release manager
|
||||
- Xavier Renard Import/Export and Samba
|
||||
- Uwe Ebel I18n
|
||||
|
||||
* Patch writers:
|
||||
|
||||
@ -16,20 +14,37 @@
|
||||
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
|
||||
|
||||
* Translators:
|
||||
|
||||
- Uwe Ebel & Marius Reider German
|
||||
- Marius Reider, German
|
||||
Uwe Ebel,
|
||||
Dieter Kluenter
|
||||
- Xavier Renard French
|
||||
- Dave Smith English ;)
|
||||
- Richard Lucassen Dutch
|
||||
- Andreu Sanchez Spanish and Català
|
||||
- Dmitry Gorpinenko Russian
|
||||
- Dmitry Gorpinenko, Russian
|
||||
Aleksey Soldatov
|
||||
Sergey Saukh
|
||||
- Unknown Italian
|
||||
|
||||
- Alexandre Maciel Portuguese (Brasilian)
|
||||
Elton Schroeder Fenner (CLeGi)
|
||||
- Piotr Tarnowski (DrFugazi) Polish
|
||||
- Gunnar Nystrom Swedish
|
||||
- VOROSBARANYI Zoltan, Hungarian
|
||||
SIPOS Agnes
|
||||
- Tadashi Jokagi (elf2000) Japanese
|
||||
|
||||
If you can help translate, please join the phpldapadmin-devel mailing list:
|
||||
https://lists.sourceforge.net/mailman/listinfo/phpldapadmin-devel
|
||||
|
||||
|
||||
|
||||
|
209
doc/ChangeLog
@ -1,3 +1,212 @@
|
||||
|
||||
* 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:
|
||||
|
@ -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,3 +1,4 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/INSTALL-es.txt,v 1.3 2004/03/19 20:22:54 i18phpldapadmin Exp $
|
||||
Estas instrucciones dejan por sentado que tienes una instalación
|
||||
funcionando de:
|
||||
a. Servidor Web (Apache, IIS, etc).
|
||||
|
@ -1,3 +1,4 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/INSTALL-fr.txt,v 1.3 2004/03/19 20:22:54 i18phpldapadmin Exp $
|
||||
Les instructions suivantes supposent une installation en état de marche de:
|
||||
a. Un serveur web (Apache, IIS, etc).
|
||||
b. PHP 4.1.0 ou une version plus récente (avec le support LDAP).
|
||||
|
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.
|
63
doc/ROADMAP
@ -1,3 +1,4 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/ROADMAP,v 1.19 2004/03/25 12:50:39 uugdave Exp $
|
||||
phpLDAPadmin roadmap
|
||||
|
||||
0.9.3 planned features:
|
||||
@ -7,31 +8,49 @@ phpLDAPadmin roadmap
|
||||
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)
|
||||
* Complete i18n. All strings localized.
|
||||
Modification templates:
|
||||
* gropOfNames (view full DNs and browse buttons)
|
||||
* groupOfUniqueNames (view full DNs and browse buttons)
|
||||
* http auth_type (a la phpMyAdmin)
|
||||
* read-only attributes (similar to hidden attributes) in config
|
||||
* Default mod template: Add a "browse" button for attributes that store DNs.
|
||||
caveat: We don't have a way to reference form elements with "[]" in the name, causing a proble
|
||||
with our default mod template. The "browser" button is present, but cannot populate the form
|
||||
element.
|
||||
* Add output buffering when including lang files so no output is sent to the browser (which could cause problems for sessions and cookies)
|
||||
* Paging search results.
|
||||
* Anonymous binds redirect to search page with no tree viewer (as an option in config)
|
||||
* pretty-printed DNs
|
||||
* DSML exports
|
||||
* obfuscated password display
|
||||
* more linkage in the schema browser (used by links)
|
||||
* jpegs drawn in-line in searches
|
||||
* configurable read-only attributes
|
||||
* paging in search results (ie, viewing entries 1-50 of 436)
|
||||
* Configuration for templates.
|
||||
|
||||
0.9.5 planned features:
|
||||
Maybe create a class called Config with static functions for fetching configuration data (ie, Config::isServerReadOnly()).
|
||||
or: Object-oriented server and general configuration (ie, add a class Server)
|
||||
Support and test ActiveDirectory and iMail LDAP schema.
|
||||
Add link to objectClass values in default mod template to jump to that objectClass in the schema viewer.
|
||||
Make deref param modifiable in the advanced search form (LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, etc.)
|
||||
Better handling of aliases and referals (display the actual alias with aliasedObjectName or ref attrs, and don't follow or perhaps make it configurable like ldapsearch)
|
||||
Remove all HTML from language files.
|
||||
Add a random hint on the welcome page
|
||||
Add blowfish encryption to encrypt cookie-stored passwords and DNs.
|
||||
Support for modifying replica entries (using ldap_set_rebind_proc())
|
||||
Modification templates
|
||||
user
|
||||
oragnizationalUnit
|
||||
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:
|
||||
Search filter builder for simple search form (just select AND or OR for a group of criteria)
|
||||
Add mass-update feature (user provides filter and set of attrs/vals to modify)
|
||||
No-schema mode of operation (some servers simply won't give us schema. This becomes a problem for normal operation)
|
||||
i18n localization of all creation templates
|
||||
Hidden/read-only attrs on a filter-basis (ie, different users have different viewable, writable attributes)
|
||||
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)
|
||||
Serious compatibility testing for additional LDAP servers.
|
||||
|
||||
(* means an item is complete and checed into CVS)
|
||||
|
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=
|
@ -1,7 +1,11 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/documentation.php,v 1.7 2004/12/17 15:21:15 uugdave Exp $
|
||||
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
|
||||
include './common.php';
|
||||
include './header.php';
|
||||
|
||||
echo "<body>";
|
||||
|
||||
$view = isset( $_GET['view'] ) ? $_GET['view'] : false;
|
||||
switch( $view ) {
|
||||
|
58
donate.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
|
||||
$donate_base_href="https://sourceforge.net/donate/index.php?group_id=61828&type=0";
|
||||
$amounts = array( 10, 20, 50, 100 );
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">Donate</h3>
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<p style="text-align: center"><?php echo $lang['donation_instructions']; ?></p>
|
||||
<br />
|
||||
|
||||
<table style="width: 100%; font-size: 12px">
|
||||
<tr>
|
||||
<?php foreach( $amounts as $amount ) { ?>
|
||||
|
||||
<td align="center">
|
||||
<a
|
||||
href="<?php echo $donate_base_href; ?>&amt=<?php echo $amount; ?>"
|
||||
target="new"><img
|
||||
src="images/paypal-donate.png"
|
||||
alt="[<?php echo sprintf( $lang['donate_amount'], '$US ' . $amount ); ?>]"
|
||||
title="<?php echo sprintf( $lang['donate_amount'], '$US ' . $amount ); ?>" /></a>
|
||||
</td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<?php foreach( $amounts as $amount ) { ?>
|
||||
|
||||
<td align="center"><?php echo sprintf( $lang['donate_amount'], '$' . $amount ); ?></td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<center>
|
||||
<?php echo $lang['wish_list_option']; ?>
|
||||
<br />
|
||||
<br />
|
||||
<a href="http://www.amazon.com/gp/registry/22APPYURX48VA"><?php echo $lang['wish_list']; ?></a>
|
||||
</center>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/download_binary_attr.php,v 1.8 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
require 'common.php';
|
||||
|
||||
require './common.php';
|
||||
|
||||
$server_id = $_GET['server_id'];
|
||||
$dn = rawurldecode( $_GET['dn'] );
|
||||
@ -8,19 +10,24 @@ $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." );
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
dn_exists( $server_id, $dn ) or pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn ) ) );
|
||||
|
||||
$search = ldap_read( $ds, $dn, "(objectClass=*)", array( $attr ), 0, 200, 0, LDAP_DEREF_ALWAYS );
|
||||
$search = @ldap_read( $ds, $dn, "(objectClass=*)", array( $attr ), 0, 0, 0, get_view_deref_setting() );
|
||||
if( ! $search )
|
||||
pla_error( $lang['error_performing_search'], ldap_error( $ds ), ldap_errno( $ds ) );
|
||||
$entry = ldap_first_entry( $ds, $search );
|
||||
$attrs = ldap_get_attributes( $ds, $entry );
|
||||
$attr = ldap_first_attribute( $ds, $entry, $attrs );
|
||||
$values = ldap_get_values_len( $ds, $entry, $attr );
|
||||
$count = $values['count'];
|
||||
unset( $values['count'] );
|
||||
Header( "Content-type: octet-stream" );
|
||||
Header( "Content-disposition: attachment; filename=$attr" );
|
||||
|
||||
// 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];
|
||||
|
15
edit.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/edit.php,v 1.48 2004/10/14 03:33:36 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* edit.php
|
||||
@ -14,8 +16,8 @@
|
||||
* - Other vars may be set and used by the modification templates
|
||||
*/
|
||||
|
||||
require realpath( 'common.php' );
|
||||
require realpath( 'templates/template_config.php' );
|
||||
require_once realpath( 'common.php' );
|
||||
require_once realpath( 'templates/template_config.php' );
|
||||
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : false;
|
||||
$dn !== false or pla_error( $lang['missing_dn_in_query_string'] );
|
||||
@ -25,11 +27,18 @@ $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'] );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
if( $use_default_template ) {
|
||||
require realpath( 'templates/modification/default.php' );
|
||||
|
104
emuhash_functions.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************************
|
||||
* 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,3 +1,4 @@
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/entry_chooser.js,v 1.2 2004/03/19 20:18:41 i18phpldapadmin Exp $
|
||||
function dnChooserPopup( form_element )
|
||||
{
|
||||
mywindow=open('entry_chooser.php','myname','resizable=no,width=600,height=370,scrollbars=1');
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/entry_chooser.php,v 1.16 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
require 'common.php';
|
||||
|
||||
require './common.php';
|
||||
|
||||
$container = isset( $_GET['container'] ) ? rawurldecode( $_GET['container'] ) : false;
|
||||
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id'] : false;
|
||||
@ -8,7 +10,19 @@ $return_form_element = isset( $_GET['form_element'] ) ? htmlspecialchars( $_GET[
|
||||
|
||||
include "header.php";
|
||||
|
||||
echo "<h3 class=\"subtitle\">Automagic Entry Chooser</h3>\n";
|
||||
echo "<h3 class=\"subtitle\">" . $lang['entry_chooser_title'] . "</h3>\n";
|
||||
flush();
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
function returnDN( dn )
|
||||
{
|
||||
opener.document.<?php echo $return_form_element; ?>.value = dn;
|
||||
close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
if( $container ) {
|
||||
echo $lang['server_colon_pare'] . "<b>" . htmlspecialchars( $servers[ $server_id ][ 'name' ] ) . "</b><br />\n";
|
||||
@ -20,15 +34,18 @@ 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 );
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
$dn_list = get_container_contents( $server_id, $container, 0, '(objectClass=*)', get_tree_deref_setting() );
|
||||
sort( $dn_list );
|
||||
|
||||
$base_dn = $servers[ $server_id ][ 'base' ];
|
||||
if( ! $base_dn )
|
||||
$base_dn = try_to_get_root_dn( $server_id );
|
||||
|
||||
if( $container == $base_dn ) {
|
||||
if( 0 == pla_compare_dns( $container, $base_dn ) ) {
|
||||
$parent_container = false;
|
||||
$up_href = "entry_chooser.php?form_element=$return_form_element";
|
||||
} else {
|
||||
@ -87,11 +104,3 @@ $elmpart =substr($return_form_element,strpos($return_form_element,".")+1);
|
||||
$return_form_element = $formpart . ".elements[\"" . $elmpart . "\"]";
|
||||
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
function returnDN( dn )
|
||||
{
|
||||
opener.document.<?php echo $return_form_element; ?>.value = dn;
|
||||
close();
|
||||
}
|
||||
</script>
|
||||
|
24
expand.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/expand.php,v 1.18 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
* expand.php
|
||||
@ -12,7 +14,7 @@
|
||||
* Note: this script is equal and opposite to collapse.php
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
// no expire header stuff
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
@ -21,6 +23,9 @@ 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'];
|
||||
@ -28,25 +33,22 @@ $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 );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
$contents = get_container_contents( $server_id, $dn, 0, '(objectClass=*)', get_tree_deref_setting() );
|
||||
|
||||
usort( $contents, 'pla_compare_dns' );
|
||||
$tree[$server_id][$dn] = $contents;
|
||||
|
||||
//echo "<pre>";
|
||||
//var_dump( $contents );
|
||||
//exit;
|
||||
|
||||
usort( $contents, 'pla_compare_dns' );
|
||||
$tree[$server_id][$dn] = $contents;
|
||||
|
||||
foreach( $contents as $dn )
|
||||
$tree_icons[$server_id][$dn] = get_icon( $server_id, $dn );
|
||||
|
||||
|
93
export.php
Executable file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export.php,v 1.11 2004/10/23 21:13:15 uugdave Exp $
|
||||
|
||||
require 'export_functions.php';
|
||||
|
||||
// get the POST parameters
|
||||
$base_dn = isset($_POST['dn']) ? $_POST['dn']:NULL;
|
||||
$server_id = isset($_POST['server_id']) ? $_POST['server_id']:NULL;
|
||||
$format = isset( $_POST['format'] ) ? $_POST['format'] : "unix";
|
||||
$scope = isset($_POST['scope']) ? $_POST['scope'] : 'base';
|
||||
$filter = isset($_POST['filter']) ? $_POST['filter'] : 'objectclass=*';
|
||||
$target = isset($_POST['target']) ? $_POST['target'] : 'display';
|
||||
$save_as_file = isset( $_POST['save_as_file'] ) && $_POST['save_as_file'] == 'on';
|
||||
$attributes = array();
|
||||
// add system attributes if needed
|
||||
if( isset( $_POST['sys_attr'] ) ){
|
||||
array_push($attributes,'*');
|
||||
array_push($attributes,'+');
|
||||
}
|
||||
isset($_POST['exporter_id']) or pla_error( $lang['must_choose_export_format'] );
|
||||
$exporter_id = $_POST['exporter_id'];
|
||||
isset($exporters[$exporter_id]) or pla_error( $lang['invalid_export_format'] );
|
||||
|
||||
// do some check
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
|
||||
// Initialisation of other variables
|
||||
$rdn = get_rdn( $base_dn );
|
||||
$friendly_rdn = get_rdn( $base_dn, 1 );
|
||||
$extension = $exporters[$exporter_id]['extension'];
|
||||
|
||||
//set the default CRLN to Unix format
|
||||
$br = "\n";
|
||||
|
||||
// default case not really needed
|
||||
switch( $format ) {
|
||||
case 'win':
|
||||
$br = "\r\n";
|
||||
break;
|
||||
case 'mac':
|
||||
$br = "\r";
|
||||
break;
|
||||
case 'unix':
|
||||
default:
|
||||
$br = "\n";
|
||||
}
|
||||
|
||||
// get the decoree,ie the source
|
||||
$plaLdapExporter = new PlaLdapExporter($server_id,$filter,$base_dn,$scope,$attributes);
|
||||
|
||||
// the decorator
|
||||
// do it that way for the moment
|
||||
$exporter = NULL;
|
||||
|
||||
switch($exporter_id){
|
||||
case 0:
|
||||
$exporter = new PlaLdifExporter($plaLdapExporter);
|
||||
break;
|
||||
case 1:
|
||||
$exporter = new PlaDsmlExporter($plaLdapExporter);
|
||||
break;
|
||||
case 2:
|
||||
$exporter = new PlaVcardExporter($plaLdapExporter);
|
||||
break;
|
||||
case 3:
|
||||
$exporter = new PlaCSVExporter($plaLdapExporter);
|
||||
break;
|
||||
default:
|
||||
// truly speaking,this default case will never be reached. See check at the bottom.
|
||||
$plaLdapExporter->pla_close();
|
||||
pla_error( $lang['no_exporter_found'] );
|
||||
}
|
||||
|
||||
// set the CLRN
|
||||
$exporter->setOutputFormat($br);
|
||||
|
||||
// prevent script from bailing early for long search
|
||||
@set_time_limit( 0 );
|
||||
|
||||
// send the header
|
||||
if( $save_as_file )
|
||||
header( "Content-type: application/download" );
|
||||
else
|
||||
header( "Content-type: text/plain" );
|
||||
header( "Content-Disposition: filename=$friendly_rdn.".$exporters[$exporter_id]['extension'] );
|
||||
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
|
||||
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
|
||||
header( "Cache-Control: post-check=0, pre-check=0", false );
|
||||
|
||||
// and export
|
||||
$exporter->export();
|
||||
?>
|
161
export_form.php
Executable file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_form.php,v 1.19 2004/10/24 23:51:49 uugdave Exp $
|
||||
|
||||
/**
|
||||
* export_form.php
|
||||
* --------------------
|
||||
*
|
||||
* Html form to choose an export format(ldif,...)
|
||||
*
|
||||
*/
|
||||
|
||||
require 'export_functions.php';
|
||||
|
||||
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id']:NULL ;
|
||||
$format = isset( $_GET['format'] ) ? $_GET['format'] : get_line_end_format();
|
||||
$scope = isset( $_GET['scope'] ) ? $_GET['scope'] : 'base' ;
|
||||
$exporter_id = isset( $_GET['exporter_id'] ) ? $_GET['exporter_id'] : 0 ;
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
|
||||
$filter = isset( $_GET['filter'] ) ? $_GET['filter'] : '(objectClass=*)';
|
||||
$attributes = isset( $_GET['attributes'] ) ? $_GET['attributes'] : '*';
|
||||
$sys_attr = isset( $_GET['sys_attr'] ) && $_GET['sys_attr'] == 'true' ? true : false;
|
||||
|
||||
$available_formats = array(
|
||||
'unix' => 'UNIX (Linux, BSD)',
|
||||
'mac' => 'Macintosh',
|
||||
'win' => 'Windows'
|
||||
);
|
||||
|
||||
$available_scopes = array(
|
||||
'base' => $lang['scope_base'],
|
||||
'one' => $lang['scope_one'],
|
||||
'sub' => $lang['scope_sub']
|
||||
);
|
||||
|
||||
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
<h3 class="title"><?php echo $lang['export']; ?></h3>
|
||||
<br />
|
||||
<center>
|
||||
<form name="export_form" action="export.php" method="POST">
|
||||
<table class="export_form">
|
||||
<tr>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang['export']; ?></legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td><?php echo $lang['server']; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if( count($servers) > 1 ){
|
||||
echo '<select name="server_id">';
|
||||
foreach( $servers as $id => $server )
|
||||
if( $server['host'] )
|
||||
echo "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . htmlspecialchars($server['name']) . "</option>\n";
|
||||
echo '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
echo '<input type="hidden" name="server_id" value="'.key($servers).'" />' .
|
||||
'<b>' . $server['name'] . '</b>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="white-space:nowrap"><?php echo $lang['base_dn']; ?></td>
|
||||
<td><nobr><input type="text" name="dn" id="dn" style="width:230px" value="<?php echo htmlspecialchars( $dn ); ?>" /> <?php draw_chooser_link( 'export_form.dn' ); ?></nobr></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span style="white-space: nowrap"><?php echo $lang['search_scope']; ?></span></td>
|
||||
<td>
|
||||
<?php foreach( $available_scopes as $id => $desc ) {
|
||||
$id = htmlspecialchars( $id );
|
||||
$desc = htmlspecialchars( $desc ); ?>
|
||||
|
||||
<input type="radio" name="scope" value="<?php echo $id; ?>" id="<?php echo $id; ?>"<?php if($id==$scope) echo ' checked="true"';?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang['search_filter']; ?></td>
|
||||
<td><input type="text" name="filter" style="width:300px" value="<?php echo htmlspecialchars($filter); ?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="checkbox" name="sys_attr" id="sys_attr" <?php if( $sys_attr ) echo 'checked="true" '; ?>/> <label for="sys_attr"><?php echo $lang['include_system_attrs']; ?></label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="checkbox" id="save_as_file" name="save_as_file" /><label for="save_as_file"><?php echo $lang['save_as_file']; ?></label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table style="width: 100%">
|
||||
<tr><td style="width: 50%">
|
||||
<fieldset style="height: 100px">
|
||||
<legend><?php echo $lang['export_format']; ?></legend>
|
||||
|
||||
<?php foreach($exporters as $index => $exporter){?>
|
||||
|
||||
<input type="radio" name="exporter_id" value="<?php echo htmlspecialchars($index); ?>" id="<?php echo htmlspecialchars($index); ?>" <?php if($index==$exporter_id) echo ' checked="true"'; ?> />
|
||||
<label for="<?php echo htmlspecialchars( $index ); ?>"><?php echo htmlspecialchars( $exporter['desc'] ); ?></label><br />
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</fieldset>
|
||||
</td>
|
||||
<td style="width: 50%">
|
||||
<fieldset style="height: 100px">
|
||||
<legend><?php echo $lang['line_ends']; ?></legend>
|
||||
<?php foreach( $available_formats as $id => $desc ) {
|
||||
$id = htmlspecialchars( $id );
|
||||
$desc = htmlspecialchars( $desc );
|
||||
?>
|
||||
|
||||
<input type="radio" name="format" value="<?php echo $id; ?>" id="<?php echo $id; ?>"<?php if($format==$id) echo ' checked="true"'; ?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
|
||||
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<center>
|
||||
<input type="submit" name="target" value="<?php echo $lang['proceed_gt']; ?>" />
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Helper functoin for fetching the line end format.
|
||||
* @return String 'win', 'unix', or 'mac' based on the user's browser..
|
||||
*/
|
||||
function get_line_end_format()
|
||||
{
|
||||
if( is_browser_os_windows() )
|
||||
return 'win';
|
||||
elseif( is_browser_os_unix() )
|
||||
return 'unix';
|
||||
elseif( is_browser_os_mac() )
|
||||
return 'mac';
|
||||
else
|
||||
return 'unix';
|
||||
}
|
857
export_functions.php
Executable file
@ -0,0 +1,857 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_functions.php,v 1.20 2004/11/03 22:00:52 xrenard Exp $
|
||||
|
||||
/**
|
||||
* Fuctions and classes for exporting ldap entries to others formats
|
||||
* (LDIF,DSML,..)
|
||||
* An example is provided at the bottom of this file if you want implement yours. *
|
||||
* @package phpLDAPadmin
|
||||
* @author The phpLDAPadmin development team
|
||||
* @see export.php and export_form.php
|
||||
*/
|
||||
|
||||
// include common configuration definitions
|
||||
include('common.php');
|
||||
|
||||
// registry for the exporters
|
||||
$exporters = array();
|
||||
|
||||
$exporters[] = array('output_type'=>'ldif',
|
||||
'desc' => 'LDIF',
|
||||
'extension' => 'ldif'
|
||||
);
|
||||
|
||||
$exporters[] = array('output_type'=>'dsml',
|
||||
'desc' => 'DSML V.1',
|
||||
'extension' => 'xml'
|
||||
);
|
||||
|
||||
$exporters[] = array('output_type'=>'vcard',
|
||||
'desc' => 'VCARD 2.1',
|
||||
'extension' => 'vcf'
|
||||
);
|
||||
$exporters[] = array('output_type'=>'csv',
|
||||
'desc' => $lang['csv_spreadsheet'],
|
||||
'extension' => 'csv'
|
||||
);
|
||||
|
||||
/**
|
||||
* This class encapsulate informations about the ldap server
|
||||
* from which the export is done.
|
||||
* The following info are provided within this class:
|
||||
*
|
||||
* $server_id: the id of the server.
|
||||
* $base_dn: if the source of the export is the ldap server,
|
||||
* it indicates the base dn of the search.
|
||||
* $query_filter: if the source of the export is the ldap server,
|
||||
* it indicates the query filter for the search.
|
||||
* $scope: if the source of the export is the ldap server,
|
||||
* it indicates the scope of the search.
|
||||
* $server_host: the host name of the server.
|
||||
* $server_name: the name of the server.
|
||||
*/
|
||||
|
||||
class LdapInfo{
|
||||
|
||||
var $base_dn;
|
||||
var $query_filter;
|
||||
var $scope;
|
||||
var $server_host = NULL;
|
||||
var $server_name = NULL;
|
||||
var $server_id = NULL;
|
||||
|
||||
/**
|
||||
* Create a new LdapInfo object
|
||||
*
|
||||
* @param int $server_id the server id
|
||||
* @param String $base_dn the base_dn for the search in a ldap server
|
||||
* @param String $query_filter the query filter for the search
|
||||
* @param String scope the scope of the search in a ldap server
|
||||
*/
|
||||
|
||||
function LdapInfo($server_id,$base_dn = NULL,$query_filter = NULL,$scope = NULL){
|
||||
global $servers;
|
||||
$this->base_dn = $base_dn;
|
||||
$this->query_filter = $query_filter;
|
||||
$this->scope = $scope;
|
||||
$this->server_name = $servers[ $server_id ][ 'name' ];
|
||||
$this->server_host = $servers[ $server_id ][ 'host' ];
|
||||
$this->server_id = $server_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class represents the base class of all exporters
|
||||
* It can be subclassed directly if your intend is to write
|
||||
* a source exporter(ie. it will act only as a decoree
|
||||
* which will be wrapped by an another exporter.)
|
||||
* If you consider writting an exporter for filtering data
|
||||
* or directly display entries, please consider subclass
|
||||
* the PlaExporter
|
||||
*
|
||||
* @see PlaExporter
|
||||
*/
|
||||
|
||||
class PlaAbstractExporter{
|
||||
|
||||
/**
|
||||
* Return the number of entries
|
||||
* @return int the number of entries to be exported
|
||||
*/
|
||||
function pla_num_entries(){}
|
||||
|
||||
/**
|
||||
* Return true if there is some more entries to be processed
|
||||
* @return bool if there is some more entries to be processed
|
||||
*/
|
||||
function pla_has_entry(){}
|
||||
|
||||
/**
|
||||
* Return the entry as an array
|
||||
* @return array an entry as an array
|
||||
*/
|
||||
function pla_fetch_entry_array(){}
|
||||
|
||||
/**
|
||||
* Return the entry as an Entry object
|
||||
* @return Entry an entry as an Entry Object
|
||||
*/
|
||||
function pla_fetch_entry_object(){}
|
||||
|
||||
/**
|
||||
* Return a PlaLdapInfo Object
|
||||
* @return LdapInfo Object with info from the ldap serveur
|
||||
*/
|
||||
function pla_get_ldap_info(){}
|
||||
|
||||
/**
|
||||
* May be call when the processing is finished
|
||||
* and to free some ressources.
|
||||
* @return bool true or false if any errors is encountered
|
||||
*/
|
||||
function pla_close(){}
|
||||
|
||||
}// end PlaAbstractExporter
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PlaExporter acts a wrapper around another exporter.
|
||||
* In other words, it will act as a decorator for another decorator
|
||||
*/
|
||||
|
||||
class PlaExporter extends PlaAbstractExporter{
|
||||
// the default CRLN
|
||||
var $br="\n";
|
||||
// the wrapped $exporter
|
||||
var $exporter;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param source $source the decoree for this exporter
|
||||
*/
|
||||
function PlaExporter( $source ){
|
||||
$this->exporter = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of entries
|
||||
* @return int the number of entries to be exported
|
||||
*/
|
||||
function pla_num_entries(){
|
||||
return $this->exporter->pla_num_entries();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there is some more entries to be processed
|
||||
* @return bool if there is some more entries to be processed
|
||||
*/
|
||||
function pla_has_entry(){
|
||||
return $this->exporter->pla_has_entry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entry as an array
|
||||
* @return array an entry as an array
|
||||
*/
|
||||
function pla_fetch_entry_array(){
|
||||
return $this->exporter->pla_fetch_entry_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entry as an Entry object
|
||||
* @return Entry an entry as an Entry Object
|
||||
*/
|
||||
function pla_fetch_entry_object(){
|
||||
return $this->exporter->pla_fetch_entry_object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a PlaLdapInfo Object
|
||||
* @return LdapInfo Object with info from the ldap serveur
|
||||
*/
|
||||
function pla_get_ldap_info(){
|
||||
return $this->exporter->pla_get_ldap_info();
|
||||
}
|
||||
|
||||
/**
|
||||
* May be call when the processing is finished
|
||||
* and to free some ressources.
|
||||
* @return bool false if any errors are encountered,false otherwise
|
||||
*/
|
||||
function pla_close(){
|
||||
return $this->exporter->pla_close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to check if the attribute value should be base 64 encoded.
|
||||
* @param String $str the string to check.
|
||||
* @return bool true if the string is safe ascii, false otherwise.
|
||||
*/
|
||||
function is_safe_ascii( $str ){
|
||||
for( $i=0; $i<strlen($str); $i++ )
|
||||
if( ord( $str{$i} ) < 32 || ord( $str{$i} ) > 127 )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract method use to export data.
|
||||
* Must be implemented in a sub-class if you write an exporter
|
||||
* which export data.
|
||||
* Leave it empty if you write a sub-class which do only some filtering.
|
||||
*/
|
||||
function export(){}
|
||||
|
||||
/**
|
||||
* Set the carriage return /linefeed for the export
|
||||
* @param String $br the CRLF to be set
|
||||
*/
|
||||
function setOutputFormat( $br ){
|
||||
$this->br = $br;
|
||||
}
|
||||
|
||||
}// end PlaExporter
|
||||
|
||||
|
||||
/**
|
||||
* Export data from a ldap server
|
||||
* @extends PlaAbstractExporter
|
||||
*/
|
||||
|
||||
class PlaLdapExporter extends PlaAbstractExporter{
|
||||
var $entry_id;
|
||||
var $results;
|
||||
var $server_id;
|
||||
var $scope;
|
||||
var $entry_array;
|
||||
var $num_entries;
|
||||
var $ldap_info;
|
||||
var $queryFilter;
|
||||
var $hasNext;
|
||||
var $connection_open_state;
|
||||
var $attributes;
|
||||
/**
|
||||
* Create a PlaLdapExporter object.
|
||||
* @param int $server_id the server id
|
||||
* @param String $queryFilter the queryFilter for the export
|
||||
* @param String $base_dn the base_dn for the data to export
|
||||
* @param String $scope the scope for export
|
||||
*/
|
||||
function PlaLdapExporter( $server_id , $queryFilter , $base_dn , $scope, $attributes){
|
||||
global $lang;
|
||||
$this->scope = $scope;
|
||||
$this->base_dn = $base_dn;
|
||||
$this->server_id = $server_id;
|
||||
$this->queryFilter = $queryFilter;
|
||||
// infos for the server
|
||||
$this->ldap_info = new LdapInfo($server_id,$base_dn,$queryFilter,$scope);
|
||||
// boolean to check if there is more entries
|
||||
$this->hasNext = 0;
|
||||
// boolean to check the state of the connection
|
||||
$this->connection_open_state = 0;
|
||||
|
||||
$this->attributes = $attributes;
|
||||
// connect to the server
|
||||
$this->ds = @pla_ldap_connect( $this->server_id );
|
||||
pla_ldap_connection_is_error( $this->ds );
|
||||
$this->connection_open_state = 1;
|
||||
|
||||
// get the data to be exported
|
||||
if( $this->scope == 'base' )
|
||||
$this->results = @ldap_read( $this->ds, $this->base_dn, $this->queryFilter,$this->attributes,
|
||||
0, 0, 0, get_export_deref_setting() );
|
||||
elseif( $this->scope == 'one' )
|
||||
$this->results = @ldap_list( $this->ds, $this->base_dn, $this->queryFilter, $this->attributes,
|
||||
0, 0, 0, get_export_deref_setting() );
|
||||
else // scope == 'sub'
|
||||
$this->results = @ldap_search( $this->ds, $this->base_dn, $this->queryFilter, $this->attributes,
|
||||
0, 0, 0, get_export_deref_setting() );
|
||||
|
||||
// if no result, there is a something wrong
|
||||
if( ! $this->results )
|
||||
pla_error( $lang['error_performing_search'], ldap_error( $this->ds ), ldap_errno( $this->ds ) );
|
||||
|
||||
// get the number of entries to be exported
|
||||
$this->num_entries = @ldap_count_entries( $this->ds,$this->results );
|
||||
|
||||
if( $this->entry_id = @ldap_first_entry( $this->ds,$this->results ) ){
|
||||
$this->hasNext = 1;
|
||||
}
|
||||
}//end constructor
|
||||
|
||||
/**
|
||||
* Return the entry as an array
|
||||
* @return array an entry as an array
|
||||
*/
|
||||
function pla_fetch_entry_array(){
|
||||
return $this->entry_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the entry as an Entry object
|
||||
* @return Entry an entry as an Entry Object
|
||||
*/
|
||||
function pla_fetch_entry_object(){
|
||||
// to do
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a PlaLdapInfo Object
|
||||
* @return LdapInfo Object with info from the ldap serveur
|
||||
*/
|
||||
function pla_get_ldap_info(){
|
||||
return $this->ldap_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of entries
|
||||
* @return int the number of entries to be exported
|
||||
*/
|
||||
function pla_num_entries(){
|
||||
return $this->num_entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there is some more entries to be processed
|
||||
* @return bool if there is some more entries to be processed
|
||||
*/
|
||||
function pla_has_entry(){
|
||||
if( $this->hasNext ){
|
||||
unset( $this->entry_array );
|
||||
$dn = @ldap_get_dn( $this->ds,$this->entry_id );
|
||||
$this->entry_array['dn'] = $dn;
|
||||
|
||||
//get the attributes of the entry
|
||||
$attrs = @ldap_get_attributes($this->ds,$this->entry_id);
|
||||
if( $attr = @ldap_first_attribute( $this->ds,$this->entry_id,$attrs ) ){
|
||||
|
||||
//iterate over the attributes
|
||||
while( $attr ){
|
||||
if( is_attr_binary( $this->server_id,$attr ) ){
|
||||
$this->entry_array[$attr] = @ldap_get_values_len( $this->ds,$this->entry_id,$attr );
|
||||
}
|
||||
else{
|
||||
$this->entry_array[$attr] = @ldap_get_values( $this->ds,$this->entry_id,$attr );
|
||||
}
|
||||
unset( $this->entry_array[$attr]['count'] );
|
||||
$attr = @ldap_next_attribute( $this->ds,$this->entry_id,$attrs );
|
||||
}// end while attr
|
||||
|
||||
if(!$this->entry_id = @ldap_next_entry( $this->ds,$this->entry_id ) ){
|
||||
$this->hasNext = 0;
|
||||
}
|
||||
}// end if attr
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
$this->pla_close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* May be call when the processing is finished
|
||||
* and to free some ressources.
|
||||
* @return bool true or false if any errors is encountered
|
||||
*/
|
||||
function pla_close(){
|
||||
if($this->connection_open_state){
|
||||
return @ldap_close( $this->ds );
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} // end PlaLdapExporter
|
||||
|
||||
/**
|
||||
* Export entries to ldif format
|
||||
* @extends PlaExporter
|
||||
*/
|
||||
|
||||
class PlaLdifExporter extends PlaExporter{
|
||||
|
||||
// variable to keep the count of the entries
|
||||
var $counter = 0;
|
||||
|
||||
// the maximum length of the ldif line
|
||||
var $MAX_LDIF_LINE_LENGTH = 76;
|
||||
|
||||
/**
|
||||
* Create a PlaLdifExporter object
|
||||
* @param PlaAbstractExporter $exporter the source exporter
|
||||
*/
|
||||
function PlaLdifExporter( $exporter ){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export entries to ldif format
|
||||
*/
|
||||
function export(){
|
||||
$pla_ldap_info = $this->pla_get_ldap_info();
|
||||
$this->displayExportInfo($pla_ldap_info);
|
||||
|
||||
//While there is an entry, fecth the entry as an array
|
||||
while($this->pla_has_entry()){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
$this->counter++;
|
||||
|
||||
// display comment before each entry
|
||||
global $lang;
|
||||
$title_string = "# " . $lang['entry'] . " " . $this->counter . ": " . $entry['dn'] ;
|
||||
if( strlen( $title_string ) > $this->MAX_LDIF_LINE_LENGTH-3 )
|
||||
$title_string = substr( $title_string, 0, $this->MAX_LDIF_LINE_LENGTH-3 ) . "...";
|
||||
echo "$title_string$this->br";
|
||||
|
||||
// display dn
|
||||
if( $this->is_safe_ascii( $entry['dn'] ))
|
||||
$this->multi_lines_display("dn:". $entry['dn']);
|
||||
else
|
||||
$this->multi_lines_display("dn:: " . base64_encode( $entry['dn'] ));
|
||||
array_shift($entry);
|
||||
|
||||
// display the attributes
|
||||
foreach( $entry as $key => $attr ){
|
||||
foreach( $attr as $value ){
|
||||
if( !$this->is_safe_ascii($value) || is_attr_binary($pla_ldap_info->server_id,$key ) ){
|
||||
$this->multi_lines_display( $key.":: " . base64_encode( $value ) );
|
||||
}
|
||||
else{
|
||||
$this->multi_lines_display( $key.": ".$value );
|
||||
}
|
||||
}
|
||||
}// end foreach $entry
|
||||
|
||||
echo $this->br;
|
||||
// flush every 5th entry (sppeds things up a bit)
|
||||
if( 0 == $this->counter % 5 )
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
// display info related to this export
|
||||
function displayExportInfo($pla_ldap_info){
|
||||
global $lang;
|
||||
echo "version: 1$this->br$this->br";
|
||||
echo "# " . sprintf( $lang['ldif_export_for_dn'], $pla_ldap_info->base_dn ) . $this->br;
|
||||
echo "# " . sprintf( $lang['generated_on_date'], date("F j, Y g:i a") ) . $this->br;
|
||||
echo "# " . $lang['server'] . ": " .$pla_ldap_info->server_name . " (" . $pla_ldap_info->server_host . ")" . $this->br;
|
||||
echo "# " . $lang['search_scope'] . ": " . $pla_ldap_info->scope . $this->br;
|
||||
echo "# " . $lang['total_entries'] . ": " . $this->pla_num_entries() . $this->br;
|
||||
echo $this->br;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to wrap ldif lines
|
||||
* @param String $str the line to be wrapped if needed.
|
||||
*/
|
||||
function multi_lines_display( $str ){
|
||||
|
||||
$length_string = strlen($str);
|
||||
$max_length = $this->MAX_LDIF_LINE_LENGTH;
|
||||
|
||||
while ($length_string > $max_length){
|
||||
echo substr($str,0,$max_length).$this->br." ";
|
||||
$str= substr($str,$max_length,$length_string);
|
||||
$length_string = strlen($str);
|
||||
|
||||
// need to do minus one to align on the right
|
||||
// the first line with the possible following lines
|
||||
// as these will have an extra space
|
||||
$max_length = $this->MAX_LDIF_LINE_LENGTH-1;
|
||||
}
|
||||
echo $str."".$this->br;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Export entries to DSML v.1
|
||||
* @extends PlaExporter
|
||||
*/
|
||||
|
||||
class PlaDsmlExporter extends PlaExporter{
|
||||
|
||||
//not in use
|
||||
var $indent_step = 2;
|
||||
var $counter = 0;
|
||||
|
||||
/**
|
||||
* Create a PlaDsmlExporter object
|
||||
* @param PlaAbstractExporter $exporter the decoree exporter
|
||||
*/
|
||||
function PlaDsmlExporter( $exporter ){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the entries to DSML
|
||||
*/
|
||||
function export(){
|
||||
global $lang;
|
||||
$pla_ldap_info = $this->pla_get_ldap_info();
|
||||
// not very elegant, but do the job for the moment as we have just 4 level
|
||||
$directory_entries_indent = " ";
|
||||
$entry_indent= " ";
|
||||
$attr_indent = " ";
|
||||
$attr_value_indent = " ";
|
||||
|
||||
// print declaration
|
||||
echo "<?xml version=\"1.0\"?>$this->br";
|
||||
|
||||
// print root element
|
||||
echo "<dsml>$this->br";
|
||||
|
||||
// print info related to this export
|
||||
echo "<!-- " . $this->br;
|
||||
echo "# " . sprintf( $lang['dsml_export_for_dn'], $pla_ldap_info->base_dn ) . $this->br;
|
||||
echo "# " . sprintf( $lang['generated_on_date'], date("F j, Y g:i a") ) . $this->br;
|
||||
echo "# " . $lang['server'] . ": " . $pla_ldap_info->server_name . " (" . $pla_ldap_info->server_host . ")" . $this->br;
|
||||
echo "# " . $lang['search_scope'] . ": " . $pla_ldap_info->scope . $this->br;
|
||||
echo "# " . $lang['total_entries'] . ": " . $this->pla_num_entries() . $this->br;
|
||||
echo "-->" . $this->br;
|
||||
|
||||
|
||||
echo $directory_entries_indent."<directory-entries>$this->br";
|
||||
//While there is an entry, fetch the entry as an array
|
||||
while($this->pla_has_entry()){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
$this->counter++;
|
||||
// display dn
|
||||
echo $entry_indent."<entry dn=\"". htmlspecialchars( $entry['dn'] ) ."\">".$this->br;
|
||||
array_shift($entry);
|
||||
|
||||
// echo the objectclass attributes first
|
||||
if(isset($entry['objectClass'])){
|
||||
echo $attr_indent."<objectClass>".$this->br;
|
||||
foreach($entry['objectClass'] as $ocValue){
|
||||
echo $attr_value_indent."<oc-value>$ocValue</oc-value>".$this->br;
|
||||
}
|
||||
echo $attr_indent."</objectClass>".$this->br;
|
||||
unset($entry['objectClass']);
|
||||
}
|
||||
|
||||
$binary_mode = 0;
|
||||
// display the attributes
|
||||
foreach($entry as $key=>$attr){
|
||||
echo $attr_indent."<attr name=\"$key\">".$this->br;
|
||||
|
||||
// if the attribute is binary, set the flag $binary_mode to true
|
||||
$binary_mode = is_attr_binary($pla_ldap_info->server_id,$key)?1:0;
|
||||
|
||||
foreach($attr as $value){
|
||||
echo $attr_value_indent."<value>".($binary_mode?base64_encode( $value): htmlspecialchars( $value ) )."</value>".$this->br;
|
||||
}
|
||||
echo $attr_indent."</attr>".$this->br;
|
||||
}// end foreach $entry
|
||||
echo $entry_indent."</entry>".$this->br;
|
||||
|
||||
// flush every 5th entry (speeds things up a bit)
|
||||
if( 0 == $this->counter % 5 )
|
||||
flush();
|
||||
}
|
||||
echo $directory_entries_indent."</directory-entries>$this->br";
|
||||
echo "</dsml>".$this->br;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PlaVcardExporter extends PlaExporter{
|
||||
|
||||
// mappping one to one attribute
|
||||
var $vcardMapping = array('cn' => 'FN',
|
||||
'title' => 'TITLE',
|
||||
'homePhone' => 'TEL;HOME',
|
||||
'mobile' => 'TEL;CELL',
|
||||
'mail' => 'EMAIL;Internet',
|
||||
'labeledURI' =>'URL',
|
||||
'o' => 'ORG',
|
||||
'audio' => 'SOUND',
|
||||
'facsmileTelephoneNumber' =>'TEL;WORK;HOME;VOICE;FAX',
|
||||
'jpegPhoto' => 'PHOTO;ENCODING=BASE64',
|
||||
'businessCategory' => 'ROLE',
|
||||
'description' => 'NOTE'
|
||||
);
|
||||
|
||||
var $deliveryAddress = array("postOfficeBox",
|
||||
"street",
|
||||
"l",
|
||||
"st",
|
||||
"postalCode",
|
||||
"c");
|
||||
|
||||
function PlaVcardExporter($exporter){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* When doing an exporter, the method export need to be overriden.
|
||||
* A basic implementation is provided here. Customize to your need
|
||||
**/
|
||||
|
||||
function export(){
|
||||
|
||||
// With the method pla->get_ldap_info,
|
||||
// you have access to some values related
|
||||
// to you ldap server
|
||||
$ldap_info = $this->pla_get_ldap_info();
|
||||
$base_dn = $ldap_info->base_dn;
|
||||
$server_id = $ldap_info->server_id;
|
||||
$scope = $ldap_info->scope;
|
||||
$server_name = $ldap_info->server_name;
|
||||
$server_host = $ldap_info->server_host;
|
||||
|
||||
while( $this->pla_has_entry() ){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
|
||||
//fetch the dn
|
||||
$dn = $entry['dn'];
|
||||
unset( $entry['dn'] );
|
||||
|
||||
// check the attributes needed for the delivery address
|
||||
// field
|
||||
$addr = "ADR:";
|
||||
foreach( $this->deliveryAddress as $attr_name ){
|
||||
if( isset( $entry[$attr_name] ) ){
|
||||
$addr .= $entry[$attr_name][0];
|
||||
unset($entry[$attr_name]);
|
||||
}
|
||||
$addr .= ';';
|
||||
}
|
||||
echo "BEGIN:VCARD$this->br";
|
||||
|
||||
// loop for the attributes
|
||||
foreach( $entry as $attr_name=>$attr_values ){
|
||||
|
||||
// if an attribute of the ldap entry exist
|
||||
// in the mapping array for vcard
|
||||
if( isset( $this->vcardMapping[$attr_name] ) ){
|
||||
|
||||
// case of organisation. Need to append the
|
||||
// possible ou attribute
|
||||
if( 0 == strcasecmp( $attr_name , 'o' )){
|
||||
echo $this->vcardMapping[$attr_name].":$attr_values[0]";
|
||||
if( isset($entry['ou'] ) )
|
||||
foreach( $entry['ou'] as $ou_value ){
|
||||
echo ";$ou_value";
|
||||
}
|
||||
}
|
||||
// the attribute is binary. (to do : need to fold the line)
|
||||
else if( 0 == strcasecmp( $attr_name,'audio') || 0 == strcasecmp( $attr_name,'jpegPhoto') ){
|
||||
echo $this->vcardMapping[$attr_name].":$this->br";
|
||||
echo " ".base64_encode( $attr_values[0]);
|
||||
}
|
||||
/* else if( $attr_name == "sn"){
|
||||
echo $this->vcardMapping[$attr_name].":$attr_values[0]";
|
||||
}
|
||||
elseif( $attr_name == "homePostalAddress"){
|
||||
}*/
|
||||
// else just print the value with the relevant attribute name
|
||||
else{
|
||||
echo $this->vcardMapping[$attr_name].":$attr_values[0]";
|
||||
}
|
||||
echo $this->br;
|
||||
}
|
||||
}
|
||||
// need to check
|
||||
echo "UID:$dn";
|
||||
echo $this->br;
|
||||
echo "VERSION:2.1";
|
||||
echo $this->br;
|
||||
echo $addr;
|
||||
echo $this->br;
|
||||
echo "END:VCARD";
|
||||
echo $this->br;
|
||||
}// end while
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Export to cvs format
|
||||
*
|
||||
* @author Glen Ogilvie
|
||||
*/
|
||||
|
||||
class PlaCSVExporter extends PlaExporter{
|
||||
|
||||
function PlaCSVExporter($exporter){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* When doing an exporter, the method export need to be overriden.
|
||||
* A basic implementation is provided here. Customize to your need
|
||||
**/
|
||||
|
||||
var $separator = ",";
|
||||
var $qualifier = '"';
|
||||
var $multivalue_separator = " | ";
|
||||
var $escapeCode = '"';
|
||||
|
||||
function export(){
|
||||
|
||||
// With the method pla->get_ldap_info,
|
||||
// you have access to some values related
|
||||
// to you ldap server
|
||||
$ldap_info = $this->pla_get_ldap_info();
|
||||
$base_dn = $ldap_info->base_dn;
|
||||
$server_id = $ldap_info->server_id;
|
||||
$scope = $ldap_info->scope;
|
||||
$server_name = $ldap_info->server_name;
|
||||
$server_host = $ldap_info->server_host;
|
||||
|
||||
$entries = array();
|
||||
$headers = array();
|
||||
|
||||
// go thru and find all the attribute names first. This is needed, because, otherwise we have
|
||||
// no idea as to which search attributes were actually populated with data
|
||||
while( $this->pla_has_entry() ) {
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
foreach (array_keys($entry) as $key) {
|
||||
if (!in_array($key, $headers))
|
||||
array_push($headers,$key);
|
||||
}
|
||||
array_push($entries, $entry);
|
||||
}
|
||||
|
||||
$num_headers = count($headers);
|
||||
|
||||
// print out the headers
|
||||
for ($i = 0; $i < $num_headers; $i++) {
|
||||
echo $this->qualifier. $headers[$i].$this->qualifier;
|
||||
if ($i < $num_headers-1)
|
||||
echo $this->separator;
|
||||
}
|
||||
|
||||
array_shift($headers);
|
||||
$num_headers--;
|
||||
|
||||
echo $this->br;
|
||||
|
||||
// loop on every entry
|
||||
foreach ($entries as $entry) {
|
||||
|
||||
//print the dn
|
||||
$dn = $entry['dn'];
|
||||
unset( $entry['dn'] );
|
||||
echo $this->qualifier. $this->LdapEscape($dn).$this->qualifier.$this->separator;
|
||||
|
||||
// print the attributes
|
||||
for($j=0;$j<$num_headers;$j++){
|
||||
|
||||
$attr_name = $headers[$j];
|
||||
|
||||
echo $this->qualifier;
|
||||
if (key_exists($attr_name, $entry)) {
|
||||
$binary_attribute = is_attr_binary( $server_id, $attr_name )?1:0;
|
||||
|
||||
$attr_values = $entry[$attr_name];
|
||||
|
||||
$num_attr_values = count( $attr_values );
|
||||
for( $i=0 ; $i<$num_attr_values; $i++){
|
||||
if($binary_attribute)
|
||||
echo base64_encode($attr_values[$i]);
|
||||
else
|
||||
echo $this->LdapEscape($attr_values[$i]);
|
||||
|
||||
if($i < $num_attr_values - 1)
|
||||
echo $this->multivalue_separator;
|
||||
|
||||
}
|
||||
}// end if key
|
||||
echo $this->qualifier;
|
||||
if( $j < $num_headers - 1 )
|
||||
echo $this->separator;
|
||||
}
|
||||
echo $this->br;
|
||||
}
|
||||
}//end export
|
||||
|
||||
// function to escape data, where the qualifier happens to also
|
||||
// be in the data.
|
||||
function LdapEscape ($var) {
|
||||
return str_replace($this->qualifier, $this->escapeCode.$this->qualifier, $var);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class MyCustomExporter extends PlaExporter{
|
||||
|
||||
function MyCutsomExporter($exporter){
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* When doing an exporter, the method export need to be overriden.
|
||||
* A basic implementation is provided here. Customize to your need
|
||||
**/
|
||||
|
||||
|
||||
function export(){
|
||||
|
||||
// With the method pla->get_ldap_info,
|
||||
// you have access to some values related
|
||||
// to you ldap server
|
||||
$ldap_info = $this->pla_get_ldap_info();
|
||||
$base_dn = $ldap_info->base_dn;
|
||||
$server_id = $ldap_info->server_id;
|
||||
$scope = $ldap_info->scope;
|
||||
$server_name = $ldap_info->server_name;
|
||||
$server_host = $ldap_info->server_host;
|
||||
|
||||
|
||||
// Just a simple loop. For each entry
|
||||
// do your custom export
|
||||
// see PlaLdifExporter or PlaDsmlExporter as an example
|
||||
while( $this->pla_has_entry() ){
|
||||
$entry = $this->pla_fetch_entry_array();
|
||||
|
||||
//fetch the dn
|
||||
$dn = $entry['dn'];
|
||||
unset( $entry['dn'] );
|
||||
|
||||
// loop for the attributes
|
||||
foreach( $entry as $attr_name=>$attr_values ){
|
||||
foreach( $attr_values as $value ){
|
||||
|
||||
// simple example
|
||||
// echo "Attribute Name:".$attr_name;
|
||||
// echo " - value:".$value;
|
||||
// echo $this->br;
|
||||
}
|
||||
}
|
||||
|
||||
}// end while
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
2922
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
|
||||
}
|
21
header.php
@ -1,7 +1,12 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/header.php,v 1.14 2004/10/24 23:51:49 uugdave Exp $
|
||||
|
||||
// We want to get $language into scope in case we were included
|
||||
// from within a function
|
||||
global $language;
|
||||
|
||||
// text/xml won't work with MSIE, but is very useful for debugging xhtml code.
|
||||
//@header( "Content-type: text/xml; charset=\"UTF-8\"" );
|
||||
@header( "Content-type: text/html; charset=\"UTF-8\"" );
|
||||
|
||||
// XML version and encoding for well-behaved browsers
|
||||
@ -13,8 +18,16 @@
|
||||
<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>
|
||||
|
21
help.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
include 'common.php';
|
||||
include 'header.php';
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
|
||||
<h3 class="title">Help</h3>
|
||||
<br />
|
||||
<center>
|
||||
<p>Do you have a problem or question?</p>
|
||||
<p>Perhaps you are new to LDAP and need a little guidance?</p>
|
||||
<p>Help is only one click away. Visit the online <a href="http://www.phpldapadmin.com/forum">phpLDAPadmin support forum</a>.</p>
|
||||
<br />
|
||||
<p>(Note that paying members will receive priority support, so <a target="new" href="https://www.phpldapadmin.com/product_info.php/products_id/28">buy your membership</a> today.)</p>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
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/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 |
BIN
images/countries/dz.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ec.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ee.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/eg.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/er.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/es.png
Normal file
After Width: | Height: | Size: 1.0 KiB |