Compare commits
1 Commits
RELEASE-0.
...
RELEASE-0.
Author | SHA1 | Date | |
---|---|---|---|
|
d12096bbd3 |
10
add_attr.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr.php,v 1.8 2004/04/26 22:58:00 xrenard Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr.php,v 1.10 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -14,7 +14,7 @@
|
||||
* - binary
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = $_POST['server_id'];
|
||||
@@ -40,6 +40,12 @@ have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
// 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'] );
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr_form.php,v 1.6 2004/04/26 13:01:24 uugdave Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_attr_form.php,v 1.9 2004/09/15 12:31:52 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -11,7 +11,7 @@
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@@ -24,8 +24,9 @@ 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'] );
|
||||
$friendly_attrs = process_friendly_attr_table();
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -42,7 +43,7 @@ $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 && 'objectclass' == get_class( $schema_oclass ) )
|
||||
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 );
|
||||
@@ -79,6 +80,7 @@ foreach( $avail_attrs as $i => $attr ) {
|
||||
<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 ) ] ) ) {
|
||||
@@ -116,6 +118,7 @@ foreach( $avail_attrs as $i => $attr ) {
|
||||
<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 ) ] ) ) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass.php,v 1.7 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass.php,v 1.11 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
/*
|
||||
* add_oclass.php
|
||||
@@ -16,7 +16,7 @@
|
||||
* - new_attrs (array, if any)
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@@ -24,7 +24,7 @@ $new_oclass = $_POST['new_oclass'];
|
||||
$server_id = $_POST['server_id'];
|
||||
$new_attrs = $_POST['new_attrs'];
|
||||
|
||||
if( is_attr_read_only( 'objectClass' ) )
|
||||
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'] );
|
||||
@@ -39,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 )
|
||||
@@ -55,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,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass_form.php,v 1.9 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_oclass_form.php,v 1.15 2004/10/22 13:58:59 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -17,7 +17,7 @@
|
||||
* - new_oclass
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@@ -47,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 ) )
|
||||
$needed_attrs[] = $attr;
|
||||
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>
|
||||
@@ -85,8 +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 ) { ?>
|
||||
<tr><td class="attr"><b><?php echo htmlspecialchars($attr); ?></b></td></tr>
|
||||
<tr><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>
|
||||
@@ -102,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,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value.php,v 1.10 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value.php,v 1.13 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -16,7 +16,7 @@
|
||||
* On failure, echo an error.
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = rawurldecode( $_POST['dn'] );
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@@ -28,13 +28,14 @@ $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( $attr ) )
|
||||
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.
|
||||
@@ -49,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,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value_form.php,v 1.23 2004/04/23 12:15:29 uugdave Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/add_value_form.php,v 1.26 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -13,7 +13,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = isset( $_GET['dn'] ) ? $_GET['dn'] : null;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@@ -46,7 +46,7 @@ if( $is_object_class ) {
|
||||
$schema_attr = get_schema_attribute( $server_id, $attr );
|
||||
}
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -120,7 +120,11 @@ 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>
|
||||
|
||||
|
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,15 +1,15 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/check_lang_files.php,v 1.8 2004/04/02 14:44:46 uugdave Exp $
|
||||
// $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.8 $
|
||||
// phpldapadmin/check_lang_files.php, $Revision: 1.9 $
|
||||
|
||||
echo "<html><head><title>phpldapadmin - check of translation</title></head><body>";
|
||||
|
||||
include realpath( './lang/en.php' );
|
||||
$english_lang = $lang;
|
||||
unset( $lang );
|
||||
$lang_dir = realpath( './lang' );
|
||||
$lang_dir = realpath( './lang/recoded' );
|
||||
$dir = opendir( $lang_dir );
|
||||
|
||||
// First, detect any unused strings from the english language:
|
||||
@@ -39,6 +39,7 @@ if( false === $unused_keys )
|
||||
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
|
||||
@@ -47,12 +48,13 @@ while( ( $file = readdir( $dir ) ) !== false ) {
|
||||
// Sanity check. Is this really a PHP file?
|
||||
if( ! preg_match( "/\.php$/", $file ) )
|
||||
continue;
|
||||
echo "<h2>$file</h2>\n";
|
||||
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;
|
||||
@@ -65,7 +67,9 @@ while( ( $file = readdir( $dir ) ) !== false ) {
|
||||
}
|
||||
if( ! $has_errors )
|
||||
echo "(No errors)\n";
|
||||
}
|
||||
echo "</ol>\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/collapse.php,v 1.10 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/collapse.php,v 1.11 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -14,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 );
|
||||
|
30
common.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/common.php,v 1.49 2004/05/10 12:28:07 uugdave Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/common.php,v 1.55 2004/10/14 20:32:48 uugdave Exp $
|
||||
|
||||
/*
|
||||
* common.php
|
||||
@@ -7,8 +7,23 @@
|
||||
* 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)
|
||||
error_reporting( E_ALL );
|
||||
if( phpversion() >= "5" )
|
||||
// E_DEBUG is PHP5 specific and prevents warnings about using 'var' to declar class members
|
||||
error_reporting( 'E_DEBUG' );
|
||||
else
|
||||
// For PHP4
|
||||
error_reporting( E_ALL );
|
||||
|
||||
|
||||
// For PHP5 backward/forward compatibility
|
||||
if( ! defined( 'E_STRICT' ) ) {
|
||||
define( 'E_STRICT', 2048 );
|
||||
}
|
||||
|
||||
/** The minimum version of PHP required to run phpLDAPadmin. */
|
||||
@define( 'REQUIRED_PHP_VERSION', '4.1.0' );
|
||||
@@ -52,16 +67,16 @@ if( file_exists( realpath( './config.php' ) ) ) {
|
||||
}
|
||||
|
||||
$required_files = array(
|
||||
// Functions that can be defined by the user (preEntryDelete(), postEntryDelete(), etc.)
|
||||
// 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',
|
||||
// The base English language strings
|
||||
'./lang/recoded/en.php' );
|
||||
'./emuhash_functions.php' );
|
||||
|
||||
|
||||
// Include each required file and check for sanity.
|
||||
@@ -75,7 +90,8 @@ foreach( $required_files as $file_name ) {
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
pla_session_start();
|
||||
if( pla_session_start() )
|
||||
postSessionInit();
|
||||
|
||||
// Language configuration. Auto or specified?
|
||||
// Shall we attempt to auto-determine the language?
|
||||
|
@@ -11,6 +11,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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();
|
||||
@@ -34,12 +40,15 @@ $servers[$i]['auth_type'] = 'config'; /* Three options for auth_type:
|
||||
login dn and password.
|
||||
2. 'session': same as cookie but your login dn
|
||||
and password are stored on the web server in
|
||||
a session variable.
|
||||
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. */
|
||||
information appropriately for your situation. If
|
||||
you choose 'cookie', your cookie contents will be
|
||||
encrypted using blowfish and the secret your specify
|
||||
above as $blowfish_secret. */
|
||||
$servers[$i]['login_dn'] = 'cn=Manager,dc=example,dc=com';
|
||||
/* The DN of the user for phpLDAPadmin to bind with.
|
||||
For anonymous binds or 'cookie' or 'session' auth_types,
|
||||
@@ -68,7 +77,17 @@ $servers[$i]['login_attr'] = 'dn'; /* If you specified 'cookie' or 'se
|
||||
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. */
|
||||
'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
|
||||
@@ -106,8 +125,20 @@ $servers[$i]['auto_uid_number_search_dn'] = '';
|
||||
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 */
|
||||
/* 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++;
|
||||
@@ -142,6 +173,32 @@ $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
|
||||
@@ -206,10 +263,13 @@ $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;
|
||||
|
||||
// If true, display password values as ******. Otherwise display them in clear-text
|
||||
// If you use clear-text passwords, it is recommended to set this to true. If you use
|
||||
// hashed passwords (sha, md5, crypt, etc), hashed passwords are already obfuscated by
|
||||
// the hashing algorithm and this should probably be left false.
|
||||
// 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;
|
||||
|
||||
/** **/
|
||||
@@ -264,8 +324,14 @@ $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 **/
|
||||
@@ -275,43 +341,49 @@ $friendly_attrs[ 'telephoneNumber' ] = 'Phone';
|
||||
// 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=posixAcount))';
|
||||
/* The LDAP filter to use */
|
||||
//$queries[$q]['attributes'] = 'uid, smbHome, uidNumber';
|
||||
$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'] = 'Organizations';
|
||||
//$queries[$q]['server'] = '0';
|
||||
//$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
//$queries[$q]['scope'] = 'sub';
|
||||
//$queries[$q]['filter'] = '(|(objeCtclass=organization)(objectClass=organizationalUnit))';
|
||||
//$queries[$q]['attributes'] = 'ou, o';
|
||||
$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';
|
||||
|
||||
//$q++;
|
||||
//$queries[$q]['name'] = 'Last name starts with S';
|
||||
//$queries[$q]['server'] = '0';
|
||||
//$queries[$q]['base'] = 'dc=example,dc=com';
|
||||
//$queries[$q]['scope'] = 'sub';
|
||||
//$queries[$q]['filter'] = '(sn=s*)';
|
||||
//$queries[$q]['attributes'] = '*';
|
||||
|
||||
?>
|
||||
|
11
copy.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy.php,v 1.22 2004/04/23 12:21:53 uugdave Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy.php,v 1.25 2004/08/15 17:35:25 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -29,7 +29,7 @@ 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 ) ) )
|
||||
@@ -96,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 />
|
||||
@@ -145,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.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy_form.php,v 1.16 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/copy_form.php,v 1.19 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -10,7 +10,7 @@
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'] ;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@@ -25,13 +25,22 @@ $attrs = get_object_attrs( $server_id, $dn );
|
||||
$server_name = $servers[$server_id]['name'];
|
||||
|
||||
$select_server_html = "";
|
||||
foreach( $servers as $id => $server )
|
||||
if (count($servers)>1){
|
||||
$select_server_html .= '<select name="dest_server_id">';
|
||||
foreach( $servers as $id => $server )
|
||||
if( $server['host'] )
|
||||
$select_server_html .= "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . htmlspecialchars($server['name']) . "</option>\n";
|
||||
$select_server_html .= '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
$select_server_html .= "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . htmlspecialchars($server['name']) . "</option>\n";
|
||||
$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 ) { ?>
|
||||
@@ -72,7 +81,7 @@ if( is_array( $children ) && count( $children ) > 0 ) { ?>
|
||||
|
||||
<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( is_array( $children ) && count( $children ) > 0 ) { ?>
|
||||
|
33
create.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create.php,v 1.21 2004/05/11 12:23:08 uugdave Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create.php,v 1.29 2004/10/28 13:37:39 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -16,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 ) )
|
||||
@@ -67,17 +68,26 @@ $new_entry['objectClass'] = $object_classes;
|
||||
if( ! in_array( 'top', $new_entry['objectClass'] ) )
|
||||
$new_entry['objectClass'][] = 'top';
|
||||
|
||||
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 ] = $v;
|
||||
else
|
||||
$new_entry[ $attr ] = $vals;
|
||||
}
|
||||
|
||||
//echo "<pre>"; var_dump( $new_dn );print_r( $new_entry ); echo "</pre>";
|
||||
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
|
||||
// Check the user-defined custom call back first
|
||||
if( true === preEntryCreate( $server_id, $new_dn, $new_entry ) )
|
||||
@@ -87,7 +97,10 @@ 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 );
|
||||
|
||||
if( array_key_exists( 'tree', $_SESSION ) )
|
||||
{
|
||||
@@ -108,21 +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 $edit_url; ?>';
|
||||
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['redirecting'] ?> <a href="<?php echo $edit_url; ?>"><?php echo $lang['here']?></a>.
|
||||
<?php echo $lang['redirecting'] ?> <a href="<?php echo $redirect_url; ?>"><?php echo $lang['here']?></a>.
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
110
create_form.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create_form.php,v 1.13 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/create_form.php,v 1.21 2004/10/28 13:37:39 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -12,7 +12,7 @@
|
||||
* - container (rawurlencoded) (optional)
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
$server_id = $_REQUEST['server_id'];
|
||||
@@ -27,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">';
|
||||
$js_dn_list = '';
|
||||
foreach( $servers as $id => $server ) {
|
||||
if( $server['host'] ) {
|
||||
$server_menu_html .= '<option value="'.$id.'"' . ( $id==$server_id? ' selected' : '' ) . '>';
|
||||
$server_menu_html .= $server['name'] . '</option>';
|
||||
$server_menu_html = '';
|
||||
if (count($servers)>1){
|
||||
$server_menu_html .= '<select name="server_id">';
|
||||
$js_dn_list = '';
|
||||
foreach( $servers as $id => $server ) {
|
||||
if( $server['host'] ) {
|
||||
$server_menu_html .= '<option value="'.$id.'"' . ( $id==$server_id? ' selected="true"' : '' ) . '>';
|
||||
$server_menu_html .= $server['name'] . '</option>';
|
||||
}
|
||||
}
|
||||
$server_menu_html .= '</select>';
|
||||
} else {
|
||||
$server = reset($servers);
|
||||
if( $server['host'] )
|
||||
$server_menu_html .= '<input type="hidden" name="server_id" value="'.key($servers).'" />' .
|
||||
'<b>' . $server['name'] . '</b>';
|
||||
}
|
||||
$server_menu_html .= '</select>';
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -52,41 +60,57 @@ include 'header.php'; ?>
|
||||
<td><?php echo $server_menu_html; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="heading"><?php echo $lang['template']; ?>:</td>
|
||||
<td>
|
||||
<table class="templates">
|
||||
<?php
|
||||
foreach( $templates as $name => $template ) {
|
||||
// Check and see if this template should be shown in the list
|
||||
$isValid = false;
|
||||
if (isset($template['regexp'])) {
|
||||
if (@preg_match("/".$template['regexp']."/i", $container)) {
|
||||
$isValid = true;
|
||||
}
|
||||
} else {
|
||||
$isValid = true;
|
||||
}
|
||||
|
||||
if ($isValid) {
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="radio"
|
||||
name="template"
|
||||
value="<?php echo htmlspecialchars($name);?>"
|
||||
id="<?php echo htmlspecialchars($name); ?>"
|
||||
<?php if( 0 == strcasecmp( 'Custom', $name ) ) { ?>
|
||||
checked
|
||||
<?php } ?>
|
||||
/></td>
|
||||
<td class="icon"><label for="<?php echo htmlspecialchars($name);?>"><img src="<?php echo $template['icon']; ?>" /></label></td>
|
||||
<td><label for="<?php echo htmlspecialchars($name);?>"><?php echo htmlspecialchars( $template['desc'] ); ?></label></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end if
|
||||
|
||||
} // end foreach ?>
|
||||
<td class="heading">
|
||||
<?php echo $lang['template']; ?>:
|
||||
</td>
|
||||
<td>
|
||||
<table class="template_display">
|
||||
<tr>
|
||||
<td>
|
||||
<table class="templates">
|
||||
<?php
|
||||
$count = count( $templates );
|
||||
$i = -1;
|
||||
foreach( $templates as $name => $template ) {
|
||||
$i++;
|
||||
// Balance the columns properly
|
||||
if( ( count( $templates ) % 2 == 0 && $i == intval( $count / 2 ) ) ||
|
||||
( count( $templates ) % 2 == 1 && $i == intval( $count / 2 ) + 1 ) )
|
||||
echo "</table></td><td><table class=\"templates\">";
|
||||
// Check and see if this template should be shown in the list
|
||||
$isValid = false;
|
||||
if( isset($template['regexp'] ) ) {
|
||||
if( @preg_match( "/".$template['regexp']."/i", $container ) ) {
|
||||
$isValid = true;
|
||||
}
|
||||
} else {
|
||||
$isValid = true;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><input type="radio" name="template" value="<?php echo htmlspecialchars($name);?>"
|
||||
id="<?php echo htmlspecialchars($name); ?>"
|
||||
<?php if( 0 == strcasecmp( 'Custom', $name ) ) echo ' checked';
|
||||
if( ! $isValid ) echo ' disabled'; ?> />
|
||||
</td>
|
||||
<td class="icon"><label for="<?php echo htmlspecialchars($name);?>"><img src="<?php echo $template['icon']; ?>" /></label></td>
|
||||
<td>
|
||||
<label for="<?php echo htmlspecialchars($name);?>">
|
||||
<?php if( 0 == strcasecmp( 'Custom', $template['desc'] ) ) echo '<b>';
|
||||
if( ! $isValid ) echo "<span style=\"color: gray\"><acronym title=\"This template is not allowed in this container\">";
|
||||
echo htmlspecialchars( $template['desc'] );
|
||||
if( ! $isValid ) echo "</acronym></span>";
|
||||
if( 0 == strcasecmp( 'Custom', $template['desc'] ) ) echo '</b>'; ?>
|
||||
</label></td>
|
||||
</tr>
|
||||
<?php
|
||||
} // end foreach ?>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/creation_template.php,v 1.11 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
|
||||
|
||||
// $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
|
||||
@@ -12,23 +10,35 @@
|
||||
* template
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require_once 'common.php';
|
||||
require 'templates/template_config.php';
|
||||
|
||||
isset( $_POST['template'] ) or pla_error( $lang['must_choose_template'] );
|
||||
$template = $_POST['template'];
|
||||
$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 = isset( $templates[$template] ) ? $templates[$template] : null;
|
||||
$server_id = $_POST['server_id'];
|
||||
$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';
|
||||
|
||||
?>
|
||||
|
||||
@@ -38,15 +48,15 @@ include 'header.php';
|
||||
|
||||
<?php
|
||||
|
||||
if( ! isset( $_POST['template'] ) )
|
||||
pla_error( $lang['ctemplate_no_template'] );
|
||||
|
||||
$handler = 'templates/creation/' . $template['handler'];
|
||||
$handler = realpath( $handler );
|
||||
if( file_exists( $handler ) )
|
||||
include $handler;
|
||||
else
|
||||
pla_error( $lang['ctemplate_config_handler'] . " <b>" . htmlspecialchars( $template['handler'] ) .
|
||||
"</b> " . $lang['ctemplate_handler_does_not_exist']);
|
||||
if( ! file_exists( $handler ) )
|
||||
pla_error( sprintf( $lang['template_does_not_exist'], htmlspecialchars( $template['handler'] ) ) );
|
||||
if( ! is_readable( $handler ) )
|
||||
pla_error( sprintf( $lang['template_not_readable'], htmlspecialchars( $template['handler'] ) ) );
|
||||
|
||||
include $handler;
|
||||
|
||||
echo "</body>\n</html>";
|
||||
|
||||
?>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/custom_functions.php,v 1.5 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/custom_functions.php,v 1.6 2004/05/27 13:25:13 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -93,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
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete.php,v 1.16 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete.php,v 1.18 2004/08/15 17:35:25 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -27,7 +27,8 @@ 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 ) ) {
|
||||
@@ -43,6 +44,7 @@ if( $del_result )
|
||||
|
||||
// kill the DN from the tree browser session variable and
|
||||
// refresh the tree viewer frame (left_frame)
|
||||
|
||||
if( array_key_exists( 'tree', $_SESSION ) )
|
||||
{
|
||||
$tree = $_SESSION['tree'];
|
||||
@@ -62,7 +64,7 @@ if( $del_result )
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
include 'header.php';
|
||||
include './header.php';
|
||||
|
||||
?>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_attr.php,v 1.6 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_attr.php,v 1.9 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -10,7 +10,7 @@
|
||||
* On failure, echo an error.
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
@@ -18,7 +18,7 @@ $dn = $_POST['dn'] ;
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
$attr = $_POST['attr'];
|
||||
|
||||
if( is_attr_read_only( $attr ) )
|
||||
if( is_attr_read_only( $server_id, $attr ) )
|
||||
pla_error( sprintf( $lang['attr_is_read_only'], htmlspecialchars( $attr ) ) );
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
if( is_server_read_only( $server_id ) )
|
||||
@@ -30,6 +30,7 @@ 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 )
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_form.php,v 1.12 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/delete_form.php,v 1.17 2004/10/21 00:14:48 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -11,7 +11,7 @@
|
||||
* - server_id
|
||||
*/
|
||||
|
||||
require 'common.php';
|
||||
require './common.php';
|
||||
|
||||
$dn = $_GET['dn'];
|
||||
$encoded_dn = rawurlencode( $dn );
|
||||
@@ -26,10 +26,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'] );
|
||||
|
||||
$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>
|
||||
|
||||
|
11
doc/CREDITS
@@ -1,8 +1,7 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/CREDITS,v 1.14 2004/05/08 14:11:28 i18phpldapadmin Exp $
|
||||
* Project Developers:
|
||||
|
||||
- David Smith Maintainer
|
||||
- Xavier Renard Import/Export
|
||||
- Xavier Renard Import/Export and Samba
|
||||
- Uwe Ebel I18n
|
||||
|
||||
* Patch writers:
|
||||
@@ -25,7 +24,7 @@ $Header: /cvsroot/phpldapadmin/phpldapadmin/doc/CREDITS,v 1.14 2004/05/08 14:11:
|
||||
|
||||
* Translators:
|
||||
|
||||
- Marius Reider, German
|
||||
- Marius Reider, German
|
||||
Uwe Ebel,
|
||||
Dieter Kluenter
|
||||
- Xavier Renard French
|
||||
@@ -34,11 +33,15 @@ $Header: /cvsroot/phpldapadmin/phpldapadmin/doc/CREDITS,v 1.14 2004/05/08 14:11:
|
||||
- Andreu Sanchez Spanish and Catal<61>
|
||||
- Dmitry Gorpinenko, Russian
|
||||
Aleksey Soldatov
|
||||
Sergey Saukh
|
||||
- Unknown Italian
|
||||
- Alexandre Maciel Brasilian (Portuguese)
|
||||
- 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
|
||||
|
@@ -1,4 +1,56 @@
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/ChangeLog,v 1.15 2004/05/11 12:25:23 uugdave Exp $
|
||||
|
||||
* 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
|
||||
|
||||
|
@@ -1,103 +1,101 @@
|
||||
README-translation
|
||||
==================
|
||||
$Header: /cvsroot/phpldapadmin/phpldapadmin/doc/README-translation.txt,v 1.2 2004/02/29 19:59:06 i18phpldapadmin Exp $
|
||||
$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 support the languages
|
||||
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
|
||||
- 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?
|
||||
|
||||
Where are the files located?
|
||||
All files are unter
|
||||
All files are in the directory:
|
||||
|
||||
phpldapadmin/lang/
|
||||
|
||||
* How are the files named?
|
||||
|
||||
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).
|
||||
|
||||
Every language is named by its local representing. For example english en and
|
||||
british english by en_GB but here we use only en.
|
||||
|
||||
|
||||
Is the location phpldapadmin/lang/ used in the application?
|
||||
* 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?
|
||||
* 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 translation is in single quote "'"
|
||||
* Don't use html-code in the translation.
|
||||
* If something should be highlighted we use double quote
|
||||
'"'.
|
||||
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?
|
||||
* Why shouldn't I use html-code?
|
||||
|
||||
* No problemens wich htmlspecialchars
|
||||
* No JavaScript problems
|
||||
* Open way for other targets like xml or other (only as a idea)
|
||||
* No problem with "wellformed" output (maybe)
|
||||
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.
|
||||
|
||||
For example the ">" is then convert to "&gt;" that we don't
|
||||
want, so it is better to use ">". If we have a Char like "&" that is
|
||||
in the used functions convert to "&" what is correct.
|
||||
* How could I start?
|
||||
|
||||
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 to the "end"
|
||||
as a comment. Look at the de.php and you know what I mean.
|
||||
* Modify the Makefile that your langugage is also convert.
|
||||
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 see how complete the translation is?
|
||||
The phpLDAPadmin contains the file phpldapadmin/check_lang_files.php
|
||||
Open it in your browser and you see how complete your translation is.
|
||||
* How could I verify that my translation is complete?
|
||||
|
||||
* extra entry: if entry is not in the en.php, maybe the value was
|
||||
changed in en.php or you type in a wrong key.
|
||||
* missing entry: the entry is missing in the translated langugage
|
||||
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?
|
||||
|
||||
What is zz.php and the zzz.php in the phpldapadmin/lang/?
|
||||
Well that is not really a language. That is only for developers
|
||||
and translators.
|
||||
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 hardcode it in the config.php file. That is not the
|
||||
* 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 like this:
|
||||
* from Menu
|
||||
Edit->Preferences
|
||||
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.
|
||||
Do the same if you want to activate/test your translation.
|
||||
|
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/documentation.php,v 1.2 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $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,8 +1,8 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/download_binary_attr.php,v 1.6 2004/04/18 15:51:24 uugdave Exp $
|
||||
// $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'] );
|
||||
@@ -12,7 +12,8 @@ $value_num = isset( $_GET['value_num'] ) ? $_GET['value_num'] : 0;
|
||||
|
||||
check_server_id( $server_id ) or pla_error( $lang['bad_server_id'] );
|
||||
have_auth_info( $server_id ) or pla_error( $lang['not_enough_login_info'] );
|
||||
$ds = pla_ldap_connect( $server_id ) or pla_error( $lang['could_not_connect'] );
|
||||
$ds = pla_ldap_connect( $server_id );
|
||||
pla_ldap_connection_is_error( $ds );
|
||||
dn_exists( $server_id, $dn ) or pla_error( sprintf( $lang['no_such_entry'], pretty_print_dn( $dn ) ) );
|
||||
|
||||
$search = @ldap_read( $ds, $dn, "(objectClass=*)", array( $attr ), 0, 0, 0, get_view_deref_setting() );
|
||||
|
11
edit.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/edit.php,v 1.46 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/edit.php,v 1.48 2004/10/14 03:33:36 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -16,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'] );
|
||||
@@ -34,8 +34,11 @@ $default_href = "edit.php?server_id=$server_id&dn=$encoded_dn&use_defaul
|
||||
$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' );
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/entry_chooser.php,v 1.14 2004/04/13 03:37:36 uugdave Exp $
|
||||
// $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;
|
||||
@@ -34,7 +34,10 @@ 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'] );
|
||||
|
||||
$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 );
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/expand.php,v 1.15 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/expand.php,v 1.18 2004/08/15 17:39:20 uugdave Exp $
|
||||
|
||||
|
||||
/*
|
||||
@@ -14,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");
|
||||
@@ -38,8 +38,9 @@ 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;
|
||||
|
26
export.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export.php,v 1.6 2004/05/05 23:22:57 xrenard Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export.php,v 1.11 2004/10/23 21:13:15 uugdave Exp $
|
||||
|
||||
require 'export_functions.php';
|
||||
|
||||
@@ -8,6 +8,15 @@ $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'] );
|
||||
@@ -16,7 +25,7 @@ isset($exporters[$exporter_id]) or pla_error( $lang['invalid_export_format'] );
|
||||
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 varaiables
|
||||
// Initialisation of other variables
|
||||
$rdn = get_rdn( $base_dn );
|
||||
$friendly_rdn = get_rdn( $base_dn, 1 );
|
||||
$extension = $exporters[$exporter_id]['extension'];
|
||||
@@ -38,7 +47,7 @@ switch( $format ) {
|
||||
}
|
||||
|
||||
// get the decoree,ie the source
|
||||
$plaLdapExporter = new PlaLdapExporter($server_id,'objectclass=*',$base_dn,$scope);
|
||||
$plaLdapExporter = new PlaLdapExporter($server_id,$filter,$base_dn,$scope,$attributes);
|
||||
|
||||
// the decorator
|
||||
// do it that way for the moment
|
||||
@@ -51,6 +60,12 @@ switch($exporter_id){
|
||||
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();
|
||||
@@ -64,7 +79,10 @@ $exporter->setOutputFormat($br);
|
||||
@set_time_limit( 0 );
|
||||
|
||||
// send the header
|
||||
header( "Content-type: application/download" );
|
||||
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" );
|
||||
|
180
export_form.php
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_form.php,v 1.7 2004/05/05 23:21:57 xrenard Exp $
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_form.php,v 1.19 2004/10/24 23:51:49 uugdave Exp $
|
||||
|
||||
/**
|
||||
* export_form.php
|
||||
@@ -12,13 +12,16 @@
|
||||
require 'export_functions.php';
|
||||
|
||||
$server_id = isset( $_GET['server_id'] ) ? $_GET['server_id']:NULL ;
|
||||
$format = isset( $_GET['format'] ) ? $_GET['format'] : "unix" ;
|
||||
$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',
|
||||
'unix' => 'UNIX (Linux, BSD)',
|
||||
'mac' => 'Macintosh',
|
||||
'win' => 'Windows'
|
||||
);
|
||||
@@ -30,7 +33,7 @@ $available_scopes = array(
|
||||
);
|
||||
|
||||
|
||||
include 'header.php'; ?>
|
||||
include './header.php'; ?>
|
||||
|
||||
<body>
|
||||
<h3 class="title"><?php echo $lang['export']; ?></h3>
|
||||
@@ -39,71 +42,120 @@ include 'header.php'; ?>
|
||||
<form name="export_form" action="export.php" method="POST">
|
||||
<table class="export_form">
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang['export']; ?></legend>
|
||||
<legend><?php echo $lang['export']; ?></legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td><?php echo $lang['server']; ?></td>
|
||||
<td>
|
||||
<select name="server_id">
|
||||
<?php
|
||||
foreach( $servers as $id => $server )
|
||||
if( $server['host'] )
|
||||
echo "<option value=\"$id\"". ($id==$server_id?" selected":"") .">" . htmlspecialchars($server['name']) . "</option>\n";
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><acronym title="<?php echo $lang['distinguished_name'];?>">DN</acronym></td>
|
||||
<td><nobr><input type="text" name="dn" id="dn" style="width:200px" value="<?php echo htmlspecialchars( $dn ); ?>" /> <?php draw_chooser_link( 'export_form.dn' ); ?></nobr></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<fieldset>
|
||||
<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'; ?> />
|
||||
<label for="<?php echo htmlspecialchars( $index ); ?>"><?php echo htmlspecialchars( $exporter['desc'] ); ?></label><br />
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<fieldset>
|
||||
<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'; ?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
<?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>
|
||||
<fieldset>
|
||||
<legend><?php echo $lang['search_scope']; ?></legend>
|
||||
<?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';?> /><label for="<?php echo $id; ?>"><?php echo $desc; ?></label><br />
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" ><center><input type="submit" value="<?php echo $lang['createf_proceed']; ?>"></center></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
</body>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<center>
|
||||
<input type="submit" name="target" value="<?php echo $lang['proceed_gt']; ?>" />
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Helper functoin for fetching the line end format.
|
||||
* @return String 'win', 'unix', or 'mac' based on the user's browser..
|
||||
*/
|
||||
function get_line_end_format()
|
||||
{
|
||||
if( is_browser_os_windows() )
|
||||
return 'win';
|
||||
elseif( is_browser_os_unix() )
|
||||
return 'unix';
|
||||
elseif( is_browser_os_mac() )
|
||||
return 'mac';
|
||||
else
|
||||
return 'unix';
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/export_functions.php,v 1.11 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $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
|
||||
@@ -26,6 +26,14 @@ $exporters[] = array('output_type'=>'dsml',
|
||||
'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
|
||||
@@ -235,8 +243,7 @@ class PlaExporter extends PlaAbstractExporter{
|
||||
class PlaLdapExporter extends PlaAbstractExporter{
|
||||
var $entry_id;
|
||||
var $results;
|
||||
var $entry_id;
|
||||
var $server_id ;
|
||||
var $server_id;
|
||||
var $scope;
|
||||
var $entry_array;
|
||||
var $num_entries;
|
||||
@@ -244,7 +251,7 @@ class PlaLdapExporter extends PlaAbstractExporter{
|
||||
var $queryFilter;
|
||||
var $hasNext;
|
||||
var $connection_open_state;
|
||||
|
||||
var $attributes;
|
||||
/**
|
||||
* Create a PlaLdapExporter object.
|
||||
* @param int $server_id the server id
|
||||
@@ -252,7 +259,7 @@ class PlaLdapExporter extends PlaAbstractExporter{
|
||||
* @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){
|
||||
function PlaLdapExporter( $server_id , $queryFilter , $base_dn , $scope, $attributes){
|
||||
global $lang;
|
||||
$this->scope = $scope;
|
||||
$this->base_dn = $base_dn;
|
||||
@@ -264,25 +271,22 @@ class PlaLdapExporter extends PlaAbstractExporter{
|
||||
$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 );
|
||||
if( ! $this->ds ) {
|
||||
pla_error( $lang['could_not_connect'] );
|
||||
}
|
||||
else{
|
||||
$this->connection_open_state = 1;
|
||||
}
|
||||
|
||||
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,array(),
|
||||
$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, array(),
|
||||
$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, array(),
|
||||
$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
|
||||
@@ -575,10 +579,235 @@ class PlaDsmlExporter extends PlaExporter{
|
||||
}
|
||||
|
||||
|
||||
class MyCustomExporter{
|
||||
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 = $exporer;
|
||||
$this->exporter = $exporter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
1072
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
|
||||
}
|
13
header.php
@@ -1,9 +1,12 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phpldapadmin/phpldapadmin/header.php,v 1.10 2004/03/19 20:13:08 i18phpldapadmin Exp $
|
||||
// $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
|
||||
@@ -16,7 +19,15 @@
|
||||
<head>
|
||||
<title>phpLDAPadmin</title>
|
||||
<link rel="stylesheet" href="style.css" media="screen" />
|
||||
<?php
|
||||
if( isset( $server_id ) ) {
|
||||
$custom_file = get_custom_file( $server_id, 'style.css' );
|
||||
if( strcmp( $custom_file, 'style.css' ) != 0 ) { ?>
|
||||
<link rel="stylesheet" href="<?php echo $custom_file ?>" media="screen" />
|
||||
<?php } } ?>
|
||||
<script src="entry_chooser.js" type="text/javascript"></script>
|
||||
<script src="ie_png_work_around.js" type="text/javascript"></script>
|
||||
<script src="search_util.js" type="text/javascript"></script>
|
||||
<script src="generic_utils.js" type="text/javascript"></script>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
</head>
|
||||
|
21
help.php
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/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 |
BIN
images/countries/et.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/fi.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/fj.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/fo.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/fr.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ga.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/gb.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/ge.png
Normal file
After Width: | Height: | Size: 628 B |
BIN
images/countries/gi.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/gl.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
images/countries/gp.png
Normal file
After Width: | Height: | Size: 1.0 KiB |