RELEASE 1.0.2

This commit is contained in:
Deon George 2009-06-30 20:41:18 +10:00
parent 5f261ded38
commit a08bc4e9e1
67 changed files with 4036 additions and 719 deletions

View File

@ -1,5 +1,5 @@
For install instructions in non-English languages, see the wiki: For install instructions in non-English languages, see the wiki:
http://wiki.pldapadmin.com http://wiki.phpldapadmin.info
* Requirements * Requirements
@ -17,7 +17,7 @@ For install instructions in non-English languages, see the wiki:
* For additional help * For additional help
See the wiki: See the wiki:
http://wiki.pldapadmin.com http://wiki.phpldapadmin.info
Join our mailing list: Join our mailing list:
https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel

View File

@ -1,4 +1,9 @@
<?php <?php
/** NOTE **
** Make sure that <?php is the FIRST line of this file!
** IE: There should NOT be any blank lines or spaces BEFORE <?php
**/
/** /**
* The phpLDAPadmin config file * The phpLDAPadmin config file
* *
@ -9,8 +14,8 @@
* For example, the default for defining the language in config_default.php * For example, the default for defining the language in config_default.php
* *
* $this->default->appearance['lang'] = array( * $this->default->appearance['lang'] = array(
* 'desc'=>'Language', * 'desc'=>'Language',
* 'default'=>'auto'); * 'default'=>'auto');
* *
* to override this, use $config->custom->appearance['lang'] = 'en'; * to override this, use $config->custom->appearance['lang'] = 'en';
* *
@ -55,6 +60,15 @@ $config->custom->session['blowfish'] = '';
// $config->custom->jpeg['tmpdir'] = "/tmp"; // Example for Unix systems // $config->custom->jpeg['tmpdir'] = "/tmp"; // Example for Unix systems
# $config->custom->jpeg['tmpdir'] = "c:\\temp"; // Example for Windows systems # $config->custom->jpeg['tmpdir'] = "c:\\temp"; // Example for Windows systems
/* Set this to (bool)true if you do NOT want a random salt used when
calling crypt(). Instead, use the first two letters of the user's
password. This is insecure but unfortunately needed for some older
environments. */
# $config->custom->password['no_random_crypt_salt'] = true;
/* Configure what objects are shown in left hand tree */
// $config->custom->appearance['tree_filter'] = '(objectclass=*)';
/*********************************************/ /*********************************************/
/* Define your LDAP servers in this section */ /* Define your LDAP servers in this section */
/*********************************************/ /*********************************************/
@ -117,10 +131,10 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
/* Enable SASL authentication LDAP SASL authentication requires PHP 5.x /* Enable SASL authentication LDAP SASL authentication requires PHP 5.x
configured with --with-ldap-sasl=DIR. If this option is disabled (ie, set to configured with --with-ldap-sasl=DIR. If this option is disabled (ie, set to
false), then all other sasl options are ignored. */ false), then all other sasl options are ignored. */
// $ldapservers->SetValue($i,'server','sasl_auth', false); // $ldapservers->SetValue($i,'server','sasl_auth',false);
/* SASL auth mechanism */ /* SASL auth mechanism */
// $ldapservers->SetValue($i,'server','sasl_mech', "PLAIN"); // $ldapservers->SetValue($i,'server','sasl_mech','PLAIN');
/* SASL authentication realm name */ /* SASL authentication realm name */
// $ldapservers->SetValue($i,'server','sasl_realm',''); // $ldapservers->SetValue($i,'server','sasl_realm','');
@ -134,13 +148,13 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
/* SASL authorization id regex and replacement /* SASL authorization id regex and replacement
When sasl_authz_id property is not set (default), phpLDAPAdmin will try to When sasl_authz_id property is not set (default), phpLDAPAdmin will try to
figure out authorization id by itself from bind distinguished name (DN). figure out authorization id by itself from bind distinguished name (DN).
This procedure is done by calling preg_replace() php function in the This procedure is done by calling preg_replace() php function in the
following way: following way:
$authz_id = preg_replace($sasl_authz_id_regex,$sasl_authz_id_replacement, $authz_id = preg_replace($sasl_authz_id_regex,$sasl_authz_id_replacement,
$bind_dn); $bind_dn);
For info about pcre regexes, see: For info about pcre regexes, see:
- pcre(3), perlre(3) - pcre(3), perlre(3)
- http://www.php.net/preg_replace */ - http://www.php.net/preg_replace */
@ -185,7 +199,7 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
/* If 'login_attr' is used above such that phpLDAPadmin will search for your DN /* If 'login_attr' is used above such that phpLDAPadmin will search for your DN
at login, you may restrict the search to a specific objectClass. EG, set this at login, you may restrict the search to a specific objectClass. EG, set this
to 'posixAccount' or 'inetOrgPerson', depending upon your setup. */ to 'posixAccount' or 'inetOrgPerson', depending upon your setup. */
// $ldapservers->SetValue($i,'login','class',''); // $ldapservers->SetValue($i,'login','class',null);
/* Specify true If you want phpLDAPadmin to not display or permit any /* Specify true If you want phpLDAPadmin to not display or permit any
modification to the LDAP server. */ modification to the LDAP server. */
@ -208,50 +222,50 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
// $ldapservers->SetValue($i,'auto_number','mechanism','search'); // $ldapservers->SetValue($i,'auto_number','mechanism','search');
/* The DN of the search base when the 'search' mechanism is used above. */ /* The DN of the search base when the 'search' mechanism is used above. */
// $ldapservers->SetValue($i,'auto_number','search_base','ou=People,dc=example,dc=com'); # $ldapservers->SetValue($i,'auto_number','search_base','ou=People,dc=example,dc=com');
/* The minimum number to use when searching for the next available UID number /* The minimum number to use when searching for the next available UID number
(only when 'search' is used for auto_uid_number_mechanism' */ (only when 'search' is used for auto_uid_number_mechanism' */
// $ldapservers->SetValue($i,'auto_number','min','1000'); // $ldapservers->SetValue($i,'auto_number','min','1000');
/* The DN of the uidPool entry when 'uidpool' mechanism is used above. */ /* The DN of the uidPool entry when 'uidpool' mechanism is used above. */
// $servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com'; # $servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com';
/* If you set this, then phpldapadmin will bind to LDAP with this user ID when /* If you set this, then phpldapadmin will bind to LDAP with this user ID when
searching for the uidnumber. The idea is, this user id would have full searching for the uidnumber. The idea is, this user id would have full
(readonly) access to uidnumber in your ldap directory (the logged in user (readonly) access to uidnumber in your ldap directory (the logged in user
may not), so that you can be guaranteed to get a unique uidnumber for your may not), so that you can be guaranteed to get a unique uidnumber for your
directory. */ directory. */
// $ldapservers->SetValue($i,'auto_number','dn',''); // $ldapservers->SetValue($i,'auto_number','dn',null);
/* The password for the dn above. */ /* The password for the dn above. */
// $ldapservers->SetValue($i,'auto_number','pass',''); // $ldapservers->SetValue($i,'auto_number','pass',null);
/* Enable anonymous bind login. */ /* Enable anonymous bind login. */
// $ldapservers->SetValue($i,'login','anon_bind',true); // $ldapservers->SetValue($i,'login','anon_bind',true);
/* Use customized page with prefix when available. */ /* Use customized page with prefix when available. */
// $ldapservers->SetValue($i,'custom','pages_prefix','custom_'); # $ldapservers->SetValue($i,'custom','pages_prefix','custom_');
/* If you set this, then phpldapadmin will bind to LDAP with this user when /* 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 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 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) to the attributes in question (the logged in user may not have enough access)
*/ */
// $ldapservers->SetValue($i,'unique_attrs','dn',''); // $ldapservers->SetValue($i,'unique_attrs','dn',null);
/* The password for the dn above */ /* The password for the dn above */
// $ldapservers->SetValue($i,'unique_attrs','pass',''); // $ldapservers->SetValue($i,'unique_attrs','pass',null);
/* If you set this, then only these DNs are allowed to log in. This array can /* If you set this, then only these DNs are allowed to log in. This array can
contain individual users, groups or ldap search filter(s). Keep in mind that contain individual users, groups or ldap search filter(s). Keep in mind that
the user has not authenticated yet, so this will be an anonymous search to the user has not authenticated yet, so this will be an anonymous search to
the LDAP server, so make your ACLs allow these searches to return results! */ the LDAP server, so make your ACLs allow these searches to return results! */
# $ldapservers->SetValue($i,'login','allowed_dns',array( # $ldapservers->SetValue($i,'login','allowed_dns',array(
# 'uid=stran,ou=People,dc=example,dc=com', # 'uid=stran,ou=People,dc=example,dc=com',
# '(&(gidNumber=811)(objectClass=groupOfNames))', # '(&(gidNumber=811)(objectClass=groupOfNames))',
# '(|(uidNumber=200)(uidNumber=201))', # '(|(uidNumber=200)(uidNumber=201))',
# 'cn=callcenter,ou=Group,dc=example,dc=com')); # 'cn=callcenter,ou=Group,dc=example,dc=com'));
/* Set this if you dont want this LDAP server to show in the tree */ /* Set this if you dont want this LDAP server to show in the tree */
// $ldapservers->SetValue($i,'appearance','visible',true); // $ldapservers->SetValue($i,'appearance','visible',true);
@ -284,29 +298,29 @@ $ldapservers->SetValue($i,'server','tls',false);
$ldapservers->SetValue($i,'server','low_bandwidth',false); $ldapservers->SetValue($i,'server','low_bandwidth',false);
$ldapservers->SetValue($i,'appearance','password_hash','md5'); $ldapservers->SetValue($i,'appearance','password_hash','md5');
$ldapservers->SetValue($i,'login','attr','dn'); $ldapservers->SetValue($i,'login','attr','dn');
$ldapservers->SetValue($i,'login','string',''); $ldapservers->SetValue($i,'login','string',null);
$ldapservers->SetValue($i,'login','class',''); $ldapservers->SetValue($i,'login','class',null);
$ldapservers->SetValue($i,'server','read_only',false); $ldapservers->SetValue($i,'server','read_only',false);
$ldapservers->SetValue($i,'appearance','show_create',true); $ldapservers->SetValue($i,'appearance','show_create',true);
$ldapservers->SetValue($i,'auto_number','enable',true); $ldapservers->SetValue($i,'auto_number','enable',true);
$ldapservers->SetValue($i,'auto_number','mechanism','search'); $ldapservers->SetValue($i,'auto_number','mechanism','search');
$ldapservers->SetValue($i,'auto_number','search_base',''); $ldapservers->SetValue($i,'auto_number','search_base',null);
$ldapservers->SetValue($i,'auto_number','min','1000'); $ldapservers->SetValue($i,'auto_number','min','1000');
$ldapservers->SetValue($i,'auto_number','dn',''); $ldapservers->SetValue($i,'auto_number','dn',null);
$ldapservers->SetValue($i,'auto_number','pass',''); $ldapservers->SetValue($i,'auto_number','pass',null);
$ldapservers->SetValue($i,'login','anon_bind',true); $ldapservers->SetValue($i,'login','anon_bind',true);
$ldapservers->SetValue($i,'custom','pages_prefix','custom_'); $ldapservers->SetValue($i,'custom','pages_prefix','custom_');
$ldapservers->SetValue($i,'unique_attrs','dn',''); $ldapservers->SetValue($i,'unique_attrs','dn',null);
$ldapservers->SetValue($i,'unique_attrs','pass',''); $ldapservers->SetValue($i,'unique_attrs','pass',null);
# SASL auth # SASL auth
$ldapservers->SetValue($i,'server','sasl_auth', true); $ldapservers->SetValue($i,'server','sasl_auth',true);
$ldapservers->SetValue($i,'server','sasl_mech', "PLAIN"); $ldapservers->SetValue($i,'server','sasl_mech','PLAIN');
$ldapservers->SetValue($i,'server','sasl_realm', "EXAMPLE.COM"); $ldapservers->SetValue($i,'server','sasl_realm','EXAMPLE.COM');
$ldapservers->SetValue($i,'server','sasl_authz_id', null); $ldapservers->SetValue($i,'server','sasl_authz_id',null);
$ldapservers->SetValue($i,'server','sasl_authz_id_regex', '/^uid=([^,]+)(.+)/i'); $ldapservers->SetValue($i,'server','sasl_authz_id_regex','/^uid=([^,]+)(.+)/i');
$ldapservers->SetValue($i,'server','sasl_authz_id_replacement', '$1'); $ldapservers->SetValue($i,'server','sasl_authz_id_replacement','$1');
$ldapservers->SetValue($i,'server','sasl_props', null); $ldapservers->SetValue($i,'server','sasl_props',null);
*/ */
/*********************************************/ /*********************************************/
@ -318,7 +332,7 @@ $ldapservers->SetValue($i,'server','sasl_props', null);
$friendly_attrs = array(); $friendly_attrs = array();
$friendly_attrs['facsimileTelephoneNumber'] = 'Fax'; $friendly_attrs['facsimileTelephoneNumber'] = 'Fax';
$friendly_attrs['telephoneNumber'] = 'Phone'; $friendly_attrs['telephoneNumber'] = 'Phone';
/*********************************************/ /*********************************************/
/* Support for attrs display order */ /* Support for attrs display order */
@ -330,16 +344,16 @@ $friendly_attrs['telephoneNumber'] = 'Phone';
attributes that are not specified in this array will be displayed after in attributes that are not specified in this array will be displayed after in
alphabetical order. */ alphabetical order. */
# $attrs_display_order = array( # $attrs_display_order = array(
# 'givenName', # 'givenName',
# 'sn', # 'sn',
# 'cn', # 'cn',
# 'displayName', # 'displayName',
# 'uid', # 'uid',
# 'uidNumber', # 'uidNumber',
# 'gidNumber', # 'gidNumber',
# 'homeDirectory', # 'homeDirectory',
# 'mail', # 'mail',
# 'userPassword' # 'userPassword'
# ); # );
/*********************************************/ /*********************************************/
@ -358,8 +372,8 @@ $friendly_attrs['telephoneNumber'] = 'Phone';
/* Hidden attributes in read-only mode. If undefined, it will be equal to /* Hidden attributes in read-only mode. If undefined, it will be equal to
$hidden_attrs. */ $hidden_attrs. */
# $hidden_attrs_ro = array( # $hidden_attrs_ro = array(
# 'objectClass','shadowWarning', 'shadowLastChange', 'shadowMax', # 'objectClass','shadowWarning', 'shadowLastChange', 'shadowMax',
# 'shadowFlag', 'shadowInactive', 'shadowMin', 'shadowExpire'); # 'shadowFlag', 'shadowInactive', 'shadowMin', 'shadowExpire');
/** **/ /** **/
/** Read-only attributes **/ /** Read-only attributes **/
@ -389,6 +403,19 @@ $friendly_attrs['telephoneNumber'] = 'Phone';
present a user with the option of changing the unique attributes. */ present a user with the option of changing the unique attributes. */
# $unique_attrs = array('uid','uidNumber','mail'); # $unique_attrs = array('uid','uidNumber','mail');
/*********************************************/
/* Group attributes */
/*********************************************/
/* Add "modify group members" link to the attribute. */
// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid')
/* Configure filter for member search. This only applies to "modify group members" feature */
// $config->custom->modify_member['filter'] = '(objectclass=Person)';
/* Attribute that is added to the group member attribute. */
// $config->custom->modify_member['attr'] = 'dn';
/*********************************************/ /*********************************************/
/* Predefined Queries (canned views) */ /* Predefined Queries (canned views) */
/*********************************************/ /*********************************************/
@ -410,7 +437,7 @@ $queries[$q]['scope'] = 'sub';
$queries[$q]['filter'] = '(&(objectClass=posixAccount)(uid=*))'; $queries[$q]['filter'] = '(&(objectClass=posixAccount)(uid=*))';
/* The attributes to return */ /* The attributes to return */
$queries[$q]['attributes'] = 'cn, uid, homeDirectory'; $queries[$q]['attributes'] = 'cn, uid, homeDirectory, telephonenumber, jpegphoto';
/* If you want to configure more pre-defined queries, copy and paste the above (including the "$q++;") */ /* If you want to configure more pre-defined queries, copy and paste the above (including the "$q++;") */
$q++; $q++;

View File

@ -1,2 +1,2 @@
Please see http://wiki.pldapadmin.com/Translating now for information on Please see http://wiki.phpldapadmin.info/Translating now for information on
translating PLA. translating PLA.

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.14 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.15 2006/10/28 07:22:39 wurley Exp $
/** /**
* Displays a form for adding an attribute/value to an LDAP entry. * Displays a form for adding an attribute/value to an LDAP entry.
@ -16,166 +16,163 @@
require './common.php'; require './common.php';
if( $ldapserver->isReadOnly() ) if ($ldapserver->isReadOnly())
pla_error( _('You cannot perform updates while server is in read-only mode') ); pla_error(_('You cannot perform updates while server is in read-only mode'));
if( ! $ldapserver->haveAuthInfo()) if (! $ldapserver->haveAuthInfo())
pla_error( _('Not enough information to login to server. Please check your configuration.') ); pla_error(_('Not enough information to login to server. Please check your configuration.'));
$dn = $_GET['dn']; $dn = $_GET['dn'];
$encoded_dn = rawurlencode( $dn ); $encoded_dn = rawurlencode($dn);
$rdn = get_rdn( $dn ); $rdn = get_rdn($dn);
$friendly_attrs = process_friendly_attr_table(); $friendly_attrs = process_friendly_attr_table();
include './header.php'; ?> include './header.php';
<body> echo '<body>';
<h3 class="title"><?php echo sprintf( _('Add new attribute'), htmlspecialchars( $rdn ) ); ?></b></h3> printf('<h3 class="title">%s <b>%s</b></h3>',_('Add new attribute'),htmlspecialchars($rdn));
<h3 class="subtitle"><?php echo _('Server'); ?>: <b><?php echo $ldapserver->name; ?></b> &nbsp;&nbsp;&nbsp; <?php echo _('Distinguished Name'); ?>: <b><?php echo htmlspecialchars( ( $dn ) ); ?></b></h3> printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
<?php $attrs = $ldapserver->getDNAttrs($dn); $attrs = $ldapserver->getDNAttrs($dn);
$oclasses = $ldapserver->getDNAttr($dn,'objectClass'); $oclasses = $ldapserver->getDNAttr($dn,'objectClass');
if( ! is_array( $oclasses ) ) if (! is_array($oclasses))
$oclasses = array( $oclasses ); $oclasses = array($oclasses);
$avail_attrs = array(); $avail_attrs = array();
$schema_oclasses = $ldapserver->SchemaObjectClasses($dn); if (array_search('extensibleObject',$oclasses) !== FALSE) {
foreach( $oclasses as $oclass ) { $schema_attrs = $ldapserver->SchemaAttributes();
$schema_oclass = $ldapserver->getSchemaObjectClass($oclass,$dn);
if( $schema_oclass && 0 == strcasecmp( 'objectclass', get_class( $schema_oclass ) ) ) foreach ($schema_attrs as $attr)
$avail_attrs = array_merge( $schema_oclass->getMustAttrNames( $schema_oclasses ), $avail_attrs[]=$attr->getName();
$schema_oclass->getMayAttrNames( $schema_oclasses ),
$avail_attrs ); } else {
$schema_oclasses = $ldapserver->SchemaObjectClasses($dn);
foreach ($oclasses as $oclass) {
$schema_oclass = $ldapserver->getSchemaObjectClass($oclass,$dn);
if ($schema_oclass && strcasecmp('objectclass',get_class($schema_oclass)) == 0)
$avail_attrs = array_merge($schema_oclass->getMustAttrNames($schema_oclasses),
$schema_oclass->getMayAttrNames($schema_oclasses),
$avail_attrs);
}
} }
$avail_attrs = array_unique( $avail_attrs ); $avail_attrs = array_unique($avail_attrs);
$avail_attrs = array_filter( $avail_attrs, "not_an_attr" ); $avail_attrs = array_filter($avail_attrs,'not_an_attr');
sort( $avail_attrs ); sort($avail_attrs);
$avail_binary_attrs = array(); $avail_binary_attrs = array();
foreach( $avail_attrs as $i => $attr ) {
foreach ($avail_attrs as $i => $attr) {
if ($ldapserver->isAttrBinary($attr)) { if ($ldapserver->isAttrBinary($attr)) {
$avail_binary_attrs[] = $attr; $avail_binary_attrs[] = $attr;
unset( $avail_attrs[ $i ] ); unset($avail_attrs[$i]);
} }
} }
?>
<br /> echo '<center>';
<center> if (is_array($avail_attrs) && count($avail_attrs) > 0) {
echo '<br />';
echo _('Add new attribute');
echo '<br />';
echo '<br />';
<?php echo _('Add new attribute'); echo '<form action="add_attr.php" method="post">';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
if( is_array( $avail_attrs ) && count( $avail_attrs ) > 0 ) { ?> echo '<select name="attr">';
<br /> $attr_select_html = '';
<br /> usort($avail_attrs,'sortAttrs');
<form action="add_attr.php" method="post"> foreach ($avail_attrs as $a) {
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo htmlspecialchars($dn); ?>" />
<select name="attr"> # is there a user-friendly translation available for this attribute?
if (isset($friendly_attrs[strtolower($a)])) {
<?php $attr_select_html = ''; $attr_display = sprintf('%s (%s)',
usort($avail_attrs,"sortAttrs"); htmlspecialchars($friendly_attrs[strtolower($a)]),
foreach( $avail_attrs as $a ) { htmlspecialchars($a));
// is there a user-friendly translation available for this attribute?
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
htmlspecialchars($a) . ")";
} else { } else {
$attr_display = htmlspecialchars( $a ); $attr_display = htmlspecialchars($a);
} }
echo $attr_display; printf('<option value="%s">%s</option>',htmlspecialchars($a),$attr_display);
$attr_select_html .= "<option>$attr_display</option>\n"; }
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
} ?>
</select> echo '</select>';
<input type="text" name="val" size="20" /> echo '<input type="text" name="val" size="20" />';
<input type="submit" name="submit" value="<?php echo _('Add'); ?>" class="update_dn" /> printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
</form> echo '</form>';
<?php } else { ?> } else {
echo '<br />';
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
}
<br /> if (count($avail_binary_attrs) > 0) {
<br /> echo '<br />';
<small>(<?php echo _('no new attributes available for this entry'); ?>)</small> echo _('Add new binary attribute');
<br /> echo '<br />';
<br /> echo '<br />';
<?php } ?> echo '<!-- Form to add a new BINARY attribute to this entry -->';
echo '<form action="add_attr.php" method="post" enctype="multipart/form-data">';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$dn);
echo '<input type="hidden" name="binary" value="true" />';
<?php echo _('Add new binary attribute'); echo '<select name="attr">';
if( count( $avail_binary_attrs ) > 0 ) { ?>
<!-- Form to add a new BINARY attribute to this entry --> $attr_select_html = '';
<form action="add_attr.php" method="post" enctype="multipart/form-data"> usort($avail_binary_attrs,'sortAttrs');
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn; ?>" />
<input type="hidden" name="binary" value="true" />
<br />
<select name="attr"> foreach ($avail_binary_attrs as $a) {
<?php $attr_select_html = ''; # is there a user-friendly translation available for this attribute?
if (isset($friendly_attrs[strtolower($a)])) {
usort($avail_binary_attrs,"sortAttrs"); $attr_display = sprintf('%s (%s)',
htmlspecialchars($friendly_attrs[strtolower($a)]),
foreach( $avail_binary_attrs as $a ) { htmlspecialchars($a));
// is there a user-friendly translation available for this attribute?
if( isset( $friendly_attrs[ strtolower( $a ) ] ) ) {
$attr_display = htmlspecialchars( $friendly_attrs[ strtolower( $a ) ] ) . " (" .
htmlspecialchars($a) . ")";
} else { } else {
$attr_display = htmlspecialchars( $a ); $attr_display = htmlspecialchars($a);
} }
echo $attr_display; printf('<option value="%s">%s</option>',htmlspecialchars($a),$attr_display);
$attr_select_html .= "<option>$attr_display</option>\n"; }
echo "<option value=\"" . htmlspecialchars($a) . "\">$attr_display</option>";
} ?>
</select> echo '</select>';
<input type="file" name="val" size="20" /> echo '<input type="file" name="val" size="20" />';
<input type="submit" name="submit" value="<?php echo _('Add'); ?>" class="update_dn" /> printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
<?php if( ! ini_get( 'file_uploads' ) ) if (! ini_get('file_uploads'))
echo "<br><small><b>" . _('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.') . "</b></small><br>"; printf('<br /><small><b>%s</b></small><br />',
_('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.'));
else else
echo "<br><small><b>" . sprintf( _('Maximum file size: %s'), ini_get( 'upload_max_filesize' ) ) . "</b></small><br>"; printf('<br /><small><b>%s: %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
?>
</form> echo '</form>';
<?php } else { ?> } else {
echo '<br />';
printf('<small>(%s)</small>',_('no new binary attributes available for this entry'));
}
<br /> echo '</center>';
<br /> echo '</body>';
<small>(<?php echo _('no new binary attributes available for this entry'); ?>)</small> echo '</html>';
<?php } ?>
</center>
</body>
</html>
<?php
/** /**
* Given an attribute $x, this returns true if it is NOT already specified * Given an attribute $x, this returns true if it is NOT already specified
@ -185,13 +182,13 @@ if( count( $avail_binary_attrs ) > 0 ) { ?>
* @return bool * @return bool
* @ignore * @ignore
*/ */
function not_an_attr( $x ) { function not_an_attr($x) {
global $attrs; global $attrs;
//return ! isset( $attrs[ strtolower( $x ) ] ); foreach($attrs as $attr => $values)
foreach( $attrs as $attr => $values ) if (strcasecmp($attr,$x) == 0)
if( 0 == strcasecmp( $attr, $x ) )
return false; return false;
return true; return true;
} }
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.36 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.38 2006/10/29 12:49:24 wurley Exp $
/** /**
* Displays a form to allow the user to enter a new value to add * Displays a form to allow the user to enter a new value to add
@ -34,10 +34,16 @@ else
$rdn = null; $rdn = null;
$current_values = $ldapserver->getDNAttr($dn,$attr); $current_values = $ldapserver->getDNAttr($dn,$attr);
if ($current_values) if ($current_values) {
$num_current_values = (is_array($current_values) ? count($current_values) : 1); if (! is_array($current_values))
else $current_values = array($current_values);
$num_current_values = count($current_values);
} else {
$current_values = array();
$num_current_values = 0; $num_current_values = 0;
}
$is_object_class = (strcasecmp($attr, 'objectClass') == 0) ? true : false; $is_object_class = (strcasecmp($attr, 'objectClass') == 0) ? true : false;
@ -107,18 +113,18 @@ if ($num_current_values) {
if (strcasecmp($attr,'userPassword') == 0) { if (strcasecmp($attr,'userPassword') == 0) {
foreach ($current_values as $key => $value) { foreach ($current_values as $key => $value) {
if (obfuscate_password_display(get_enc_type($value))) if (obfuscate_password_display(get_enc_type($value)))
echo '<li><nobr>'.preg_replace('/./','*',$value).'<br /></li>'; echo '<li><span style="white-space: nowrap;">'.preg_replace('/./','*',$value).'<br /></li>';
else else
echo '<li><nobr>'.htmlspecialchars($value).'<br /></li>'; echo '<li><span style="white-space: nowrap;">'.htmlspecialchars($value).'<br /></li>';
} }
} else { } else {
foreach ($current_values as $val) foreach ($current_values as $val)
printf('<li><nobr>%s</nobr></li>',htmlspecialchars($val)); printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($val));
} }
} else { } else {
printf('<li><nobr>%s</nobr></li>',htmlspecialchars($current_values)); printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($current_values));
} }
echo '</ul>'; echo '</ul>';

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/collapse.php,v 1.14 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/collapse.php,v 1.15 2006/10/28 11:42:10 wurley Exp $
/** /**
* This script alters the session variable 'tree', collapsing it * This script alters the session variable 'tree', collapsing it
@ -23,17 +23,11 @@ $tree = get_cached_item($ldapserver->server_id,'tree');
$tree['browser'][$dn]['open'] = false; $tree['browser'][$dn]['open'] = false;
set_cached_item($ldapserver->server_id,'tree','null',$tree); set_cached_item($ldapserver->server_id,'tree','null',$tree);
/* This is for Opera. By putting "random junk" in the query string, it thinks
that it does not have a cached version of the page, and will thus
fetch the page rather than display the cached version */
$time = gettimeofday();
$random_junk = md5(strtotime('now').$time['usec']);
/* If cookies were disabled, build the url parameter for the session id. /* If cookies were disabled, build the url parameter for the session id.
It will be append to the url to be redirect */ It will be append to the url to be redirect */
$id_session_param = ''; $id_session_param = '';
if (SID != '') if (SID != '')
$id_session_param = sprintf('&%s=%s',session_name(),session_id()); $id_session_param = sprintf('&%s=%s',session_name(),session_id());
header(sprintf('Location:tree.php?foo=%s#%s_%s%s',$random_junk,$ldapserver->server_id,rawurlencode($dn),$id_session_param)); header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param));
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.14 2006/01/03 20:39:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.15 2006/09/17 06:35:11 wurley Exp $
/** /**
* Compare two DNs - the destination DN is editable. * Compare two DNs - the destination DN is editable.
@ -163,7 +163,7 @@ foreach ($attrs_all as $attr) {
if ($side == 'src') { ?> if ($side == 'src') { ?>
<td class="attr"> <td class="attr">
<?php $schema_href="schema.php?server_id=$server_id_src&amp;view=attributes&amp;viewvalue=".real_attr_name($attr); ?> <?php $schema_href="schema.php?server_id=$server_id_src&amp;view=attributes&amp;viewvalue=".real_attr_name($attr); ?>
<b><a title="<?php echo sprintf(_('Click to view the schema defintion for attribute type \'%s\''),$attr) ?>" href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a></b> <b><a title="<?php echo sprintf(_('Click to view the schema definition for attribute type \'%s\''),$attr) ?>" href="<?php echo $schema_href; ?>"><?php echo $attr_display; ?></a></b>
</td> </td>
<td class="attr_note"> <td class="attr_note">

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.39 2006/01/03 20:39:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.43 2007/03/18 01:30:33 wurley Exp $
/** /**
* Copies a given object to create a new one. * Copies a given object to create a new one.
@ -88,7 +88,7 @@ if ($copy_result) {
if ($do_remove) { if ($do_remove) {
sleep(2); sleep(2);
$delete_url = sprintf('delete_form.php?server_id=%s&dn=%s',$server_id_dst,rawurlencode($dn_src)); $delete_url = sprintf('delete_form.php?server_id=%s&dn=%s',$server_id_src,rawurlencode($dn_src));
echo '<!-- redirect to the delete form -->'; echo '<!-- redirect to the delete form -->';
printf('<script type="text/javascript" language="javascript">parent.right_frame.location="%s" </script>',$delete_url); printf('<script type="text/javascript" language="javascript">parent.right_frame.location="%s" </script>',$delete_url);
} }
@ -99,7 +99,7 @@ function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_ds
debug_log('r_copy_dn: Entered with (%s,%s,%s,%s,%s)',1, debug_log('r_copy_dn: Entered with (%s,%s,%s,%s,%s)',1,
$ldapserver_src->server_id,$ldapserver_dst->server_id,$snapshottree,$root_dn,$dn_dst); $ldapserver_src->server_id,$ldapserver_dst->server_id,$snapshottree,$root_dn,$dn_dst);
printf('<nobr>%s %s...',_('Copying '),htmlspecialchars($root_dn)); printf('<span style="white-space: nowrap;">%s %s...',_('Copying'),htmlspecialchars($root_dn));
flush(); flush();
$copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$root_dn,$dn_dst); $copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$root_dn,$dn_dst);
@ -107,7 +107,7 @@ function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_ds
if (! $copy_result) if (! $copy_result)
return false; return false;
printf('<span style="color:green">%s</span></nobr><br />',_('Success')); printf('<span style="color:green">%s</span><br />',_('Success'));
flush(); flush();
$children = isset($snapshottree[$root_dn]) ? $snapshottree[$root_dn] : null; $children = isset($snapshottree[$root_dn]) ? $snapshottree[$root_dn] : null;
@ -172,6 +172,7 @@ function build_tree($ldapserver,$dn,$buildtree) {
debug_log('build_tree: Entered with (%s,%s,%s)',1, debug_log('build_tree: Entered with (%s,%s,%s)',1,
$ldapserver->server_id,$dn,$buildtree); $ldapserver->server_id,$dn,$buildtree);
# we search all children, not only the visible children in the tree
$children = $ldapserver->getContainerContents($dn,0); $children = $ldapserver->getContainerContents($dn,0);
if (is_array($children) && count($children) > 0) { if (is_array($children) && count($children) > 0) {

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.27 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.29 2007/03/18 02:18:14 wurley Exp $
/** /**
* Copies a given object to create a new one. * Copies a given object to create a new one.

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.46 2006/02/19 05:44:34 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.47 2006/10/28 16:37:59 wurley Exp $
/** /**
* Creates a new object. * Creates a new object.
@ -35,7 +35,7 @@ $redirect = isset($_POST['redirect']) ? $_POST['redirect'] : false;
# See if there are any presubmit values to work out. # See if there are any presubmit values to work out.
if (isset($_POST['presubmit']) && count($_POST['presubmit']) && isset($_POST['template'])) { if (isset($_POST['presubmit']) && count($_POST['presubmit']) && isset($_POST['template'])) {
$templates = new Templates($ldapserver->server_id); $templates = new Templates($ldapserver->server_id);
$template = $templates->GetTemplate($_POST['template']); $template = $templates->getCreationTemplate($_POST['template']);
foreach ($_POST['presubmit'] as $attr) { foreach ($_POST['presubmit'] as $attr) {
$_POST['attrs'][] = $attr; $_POST['attrs'][] = $attr;

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create_form.php,v 1.33 2006/01/03 20:39:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create_form.php,v 1.34 2006/10/28 16:37:59 wurley Exp $
/** /**
* The menu where the user chooses an RDN, Container, and Template for creating a new entry. * The menu where the user chooses an RDN, Container, and Template for creating a new entry.
@ -51,7 +51,7 @@ echo '<table class="templates">';
$i = -1; $i = -1;
$template_xml = new Templates($ldapserver->server_id); $template_xml = new Templates($ldapserver->server_id);
$templates = $template_xml->_template; $templates = $template_xml->getCreationTemplates();
# Remove non-visable templates. # Remove non-visable templates.
foreach ($templates as $index => $template) foreach ($templates as $index => $template)

View File

@ -1,4 +1,4 @@
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.45 2005/12/10 10:34:54 wurley Exp $ */ /* $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/css/style.css,v 1.47 2006/10/29 11:44:36 wurley Exp $ */
span.hint { span.hint {
font-size: small; font-size: small;
font-weight: normal; font-weight: normal;
@ -56,40 +56,89 @@ table.schema_attr tr.highlight{
font-weight: Bold; font-weight: Bold;
} }
table.modify_members {
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: 1px solid black;
border-top: 1px solid black;
margin-bottom: 10px;
background-color: #eee;
width: 80%;
}
table.modify_members td {
vertical-align: top;
text-align: left;
padding-left: 5px;
}
table.modify_members th {
background-color: #016;
padding: 5px;
color: white;
font-weight: bold;
font-size: 125%;
}
table.modify_members td {
padding: 5px;
vertical-align: top;
}
table.modify_members tr.even {
background-color: #eee;
}
table.modify_members tr.odd {
background-color: #ccc;
}
table.modify_members tr.highlight {
background-color: #bcd;
font-weight: Bold;
}
table.modify_members select {
width: 100%;
}
/* Bug Notice */
table.notice tr td { table.notice tr td {
font-size: 9pt; font-size: 9pt;
padding: 2px; padding: 2px;
margin: 0px; margin: 0px;
background-color: #eee; background-color: #eeeeee;
} }
/* Error Dialog Box */
table.error { table.error {
width: 500px; width: 500px;
border: 2px solid black; border: 1px solid #aa0000;
background-color: #fff0f0;
} }
table.error tr td table.bug tr td{ table.error th {
padding: 6px; background-color: #aa0000;
margin: 0px;
background-color: #eee;
}
table.error tr td {
vertical-align: top;
text-align: left;
padding: 15px;
border: 0px; border: 0px;
color: #ffffff;
font-size: 12pt;
font-weight: bold;
text-align: center;
vertical-align: middle;
width: 100%;
} }
table.error tr td h2 { table.error th.img {
margin: 5px;
margin-bottom: 20px;
}
table.error tr td.img {
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
width: 20px; }
table.error td {
border: 0px;
background-color: #fff0f0;
padding: 2px;
text-align: left;
vertical-align: top;
} }
table.confirm th { table.confirm th {
@ -131,7 +180,7 @@ table.browse tr td {
} }
table.template_display tr td { table.template_display tr td {
vertical-align: top; vertical-align: top;
} }
table.templates tr td { table.templates tr td {
@ -346,7 +395,7 @@ table.edit_dn tr td.heading {
} }
table.edit_dn tr td.attr_note { table.edit_dn tr td.attr_note {
text-align: right; text-align: right;
background-color: #eee; background-color: #eee;
} }
@ -480,26 +529,26 @@ form.new_value {
} }
table.search_result_table { table.search_result_table {
border-spacing: 0; border-spacing: 0;
border-collapse: collapse; border-collapse: collapse;
empty-cells: show; empty-cells: show;
} }
table.search_result_table td { table.search_result_table td {
vertical-align: top; vertical-align: top;
border: 1px solid gray; border: 1px solid gray;
padding: 4px; padding: 4px;
} }
table.search_result_table th { table.search_result_table th {
border: 1px solid gray; border: 1px solid gray;
padding: 10px; padding: 10px;
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;
} }
table.search_result_table tr.highlight { table.search_result_table tr.highlight {
background-color: #eee; background-color: #eee;
} }
@ -509,8 +558,8 @@ ul.search {
table.search_header { table.search_header {
background-color: #ddf; background-color: #ddf;
width: 100%; width: 100%;
vertical-align: top; vertical-align: top;
} }
div.search_result { div.search_result {
@ -576,13 +625,39 @@ table.delete_confirm {
text-align: left; text-align: left;
} }
table.login { /* Login Box */
background-color: #ddf; #pla_login {
padding: 10px; background: url('../images/uid.png') no-repeat 0 1px;
background-color: #fafaff;
padding-left: 17px;
} }
table.login td { #pla_login:focus {
padding: 5px; background-color: #ffffba;
}
#pla_login:disabled {
background-color: #ddddff;
}
#pla_pass {
background: url('../images/key.png') no-repeat 0 1px;
background-color: #fafaff;
padding-left: 17px;
}
#pla_pass:focus {
background-color: #ffffba;
}
#pla_pass:disabled {
background-color: #ddddff;
}
table.login {
background-color: #eeeeff;
padding: 10px;
border: 1px solid #aaaacc;
} }
table.create { table.create {
@ -602,7 +677,7 @@ table.create td.name {
div.add_value { div.add_value {
font-size: 10pt; font-size: 10pt;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
} }
a.logged_in_dn { a.logged_in_dn {
@ -659,6 +734,6 @@ table.form tr td {
} }
img.chooser { img.chooser {
/* This makes the chooser image line up properly when placed next to a form element in a table cell*/ /* This makes the chooser image line up properly when placed next to a form element in a table cell*/
vertical-align: bottom; vertical-align: bottom;
} }

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.23 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.25 2007/03/18 02:14:16 wurley Exp $
/** /**
* delete_form.php * delete_form.php

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/expand.php,v 1.23 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/expand.php,v 1.25 2006/10/28 11:42:10 wurley Exp $
/** /**
* This script alters the session variable 'tree', expanding it * This script alters the session variable 'tree', expanding it
@ -29,23 +29,17 @@ if (! $ldapserver->haveAuthInfo())
$dn = $_GET['dn']; $dn = $_GET['dn'];
# We dont need this result, as we'll use the SESSION value when we call tree.php # We dont need this result, as we'll use the SESSION value when we call tree.php
$ldapserver->getContainerContents($dn,0,'(objectClass=*)',$config->GetValue('deref','tree')); $ldapserver->getContainerContents($dn,0,$config->GetValue('appearance','tree_filter'),$config->GetValue('deref','tree'));
$tree = get_cached_item($ldapserver->server_id,'tree'); $tree = get_cached_item($ldapserver->server_id,'tree');
$tree['browser'][$dn]['open'] = true; $tree['browser'][$dn]['open'] = true;
set_cached_item($ldapserver->server_id,'tree','null',$tree); set_cached_item($ldapserver->server_id,'tree','null',$tree);
/* This is for Opera. By putting "random junk" in the query string, it thinks
that it does not have a cached version of the page, and will thus
fetch the page rather than display the cached version */
$time = gettimeofday();
$random_junk = md5(strtotime('now').$time['usec']);
/* If cookies were disabled, build the url parameter for the session id. /* If cookies were disabled, build the url parameter for the session id.
It will be append to the url to be redirect */ It will be append to the url to be redirect */
$id_session_param = ''; $id_session_param = '';
if (SID != '') if (SID != '')
$id_session_param = sprintf('&%s=%s',session_name(),session_id()); $id_session_param = sprintf('&%s=%s',session_name(),session_id());
header(sprintf('Location:tree.php?foo=%s#%s_%s%s',$random_junk,$ldapserver->server_id,rawurlencode($dn),$id_session_param)); header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param));
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.24 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.25 2006/10/29 12:49:24 wurley Exp $
/** /**
* export_form.php * export_form.php
@ -52,9 +52,9 @@ printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),server_select_list());
echo '<tr>'; echo '<tr>';
printf('<td style="white-space:nowrap">%s</td>',_('Base DN')); printf('<td style="white-space:nowrap">%s</td>',_('Base DN'));
printf('<td><nobr><input type="text" name="dn" id="dn" style="width:230px" value="%s" />&nbsp;',htmlspecialchars($dn)); printf('<td><span style="white-space: nowrap;"><input type="text" name="dn" id="dn" style="width:230px" value="%s" />&nbsp;',htmlspecialchars($dn));
draw_chooser_link('export_form.dn'); draw_chooser_link('export_form.dn');
echo '</nobr></td>'; echo '</span></td>';
echo '</tr>'; echo '</tr>';
echo '<tr>'; echo '<tr>';

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.24 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.26 2006/09/17 04:51:56 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -42,12 +42,14 @@ printf('<script type="text/javascript" src="%sentry_chooser.js"></script>',JSDIR
printf('<script type="text/javascript" src="%sie_png_work_around.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sie_png_work_around.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%ssearch_util.js"></script>',JSDIR); printf('<script type="text/javascript" src="%ssearch_util.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sgeneric_utils.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sgeneric_utils.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sto_ascii.js"></script>',JSDIR);
printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />',JSDIR); printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />',JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sdate_selector.js"></script>',JSDIR); printf('<script type="text/javascript" src="%sdate_selector.js"></script>',JSDIR);
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>',JSDIR); printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>',JSDIR);
printf('<script type="text/javascript" src="%smodify_member.js"></script>',JSDIR);
if (isset($meta_refresh_variable)) if (isset($meta_refresh_variable))
printf('<meta http-equiv="refresh" content="%s" />',$meta_refresh_variable); printf('<meta http-equiv="refresh" content="%s" />',$meta_refresh_variable);

BIN
htdocs/images/key.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

View File

@ -5,7 +5,11 @@ function dateSelector(id) {
var parse = false; var parse = false;
var cal = new Calendar(0, null, onSelect, onClose); var cal = new Calendar(0, null, onSelect, onClose);
cal.showsTime = false; if (defaults['f_time_'+id]) {
cal.showsTime = true;
} else {
cal.showsTime = false;
}
cal.weekNumbers = true; cal.weekNumbers = true;
cal.showsOtherMonths = true; cal.showsOtherMonths = true;
cal.create(); cal.create();

View File

@ -0,0 +1,98 @@
/* This function submits the form
* when Save Changes button is pressed.
* see modify_member_form.php
*/
function submitForm(formId) {
var formObj = document.getElementById(formId);
formObj.submit();
}
/* This function generates hidden input array from new group members
* when submit button is pressed.
* see modify_member_form.php
*/
function update_new_values(memberattr,formId) {
el = document.getElementById("dnu");
for (i=0;i<m2.length;i++) {
el.innerHTML =
el.innerHTML +
"<input type='hidden' name='new_values[" + memberattr + "][" +
i + "]' value='" + m2.options[i].text + "' />";
}
submitForm(formId);
}
/* This function moves members from left select box to right one
* see modify_member_form.php
*/
function one2two() {
m1len = m1.length ;
for (i=0;i<m1len;i++) {
if (m1.options[i].selected == true) {
m2len = m2.length;
m2.options[m2len]= new Option(m1.options[i].text);
}
}
for (i=(m1len-1);i>=0;i--){
if (m1.options[i].selected == true) {
m1.options[i] = null;
}
}
}
/* This function moves members from right select box to left one
* see modify_member_form.php
*/
function two2one() {
m2len = m2.length ;
for (i=0;i<m2len;i++){
if (m2.options[i].selected == true) {
m1len = m1.length;
m1.options[m1len]= new Option(m2.options[i].text);
}
}
for (i=(m2len-1);i>=0;i--) {
if (m2.options[i].selected == true) {
m2.options[i] = null;
}
}
}
/* This function moves all members from left select box to right one
* see modify_member_form.php
*/
function all2two() {
m1len = m1.length ;
for (i=0;i<m1len;i++) {
m2len = m2.length;
m2.options[m2len]= new Option(m1.options[i].text);
}
for (i=(m1len-1);i>=0;i--) {
m1.options[i] = null;
}
}
/* This function moves all members from right select box to left one
* see modify_member_form.php
*/
function all2one() {
m2len = m2.length ;
for (i=0;i<m2len;i++) {
m1len = m1.length;
m1.options[m1len]= new Option(m2.options[i].text);
}
for (i=(m2len-1);i>=0;i--) {
m2.options[i] = null;
}
}

View File

@ -8,7 +8,7 @@
// Bjoern Schotte <bjoern@rent-a-phpwizard.de> (PEARification) // Bjoern Schotte <bjoern@rent-a-phpwizard.de> (PEARification)
// Martin Jansen <mj@php.net> (PEAR conformance) // Martin Jansen <mj@php.net> (PEAR conformance)
// //
// $Id: PHPLIB.php,v 1.2 2005/12/10 10:34:54 wurley Exp $ // $Id: PHPLIB.php,v 1.3 2006/09/17 06:22:04 wurley Exp $
// //
//require_once "PEAR.php"; //require_once "PEAR.php";
@ -31,37 +31,37 @@ class Template_PHPLIB
* If set, echo assignments * If set, echo assignments
* @var bool * @var bool
*/ */
var $debug = false; public $debug = false;
/** /**
* $file[handle] = "filename"; * $file[handle] = "filename";
* @var array * @var array
*/ */
var $file = array(); public $file = array();
/** /**
* fallback paths that should be defined in a child class * fallback paths that should be defined in a child class
* @var array * @var array
*/ */
var $file_fallbacks = array(); public $file_fallbacks = array();
/** /**
* Relative filenames are relative to this pathname * Relative filenames are relative to this pathname
* @var string * @var string
*/ */
var $root = ""; public $root = "";
/* /*
* $_varKeys[key] = "key" * $_varKeys[key] = "key"
* @var array * @var array
*/ */
var $_varKeys = array(); public $_varKeys = array();
/** /**
* $_varVals[key] = "value"; * $_varVals[key] = "value";
* @var array * @var array
*/ */
var $_varVals = array(); public $_varVals = array();
/** /**
* "remove" => remove undefined variables * "remove" => remove undefined variables
@ -69,20 +69,20 @@ class Template_PHPLIB
* "keep" => keep undefined variables * "keep" => keep undefined variables
* @var string * @var string
*/ */
var $unknowns = "remove"; public $unknowns = "remove";
/** /**
* "yes" => halt, "report" => report error, continue, "no" => ignore error quietly * "yes" => halt, "report" => report error, continue, "no" => ignore error quietly
* @var string * @var string
*/ */
var $haltOnError = "report"; public $haltOnError = "report";
/** /**
* The last error message is retained here * The last error message is retained here
* @var string * @var string
* @see halt * @see halt
*/ */
var $_lastError = ""; public $_lastError = "";
/** /**

View File

@ -22,112 +22,112 @@ class LayersMenuCommon
* @access private * @access private
* @var string * @var string
*/ */
var $_packageName; public $_packageName;
/** /**
* The version of the package * The version of the package
* @access private * @access private
* @var string * @var string
*/ */
var $version; public $version;
/** /**
* The copyright of the package * The copyright of the package
* @access private * @access private
* @var string * @var string
*/ */
var $copyright; public $copyright;
/** /**
* The author of the package * The author of the package
* @access private * @access private
* @var string * @var string
*/ */
var $author; public $author;
/** /**
* URL to be prepended to the menu hrefs * URL to be prepended to the menu hrefs
* @access private * @access private
* @var string * @var string
*/ */
var $prependedUrl = ''; public $prependedUrl = '';
/** /**
* Do you want that code execution halts on error? * Do you want that code execution halts on error?
* @access private * @access private
* @var string * @var string
*/ */
var $haltOnError = 'yes'; public $haltOnError = 'yes';
/** /**
* The base directory where the package is installed * The base directory where the package is installed
* @access private * @access private
* @var string * @var string
*/ */
var $dirroot; public $dirroot;
/** /**
* The "libjs" directory of the package * The "libjs" directory of the package
* @access private * @access private
* @var string * @var string
*/ */
var $libjsdir; public $libjsdir;
/** /**
* The directory where images related to the menu can be found * The directory where images related to the menu can be found
* @access private * @access private
* @var string * @var string
*/ */
var $imgdir; public $imgdir;
/** /**
* The http path corresponding to imgdir * The http path corresponding to imgdir
* @access private * @access private
* @var string * @var string
*/ */
var $imgwww; public $imgwww;
/** /**
* The directory where icons of menu items can be found * The directory where icons of menu items can be found
* @access private * @access private
* @var string * @var string
*/ */
var $icondir; public $icondir;
/** /**
* The http path corresponding to icondir * The http path corresponding to icondir
* @access private * @access private
* @var string * @var string
*/ */
var $iconwww; public $iconwww;
/** /**
* This array may contain width and height of all icons * This array may contain width and height of all icons
* @access private * @access private
* @var integer * @var integer
*/ */
var $iconsize = array(); public $iconsize = array();
/** /**
* If this var is false, width and height of icons have to be detected; if this var is true, width and height of icons are not detected and are retrieved from the iconsize array * If this var is false, width and height of icons have to be detected; if this var is true, width and height of icons are not detected and are retrieved from the iconsize array
* @access private * @access private
* @var boolean * @var boolean
*/ */
var $issetIconsize = false; public $issetIconsize = false;
/** /**
* The directory where templates can be found * The directory where templates can be found
* @access private * @access private
* @var string * @var string
*/ */
var $tpldir; public $tpldir;
/** /**
* The string containing the menu structure * The string containing the menu structure
* @access private * @access private
* @var string * @var string
*/ */
var $menuStructure; public $menuStructure;
/** /**
* It counts nodes for all menus * It counts nodes for all menus
* @access private * @access private
* @var integer * @var integer
*/ */
var $_nodesCount; public $_nodesCount;
/** /**
* A multi-dimensional array to store informations for each menu entry * A multi-dimensional array to store informations for each menu entry
* @access private * @access private
* @var array * @var array
*/ */
var $tree; public $tree;
/** /**
* A multi-dimensional array used only with the DB support; for each $menu_name, it stores the $cnt associated to each item id * A multi-dimensional array used only with the DB support; for each $menu_name, it stores the $cnt associated to each item id
* *
@ -138,56 +138,56 @@ var $tree;
* @access private * @access private
* @var array * @var array
*/ */
var $treecnt; public $treecnt;
/** /**
* The maximum hierarchical level of menu items * The maximum hierarchical level of menu items
* @access private * @access private
* @var integer * @var integer
*/ */
var $_maxLevel; public $_maxLevel;
/** /**
* An array that counts the number of first level items for each menu * An array that counts the number of first level items for each menu
* @access private * @access private
* @var array * @var array
*/ */
var $_firstLevelCnt; public $_firstLevelCnt;
/** /**
* An array containing the number identifying the first item of each menu * An array containing the number identifying the first item of each menu
* @access private * @access private
* @var array * @var array
*/ */
var $_firstItem; public $_firstItem;
/** /**
* An array containing the number identifying the last item of each menu * An array containing the number identifying the last item of each menu
* @access private * @access private
* @var array * @var array
*/ */
var $_lastItem; public $_lastItem;
/** /**
* Data Source Name: the connection string for PEAR DB * Data Source Name: the connection string for PEAR DB
* @access private * @access private
* @var string * @var string
*/ */
var $dsn = 'pgsql://dbuser:dbpass@dbhost/dbname'; public $dsn = 'pgsql://dbuser:dbpass@dbhost/dbname';
/** /**
* DB connections are either persistent or not persistent * DB connections are either persistent or not persistent
* @access private * @access private
* @var boolean * @var boolean
*/ */
var $persistent = false; public $persistent = false;
/** /**
* Name of the table storing data describing the menu * Name of the table storing data describing the menu
* @access private * @access private
* @var string * @var string
*/ */
var $tableName = 'phplayersmenu'; public $tableName = 'phplayersmenu';
/** /**
* Name of the i18n table corresponding to $tableName * Name of the i18n table corresponding to $tableName
* @access private * @access private
* @var string * @var string
*/ */
var $tableName_i18n = 'phplayersmenu_i18n'; public $tableName_i18n = 'phplayersmenu_i18n';
/** /**
* Names of fields of the table storing data describing the menu * Names of fields of the table storing data describing the menu
* *
@ -197,7 +197,7 @@ var $tableName_i18n = 'phplayersmenu_i18n';
* @access private * @access private
* @var array * @var array
*/ */
var $tableFields = array( public $tableFields = array(
'id' => 'id', 'id' => 'id',
'parent_id' => 'parent_id', 'parent_id' => 'parent_id',
'text' => 'text', 'text' => 'text',
@ -213,7 +213,7 @@ var $tableFields = array(
* @access private * @access private
* @var array * @var array
*/ */
var $tableFields_i18n = array( public $tableFields_i18n = array(
'language' => 'language', 'language' => 'language',
'id' => 'id', 'id' => 'id',
'text' => 'text', 'text' => 'text',
@ -224,7 +224,7 @@ var $tableFields_i18n = array(
* @access private * @access private
* @var array * @var array
*/ */
var $_tmpArray = array(); public $_tmpArray = array();
/** /**
* The constructor method; it initializates the menu system * The constructor method; it initializates the menu system

View File

@ -22,19 +22,19 @@ class TreeMenu extends LayersMenuCommon
* @access private * @access private
* @var string * @var string
*/ */
var $treeMenuImagesType; public $treeMenuImagesType;
/** /**
* Prefix for filenames of images of a theme * Prefix for filenames of images of a theme
* @access private * @access private
* @var string * @var string
*/ */
var $treeMenuTheme; public $treeMenuTheme;
/** /**
* An array where we store the Tree Menu code for each menu * An array where we store the Tree Menu code for each menu
* @access private * @access private
* @var array * @var array
*/ */
var $_treeMenu; public $_treeMenu;
/** /**
* The constructor method; it initializates the menu system * The constructor method; it initializates the menu system

80
htdocs/js/to_ascii.js Executable file
View File

@ -0,0 +1,80 @@
//
// Purpose of this file is to remap characters as ASCII characters
//
//
var to_ascii_array = new Array();
to_ascii_array['à'] = 'a';
to_ascii_array['á'] = 'a';
to_ascii_array['â'] = 'a';
to_ascii_array['À'] = 'a';
to_ascii_array['ã'] = 'a';
to_ascii_array['Ã¥'] = 'a';
to_ascii_array['À'] = 'A';
to_ascii_array['Á'] = 'A';
to_ascii_array['Ä'] = 'A';
to_ascii_array['Â'] = 'A';
to_ascii_array['Ã'] = 'A';
to_ascii_array['Å'] = 'A';
to_ascii_array['é'] = 'e';
to_ascii_array['Ú'] = 'e';
to_ascii_array['ë'] = 'e';
to_ascii_array['ê'] = 'e';
to_ascii_array['€'] = 'E';
to_ascii_array['ï'] = 'i';
to_ascii_array['î'] = 'i';
to_ascii_array['ì'] = 'i';
to_ascii_array['í'] = 'i';
to_ascii_array['Ï'] = 'I';
to_ascii_array['Î'] = 'I';
to_ascii_array['Ì'] = 'I';
to_ascii_array['Í'] = 'I';
to_ascii_array['ò'] = 'o';
to_ascii_array['ó'] = 'o';
to_ascii_array['ÃŽ'] = 'o';
to_ascii_array['õ'] = 'o';
to_ascii_array['ö'] = 'o';
to_ascii_array['Þ'] = 'o';
to_ascii_array['Ò'] = 'O';
to_ascii_array['Ó'] = 'O';
to_ascii_array['Ô'] = 'O';
to_ascii_array['Õ'] = 'O';
to_ascii_array['Ö'] = 'O';
to_ascii_array['Ø'] = 'O';
to_ascii_array['ù'] = 'u';
to_ascii_array['ú'] = 'u';
to_ascii_array['Ì'] = 'u';
to_ascii_array['û'] = 'u';
to_ascii_array['Ù'] = 'U';
to_ascii_array['Ú'] = 'U';
to_ascii_array['Ü'] = 'U';
to_ascii_array['Û'] = 'U';
to_ascii_array['Ê'] = 'ae';
to_ascii_array['Æ'] = 'AE';
to_ascii_array['Ü'] = 'y';
to_ascii_array['ÿ'] = 'y';
to_ascii_array['ß'] = 'SS';
to_ascii_array['Ç'] = 'C';
to_ascii_array['ç'] = 'c';
to_ascii_array['Ñ'] = 'N';
to_ascii_array['ñ'] = 'n';
to_ascii_array['¢'] = 'c';
to_ascii_array['©'] = '(C)';
to_ascii_array['®'] = '(R)';
to_ascii_array['«'] = '<<';
to_ascii_array['»'] = '>>';
function toAscii(text) {
//var text = field.value;
var position = 0;
var output = "";
for (position = 0 ; position < text.length ; position++) {
var tmp = text.substring(position,position+1);
if (to_ascii_array[tmp] != undefined) {
tmp = to_ascii_array[tmp];
}
output = output + tmp;
}
return output;
}

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.54 2006/01/03 20:39:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.55 2006/09/12 13:09:08 wurley Exp $
/** /**
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me the * For servers whose auth_type is set to 'cookie' or 'session'. Pass me the
@ -38,7 +38,7 @@ if (! $anon_bind)
$save_auth_type = $ldapserver->auth_type; $save_auth_type = $ldapserver->auth_type;
if ($anon_bind) { if ($anon_bind) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Anonymous Login was posted [%s].',64,$anon_bind); debug_log('Anonymous Login was posted [%s].',64,$anon_bind);
$dn = null; $dn = null;
@ -78,14 +78,15 @@ if ($anon_bind) {
# Got through each of the BASE DNs and test the login. # Got through each of the BASE DNs and test the login.
foreach ($ldapserver->getBaseDN() as $base_dn) { foreach ($ldapserver->getBaseDN() as $base_dn) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Searching LDAP with base [%s]',64,$base_dn); debug_log('Searching LDAP with base [%s]',64,$base_dn);
$result = array_pop($ldapserver->search(null,$base_dn,$filter,array('dn'))); $result = $ldapserver->search(null,$base_dn,$filter,array('dn'));
$result = array_pop($result);
$dn = $result['dn']; $dn = $result['dn'];
if ($dn) { if ($dn) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('Got DN [%s] for user ID [%s]',64,$dn,$uid); debug_log('Got DN [%s] for user ID [%s]',64,$dn,$uid);
break; break;
} }

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.27 2005/12/17 00:00:11 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.28 2006/10/29 11:44:36 wurley Exp $
/** /**
* Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type. * Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type.
@ -16,22 +16,65 @@
require './common.php'; require './common.php';
if (! $ldapserver->auth_type)
pla_error(_('Error: You have an error in your config file. The only three allowed values
for auth_type in the $servers section are \'session\', \'cookie\', and \'config\'. You entered \'%s\',
which is not allowed. '));
if (! in_array($ldapserver->auth_type, array('cookie','session'))) if (! in_array($ldapserver->auth_type, array('cookie','session')))
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type))); pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)));
include './header.php'; ?> include './header.php';
<body> echo '<body>';
<?php if( $ldapserver->isAnonBindAllowed() ) { ?> printf('<h3 class="title">%s %s</h3>',_('Authenticate to server'),$ldapserver->name);
# Check for a secure connection
if (! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
echo '<br />';
echo '<center>';
echo '<span style="color:red">';
printf('<acronym title="%s"><b>%s: %s.</b></acronym>',
_('You are not using \'https\'. Web browser will transmit login information in clear text.'),
_('Warning'),_('This web connection is unencrypted'));
echo '</span>';
echo '</center>';
echo '<br />';
}
# Login form.
echo '<form action="login.php" method="post" name="login_form">';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
if (isset($_GET['redirect']))
printf('<input type="hidden" name="redirect" value="%s" />',rawurlencode($_GET['redirect']));
echo '<center>';
echo '<table class="login">';
printf('<tr><td><b>%s</b></td></tr>',$ldapserver->isLoginAttrEnabled() ? _('Login Name') : _('Login DN'));
printf('<tr><td><input type="text" id="pla_login" name="%s" size="40" value="%s" /></td></tr>',
$ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn',
$ldapserver->isLoginAttrEnabled() ? '' : $ldapserver->login_dn);
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td><b>%s</b></td></tr>',_('Password'));
echo '<tr><td><input type="password" id="pla_pass" size="40" value="" name="login_pass" /></td></tr>';
echo '<tr><td colspan=2>&nbsp;</td></tr>';
# If Anon bind allowed, then disable the form if the user choose to bind anonymously.
if ($ldapserver->isAnonBindAllowed())
printf('<tr><td colspan="2"><small><b>%s</b></small> <input type="checkbox" name="anonymous_bind" onclick="toggle_disable_login_fields(this)" id="anonymous_bind_checkbox" /></td></tr>',
_('Anonymous'));
printf('<tr><td colspan="2"><center><input type="submit" name="submit" value="%s" /></center></td></tr>',
_('Authenticate'));
echo '</table>';
echo '</center>';
echo '</form>';
if( $ldapserver->isAnonBindAllowed() ) { ?>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
function toggle_disable_login_fields( anon_checkbox ) function toggle_disable_login_fields(anon_checkbox) {
{ if (anon_checkbox.checked) {
if( anon_checkbox.checked ) {
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = true; anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = true;
anon_checkbox.form.login_pass.disabled = true; anon_checkbox.form.login_pass.disabled = true;
} else { } else {
@ -41,63 +84,8 @@ include './header.php'; ?>
} }
--> -->
</script> </script>
<?php } ?> <?php }
<h3 class="title"><?php printf(_('Authenticate to server %s'),$ldapserver->name); ?></h3> echo '</body>';
<br /> echo '</html>';
<?php if (! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') { ?>
<center>
<span style="color:red">
<acronym title="<?php echo _('You are not using \'https\'. Web browser will transmit login information in clear text.'); ?>">
<?php echo _('Warning: This web connection is unencrypted.'); ?>
</acronym>
</span>
<br />
</center>
<?php } ?>
<br />
<form action="login.php" method="post" name="login_form">
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<?php if( isset( $_GET['redirect'] ) ) { ?>
<input type="hidden" name="redirect" value="<?php echo rawurlencode( $_GET['redirect'] ) ?>" />
<?php } ?>
<center>
<table class="login">
<?php if( $ldapserver->isAnonBindAllowed() ) { ?>
<tr>
<td colspan="2"><small><label for="anonymous_bind_checkbox"><?php echo _('Anonymous Bind'); ?></label></small> <input type="checkbox" name="anonymous_bind" onclick="toggle_disable_login_fields(this)" id="anonymous_bind_checkbox"/></td>
</tr>
<?php } ?>
<tr>
<td><small>
<?php
if ($ldapserver->isLoginAttrEnabled())
echo _('User name');
else
echo _('Login DN');
?> ?>
</small></td>
<td><input type="text" name="<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>" size="40" value="<?php echo $ldapserver->isLoginAttrEnabled() ? '' : $ldapserver->login_dn; ?>" /></td>
</tr>
<tr>
<td><small><?php echo _('Password'); ?></small></td>
<td><input type="password" size="40" value="" name="login_pass" /></td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" name="submit" value="<?php echo _('Authenticate'); ?>" /></center></td>
</tr>
</table>
</center>
</form>
</body>
</html>

View File

@ -0,0 +1,193 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/modify_member_form.php,v 1.4 2006/10/29 01:47:08 wurley Exp $
/**
* Displays a form to allow the user to modify group members.
*
* Variables that come in via common.php
* - server_id
* Variables that come in as GET vars:
* - dn (rawurlencoded)
* - attr (rawurlencoded) the attribute to which we are adding a value
*
* @package phpLDAPadmin
*/
/**
*/
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
$attr = $_GET['attr'];
$dn = isset($_GET['dn']) ? $_GET['dn'] : null;
$encoded_dn = rawurlencode($dn);
$encoded_attr = rawurlencode($attr);
if (! is_null($dn))
$rdn = get_rdn($dn);
else
$rdn = null;
# Get all current group members
$current_members = $ldapserver->getDNAttr($dn,$attr);
if ($current_members)
$num_current_members = (is_array($current_members) ? count($current_members) : 1);
else
$num_current_members = 0;
/*
* If there is only one member, convert scalar to array,
* arrays are required later when processing members
*/
if ($num_current_members == 1)
$current_members = array($current_members);
sort($current_members);
# Loop through all base dn's and search possible member entries
foreach ($ldapserver->getBaseDN() as $base_dn) {
# Get all entries that can be added to the group
if (preg_match("/^$attr$/i",$config->GetValue('modify_member','posixgroupattr')))
$possible_values = array_merge($ldapserver->search(null,$base_dn,
$config->GetValue('modify_member','posixfilter'),array($config->GetValue('modify_member','posixattr'))));
else
$possible_values = array_merge($ldapserver->search(null,$base_dn,
$config->GetValue('modify_member','filter'),array($config->GetValue('modify_member','attr'))));
}
if ($possible_values)
$num_possible_values = (is_array($possible_values) ? count($possible_values) : 1);
else
$num_possible_values = 0;
sort($possible_values);
include './header.php';
echo '<body>';
printf('<h3 class="title">%s <b>%s</b></h3>',_('Modify group'),htmlspecialchars($rdn));
printf('<h3 class="subtitle">%s <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
printf('%s <b>%s</b> %s <b>%s</b>:',
_('There are'),$num_current_members,_('members in group'),htmlspecialchars($rdn));
for ($i=0; $i<count($possible_values); $i++) {
if (preg_match("/^$attr$/i",$config->GetValue('modify_member','posixgroupattr')))
$possible_members[$i] = $possible_values[$i][$config->GetValue('modify_member','posixattr')];
else
$possible_members[$i] = $possible_values[$i][$config->GetValue('modify_member','attr')];
}
sort($possible_members);
/*
* Show only user that are not already in group.
* This loop removes existing users from possible members
*/
foreach ($possible_members as $pkey => $possible) {
foreach ($current_members as $current) {
if (preg_match("/^$current$/i","$possible_members[$pkey]")) {
unset($possible_members[$pkey]);
break;
}
}
}
/*
* Draw form with select boxes, left for all possible members and
* right one for those that belong to group
*/
# Modifications will be sent to update_confirm which takes care of rest of the processing
echo '<br />';
echo '<br />';
echo '<form action="update_confirm.php" method="post" class="add_value" name="member">';
echo '<table class="modify_members">';
echo '<tr>';
printf('<td><img src="images/user.png" alt="Users" /> %s</td>',_('Available members'));
printf('<td><img src="images/uniquegroup.png" alt="Members" /> %s</td>',_('Group members'));
echo '</tr>';
# Generate select box from all possible members
echo '<tr>';
echo '<td>';
echo '<select name="notmembers" size="10" multiple>';
foreach ($possible_members as $possible)
printf('<option>%s</option>',$possible);
echo '</select>';
echo '</td>';
# Generate select box from all current members
echo '<td>';
echo '<select name="members" size="10" multiple>';
foreach ($current_members as $current)
printf('<option>%s</option>',$current);
echo '</select>';
echo '</td>';
echo '</tr>';
# Show buttons which move users from left to right and vice versa
echo '<tr>';
echo '<td>';
printf('<input type="button" onClick="one2two()" value="%s >>" />&nbsp;<input type="button" onClick="all2two()" value="%s >>" />',
_('Add selected'),_('Add all'));
echo '</td>';
echo '<td>';
printf('<input type="button" onClick="two2one()" value="<< %s" />&nbsp;<input type="button" onClick="all2one()" value="<< %s" />',
_('Remove selected'),('Remove all'));
echo '</td>';
echo '</tr>';
echo '<tr><td colspan="2">';
# Hidden attributes for update_confirm.php
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$dn);
printf('<input type="hidden" name="attr" value="%s" />',$encoded_attr);
/*
* Generate array of input text boxes from current members.
* update_confirm.php will see this as old_values[member-attribute][item]
*/
for ($i=0; $i<$num_current_members; $i++)
printf('<input type="hidden" name="old_values[%s][%s]" value="%s" />',
htmlspecialchars($attr),$i,htmlspecialchars($current_members[$i]));
/*
* Javascript generates array of input text boxes from new members.
* update_confirm.php will see this as new_values[member-attribute][item]
* Input text boxes will be generated to div=dnu
*/
echo '<div id="dnu">';
printf('<input type="hidden" name="new_values[%s][]" value="" />',htmlspecialchars($attr));
echo '</div>';
# Submit values to update_confirm.php and when clicked, run addSelected
printf('<input type="submit" name="save" value="%s" onClick="update_new_values(\'%s\',\'modifymember\')" />',_('Save changes'),$attr);
echo '</td></tr>';
echo '</table>';
echo '</form>';
# Variables for Javascript function that moves members from left to right
echo '<script type="text/javascript" language="javascript">';
echo 'var m1 = document.member.notmembers;';
echo 'var m2 = document.member.members;';
echo '</script>';
echo '</body></html>';
?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.24 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.27 2007/03/18 03:14:52 wurley Exp $
/** /**
* Recursively deletes the specified DN and all of its children * Recursively deletes the specified DN and all of its children
@ -57,13 +57,13 @@ function pla_rdelete($ldapserver,$dn) {
$children = $ldapserver->getContainerContents($dn); $children = $ldapserver->getContainerContents($dn);
if (! is_array($children) || count($children) == 0) { if (! is_array($children) || count($children) == 0) {
printf('<nobr>'._('Deleting %s').'...',htmlspecialchars($dn)); printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),htmlspecialchars($dn));
flush(); flush();
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)))
if ($ldapserver->delete($dn)) { if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn));
printf(' <span style="color:green">%s</span></nobr><br />',_('Success')); printf(' <span style="color:green">%s</span></span><br />',_('Success'));
return true; return true;
} else { } else {
@ -74,13 +74,13 @@ function pla_rdelete($ldapserver,$dn) {
foreach ($children as $child_dn) foreach ($children as $child_dn)
pla_rdelete($ldapserver,$child_dn); pla_rdelete($ldapserver,$child_dn);
printf('<nobr>'._('Deleting %s').'...',htmlspecialchars($dn)); printf('<span style="white-space: nowrap;">%s %s...',_('Deleting'),htmlspecialchars($dn));
flush(); flush();
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)))
if ($ldapserver->delete($dn)) { if ($ldapserver->delete($dn)) {
run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn));
printf(' <span style="color:green">%s</span></nobr><br />',_('Success')); printf(' <span style="color:green">%s</span></span><br />',_('Success'));
return true; return true;
} else { } else {

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.30 2005/12/10 10:34:54 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.32 2007/03/18 02:06:20 wurley Exp $
/** /**
* Renames a DN to a different name. * Renames a DN to a different name.

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.64 2006/01/03 20:39:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.66 2007/03/21 23:33:58 wurley Exp $
/** /**
* Displays the schema for the specified server_id * Displays the schema for the specified server_id

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.76 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.77 2007/03/18 01:42:05 wurley Exp $
/** /**
* Perform LDAP searches and draw the advanced/simple search forms * Perform LDAP searches and draw the advanced/simple search forms
@ -43,6 +43,7 @@ if (isset($ldapserver)) {
} }
$filter = isset($_GET['filter']) ? clean_search_vals($_GET['filter']) : null; $filter = isset($_GET['filter']) ? clean_search_vals($_GET['filter']) : null;
$orderby = isset($_GET['orderby']) ? clean_search_vals($_GET['orderby']) : null;
$attr = isset($_GET['attribute']) ? $_GET['attribute'] : null; $attr = isset($_GET['attribute']) ? $_GET['attribute'] : null;
# grab the base dn for the search # grab the base dn for the search
@ -207,7 +208,8 @@ if (isset($_GET['search'])) {
debug_log('Search with base DN [%s]',64,$base_dn); debug_log('Search with base DN [%s]',64,$base_dn);
} }
$results = $ldapserver->search(null,dn_escape($base_dn),$filter,$search_result_attributes,$scope,true,$config->GetValue('deref','search')); $results = $ldapserver->search(null,dn_escape($base_dn),$filter,
$search_result_attributes,$scope,$orderby,$config->GetValue('deref','search'));
if ((! $results) && $ldapserver->errno()) if ((! $results) && $ldapserver->errno())
pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno()); pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno());

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.24 2006/04/29 06:49:31 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.26 2006/09/17 06:35:11 wurley Exp $
/** /**
* Fetches and displays all information that it can from the specified server * Fetches and displays all information that it can from the specified server
@ -50,13 +50,15 @@ if (! $ldapserver->haveAuthInfo())
pla_error( _('Not enough information to login to server. Please check your configuration.') ); pla_error( _('Not enough information to login to server. Please check your configuration.') );
# Fetch basic RootDSE attributes using the + and *. # Fetch basic RootDSE attributes using the + and *.
$attrs = array_pop($ldapserver->search(null,'','objectClass=*',array('+','*'),'base')); $attrs = $ldapserver->search(null,'','objectClass=*',array('+','*'),'base');
$attrs = array_pop($attrs);
/* After fetching the "basic" attributes from the RootDSE, try fetching the /* After fetching the "basic" attributes from the RootDSE, try fetching the
more advanced ones (from ths list). Add them to the list of attrs to display more advanced ones (from ths list). Add them to the list of attrs to display
if they weren't already fetched. (this was added as a work-around for OpenLDAP if they weren't already fetched. (this was added as a work-around for OpenLDAP
on RHEL 3. */ on RHEL 3. */
$attrs2 = array_pop($ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base')); $attrs2 = $ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base');
$attrs2 = array_pop($attrs2);
if (is_array($attrs2)) if (is_array($attrs2))
foreach ($attrs2 as $attr => $values) foreach ($attrs2 as $attr => $values)
@ -83,7 +85,7 @@ foreach ($attrs as $attr => $values) {
$schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',$ldapserver->server_id,$attr); $schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',$ldapserver->server_id,$attr);
echo '<tr><td class="attr">'; echo '<tr><td class="attr">';
printf('<b><a title="'._('Click to view the schema defintion for attribute type \'%s\'').'" href="%s">%s</a></b>', printf('<b><a title="'._('Click to view the schema definition for attribute type \'%s\'').'" href="%s">%s</a></b>',
$attr,$schema_href,htmlspecialchars($attr)); $attr,$schema_href,htmlspecialchars($attr));
echo '</td></tr>'; echo '</td></tr>';

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.33 2006/05/13 12:52:26 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.44 2007/01/18 21:03:58 wurley Exp $
/** /**
* Template render engine. * Template render engine.
@ -30,7 +30,6 @@ $shadow_format_attrs = array_merge($shadow_before_today_attrs,$shadow_after_toda
# If we have a DN, then this is to edit the entry. # If we have a DN, then this is to edit the entry.
if (isset($_REQUEST['dn'])) { if (isset($_REQUEST['dn'])) {
$dn = $_GET['dn']; $dn = $_GET['dn'];
$decoded_dn = rawurldecode($dn); $decoded_dn = rawurldecode($dn);
$encoded_dn = rawurlencode($decoded_dn); $encoded_dn = rawurlencode($decoded_dn);
@ -63,7 +62,7 @@ if (isset($_REQUEST['dn'])) {
} else { } else {
$templates = new Templates($ldapserver->server_id); $templates = new Templates($ldapserver->server_id);
$template = $templates->GetTemplate($_REQUEST['template']); $template = $templates->getCreationTemplate($_REQUEST['template']);
} }
} }
@ -84,9 +83,25 @@ if (isset($template['empty_attrs'])) {
echo "\n\n"; echo "\n\n";
if (isset($_REQUEST['nextpage']) && ! $_REQUEST['nextpage']) { if (isset($_REQUEST['nextpage']) && ! $_REQUEST['nextpage']) {
$new_dn = sprintf('%s=%s,%s',$template['rdn'],$_REQUEST['form'][$template['rdn']],$_REQUEST['container']);
echo '<form action="create.php" method="post">'; /*
* destinationcontainer is an otherride of dn.
* needed for such "actions" other than create.php
*/
if (!isset($template['destinationcontainer']))
$new_dn = sprintf('%s=%s,%s',$template['rdn'],$_REQUEST['form'][$template['rdn']],$_REQUEST['container']);
else
$new_dn = sprintf('%s',$template['destinationcontainer']);
/*
* default action is create.php
* you can change this behavior by setting <action>myscript.php</action> in template header
*/
if (!isset($template['action']))
echo '<form action="create.php" method="post">';
else
printf ('<form action="%s" method="post">',rawurlencode($template['action']));
printf('<input type="hidden" name="new_dn" value="%s" />',htmlspecialchars($new_dn)); printf('<input type="hidden" name="new_dn" value="%s" />',htmlspecialchars($new_dn));
} else { } else {
@ -255,7 +270,9 @@ if (isset($template['empty_attrs'])) {
# Some conditional checking. # Some conditional checking.
# $detail['must'] & $detail['disable'] cannot be set at the same time. # $detail['must'] & $detail['disable'] cannot be set at the same time.
if (isset($detail['must']) && $detail['must'] && isset($detail['disable']) && $detail['disable']) # except when "action" is other than create.php
if (isset($detail['must']) && $detail['must'] && isset($detail['disable']) && $detail['disable']
&& (!isset($template['action']) || ($template['action']) == 'create.php'))
pla_error(sprintf(_('Attribute [%s] is a MUST attribute, so it cannot be disabled.'),$attr)); pla_error(sprintf(_('Attribute [%s] is a MUST attribute, so it cannot be disabled.'),$attr));
# If this attribute is disabled, go to the next one. # If this attribute is disabled, go to the next one.
@ -439,7 +456,7 @@ if (isset($template['empty_attrs'])) {
printf('<td><input type="%s" name="form[%s][]" id="%s" value="%s" %s %s />', printf('<td><input type="%s" name="form[%s][]" id="%s" value="%s" %s %s />',
$type,$attr,$attr.$i,(isset($detail['value']) ? $detail['value'] : ''), $type,$attr,$attr.$i,(isset($detail['value']) ? $detail['value'] : ''),
"onBlur=\"fill('$attr', this.value);\"", '',
isset($detail['disable']) ? 'disabled' : ''); isset($detail['disable']) ? 'disabled' : '');
if (isset($detail['helper']) && isset($detail['helper']['location']) if (isset($detail['helper']) && isset($detail['helper']['location'])
@ -507,21 +524,32 @@ if (isset($template['empty_attrs'])) {
printf('<tr class="%s"><td colspan=2>',($counter++%2==0?'even':'odd')); printf('<tr class="%s"><td colspan=2>',($counter++%2==0?'even':'odd'));
printf('<input type="hidden" name="attrs[]" value="%s" />',$attr); printf('<input type="hidden" name="attrs[]" value="%s" />',$attr);
$countitems = false;
if (is_array($value)) if (is_array($value))
foreach ($value as $item) { foreach ($value as $item) {
if ($item && ! isset($unique[$item])) {
if (($item || $item == '0') && ! isset($unique[$item])) {
$unique[$item] = 1; $unique[$item] = 1;
if ($countitems)
printf ('<tr class="%s"><td colspan=2>',($counter++%2==0?'even':'odd'));
$countitems = true;
printf('<input type="hidden" name="vals[%s][]" value="%s" />', printf('<input type="hidden" name="vals[%s][]" value="%s" />',
array_search($attr,$attrs),$item); array_search($attr,$attrs),$item);
printf('%s</td><td><b>%s</b></td></tr>',$attr,htmlspecialchars($item)); printf('%s</td><td><b>%s</b></td></tr>',$attr,htmlspecialchars($item));
} }
} }
else { else {
$display = $value; $display = $value;
if (isset($template['attribute'][$attr]['type']) && $template['attribute'][$attr]['type'] == 'password') if (isset($template['attribute'][$attr]['type']) && $template['attribute'][$attr]['type'] == 'password') {
if (obfuscate_password_display($_REQUEST['enc']))
$enc = (isset($_REQUEST['enc'])) ? $_REQUEST['enc'] : get_enc_type($value);
if (obfuscate_password_display($enc))
$display = '********'; $display = '********';
}
printf('<input type="hidden" name="vals[]" value="%s" />',$value); printf('<input type="hidden" name="vals[]" value="%s" />',$value);
printf('%s</td><td><b>%s</b></td></tr>',$attr,htmlspecialchars($display)); printf('%s</td><td><b>%s</b></td></tr>',$attr,htmlspecialchars($display));
@ -619,7 +647,11 @@ if (isset($template['empty_attrs'])) {
return; return;
else { else {
attrTrace[id] = 1; attrTrace[id] = 1;
document.getElementById(id).value = value; // disable value setting in case of "select multiple"
if ((document.getElementById(id).tagName != "SELECT"
&& document.getElementById(id).tagName != "select")
|| document.getElementById(id).getAttribute("multiple") == "")
document.getElementById(id).value = value;
// here comes template-specific implementation, generated by php // here comes template-specific implementation, generated by php
if (false) {}'; if (false) {}';
@ -738,21 +770,25 @@ foreach ($template['attrs'] as $attr => $vals) {
echo '<tr>'; echo '<tr>';
echo '<td class="attr">'; echo '<td class="attr">';
if ($config->GetValue('appearance','show_schema_link')) {
$schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s', $schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',
$ldapserver->server_id,real_attr_name($attr)); $ldapserver->server_id,real_attr_name($attr));
printf('<b><a title="'._('Click to view the schema definition for attribute type \'%s\'').'" href="%s">%s</a></b>',$attr,$schema_href,$attr_display);
printf('<b><a title="'._('Click to view the schema defintion for attribute type \'%s\'').'" href="%s">%s</a></b>',$attr,$schema_href,$attr_display); } else {
printf('<b>%s</s>',$attr_display);
}
echo '</td>'; echo '</td>';
echo '<td class="attr_note">'; if ($config->GetValue('appearance','show_attribute_notes')) {
if ($attr_note) echo '<td class="attr_note">';
printf('<sup><small>%s</small></sup>',$attr_note); if ($attr_note)
printf('<sup><small>%s</small></sup>',$attr_note);
if ($ldapserver->isAttrReadOnly($attr)) if ($ldapserver->isAttrReadOnly($attr))
printf('<small>(<acronym title="%s">%s</acronym>)</small>',_('This attribute has been flagged as read only by the phpLDAPadmin administrator'),_('read only')); printf('<small>(<acronym title="%s">%s</acronym>)</small>',_('This attribute has been flagged as read only by the phpLDAPadmin administrator'),_('read only'));
echo '</td>'; echo '</td>';
}
echo '</tr>'; echo '</tr>';
if ($is_modified_attr) if ($is_modified_attr)
@ -968,13 +1004,17 @@ foreach ($template['attrs'] as $attr => $vals) {
$val = $vals[0]; $val = $vals[0];
printf('<input type="hidden" name="old_values[%s][]" value="%s" />',htmlspecialchars($attr),htmlspecialchars($val)); printf('<input type="hidden" name="old_values[%s][]" value="%s" />',htmlspecialchars($attr),htmlspecialchars($val));
printf('<nobr><input type="text" size="30" id="f_date_%s" name="new_values[%s][0]" value="%s" />&nbsp;', printf('<span style="white-space: nowrap;"><input type="text" size="30" id="f_date_%s" name="new_values[%s][0]" value="%s" />&nbsp;',
$attr,htmlspecialchars($attr),htmlspecialchars($val)); $attr,htmlspecialchars($attr),htmlspecialchars($val));
draw_date_selector_link($attr); draw_date_selector_link($attr);
echo '</nobr></td>'; echo '</span></td>';
echo '</tr>'; echo '</tr>';
$js[] = sprintf('<script type="text/javascript" language="javascript">defaults[\'f_date_%s\'] = \'%s\';</script>',$attr,$js_date_attrs[$attr]); $js[] = sprintf('<script type="text/javascript" language="javascript">defaults[\'f_date_%s\'] = \'%s\';</script>',$attr,$js_date_attrs[$attr]);
$js_datetime_attrs = $config->GetValue('appearance','date_attrs_showtime');
if (in_array_ignore_case($attr,array_keys($js_datetime_attrs)) && ($js_datetime_attrs[$attr]))
$js[] = sprintf('<script type="text/javascript" language="javascript">defaults[\'f_time_%s\'] = \'%s\';</script>',$attr,'true');
if ($is_modified_attr) if ($is_modified_attr)
echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>'; echo '<tr class="updated_attr"><td class="bottom" colspan="2"></td></tr>';
@ -1005,7 +1045,7 @@ foreach ($template['attrs'] as $attr => $vals) {
if (! strcasecmp($attr,'objectClass')) { if (! strcasecmp($attr,'objectClass')) {
printf('<a title="%s" href="schema.php?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s"><img src="images/info.png" alt="Info" /></a>&nbsp;', printf('<a title="%s" href="schema.php?server_id=%s&amp;view=objectClasses&amp;viewvalue=%s"><img src="images/info.png" alt="Info" /></a>&nbsp;',
_('View the schema description for this objectClass'),$ldapserver->server_id,htmlspecialchars($val)); _('View the schema description for this objectClass'),$ldapserver->server_id,strtolower(htmlspecialchars($val)));
$schema_object = $ldapserver->getSchemaObjectClass($val); $schema_object = $ldapserver->getSchemaObjectClass($val);
@ -1022,10 +1062,10 @@ foreach ($template['attrs'] as $attr => $vals) {
if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) if (is_dn_string($val) || $ldapserver->isDNAttr($attr))
if ($ldapserver->dnExists($val)) { if ($ldapserver->dnExists($val)) {
printf('<a title="'._('Go to %s').'" href="template_engine.php?server_id=%s&amp;dn=%s"><img style="vertical-align: top" src="images/go.png" /></a>&nbsp;', printf('<a title="'._('Go to %s').'" href="template_engine.php?server_id=%s&amp;dn=%s"><img style="vertical-align: top" src="images/go.png" alt="Go" /></a>&nbsp;',
htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val)); htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val));
} else { } else {
printf('<a title="'._('DN not available %s').'"><img style="vertical-align: top" src="images/nogo.png" /></a>&nbsp;', printf('<a title="'._('DN not available %s').'"><img style="vertical-align: top" src="images/nogo.png" alt="N/E" /></a>&nbsp;',
htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val)); htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val));
} }
@ -1104,6 +1144,14 @@ foreach ($template['attrs'] as $attr => $vals) {
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>', printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',
$add_href,sprintf(_('Add an additional value to attribute \'%s\''),$attr),_('add value')); $add_href,sprintf(_('Add an additional value to attribute \'%s\''),$attr),_('add value'));
if (in_array($schema_attr->name,$config->GetValue('modify_member','groupattr'))) {
$add_href = sprintf('modify_member_form.php?server_id=%s&amp;dn=%s&amp;attr=%s',
$ldapserver->server_id,$encoded_dn,rawurlencode($attr));
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',
$add_href,sprintf('%s %s',_('Modify members for'),$dn),_('modify group members'));
}
} }
echo '</td>'; echo '</td>';

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/tree.php,v 1.91 2006/01/03 20:39:58 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/tree.php,v 1.92 2006/10/29 12:49:24 wurley Exp $
/** /**
* This script displays the LDAP tree for all the servers that you have * This script displays the LDAP tree for all the servers that you have
@ -77,24 +77,24 @@ echo "\n\n";
echo '<!-- Links at the top of the tree viewer -->'; echo '<!-- Links at the top of the tree viewer -->';
echo '<table class="edit_dn_menu" width=100%><tr>'; echo '<table class="edit_dn_menu" width=100%><tr>';
printf('<td><img src="images/home.png" alt="%s" /></td>',_('Home')); printf('<td><img src="images/home.png" alt="%s" /></td>',_('Home'));
printf('<td width=50%%><nobr><a href="welcome.php" target="right_frame">%s</a></nobr></td>',_('Home')); printf('<td width=50%%><span style="white-space: nowrap;"><a href="welcome.php" target="right_frame">%s</a></span></td>',_('Home'));
printf('<td><img src="images/trash.png" alt="%s" /></td>',_('Purge caches')); printf('<td><img src="images/trash.png" alt="%s" /></td>',_('Purge caches'));
printf('<td width=50%%><nobr><a href="purge_cache.php" target="right_frame" title="%s">%s</a></nobr></td>',_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches')); printf('<td width=50%%><span style="white-space: nowrap;"><a href="purge_cache.php" target="right_frame" title="%s">%s</a></span></td>',_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'));
echo '</tr><tr>'; echo '</tr><tr>';
if (! $config->GetValue('appearance','hide_configuration_management')) { if (! $config->GetValue('appearance','hide_configuration_management')) {
printf('<td><img src="images/light.png" alt="%s" /></td>',_('light')); printf('<td><img src="images/light.png" alt="%s" /></td>',_('light'));
printf('<td width=50%%><nobr><a href="%s" target="new">%s</a></nobr></td>',get_href('add_rfe'),_('Request feature')); printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="new">%s</a></span></td>',get_href('add_rfe'),_('Request feature'));
printf('<td><img src="images/bug.png" alt="%s" /></td>',_('bug')); printf('<td><img src="images/bug.png" alt="%s" /></td>',_('bug'));
printf('<td width=50%%><nobr><a href="%s" target="new">%s</a></nobr></td>',get_href('add_bug'),_('Report a bug')); printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="new">%s</a></span></td>',get_href('add_bug'),_('Report a bug'));
echo '</tr><tr>'; echo '</tr><tr>';
printf('<td><img src="images/smile.png" alt="%s" /></td>',_('Donate')); printf('<td><img src="images/smile.png" alt="%s" /></td>',_('Donate'));
printf('<td width=50%%><nobr><a href="%s" target="right_frame">%s</a></nobr></td>',get_href('donate'),_('Donate')); printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="right_frame">%s</a></span></td>',get_href('donate'),_('Donate'));
} }
printf('<td><img src="images/help.png" alt="%s" /></td>',_('Help')); printf('<td><img src="images/help.png" alt="%s" /></td>',_('Help'));
printf('<td><nobr><a href="help.php" target="right_frame">%s</a></nobr></td>',_('Help')); printf('<td><span style="white-space: nowrap;"><a href="help.php" target="right_frame">%s</a></span></td>',_('Help'));
echo '</tr></table>'; echo '</tr></table>';
echo "\n\n"; echo "\n\n";

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.47 2006/05/13 12:52:26 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.48 2006/10/29 12:49:24 wurley Exp $
/** /**
* Takes the results of clicking "Save" in template_engine.php and determines which * Takes the results of clicking "Save" in template_engine.php and determines which
@ -144,7 +144,7 @@ if (count($update_array) > 0) {
printf('<tr class="%s">',$counter%2 ? 'even' : 'odd'); printf('<tr class="%s">',$counter%2 ? 'even' : 'odd');
printf('<td><b>%s</b></td>',htmlspecialchars($attr)); printf('<td><b>%s</b></td>',htmlspecialchars($attr));
echo '<td><nobr>'; echo '<td><span style="white-space: nowrap;">';
if (strcasecmp($attr,'userPassword') == 0) { if (strcasecmp($attr,'userPassword') == 0) {
foreach ($old_values[$attr] as $key => $value) { foreach ($old_values[$attr] as $key => $value) {
@ -161,8 +161,8 @@ if (count($update_array) > 0) {
else else
echo nl2br(htmlspecialchars($old_values[$attr])).'<br />'; echo nl2br(htmlspecialchars($old_values[$attr])).'<br />';
echo '</nobr></td>'; echo '</span></td>';
echo '<td><nobr>'; echo '<td><span style="white-space: nowrap;">';
# Is this a multi-valued attribute? # Is this a multi-valued attribute?
if (is_array($new_val)) { if (is_array($new_val)) {
@ -201,7 +201,7 @@ if (count($update_array) > 0) {
} elseif ($new_val != '') } elseif ($new_val != '')
printf('<span style="color: red">%s</span>',_('[attribute deleted]')); printf('<span style="color: red">%s</span>',_('[attribute deleted]'));
echo '</nobr></td>'; echo '</span></td>';
printf('<td><input name="skip_array[%s]" type="checkbox" /></td>',htmlspecialchars($attr)); printf('<td><input name="skip_array[%s]" type="checkbox" /></td>',htmlspecialchars($attr));
echo '</tr>'."\n\n"; echo '</tr>'."\n\n";

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.78 2006/01/03 20:39:59 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.79 2006/09/17 07:22:09 wurley Exp $
/** /**
* Contains code to be executed at the top of each phpLDAPadmin page. * Contains code to be executed at the top of each phpLDAPadmin page.
@ -105,6 +105,7 @@ if ($language == 'auto') {
# Set language # Set language
putenv('LANG='.$HTTP_LANG); # e.g. LANG=de_DE putenv('LANG='.$HTTP_LANG); # e.g. LANG=de_DE
$HTTP_LANG .= '.UTF-8';
setlocale(LC_ALL,$HTTP_LANG); # set LC_ALL to de_DE setlocale(LC_ALL,$HTTP_LANG); # set LC_ALL to de_DE
bindtextdomain('messages',LANGDIR); bindtextdomain('messages',LANGDIR);
bind_textdomain_codeset('messages','UTF-8'); bind_textdomain_codeset('messages','UTF-8');
@ -125,6 +126,7 @@ if ($language == 'auto') {
# Set language # Set language
putenv('LANG='.$language); # e.g. LANG=de_DE putenv('LANG='.$language); # e.g. LANG=de_DE
$language .= '.UTF-8';
setlocale(LC_ALL,$language); # set LC_ALL to de_DE setlocale(LC_ALL,$language); # set LC_ALL to de_DE
bindtextdomain('messages',LANGDIR); bindtextdomain('messages',LANGDIR);
bind_textdomain_codeset('messages','UTF-8'); bind_textdomain_codeset('messages','UTF-8');

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.17 2005/12/10 10:34:55 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.25 2007/01/18 21:03:58 wurley Exp $
/** /**
* Configuration processing and defaults. * Configuration processing and defaults.
@ -9,11 +9,11 @@
*/ */
# The minimum version of PHP required to run phpLDAPadmin. # The minimum version of PHP required to run phpLDAPadmin.
define('REQUIRED_PHP_VERSION','4.1.0'); define('REQUIRED_PHP_VERSION','5.0.0');
class Config { class Config {
var $custom; public $custom;
var $default; protected $default;
function Config() { function Config() {
@ -46,6 +46,10 @@ class Config {
'desc'=>'Array of attributes that should show a jscalendar', 'desc'=>'Array of attributes that should show a jscalendar',
'default'=>array('shadowExpire'=>'%es','shadowLastChange'=>'%es')); 'default'=>array('shadowExpire'=>'%es','shadowLastChange'=>'%es'));
$this->default->appearance['date_attrs_showtime'] = array(
'desc'=>'Array of attributes that should show a the time when showing the jscalendar',
'default'=>array(''));
$this->default->appearance['hide_configuration_management'] = array( $this->default->appearance['hide_configuration_management'] = array(
'desc'=>'Hide the Sourceforge related links', 'desc'=>'Hide the Sourceforge related links',
'default'=>false); 'default'=>false);
@ -94,7 +98,7 @@ class Config {
*/ */
$this->default->appearance['obfuscate_password_display'] = array( $this->default->appearance['obfuscate_password_display'] = array(
'desc'=>'Obfuscate the display of passwords', 'desc'=>'Obfuscate the display of passwords',
'default'=>false); 'default'=>true);
$this->default->appearance['show_clear_password'] = array( $this->default->appearance['show_clear_password'] = array(
'desc'=>'Whether to show clear passwords if we dont obfuscate them', 'desc'=>'Whether to show clear passwords if we dont obfuscate them',
@ -108,6 +112,18 @@ class Config {
'desc'=>'Show helpful hints', 'desc'=>'Show helpful hints',
'default'=>true); 'default'=>true);
$this->default->appearance['show_top_create'] = array(
'desc'=>'Show a additional create link on the top of the list if there are more than 10 entries',
'default'=>true);
$this->default->appearance['show_schema_link'] = array(
'desc'=>'Show the schema link for each attribute',
'default'=>true);
$this->default->appearance['show_attribute_notes'] = array(
'desc'=>'Show notes for each attribute',
'default'=>true);
/** Tree display /** Tree display
* A format string used to display enties in the tree viewer (left-hand side) * 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 * You can use special tokens to draw the entries as you wish. You can even mix in HTML to format the string
@ -141,6 +157,14 @@ class Config {
'desc'=>'Whether to enable the PHPLayersMenu for the tree', 'desc'=>'Whether to enable the PHPLayersMenu for the tree',
'default'=>false); 'default'=>false);
/**
* Tree display filter
* LDAP filter used to search entries for the tree viewer (left-hand side)
*/
$this->default->appearance['tree_filter'] = array(
'desc'=>'LDAP search filter for the tree entries',
'default'=>'(objectClass=*)');
/** Caching /** Caching
*/ */
$this->default->cache['schema'] = array( $this->default->cache['schema'] = array(
@ -209,6 +233,56 @@ class Config {
'desc'=>'Time in seconds to keep jpegPhoto temporary files in the temp directory', 'desc'=>'Time in seconds to keep jpegPhoto temporary files in the temp directory',
'default'=>120); 'default'=>120);
## Modify members feature
/**
* Search filter setting for new members. This is used to search possible members that can be added
* to the group. See modify_member_form.php
*/
$this->default->modify_member['filter'] = array(
'desc'=>'Search filter for member searches',
'default'=>'(objectclass=Person)');
/**
* Group attributes. When these attributes are seen in template_engine.php, add "modify group members"
* link to the attribute
* See template_engine.php
*/
$this->default->modify_member['groupattr'] = array(
'desc'=>'Group member attributes',
'default'=>array('member','uniqueMember','memberUid'));
/**
* Attribute that is added to the group member attribute. For groupOfNames or groupOfUniqueNames this is dn,
* for posixGroup it's uid. See modify_member_form.php
*/
$this->default->modify_member['attr'] = array(
'desc'=>'Default attribute that is added to the group member attribute',
'default'=>'dn');
/**
* Attribute that is added to the group member attribute.
* For posixGroup it's uid. See modify_member_form.php
*/
$this->default->modify_member['posixattr'] = array(
'desc'=>'Contents of the group member attribute',
'default'=>'uid');
/**
* Search filter setting for new members to group. This is used to search possible members that can be added
* to the posixGroup. See modify_member_form.php
*/
$this->default->modify_member['posixfilter'] = array(
'desc'=>'Search filter for posixmember searches',
'default'=>'(uid=*)');
/**
* posixGroup attribute. When this attribute are seen in modify_member_form.php, only posixGroup members are shown
* See modify_member_form.php
*/
$this->default->modify_member['posixgroupattr'] = array(
'desc'=>'posixGroup member attribute',
'default'=>'memberUid');
## Session Attributes ## Session Attributes
/** Cookie Encryption /** Cookie Encryption
* phpLDAPadmin can encrypt the content of sensitive cookies if you set this to a big random string. * phpLDAPadmin can encrypt the content of sensitive cookies if you set this to a big random string.
@ -250,6 +324,10 @@ class Config {
'desc'=>'Whether to use similiar characters', 'desc'=>'Whether to use similiar characters',
'default'=>true); 'default'=>true);
$this->default->password['no_random_crypt_salt'] = array(
'descr'=>'Disable random salt for crypt()',
'default'=>false);
/** Search display /** Search display
* By default, when searching you may display a list or a table of results. * 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 'table' to see table formatted results.
@ -289,7 +367,7 @@ class Config {
'default'=>array('cn','sn','uid','postalAddress','telephoneNumber')); 'default'=>array('cn','sn','uid','postalAddress','telephoneNumber'));
} }
function GetValue($key,$index) { public function GetValue($key,$index) {
$value = null; $value = null;
@ -321,7 +399,7 @@ class Config {
/** /**
* Function to check and warn about any unusual defined variables. * Function to check and warn about any unusual defined variables.
*/ */
function CheckCustom() { public function CheckCustom() {
if (isset($this->custom)) { if (isset($this->custom)) {
foreach ($this->custom as $masterkey => $masterdetails) { foreach ($this->custom as $masterkey => $masterdetails) {

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.292 2006/05/13 12:52:27 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.302 2006/10/29 11:44:36 wurley Exp $
/** /**
* A collection of functions used throughout phpLDAPadmin. * A collection of functions used throughout phpLDAPadmin.
@ -400,9 +400,10 @@ function real_attr_name($attr_name) {
* *
* @todo Must turn off auto_uid|gid in template if config is disabled. * @todo Must turn off auto_uid|gid in template if config is disabled.
*/ */
function get_next_number(&$ldapserver,$startbase='',$type='uid') { function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false,$filter=false) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('get_next_number(): Entered with (%s,%s,%s)',1,$ldapserver->server_id,$startbase,$type); debug_log('get_next_number(): Entered with (%s,%s,%s,%s)',1,
$ldapserver->server_id,$startbase,$type,$filter);
global $config,$ldapservers; global $config,$ldapservers;
@ -420,15 +421,16 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid') {
if (is_null($base_dn)) if (is_null($base_dn))
pla_error(sprintf(_('You specified the "auto_uid_number_mechanism" as "search" in your pla_error(sprintf(_('You specified the "auto_uid_number_mechanism" as "search" in your
configuration for server <b>%s</b>, but you did not specify the configuration for server <b>%s</b>, but you did not specify the
"auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name)); "auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name));
} else { } else {
$base_dn = $startbase; $base_dn = $startbase;
} }
if (! $ldapserver->dnExists($base_dn)) if (! $ldapserver->dnExists($base_dn))
pla_error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'),$ldapserver->name)); pla_error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'),
$ldapserver->name));
$filter = '(|(uidNumber=*)(gidNumber=*))'; $filter = '(|(uidNumber=*)(gidNumber=*))';
$results = array(); $results = array();
@ -497,11 +499,80 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid') {
break; break;
case 'uidpool':
$con = $ldapserver->connect(false,'auto_search',false,
$ldapservers->GetValue($ldapserver->server_id,'auto_number','dn'),
$ldapservers->GetValue($ldapserver->server_id,'auto_number','pass'));
if (! $con)
pla_error(sprintf(_('Unable to bind to <b>%s</b> with your with auto_uid credentials. Please check your configuration file.'),$ldapserver->name));
# assume that uidpool dn is set in config file if no filter given
if (empty($filter))
$uidpool_dn = $ldapservers->GetValue($ldapserver->server_id,'auto_number','uidpool_dn');
else {
$filter = str_replace(array('&amp;',':::'),array('&',','),$filter);
$dns = $ldapserver->search($con,$startbase,$filter,array('dn'),'sub');
switch (count($dns)) {
case '1':
break;
case '0':
pla_error(_('Uidpool dn not found, please change filter parameter'));
default:
pla_error(_('There is more than one dn for uidpool,please change filter parameter'));
}
list ($key,$attrs) = each($dns);
$attrs = array_change_key_case($attrs);
$uidpool_dn = $attrs['dn'];
}
if (empty($uidpool_dn))
pla_error(_('uidpool_dn not found. Please check filter (arg 3) or set up uidpool_dn in config file'));
switch ($type) {
case 'uid':
$attrs = array('sambaNextUserRid');
$key = 'sambanextuserrid';
$realkey = 'sambaNextUserRid';
break;
case 'gid':
$attrs = array('sambaNextGroupRid');
$key = 'sambanextgrouprid';
$realkey = 'sambaNextGroupRid';
break;
default:
// It might exists other attributes types...
$attrs = array($type);
$key = strtolower($type);
$realkey = $type;
break;
}
$number = $ldapserver->search($con,$uidpool_dn,$filter,$attrs,'base');
list($rkey,$number) = each($number);
$number = array_change_key_case($number);
$number = $number[$key];
if (isset($increment) && ($increment == 'true')) {
$updatedattr = array ($key => $number + 1);
$ldapserver->modify($uidpool_dn,$updatedattr);
}
return $number;
break;
# No other cases allowed. The user has an error in the configuration # No other cases allowed. The user has an error in the configuration
default : default :
pla_error( sprintf( _('You specified an invalid value for auto_uid_number_mechanism ("%s") pla_error( sprintf( _('You specified an invalid value for auto_uid_number_mechanism ("%s")
in your configration. Only "uidpool" and "search" are valid. in your configration. Only "uidpool" and "search" are valid.
Please correct this problem.') , $mechanism) ); Please correct this problem.') , $mechanism) );
} }
} }
@ -1006,67 +1077,91 @@ function support_oid_to_text($oid_id) {
* @see ldap_errno * @see ldap_errno
* @see pla_verbose_error * @see pla_verbose_error
*/ */
function pla_error( $msg, $ldap_err_msg=null, $ldap_err_no=-1, $fatal=true ) { function pla_error($msg,$ldap_err_msg=null,$ldap_err_no=-1,$fatal=true,$backtrace=null) {
if (defined('DEBUG_ENABLED') && (DEBUG_ENABLED)) if (defined('DEBUG_ENABLED') && (DEBUG_ENABLED))
debug_log('pla_error(): Entered with (%s,%s,%s,%s)',1,$msg,$ldap_err_msg,$ldap_err_no,$fatal); debug_log('pla_error(): Entered with (%s,%s,%s,%s)',1,$msg,$ldap_err_msg,$ldap_err_no,$fatal);
@include_once HTDOCDIR.'header.php'; include_once HTDOCDIR.'header.php';
$server = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'undefined';
global $config; global $config;
?> echo '<center>';
<center> echo '<table class="error">';
<table class="error"><tr><td class="img"><img src="images/warning.png" alt="Warning" /></td>
<td><center><h2><?php echo _('Error');?></h2></center> printf('<tr><th colspan="4">%s</th></tr>',_('Error'));
<?php echo $msg; ?>
<br /> echo '<tr>';
<br /> echo '<td rowspan="99" width="10%"><img src="images/warning.png" alt="Warning" /></td>';
<?php printf('<td colspan="3"><b>%s</b></td>',$msg);
echo '</tr>';
echo '<tr><td colspan="3">&nbsp;</td></tr>';
if (function_exists('syslog_err')) if (function_exists('syslog_err'))
syslog_err($msg); syslog_err($msg);
if( $ldap_err_msg ) { if ($ldap_err_msg)
echo sprintf(_('LDAP said: %s'), htmlspecialchars( $ldap_err_msg )); printf('<tr><td colspan="3"><b>%s</b>: %s</td></tr>',_('LDAP said'),htmlspecialchars($ldap_err_msg));
echo '<br />';
}
if( $ldap_err_no != -1 ) { if ($ldap_err_no != -1) {
$ldap_err_no = ( '0x' . str_pad( dechex( $ldap_err_no ), 2, 0, STR_PAD_LEFT ) ); $ldap_err_no = ('0x'.str_pad(dechex($ldap_err_no),2,0,STR_PAD_LEFT));
$verbose_error = pla_verbose_error( $ldap_err_no ); $verbose_error = pla_verbose_error($ldap_err_no);
if( $verbose_error ) { if ($verbose_error) {
echo sprintf( _('Error number: %s (%s)'), $ldap_err_no, $verbose_error['title']); printf('<tr><td colspan="2"><b>%s</b>: %s (%s)</td></tr>',_('Error number'),$ldap_err_no,$verbose_error['title']);
echo '<br />'; printf('<tr><td colspan="2"><b>%s</b>: %s</td></tr>',_('Description'),$verbose_error['desc']);
echo sprintf( _('Description: %s <br /><br />'), $verbose_error['desc']);
} else { } else {
echo sprintf(_('Error number: %s<br /><br />'), $ldap_err_no); printf('<tr><td colspan="2"><b>%s</b>: %s</td></tr>',_('Error number'),$ldap_err_no);
echo '<br />'; printf('<tr><td colspan="2"><b>%s</b>: (%s)</td></tr>',_('Description'),_('no description available'));
echo _('Description: (no description available)<br />');
} }
echo '<tr><td colspan="3">&nbsp;</td></tr>';
if (function_exists('syslog_err')) if (function_exists('syslog_err'))
syslog_err(sprintf(_('Error number: %s<br /><br />'),$ldap_err_no)); syslog_err(sprintf('%s %s',_('Error number'),$ldap_err_no));
}
?>
<br />
<!-- Commented out due to too many false bug reports. :)
<br />
<center>
<small>
<?php echo sprintf(_('Is this a phpLDAPadmin bug? If so, please <a href=\'%s\'>report it</a>.') , get_href( 'add_bug' ));?>
<?php
if( function_exists( "debug_print_backtrace" ) )
debug_print_backtrace();
?>
</small>
</center>
-->
</td></tr></table>
</center>
<?php
if( $fatal ) { } elseif ((defined('DEBUG_ENABLED') && DEBUG_ENABLED && function_exists('debug_backtrace')) || $backtrace) {
echo "</body>\n</html>"; printf('<tr><td colspan="3"><b>%s</b></td></tr>',_('Backtrace'));
if (is_null($backtrace))
$backtrace = debug_backtrace();
printf('<tr><td>&nbsp;</td><td><b><small><span style="white-space: nowrap;">%s</span></small></b></td><td>%s</td></tr>',
'PHP Version',phpversion());
printf('<tr><td>&nbsp;</td><td><b><small><span style="white-space: nowrap;">%s</span></small></b></td><td>%s</td></tr>',
'PLA Version',pla_version());
printf('<tr><td>&nbsp;</td><td><b><small><span style="white-space: nowrap;">%s</span></small></b></td><td>%s</td></tr>',
'PHP SAPI',php_sapi_name());
printf('<tr><td>&nbsp;</td><td><b><small><span style="white-space: nowrap;">%s</span></small></b></td><td>%s</td></tr>',
'Web Server',$server);
echo '<tr><td colspan="3">&nbsp;</td></tr>';
foreach ($backtrace as $error => $line) {
printf('<tr><td rowspan="2">&nbsp;</td><td><b><small>%s</small></b></td><td>%s (%s)</td></tr>',_('File'),$line['file'],$line['line']);
printf('<tr><td><b><small>%s</small></b></td><td><small>%s<br /><pre>',_('Function'),$line['function']);
print_r($line['args']);
echo '</pre></small></td></tr>';
}
/*
<br />
<!-- Commented out due to too many false bug reports. :)
<br />
<center>
<small>
<?php printf(_('Is this a phpLDAPadmin bug? If so, please <a href=\'%s\'>report it</a>.'),get_href('add_bug'));?>
</small>
</center>
-->
*/
}
echo '</table>';
echo '</center>';
if ($fatal) {
echo '</body>';
echo '</html>';
die(); die();
} }
} }
@ -1088,69 +1183,66 @@ function pla_error( $msg, $ldap_err_msg=null, $ldap_err_no=-1, $fatal=true ) {
* *
* @see set_error_handler * @see set_error_handler
*/ */
function pla_error_handler( $errno, $errstr, $file, $lineno ) { function pla_error_handler($errno,$errstr,$file,$lineno) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('pla_error_handler(): Entered with (%s,%s,%s,%s)',1,$errno,$errstr,$file,$lineno); debug_log('pla_error_handler(): Entered with (%s,%s,%s,%s)',1,$errno,$errstr,$file,$lineno);
// error_reporting will be 0 if the error context occurred /* error_reporting will be 0 if the error context occurred
// within a function call with '@' preprended (ie, @ldap_bind() ); * within a function call with '@' preprended (ie, @ldap_bind() );
// So, don't report errors if the caller has specifically * So, don't report errors if the caller has specifically
// disabled them with '@' * disabled them with '@'
if( 0 == ini_get( 'error_reporting' ) || 0 == error_reporting() ) */
if (ini_get('error_reporting') == 0 || error_reporting() == 0)
return; return;
$file = basename( $file ); $file = basename($file);
$caller = basename( $_SERVER['PHP_SELF'] ); $caller = basename($_SERVER['PHP_SELF']);
$errtype = ""; $errtype = '';
switch( $errno ) {
case E_STRICT: $errtype = "E_STRICT"; break; switch ($errno) {
case E_ERROR: $errtype = "E_ERROR"; break; case E_STRICT: $errtype = 'E_STRICT'; break;
case E_WARNING: $errtype = "E_WARNING"; break; case E_ERROR: $errtype = 'E_ERROR'; break;
case E_PARSE: $errtype = "E_PARSE"; break; case E_WARNING: $errtype = 'E_WARNING'; break;
case E_NOTICE: $errtype = "E_NOTICE"; break; case E_PARSE: $errtype = 'E_PARSE'; break;
case E_CORE_ERROR: $errtype = "E_CORE_ERROR"; break; case E_NOTICE: $errtype = 'E_NOTICE'; break;
case E_CORE_WARNING: $errtype = "E_CORE_WARNING"; break; case E_CORE_ERROR: $errtype = 'E_CORE_ERROR'; break;
case E_COMPILE_ERROR: $errtype = "E_COMPILE_ERROR"; break; case E_CORE_WARNING: $errtype = 'E_CORE_WARNING'; break;
case E_COMPILE_WARNING: $errtype = "E_COMPILE_WARNING"; break; case E_COMPILE_ERROR: $errtype = 'E_COMPILE_ERROR'; break;
case E_USER_ERROR: $errtype = "E_USER_ERROR"; break; case E_COMPILE_WARNING: $errtype = 'E_COMPILE_WARNING'; break;
case E_USER_WARNING: $errtype = "E_USER_WARNING"; break; case E_USER_ERROR: $errtype = 'E_USER_ERROR'; break;
case E_USER_NOTICE: $errtype = "E_USER_NOTICE"; break; case E_USER_WARNING: $errtype = 'E_USER_WARNING'; break;
case E_ALL: $errtype = "E_ALL"; break; case E_USER_NOTICE: $errtype = 'E_USER_NOTICE'; break;
default: $errtype = _('Unrecognized error number: ') . $errno; case E_ALL: $errtype = 'E_ALL'; break;
default: $errtype = sprintf('%s: %s',_('Unrecognized error number'),$errno);
} }
$errstr = preg_replace("/\s+/"," ",$errstr); $errstr = preg_replace('/\s+/',' ',$errstr);
if( $errno == E_NOTICE ) {
echo sprintf(_('<center><table class=\'notice\'><tr><td colspan=\'2\'><center><img src=\'images/warning.png\' height=\'12\' width=\'13\' alt="Warning" /> if ($errno == E_NOTICE) {
<b>You found a non-fatal phpLDAPadmin bug!</b></td></tr><tr><td>Error:</td><td><b>%s</b> (<b>%s</b>)</td></tr><tr><td>File:</td> echo '<center>';
<td><b>%s</b> line <b>%s</b>, caller <b>%s</b></td></tr><tr><td>Versions:</td><td>PLA: <b>%s</b>, PHP: <b>%s</b>, SAPI: <b>%s</b>
</td></tr><tr><td>Web server:</td><td><b>%s</b></td></tr> echo '<table class="notice">';
<tr><td colspan=\'2\'><center><a target=\'new\' href=\'%s\'>Please check and see if this bug has been reported here</a>.</center></td></tr> printf('<tr><td colspan="2"><center><img src="images/warning.png" height="12" width="13" alt="Warning" />&nbsp;<b>%s</b></center></td></tr>',
<tr><td colspan=\'2\'><center><a target=\'new\' href=\'%s\'>If it hasnt been reported, you may report this bug by clicking here</a>.</center></td></tr> _('You found a non-fatal phpLDAPadmin bug!'));
</table></center><br />'), $errstr, $errtype, $file,
$lineno, $caller, pla_version(), phpversion(), php_sapi_name(), printf('<tr><td>%s:</td><td><b>%s</b> (<b>%s</b>)</td></tr>',_('Error'),$errstr,$errtype);
$_SERVER['SERVER_SOFTWARE'], get_href('search_bug',"&summary_keyword=".htmlspecialchars($errstr)),get_href('add_bug')); printf('<tr><td>%s:</td><td><b>%s</b> %s <b>%s</b>, %s <b>%s</b></td></tr>',_('File'),$file,_('line'),$lineno,_('caller'),$caller);
printf('<tr><td>Versions:</td><td>PLA: <b>%s</b>, PHP: <b>%s</b>, SAPI: <b>%s</b></td></tr>',
pla_version(),phpversion(),php_sapi_name());
printf('<tr><td>Web server:</td><td><b>%s</b></td></tr>',$_SERVER['SERVER_SOFTWARE']);
printf('<tr><td colspan="2"><a target="new" href="%s"><center>%s.</center></a></td></tr>',
get_href('search_bug',"&summary_keyword=".htmlspecialchars($errstr)),
_('Please check and see if this bug has been reported'));
echo '</table>';
echo '</center>';
return; return;
} }
$server = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : 'undefined'; pla_error(sprintf('%s: %s',$errtype,$errstr),null,-1,true,debug_backtrace());
$phpself = isset( $_SERVER['PHP_SELF'] ) ? basename( $_SERVER['PHP_SELF'] ) : 'undefined';
pla_error( sprintf(_('Congratulations! You found a bug in phpLDAPadmin.<br /><br />
<table class=\'bug\'>
<tr><td>Error:</td><td><b>%s</b></td></tr>
<tr><td>Level:</td><td><b>%s</b></td></tr>
<tr><td>File:</td><td><b>%s</b></td></tr>
<tr><td>Line:</td><td><b>%s</b></td></tr>
<tr><td>Caller:</td><td><b>%s</b></td></tr>
<tr><td>PLA Version:</td><td><b>%s</b></td></tr>
<tr><td>PHP Version:</td><td><b>%s</b></td></tr>
<tr><td>PHP SAPI:</td><td><b>%s</b></td></tr>
<tr><td>Web server:</td><td><b>%s</b></td></tr>
</table>
<br />
Please report this bug by clicking below!'), $errstr, $errtype, $file,
$lineno, $phpself, pla_version(),
phpversion(), php_sapi_name(), $server ));
} }
/** /**
@ -1216,7 +1308,8 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu
if (isset($table_html_attrs) && trim($table_html_attrs) ) if (isset($table_html_attrs) && trim($table_html_attrs) )
printf('<table %s><tr><td><center>',$table_html_attrs); printf('<table %s><tr><td><center>',$table_html_attrs);
$jpeg_data = array_pop($ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base')); $jpeg_data = $ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base');
$jpeg_data = array_pop($jpeg_data);
if (! $jpeg_data) { if (! $jpeg_data) {
printf(_('Could not fetch jpeg data from LDAP server for attribute %s.'),htmlspecialchars($attr_name)); printf(_('Could not fetch jpeg data from LDAP server for attribute %s.'),htmlspecialchars($attr_name));
return; return;
@ -1311,7 +1404,13 @@ function password_hash( $password_clear, $enc_type ) {
switch( $enc_type ) { switch( $enc_type ) {
case 'crypt': case 'crypt':
$new_value = '{CRYPT}' . crypt( $password_clear, random_salt(2) ); global $config;
if ($config->GetValue('password','no_random_crypt_salt') == true)
$new_value = '{CRYPT}' . crypt($password_clear,substr($password_clear,0,2));
else
$new_value = '{CRYPT}' . crypt($password_clear,random_salt(2));
break; break;
case 'ext_des': case 'ext_des':
@ -1719,7 +1818,7 @@ function dn_unescape($dn) {
*/ */
function get_href($type,$extra_info='') { function get_href($type,$extra_info='') {
$sf = 'https://sourceforge.net'; $sf = 'https://sourceforge.net';
$pla = 'http://wiki.pldapadmin.com'; $pla = 'http://wiki.phpldapadmin.info';
$group_id = '61828'; $group_id = '61828';
$bug_atid = '498546'; $bug_atid = '498546';
$rfe_atid = '498549'; $rfe_atid = '498549';
@ -2575,12 +2674,15 @@ function masort(&$data,$sortby,$rev=0) {
* @param array $attrs LDAP attributes to use as values. * @param array $attrs LDAP attributes to use as values.
* @return array $results Array of values keyed by $key. * @return array $results Array of values keyed by $key.
*/ */
function return_ldap_hash($ldapserver,$base_dn,$filter,$key,$attrs) { function return_ldap_hash($ldapserver,$base_dn,$filter,$key,$attrs,$sort=null) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('return_ldap_hash(): Entered with (%s,%s,%s,%s,%s)',0, debug_log('return_ldap_hash(): Entered with (%s,%s,%s,%s,%s)',0,
$ldapserver->server_id,$base_dn,$filter,$key,count($attrs)); $ldapserver->server_id,$base_dn,$filter,$key,count($attrs));
$ldapquery = $ldapserver->search(null,$base_dn,$filter,$attrs); if (is_array($sort))
$ldapquery = $ldapserver->search(null,$base_dn,$filter,$attrs,'sub',false,LDAP_DEREF_NEVER,0,$sort);
else
$ldapquery = $ldapserver->search(null,$base_dn,$filter,$attrs);
$results = array(); $results = array();
@ -2666,7 +2768,7 @@ function password_generate() {
$leftover = array_merge($leftover,$llower,$lupper,$numbers,$punc); $leftover = array_merge($leftover,$llower,$lupper,$numbers,$punc);
shuffle($leftover); shuffle($leftover);
$outarray = array_merge($outarray, a_array_rand($leftover, $criteria['num'] - $num_spec)); $outarray = array_merge($outarray, a_array_rand($leftover,$length-$num_spec));
} }
shuffle($outarray); shuffle($outarray);
@ -2800,4 +2902,14 @@ function no_expire_header() {
header('Cache-Control: post-check=0, pre-check=0', false); header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); header('Pragma: no-cache');
} }
/**
* This is for Opera. By putting "random junk" in the query string, it thinks
* that it does not have a cached version of the page, and will thus
* fetch the page rather than display the cached version
*/
function random_junk() {
$time = gettimeofday();
return md5(strtotime('now').$time['usec']);
}
?> ?>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.7 2006/02/25 13:12:05 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.8 2006/10/28 06:03:30 wurley Exp $
/** /**
* Functions related to hooks management. * Functions related to hooks management.
@ -171,13 +171,13 @@ function clear_hooks ( $hook_name ) {
} }
/* Evaluating user-made hooks */ /* Evaluating user-made hooks */
if ( is_dir(HOOKSDIR) ) { if (is_dir(HOOKSDIR)) {
$dir = dir (HOOKSDIR); $dir = dir(HOOKSDIR);
while (false !== ($entry = $dir -> read() ) ) { while (false !== ($entry = $dir->read())) {
if ( is_file ("hooks/$entry") and eregi ('php[0-9]?$', $entry) ) { $filename = sprintf('%s/%s',HOOKSDIR,$entry);
require_once "hooks/$entry"; if (is_file($filename) and eregi('php[0-9]?$',$entry))
} require_once "hooks/$entry";
} }
$dir -> close(); $dir -> close();

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.24 2005/12/10 10:34:55 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.25 2007/03/18 01:48:39 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -87,6 +87,12 @@ if( isset( $base_dn_does_not_exist ) && $base_dn_does_not_exist )
join(', ',$config->GetValue('search','result_attributes')); ?>" /> join(', ',$config->GetValue('search','result_attributes')); ?>" />
</tr> </tr>
<tr>
<td><small><acronym title="<?php echo htmlspecialchars(_('Order by').'...'); ?>">
<?php echo _('Order by'); ?></acronym></small></td>
<td><input type="text" name="orderby" id="orderby" style="width: 200px" value="<?php echo $filter ? htmlspecialchars($orderby) : ''; ?>" /></td>
</tr>
<tr> <tr>
<td colspan="2"><br /><center><input type="submit" value="<?php echo _('Search'); ?>" /></center></td> <td colspan="2"><br /><center><input type="submit" value="<?php echo _('Search'); ?>" /></center></td>
</tr> </tr>

View File

@ -1,5 +1,5 @@
<?php <?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.45 2006/05/13 12:52:27 wurley Exp $ */ /* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.50 2006/10/28 16:33:32 wurley Exp $ */
/** /**
* Classes and functions for LDAP server configuration and capability * Classes and functions for LDAP server configuration and capability
@ -158,7 +158,7 @@ class LDAPserver {
# Quick return if we have already connected. # Quick return if we have already connected.
$resource = $this->_connect($connect_id); $resource = $this->_connect($connect_id);
if ($resource && ! $reconnect) if (is_resource($resource) && ! $reconnect)
return $resource; return $resource;
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
@ -243,7 +243,7 @@ class LDAPserver {
# Now that we have worked out the connect_id, lets just check and see if we have already connected. # Now that we have worked out the connect_id, lets just check and see if we have already connected.
$resource = $this->_connect($connect_id); $resource = $this->_connect($connect_id);
if ($resource && ! $reconnect) if (is_resource($resource) && ! $reconnect)
return $resource; return $resource;
run_hook('pre_connect',array('server_id'=>$this->server_id,'connect_id'=>$connect_id)); run_hook('pre_connect',array('server_id'=>$this->server_id,'connect_id'=>$connect_id));
@ -419,7 +419,8 @@ class LDAPserver {
debug_log('%s::getBaseDN(): Connect to LDAP to find BaseDN',80,get_class($this)); debug_log('%s::getBaseDN(): Connect to LDAP to find BaseDN',80,get_class($this));
if ($this->connect()) { if ($this->connect()) {
$r = array_pop($this->search(null,'','objectClass=*',array('namingContexts'),'base')); $r = $this->search(null,'','objectClass=*',array('namingContexts'),'base');
$r = array_pop($r);
if (is_array($r)) if (is_array($r))
$r = array_change_key_case($r); $r = array_change_key_case($r);
@ -1219,11 +1220,7 @@ class LDAPserver {
/* foreach of the attribute's aliases, create a new entry in the attrs array /* foreach of the attribute's aliases, create a new entry in the attrs array
with its name set to the alias name, and all other data copied.*/ with its name set to the alias name, and all other data copied.*/
foreach ($aliases as $alias_attr_name) { foreach ($aliases as $alias_attr_name) {
# clone is a PHP5 function and must be used. $new_attr = clone $attr;
if (version_compare(PHP_VERSION,'5.0') > 0 )
$new_attr = clone($attr);
else
$new_attr = $attr;
$new_attr->setName($alias_attr_name); $new_attr->setName($alias_attr_name);
$new_attr->addAlias($attr->getName()); $new_attr->addAlias($attr->getName());
@ -1276,11 +1273,7 @@ class LDAPserver {
/* clone the SUP attributeType and populate those values /* clone the SUP attributeType and populate those values
that were set by the child attributeType */ that were set by the child attributeType */
# clone is a PHP5 function and must be used. $attr = clone $sup_attr;
if (function_exists('clone'))
$attr = clone($sup_attr);
else
$attr = $sup_attr;
$attr->setOID($tmp_oid); $attr->setOID($tmp_oid);
$attr->setName($tmp_name); $attr->setName($tmp_name);
@ -1754,13 +1747,13 @@ class LDAPserver {
* @param array $attrs An array of attributes to include in the search result (example: array( "objectClass", "uid", "sn" )). * @param array $attrs An array of attributes to include in the search result (example: array( "objectClass", "uid", "sn" )).
* @param string $scope The LDAP search scope. Must be one of "base", "one", or "sub". Standard LDAP search scope. * @param string $scope The LDAP search scope. Must be one of "base", "one", or "sub". Standard LDAP search scope.
* @param bool $sort_results Specify false to not sort results by DN or true to have the * @param bool $sort_results Specify false to not sort results by DN or true to have the
* returned array sorted by DN (uses ksort) * returned array sorted by DN (uses ksort)
* @param int $deref When handling aliases or referrals, this specifies whether to follow referrals. Must be one of * @param int $deref When handling aliases or referrals, this specifies whether to follow referrals. Must be one of
* LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, or LDAP_DEREF_FINDING. See the PHP LDAP API for details. * LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, or LDAP_DEREF_FINDING. See the PHP LDAP API for details.
* @param int $size_limit Size limit for search * @param int $size_limit Size limit for search
* @todo: Add entries to tree cache. * @todo: Add entries to tree cache.
*/ */
function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=true,$deref=LDAP_DEREF_NEVER,$size_limit=0) { function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=true,$deref=LDAP_DEREF_NEVER,$size_limit=0,$sort_by=null) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('%s::search(): Entered with (%s,%s,%s,%s,%s,%s,%s)',17, debug_log('%s::search(): Entered with (%s,%s,%s,%s,%s,%s,%s)',17,
get_class($this),is_resource($this),$base_dn,$filter,$attrs,$scope,$sort_results,$deref); get_class($this),is_resource($this),$base_dn,$filter,$attrs,$scope,$sort_results,$deref);
@ -1802,6 +1795,10 @@ class LDAPserver {
return array(); return array();
$return = array(); $return = array();
if (is_array($sort_by))
foreach ($sort_by as $sort)
if (in_array($sort,$attrs))
ldap_sort($resource,$search,$sort);
# Get the first entry identifier # Get the first entry identifier
if ($entry_id = ldap_first_entry($resource,$search)) if ($entry_id = ldap_first_entry($resource,$search))
@ -2524,7 +2521,8 @@ class LDAPserver {
debug_log('%s:getDNAttrs(): Entered with (%s,%s,%s)',17, debug_log('%s:getDNAttrs(): Entered with (%s,%s,%s)',17,
get_class($this),$dn,$lower_case_attr_names,$deref); get_class($this),$dn,$lower_case_attr_names,$deref);
$attrs = array_pop($this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref)); $attrs = $this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref);
$attrs = array_pop($attrs);
if (is_array($attrs)) { if (is_array($attrs)) {
if ($lower_case_attr_names) if ($lower_case_attr_names)

View File

@ -1,5 +1,5 @@
<?php <?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.35 2006/04/29 06:49:32 wurley Exp $ */ /* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.41 2006/10/28 16:38:36 wurley Exp $ */
/** /**
* Classes and functions for the template engine.ation and capability * Classes and functions for the template engine.ation and capability
@ -94,14 +94,14 @@ class xml2array {
} }
class Templates { class Templates {
var $_template = array(); var $_creation_template = array();
var $_js_hash = array(); var $_js_hash = array();
function Templates($server_id) { function Templates($server_id) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('%s::__construct(): Entered with ()',5,get_class($this)); debug_log('%s::__construct(): Entered with ()',5,get_class($this));
if ($this->_template = get_cached_item($server_id,'template','all')) { if ($this->_creation_template = get_cached_item($server_id,'template','creation')) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('%s::init(): Using CACHED [%s]',5,get_class($this),'templates'); debug_log('%s::init(): Using CACHED [%s]',5,get_class($this),'templates');
@ -119,19 +119,19 @@ class Templates {
$this->storeTemplate($template_name,$xmldata); $this->storeTemplate($template_name,$xmldata);
} }
masort($this->_template,'title'); masort($this->_creation_template,'title');
set_cached_item($server_id,'template','all',$this->_template); set_cached_item($server_id,'template','creation',$this->_creation_template);
} }
} }
function storeTemplate($template,$xmldata) { function storeTemplate($xtemplate,$xmldata) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('%s::storeTemplate(): Entered with (%s,%s)',5, debug_log('%s::storeTemplate(): Entered with (%s,%s)',5,
get_class($this),$template,$xmldata); get_class($this),$template,$xmldata);
global $ldapserver; global $ldapserver;
$this->_template[$template]['objectclass'] = array(); $template['objectclass'] = array();
foreach ($xmldata['template'] as $xml_key => $xml_value) { foreach ($xmldata['template'] as $xml_key => $xml_value) {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
debug_log('%s::storeTemplate(): Foreach loop Key [%s] Value [%s]',4, debug_log('%s::storeTemplate(): Foreach loop Key [%s] Value [%s]',4,
@ -149,10 +149,10 @@ class Templates {
if ($schema = $ldapserver->getSchemaObjectClass($details['ID'])) { if ($schema = $ldapserver->getSchemaObjectClass($details['ID'])) {
# If we havent recorded this objectclass already, do so now. # If we havent recorded this objectclass already, do so now.
if (! isset($this->_template[$template]['objectclass']) || if (! isset($template['objectclass']) ||
! in_array($schema->getName(),$this->_template[$template]['objectclass'])) { ! in_array($schema->getName(),$template['objectclass'])) {
$this->_template[$template]['objectclass'][] = $schema->getName(); $template['objectclass'][] = $schema->getName();
} }
# This objectClass doesnt exist. # This objectClass doesnt exist.
@ -161,10 +161,10 @@ class Templates {
} else { } else {
if ($schema = $ldapserver->getSchemaObjectClass($details)) { if ($schema = $ldapserver->getSchemaObjectClass($details)) {
if (! isset($this->_template[$template]['objectclass']) || if (! isset($template['objectclass']) ||
! in_array($details,$this->_template[$template]['objectclass'])) { ! in_array($details,$template['objectclass'])) {
$this->_template[$template]['objectclass'][] = $schema->getName(); $template['objectclass'][] = $schema->getName();
} }
# This objectClass doesnt exist. # This objectClass doesnt exist.
@ -182,7 +182,7 @@ class Templates {
debug_log('%s::storeTemplate(): Case [%s]',4,get_class($this),'attributes'); debug_log('%s::storeTemplate(): Case [%s]',4,get_class($this),'attributes');
if (isset($xmldata['template']['attributes']) && is_array($xmldata['template']['attributes'])) { if (isset($xmldata['template']['attributes']) && is_array($xmldata['template']['attributes'])) {
$this->_template[$template]['attribute'] = array(); $template['attribute'] = array();
foreach ($xmldata['template']['attributes'] as $tattrs) { foreach ($xmldata['template']['attributes'] as $tattrs) {
foreach ($tattrs as $index => $attr_details) { foreach ($tattrs as $index => $attr_details) {
@ -194,7 +194,7 @@ class Templates {
# Single attribute XML files are not indexed. # Single attribute XML files are not indexed.
if (is_numeric($index)) { if (is_numeric($index)) {
if ($attr = $ldapserver->getSchemaAttribute($attr_details['ID'])) if ($attr = $ldapserver->getSchemaAttribute($attr_details['ID']))
$this->_template[$template]['attribute'][$attr->getName()] = $this->_parseXML($index,$attr_details); $template['attribute'][$attr->getName()] = $this->_parseXML($index,$attr_details);
} else { } else {
if (! strcmp($index,'ID')) if (! strcmp($index,'ID'))
@ -203,12 +203,12 @@ class Templates {
if ($attr = $ldapserver->getSchemaAttribute($tattrs['ID'])) { if ($attr = $ldapserver->getSchemaAttribute($tattrs['ID'])) {
foreach ($attr_details as $key => $values) { foreach ($attr_details as $key => $values) {
if (is_array($values) && isset($values['ID'])) { if (is_array($values) && isset($values['ID'])) {
$this->_template[$template]['attribute'][$attr->getName()][$index]['_KEY:'.$values['ID']] = $this->_parseXML($key,$values); $template['attribute'][$attr->getName()][$index]['_KEY:'.$values['ID']] = $this->_parseXML($key,$values);
} elseif (is_array($values) && isset($values['#text'])) { } elseif (is_array($values) && isset($values['#text'])) {
$this->_template[$template]['attribute'][$attr->getName()][$index][] = $values['#text']; $template['attribute'][$attr->getName()][$index][] = $values['#text'];
} else { } else {
$this->_template[$template]['attribute'][$attr->getName()][$index] = $this->_parseXML($key,$values); $template['attribute'][$attr->getName()][$index] = $this->_parseXML($key,$values);
} }
} }
} }
@ -217,11 +217,11 @@ class Templates {
} }
# Do we have an override parameter? # Do we have an override parameter?
foreach ($this->_template[$template]['attribute'] as $key => $data) { foreach ($template['attribute'] as $key => $data) {
if (isset($data['override'])) { if (isset($data['override'])) {
$this->_template[$template]['attribute'][$data['override']] = $data; $template['attribute'][$data['override']] = $data;
unset($this->_template[$template]['attribute'][$key]); unset($template['attribute'][$key]);
$this->_template[$template]['attribute'][$key] = $data['override']; $template['attribute'][$key] = $data['override'];
} }
} }
} }
@ -229,23 +229,23 @@ class Templates {
break; break;
default : default :
$this->_template[$template][$xml_key] = $xml_value['#text']; $template[$xml_key] = $xml_value['#text'];
} }
} }
if (! count($this->_template[$template]['objectclass'])) { if (! count($template['objectclass'])) {
$this->_template[$template]['invalid'] = 1; $template['invalid'] = 1;
$this->_template[$template]['invalid_reason'] = _('ObjectClasses in XML dont exist in LDAP server.'); $template['invalid_reason'] = _('ObjectClasses in XML dont exist in LDAP server.');
return; return;
} }
# Collect our structural, must & may attributes. # Collect our structural, must & may attributes.
$this->_template[$template]['must'] = array(); $template['must'] = array();
$this->_template[$template]['may'] = array(); $template['may'] = array();
$this->_template[$template]['empty_attrs'] = array(); $template['empty_attrs'] = array();
$superclasslist = array(); $superclasslist = array();
foreach ($this->_template[$template]['objectclass'] as $oclass) { foreach ($template['objectclass'] as $oclass) {
# If we get some superclasses - then we'll need to go through them too. # If we get some superclasses - then we'll need to go through them too.
$supclass = true; $supclass = true;
@ -257,27 +257,27 @@ class Templates {
* Shouldnt be required now... * Shouldnt be required now...
# Test that this is a valid objectclass - disable if an invalid one found. # Test that this is a valid objectclass - disable if an invalid one found.
if (! $schema_object) { if (! $schema_object) {
$this->_template[$template]['invalid'] = 1; $template['invalid'] = 1;
$supclass = false; $supclass = false;
continue; continue;
} }
*/ */
if ($schema_object->getType() == 'structural' && (! $enherited)) if ($schema_object->getType() == 'structural' && (! $enherited))
$this->_template[$template]['structural'][] = $oclass; $template['structural'][] = $oclass;
if ($schema_object->getMustAttrs() ) if ($schema_object->getMustAttrs() )
foreach ($schema_object->getMustAttrs() as $index => $detail) { foreach ($schema_object->getMustAttrs() as $index => $detail) {
$objectclassattr = $detail->getName(); $objectclassattr = $detail->getName();
if (! in_array($objectclassattr,$this->_template[$template]['must']) && if (! in_array($objectclassattr,$template['must']) &&
strcasecmp('objectClass',$objectclassattr) != 0) { strcasecmp('objectClass',$objectclassattr) != 0) {
# Go through the aliases, and ignore any that are already defined. # Go through the aliases, and ignore any that are already defined.
$ignore = false; $ignore = false;
$attr = $ldapserver->getSchemaAttribute($objectclassattr); $attr = $ldapserver->getSchemaAttribute($objectclassattr);
foreach ($attr->aliases as $alias) { foreach ($attr->aliases as $alias) {
if (in_array($alias,$this->_template[$template]['must'])) { if (in_array($alias,$template['must'])) {
$ignore = true; $ignore = true;
break; break;
} }
@ -286,14 +286,14 @@ class Templates {
if ($ignore) if ($ignore)
continue; continue;
if (isset($this->_template[$template]['attribute'][$objectclassattr]) && if (isset($template['attribute'][$objectclassattr]) &&
! is_array($this->_template[$template]['attribute'][$objectclassattr])) ! is_array($template['attribute'][$objectclassattr]))
$this->_template[$template]['must'][] = $template['must'][] =
$this->_template[$template]['attribute'][$objectclassattr]; $template['attribute'][$objectclassattr];
else else
$this->_template[$template]['must'][] = $objectclassattr; $template['must'][] = $objectclassattr;
} }
} }
@ -301,8 +301,8 @@ class Templates {
foreach ($schema_object->getMayAttrs() as $index => $detail) { foreach ($schema_object->getMayAttrs() as $index => $detail) {
$objectclassattr = $detail->getName(); $objectclassattr = $detail->getName();
if (! in_array($objectclassattr,$this->_template[$template]['may'])) if (! in_array($objectclassattr,$template['may']))
$this->_template[$template]['may'][] = $objectclassattr; $template['may'][] = $objectclassattr;
} }
# Keep a list to objectclasses we have processed, so we dont get into a loop. # Keep a list to objectclasses we have processed, so we dont get into a loop.
@ -327,65 +327,67 @@ class Templates {
} }
# Remove any must attributes in the may list. # Remove any must attributes in the may list.
foreach ($this->_template[$template]['may'] as $index => $detail) { foreach ($template['may'] as $index => $detail) {
if (in_array($detail,$this->_template[$template]['must'])) { if (in_array($detail,$template['must'])) {
unset($this->_template[$template]['may'][$index]); unset($template['may'][$index]);
continue; continue;
} }
} }
# Remove any attributes not in the xml file and not in the dn. # Remove any attributes not in the xml file and not in the dn.
foreach ($this->_template[$template]['may'] as $index => $detail) { foreach ($template['may'] as $index => $detail) {
if (isset($this->_template[$template]['attribute']) if (isset($template['attribute'])
&& ! isset($this->_template[$template]['attribute'][$detail])) { && ! isset($template['attribute'][$detail])) {
unset($this->_template[$template]['may'][$index]); unset($template['may'][$index]);
continue; continue;
} }
if (! isset($attrs[$detail])) if (! isset($attrs[$detail]))
if (isset($this->_template[$template]['attribute'][$detail])) if (isset($template['attribute'][$detail]))
$this->_template[$template]['empty_attrs'][$detail] = $this->_template[$template]['attribute'][$detail]; $template['empty_attrs'][$detail] = $template['attribute'][$detail];
else else
$this->_template[$template]['empty_attrs'][$detail]['display'] = $detail; $template['empty_attrs'][$detail]['display'] = $detail;
else else
$this->_template[$template]['attrs'][$detail] = $attrs[$detail]; $template['attrs'][$detail] = $attrs[$detail];
} }
# Add the must attrs to the attributes key. # Add the must attrs to the attributes key.
foreach ($this->_template[$template]['must'] as $index => $detail) { foreach ($template['must'] as $index => $detail) {
if (! isset($attrs[$detail])) { if (! isset($attrs[$detail])) {
if (isset($this->_template[$template]['attribute'][$detail])) if (isset($template['attribute'][$detail]))
$this->_template[$template]['empty_attrs'][$detail] = $this->_template[$template]['attribute'][$detail]; $template['empty_attrs'][$detail] = $template['attribute'][$detail];
else else
$this->_template[$template]['empty_attrs'][$detail]['display'] = $detail; $template['empty_attrs'][$detail]['display'] = $detail;
$this->_template[$template]['empty_attrs'][$detail]['must'] = true; $template['empty_attrs'][$detail]['must'] = true;
} else } else
$this->_template[$template]['attrs'][$detail] = $attrs[$detail]; $template['attrs'][$detail] = $attrs[$detail];
} }
# Check if there are any items without a page or order parameter, and make it 1 and 255. # Check if there are any items without a page or order parameter, and make it 1 and 255.
foreach ($this->_template[$template]['empty_attrs'] as $index => $detail) { foreach ($template['empty_attrs'] as $index => $detail) {
if (! isset($detail['page'])) if (! isset($detail['page']))
$this->_template[$template]['empty_attrs'][$index]['page'] = 1; $template['empty_attrs'][$index]['page'] = 1;
if (! isset($detail['order'])) if (! isset($detail['order']))
$this->_template[$template]['empty_attrs'][$index]['order'] = 255; $template['empty_attrs'][$index]['order'] = 255;
} }
# Check we have some manditory items. # Check we have some manditory items.
foreach (array('rdn','structural','visible') as $key) { foreach (array('rdn','structural','visible') as $key) {
if (! isset($this->_template[$template][$key]) if (! isset($template[$key])
|| (! is_array($this->_template[$template][$key]) && ! trim($this->_template[$template][$key]))) { || (! is_array($template[$key]) && ! trim($template[$key]))) {
//unset($this->_template[$template]); //unset($template);
$this->_template[$template]['invalid'] = 1; $template['invalid'] = 1;
$this->_template[$template]['invalid_reason'] = sprintf(_('Missing %s in the XML file.'),$key); $template['invalid_reason'] = sprintf(_('Missing %s in the XML file.'),$key);
break; break;
} }
} }
$this->_creation_template[$xtemplate] = $template;
} }
function _parseXML($index,$attr_details) { function _parseXML($index,$attr_details) {
@ -423,12 +425,12 @@ class Templates {
return $parseXML; return $parseXML;
} }
function getTemplate($template) { function getCreationTemplate($template) {
return isset($this->_template[$template]) ? $this->_template[$template] : null; return isset($this->_creation_template[$template]) ? $this->_creation_template[$template] : null;
} }
function getTemplates() { function getCreationTemplates() {
return $this->_template; return $this->_creation_template;
} }
function OnChangeAdd($ldapserver,$origin,$value) { function OnChangeAdd($ldapserver,$origin,$value) {
@ -438,7 +440,8 @@ class Templates {
global $_js_hash; global $_js_hash;
list($command,$arg) = split(':',$value); # limit to 2 fields because of 'C:\\my directory\\foobar'
list($command,$arg) = split(':',$value,2);
switch ($command) { switch ($command) {
/* /*
@ -447,7 +450,7 @@ class Templates {
to substitute values read from other fields. to substitute values read from other fields.
|start-end is optional, but must be present if the k flag is used. |start-end is optional, but must be present if the k flag is used.
/flags is optional. /flags is optional.
flags may be: flags may be:
T: Read display text from selection item (drop-down list), otherwise, read the value of the field T: Read display text from selection item (drop-down list), otherwise, read the value of the field
For fields that aren't selection items, /T shouldn't be used, and the field value will always be read. For fields that aren't selection items, /T shouldn't be used, and the field value will always be read.
@ -465,7 +468,7 @@ class Templates {
*/ */
case 'autoFill' : case 'autoFill' :
list($attr,$string) = preg_split('(([^,]+),(.*))',$arg,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); list($attr,$string) = preg_split('(([^,]+),(.*))',$arg,-1,PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%/U',$string,$matchall); preg_match_all('/%(\w+)(\|[0-9]*-[0-9]*)?(\/[klTUA]+)?%/U',$string,$matchall);
//print"<PRE>";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod //print"<PRE>";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod
if (! isset($_js_hash['autoFill'.$origin])) if (! isset($_js_hash['autoFill'.$origin]))
@ -529,17 +532,20 @@ class Templates {
if (strstr($match_mod,'U')) { if (strstr($match_mod,'U')) {
$_js_hash['autoFill'.$origin] .= sprintf(" %s = %s.toUpperCase();\n",$match_attr,$match_attr); $_js_hash['autoFill'.$origin] .= sprintf(" %s = %s.toUpperCase();\n",$match_attr,$match_attr);
} }
if (strstr($match_mod,'A')) {
$_js_hash['autoFill'.$origin] .= sprintf(" %s = toAscii(%s);\n",$match_attr,$match_attr);
}
# Matchfor only entry without modifiers. # Matchfor only entry without modifiers.
$formula = preg_replace('/^%('.$match_attr.')%$/U','$1 + \'\'',$formula); $formula = preg_replace('/^%('.$match_attr.')%$/U','$1 + \'\'',$formula);
# Matchfor only entry with modifiers. # Matchfor only entry with modifiers.
$formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%$/U','$1 + \'\'',$formula); $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTUA]+)?%$/U','$1 + \'\'',$formula);
# Matchfor begining entry. # Matchfor begining entry.
$formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%/U','$1 + \'',$formula); $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTUA]+)?%/U','$1 + \'',$formula);
# Matchfor ending entry. # Matchfor ending entry.
$formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTU]+)?%$/U','\' + $1 ',$formula); $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[klTUA]+)?%$/U','\' + $1 ',$formula);
# Match for entries not at begin/end. # Match for entries not at begin/end.
$formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[:lTU]+)?%/U','\' + $1 + \'',$formula); $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[:lTUA]+)?%/U','\' + $1 + \'',$formula);
} }
$_js_hash['autoFill'.$origin] .= sprintf(" fillRec('%s', %s);\n",$attr,$formula); $_js_hash['autoFill'.$origin] .= sprintf(" fillRec('%s', %s);\n",$attr,$formula);
@ -570,38 +576,319 @@ class Templates {
switch($matches[1]) { switch($matches[1]) {
case 'GetNextNumber' : case 'GetNextNumber' :
/*
* mandatory arguments:
* * arg 0
* - "$" => 'auto_number','search_base' in config file
* - "/","..","." => get container parent as usual
* * arg 1
* - "gid" or "uid" for autosearch
* - idem or real attribute name for uidpool mechanism
* (gid and uid are mapped to sambaNextGroupRid and sambaNextUserRid)
* optional arguments:
* * arg 2 (uidpool mechanism only)
* - "true" increments attribute by 1
* - "false" do nothing
* * arg 3 (uidpool mechanism only)
* ldap filter (must match one entry only in container)
* * arg 4
* calculus on number, eg:
* *2;+1000 => number = (2*number) + 1000
*/
if ($args[0] == '$') if ($args[0] == '$')
$args[0] = $ldapservers->GetValue($ldapserver->server_id,'auto_number','search_base'); $args[0] = $ldapservers->GetValue($ldapserver->server_id,'auto_number','search_base');
$container = $ldapserver->getContainerParent($container,$args[0]); $container = $ldapserver->getContainerParent($container,$args[0]);
$detail['value'] = get_next_number($ldapserver,$container,$args[1],
(!empty($args[2]) && ($args[2] == 'true')) ? true : false,(!empty($args[3])) ? $args[3] : false);
$detail['value'] = get_next_number($ldapserver,$container,$args[1]); # operate calculus on next number.
if (!empty($args[4])) {
$mod = split(';',$args[4]);
$next_number = $detail['value'];
foreach ($mod as $calc) {
$operand = $calc{0};
$operator = substr ($calc,1);
switch ($operand) {
case '*':
$next_number = $next_number * $operator;
break;
case '+':
$next_number = $next_number + $operator;
break;
case '-':
$next_number = $next_number - $operator;
break;
case '/':
$next_number = $next_number / $operator;
break;
}
}
$detail['value'] = $next_number;
}
break; break;
case 'PickList' : case 'PickList' :
/*
* PickList Syntax:
* arg0: container, from current position
* arg1: LDAP filter. must replace '&' by '&amp;'
* arg2: list attribute key
* arg3: display, as usual
optional arguments:
* arg4: output attribute
* arg5: container override
* arg6: csv list (; separator) of added values. syntax key => display_attribute=value; key...
* arg7: csv list (; separator) of sort attributes (less to more important)
* example
* <value>=php.PickList(/,(&amp;(objectClass=sambaGroupMapping)(|(cn=domain administrator)(cn=domain users)(cn=domain guests))),sambaSID,%cn% (%sambaSID%),sambaPrimaryGroupSID,dmdname=users:::dmdName=groups:::dc=example:::dc=com, S-1-5-XX-YYY => cn=Administrators ; S-1-5-XX-YYY => cn=Users ; S-1-5-XX-YYY => cn=Guests ; S-1-5-XX-YYY => cn=power users,cn)</value>
*/
$container = $ldapserver->getContainerParent($container,$args[0]); $container = $ldapserver->getContainerParent($container,$args[0]);
preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',$args[3],$matchall); preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',$args[3],$matchall);
//print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod //print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod
$ldap_attrs = $matchall[1]; $ldap_attrs = $matchall[1];
array_push($ldap_attrs,$args[2]); array_push($ldap_attrs,$args[2]);
$picklistvalues = return_ldap_hash($ldapserver,$container,$args[1],$args[2],$ldap_attrs);
$args[1] = str_replace ('&amp;','&',$args[1]);
# arg5 overrides container
if (!empty($args[5]))
$container = str_replace(':::',',',$args[5]);
if (!empty($args[7])) {
$sort_attrs = split(';',$args[7]);
$ldap_attrs = array_merge($ldap_attrs,$sort_attrs);
}
$picklistvalues = return_ldap_hash($ldapserver,$container,$args[1],$args[2],$ldap_attrs,
(isset($args[7])) ? $sort_attrs : false);
if (!empty($args[6])) {
$args[6] = str_replace(':::',',',$args[6]);
$fixedvalues = split(';',$args[6]);
foreach ($fixedvalues as $fixedvalue) {
$fixedvalue = preg_split('#=\>#',$fixedvalue);
$displayvalue = split('=',$fixedvalue[1]);
$newvalue[trim($fixedvalue[0])] = array( $args[2] => trim($fixedvalue[0]),
trim($displayvalue[0]) => trim($displayvalue[1]));
$picklistvalues = array_merge($picklistvalues,$newvalue);
}
}
$detail['value'] = sprintf('<select name="form[%s]" id="%%s" %%s %%s>',(isset($args[4]) ? $args[4] : $args[2])); $detail['value'] = sprintf('<select name="form[%s]" id="%%s" %%s %%s>',(isset($args[4]) ? $args[4] : $args[2]));
$counter = 0; $counter = 0;
foreach ($picklistvalues as $key => $values) { foreach ($picklistvalues as $key => $values) {
$display = $args[3]; $display = $args[3];
foreach ($matchall[1] as $arg) { foreach ($matchall[1] as $arg)
$display = preg_replace('/%('.$arg.')(\|.+)?(\/[lU])?%/U',$values[$arg],$display); $display = preg_replace('/%('.$arg.')(\|.+)?(\/[lU])?%/U',$values[$arg],$display);
if (! isset($picklist[$values[$args[2]]])) {
$detail['value'] .= sprintf('<option id="%s%s" value="%s" %s>%s</option>',
(!empty($args[4]) ? $args[4] : $args[2]),++$counter,$values[$args[2]],
($default == $values[$args[2]]) ? 'selected' : '',
$display);
$picklist[$values[$args[2]]] = true;
}
}
$detail['value'] .= '</select>';
break;
case 'MultiList' :
/*
* MultiList Syntax:
*/
/**
mandatory fields:
arg 0: "/" ,"..","." - from container dn
arg 1: search filter, may have values like '%gidNumber%, in case of it is replaced
by the gidNumber setted in previous pages. '&' must be replaced by '&amp;'
because of xml...
arg 2: the key of retrived values
optional fields:
arg 3: display, as usual (plus modifier /C: Capitalize). replaced by %arg 2% if not given
arg 4: the value furnished in output - must be attribute id. replaced by arg 2 if not given
arg 5: override of container (replace ',' by ':::' in dn)
arg 6: csv (; separator) list of added values. syntax: value => display_key=display_value
arg 7: csv (; separator) list of attributes which list must be sort by. less to more important
arg 8: size of displayed list (default: 10lines)
arg 9: preselected values filter. see arg 1.
arg 10: key of preselected values. replaced by arg 4 if not given. replaced bty arg 2 if both are not given.
arg 11: base dn override for preselected values
unusual exemple:)
<value>=php.MultiList(/,(&amp;(objectClass=posixAccount)(uid=groupA*)),uid,%cn/U% (%gidNumber%),memberUid,dmdName=users,root => cn=root; nobody => cn=nobody,gidNumber,10,(gidNuber=%gidNumber%),uid)</value>
minimal exemple:
<value>=php.MultiList(/,(objectClass=posixAccount),uid)</value>
**/
$container = $ldapserver->getContainerParent($container,$args[0]);
/*
* process filter (arg 1), eventually replace %attr% by it's value
* setted in a previous page.
*/
$args[1] = str_replace('&amp;','&',$args[1]);
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$args[1],$filtermatchall);
$formvalues = array_change_key_case($_REQUEST['form']);
foreach ($filtermatchall[1] as $arg) {
$value=$formvalues[strtolower($arg)];
$args[1] = preg_replace('/%('.$arg.')(\|.+)?(\/[lU])?%/U',$value,$args[1]);
}
$args[3] = !empty($args[3]) ? $args[3] : "%{$args[2]}%";
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$args[3],$matchall);
//print_r($matchall); // -1 = highlevel match, 1 = attr, 2 = subst, 3 = mod
$ldap_attrs = $matchall[1];
array_push($ldap_attrs,$args[2]);
/*
* container is arg 5 if set
* with arg 5 = 'dc=thissubtree:::dc=thistree' stands for 'dc=subtree,dc=tree'
* => 'dc=subtree,dc=tree,dc=container'
*/
if (isset($args[5]) && ($args[5]))
$container = str_replace(':::',',',$args[5]);
/*
* arg 7 is sort attributes
* eg: 'sn;givenName'
*/
if (isset($args[7])) {
$sort_attrs = split(';',$args[7]);
$ldap_attrs = array_merge($ldap_attrs,$sort_attrs);
}
$picklistvalues = return_ldap_hash($ldapserver,$container,$args[1],$args[2],$ldap_attrs,
(isset($args[7]) && ($args[7])) ? $sort_attrs : false);
# arg 6 is a set of fixed values to add to search result
if (isset($args[6])) {
$args[6] = str_replace(':::',',',$args[6]);
$fixedvalues = split(';',$args[6]);
foreach ($fixedvalues as $fixedvalue) {
if (empty($fixedvalue))
continue;
$fixedvalue = preg_split('#=\>#',$fixedvalue);
$displayvalue = split('=',$fixedvalue[1]);
$newvalue[trim($fixedvalue[0])] = array($args[2] => trim($fixedvalue[0]),
trim($displayvalue[0]) => trim($displayvalue[1]));
$picklistvalues = array_merge($picklistvalues,$newvalue);
}
}
/*
* arg 9 is the search filter for already selected values, with criteriai eventually
* coming from previous pages (eg: %uid%)
*/
if (isset($args[9])) {
$args[9] = str_replace('&amp;','&',$args[9]);
preg_match_all('/%(\w+)(\|.+)?(\/[lUC])?%/U',$args[9],$matchallinlist);
foreach ($matchallinlist[1] as $arg) {
$value=$formvalues[strtolower($arg)];
$args[9] = preg_replace('/%('.$arg.')(\|.+)?(\/[lU])?%/U',$value,$args[9]);
} }
if (! isset($picklist[$display])) { # arg 11 overrides container dn for selected values
$detail['value'] .= sprintf('<option id="%s%s" value="%s" %s>%s</option>', if (!empty($args[11]))
(isset($args[4]) ? $args[4] : $args[2]),++$counter,$values[$args[2]], $container = str_replace(':::',',',$args[11]);
($default == $display ? 'selected' : ''),
$display); $inpicklistvalues = return_ldap_hash($ldapserver,$container,$args[9],$args[2],$ldap_attrs);
$picklist[$display] = true; }
$detail['value'] = sprintf('<select name="form[%s][]" multiple="multiple" size="%s" id="%%s" %%s %%s>',
(isset($args[4])) ? $args[4] : $args[2],
# arg 8 is the size (nbr of displayed lines) of select
(isset($args[8])) ? $args[8] : 10);
$counter = 0;
foreach ($picklistvalues as $key => $values) {
$display = $args[3];
foreach ($matchall[1] as $key => $arg) {
$disp_val = $values[$arg];
if ($matchall[3][$key])
switch ($matchall[3][$key]) {
case '/l':
# lowercase
$disp_val = mb_convert_case($disp_val,MB_CASE_LOWER,'utf-8');
break;
case '/U':
# uppercase
$disp_val = mb_convert_case($disp_val,MB_CASE_UPPER,'utf-8');
break;
case '/C':
# capitalize
$disp_val = mb_convert_case($disp_val,MB_CASE_TITLE,'utf-8');
break;
default:
break;
}
# make value a substring of
preg_match_all('/^\|([0-9]*)-([0-9]*)$/',trim($matchall[2][$key]),$substrarray);
if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) {
$begin = $substrarray[1][0] ? $substrarray[1][0] : '0';
$end = $substrarray[2][0] ? $substrarray[2][0] : strlen($disp_val);
$disp_val = mb_substr($disp_val,$begin,$end,'utf-8');
}
$display = preg_replace('/%('.$arg.')(\|.+)?(\/[lUC])?%/U',$disp_val,$display);
}
if (! isset($picklist[$values[$args[2]]])) {
if (!isset($args[9])) {
# there is no criteria filter for selected values
$detail['value'] .= sprintf('<option id="%s%s" value="%s" %s>%s</option>',
# arg 4 is the output criteria
((isset($args[4]) && !empty($args[4])) ? $args[4] : $args[2]),
++$counter,
$values[$args[2]],
# if the value the default, then select it
(in_array($values[$args[2]],$default)) ? 'selected' : '',
$display);
} else {
# if default filter is given
$detail['value'] .= sprintf('<option id="%s%s" value="%s" %s>%s</option>',
(isset($args[4]) ? $args[4] : $args[2]),
++$counter,
$values[$args[2]],
# arg 10 is the key for filter values
(array_key_exists($values[(isset($args[10]) ? $args[10] : (isset($args[4]) ? $args[4] : $args[2]))],$inpicklistvalues)) ? 'selected' : '',
$display);
}
$picklist[$values[$args[2]]] = true;
} }
} }
$detail['value'] .= '</select>'; $detail['value'] .= '</select>';
@ -666,11 +953,12 @@ class Templates {
if ($container && $ldapserver && ! is_array($helper)) { if ($container && $ldapserver && ! is_array($helper)) {
if (preg_match('/^=php./',$helper)) if (preg_match('/^=php./',$helper))
return $this->EvaluateDefault($ldapserver,$helper,$container,$counter); $html = sprintf('<input type="text" name="%s" value="%s" size="8" />',$id,
$this->EvaluateDefault($ldapserver,$helper,$container,$counter));
else else
# @todo: Enable size and width configuration in template # @todo: Enable size and width configuration in template
$html = sprintf('<input type="text" name="%s" size="8">',$id); $html = sprintf('<input type="text" name="%s" size="8" />',$id);
} else { } else {
if (is_array($helper)) { if (is_array($helper)) {

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/tree_functions.php,v 1.25 2006/05/13 12:52:27 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/tree_functions.php,v 1.29 2007/03/18 00:45:24 wurley Exp $
/** /**
* @package phpLDAPadmin * @package phpLDAPadmin
@ -39,13 +39,13 @@ function draw_server_tree() {
echo '<tr class="server">'; echo '<tr class="server">';
printf('<td class="icon"><img src="images/server.png" alt="%s" /></td>',_('Server')); printf('<td class="icon"><img src="images/server.png" alt="%s" /></td>',_('Server'));
printf('<td colspan="99"><a name="%s"></a>',$ldapserver->server_id); printf('<td colspan="99"><a name="%s"></a>',$ldapserver->server_id);
printf('<nobr>%s ',htmlspecialchars($ldapserver->name)); printf('<span style="white-space: nowrap;">%s ',htmlspecialchars($ldapserver->name));
if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config')
printf('<acronym title="%s"><img width=14 height=14 src="images/timeout.png" alt="timeout" /></acronym>', printf('<acronym title="%s"><img width=14 height=14 src="images/timeout.png" alt="timeout" /></acronym>',
sprintf(_('Inactivity will log you off at %s'),strftime('%H:%M',time()+($ldapserver->session_timeout*60)))); sprintf(_('Inactivity will log you off at %s'),strftime('%H:%M',time()+($ldapserver->session_timeout*60))));
echo '</nobr></td></tr>'; echo '</span></td></tr>';
/* do we have what it takes to authenticate here, or do we need to /* do we have what it takes to authenticate here, or do we need to
present the user with a login link (for 'cookie' and 'session' auth_types)? */ present the user with a login link (for 'cookie' and 'session' auth_types)? */
@ -62,7 +62,7 @@ function draw_server_tree() {
# Draw the quick-links below the server name: # Draw the quick-links below the server name:
echo '<tr><td colspan="100" class="links">'; echo '<tr><td colspan="100" class="links">';
echo '<nobr>'; echo '<span style="white-space: nowrap;">';
echo '( '; echo '( ';
printf('<a title="%s %s" href="%s">%s</a> | ',_('View schema for'),$ldapserver->name,$schema_href,_('schema')); printf('<a title="%s %s" href="%s">%s</a> | ',_('View schema for'),$ldapserver->name,$schema_href,_('schema'));
printf('<a title="%s %s" href="%s">%s</a> | ',_('search'),$ldapserver->name,$search_href,_('search')); printf('<a title="%s %s" href="%s">%s</a> | ',_('search'),$ldapserver->name,$search_href,_('search'));
@ -74,11 +74,11 @@ function draw_server_tree() {
if ($ldapserver->auth_type != 'config') if ($ldapserver->auth_type != 'config')
printf(' | <a title="%s" href="%s" target="right_frame">%s</a>',_('Logout of this server'),$logout_href,_('logout')); printf(' | <a title="%s" href="%s" target="right_frame">%s</a>',_('Logout of this server'),$logout_href,_('logout'));
echo ' )</nobr></td></tr>'; echo ' )</span></td></tr>';
if ($ldapserver->auth_type != 'config') { if ($ldapserver->auth_type != 'config') {
$logged_in_dn = $ldapserver->getLoggedInDN(); $logged_in_dn = $ldapserver->getLoggedInDN();
echo '<tr><td class="links" colspan="100"><nobr>'._('Logged in as: '); echo '<tr><td class="links" colspan="100"><span style="white-space: nowrap;">'._('Logged in as: ');
if ($ldapserver->getDNBase($logged_in_dn) == $logged_in_dn) { if ($ldapserver->getDNBase($logged_in_dn) == $logged_in_dn) {
$logged_in_branch = ''; $logged_in_branch = '';
@ -86,7 +86,7 @@ function draw_server_tree() {
} else { } else {
$logged_in_branch = preg_replace('/,'.$ldapserver->getDNBase($logged_in_dn).'$/','',$logged_in_dn); $logged_in_branch = preg_replace('/,'.$ldapserver->getDNBase($logged_in_dn).'$/','',$logged_in_dn);
$logged_in_dn_array = explode(',',$logged_in_branch); $logged_in_dn_array = pla_explode_dn($logged_in_branch);
} }
$bases = $ldapserver->getDNBase($logged_in_dn); $bases = $ldapserver->getDNBase($logged_in_dn);
@ -110,11 +110,11 @@ function draw_server_tree() {
} else } else
echo 'Anonymous'; echo 'Anonymous';
echo '</nobr></td></tr>'; echo '</span></td></tr>';
} }
if ($ldapserver->isReadOnly()) if ($ldapserver->isReadOnly())
printf('<tr><td class="links" colspan="100"><nobr>(%s)</nobr></td></tr>',_('read only')); printf('<tr><td class="links" colspan="100"><span style="white-space: nowrap;">(%s)</span></td></tr>',_('read only'));
$javascript_forms = ''; $javascript_forms = '';
$javascript_id = 0; $javascript_id = 0;
@ -176,7 +176,8 @@ function draw_server_tree() {
$child_count = null; $child_count = null;
} else { } else {
$children = $ldapserver->getContainerContents($base_dn,$size_limit+1,'(objectClass=*)', $children = $ldapserver->getContainerContents($base_dn,$size_limit+1,
$config->GetValue('appearance','tree_filter'),
$config->GetValue('deref','tree')); $config->GetValue('deref','tree'));
$child_count = count($children); $child_count = count($children);
@ -206,12 +207,12 @@ function draw_server_tree() {
printf('<td class="expander"><a href="%s"><img src="%s" alt="%s" /></a></td>',$expand_href,$expand_img,$expand_alt); printf('<td class="expander"><a href="%s"><img src="%s" alt="%s" /></a></td>',$expand_href,$expand_img,$expand_alt);
printf('<td class="icon"><a href="%s" target="right_frame"><img src="images/%s" alt="img" /></a></td>',$edit_href,$icon); printf('<td class="icon"><a href="%s" target="right_frame"><img src="images/%s" alt="img" /></a></td>',$edit_href,$icon);
printf('<td class="rdn" colspan="98"><nobr><a href="%s" target="right_frame">%s</a>',$edit_href,pretty_print_dn($base_dn)); printf('<td class="rdn" colspan="98"><span style="white-space: nowrap;"><a href="%s" target="right_frame">%s</a>',$edit_href,pretty_print_dn($base_dn));
if ($child_count) if ($child_count)
printf(' <span class="count">(%s)</span>',$child_count); printf(' <span class="count">(%s)</span>',$child_count);
echo '</nobr></td>'; echo '</span></td>';
echo '</tr>'; echo '</tr>';
} }
@ -235,8 +236,9 @@ function draw_server_tree() {
# Is the root of the tree expanded already? # Is the root of the tree expanded already?
if (isset($tree['browser'][$base_dn]['open'] ) && $tree['browser'][$base_dn]['open']) { if (isset($tree['browser'][$base_dn]['open'] ) && $tree['browser'][$base_dn]['open']) {
if ($ldapserver->isShowCreateEnabled() && count($tree['browser'][$base_dn]['children']) > 10 ) if ($config->GetValue('appearance', 'show_top_create'))
draw_create_link($ldapserver->server_id,$base_dn,-1,urlencode($base_dn)); if ($ldapserver->isShowCreateEnabled() && count($tree['browser'][$base_dn]['children']) > 10 )
draw_create_link($ldapserver->server_id,$base_dn,-1,urlencode($base_dn));
foreach ($tree['browser'][$base_dn]['children'] as $child_dn) foreach ($tree['browser'][$base_dn]['children'] as $child_dn)
draw_tree_html($child_dn,$ldapserver,0); draw_tree_html($child_dn,$ldapserver,0);
@ -336,9 +338,9 @@ function draw_tree_html($dn,$ldapserver,$level=0) {
$child_count = number_format(count($tree['browser'][$dn]['children'])); $child_count = number_format(count($tree['browser'][$dn]['children']));
if ((! $child_count) && (! $ldapserver->isShowCreateEnabled())) if ((! $child_count) && (! $ldapserver->isShowCreateEnabled()))
echo '<td class="expander"><nobr><img src="images/minus.png" alt="-" /></nobr></td>'; echo '<td class="expander"><span style="white-space: nowrap;"><img src="images/minus.png" alt="-" /></span></td>';
else else
printf('<td class="expander"><nobr><a href="%s"><img src="images/minus.png" alt="-" /></a></nobr></td>',$collapse_href); printf('<td class="expander"><span style="white-space: nowrap;"><a href="%s"><img src="images/minus.png" alt="-" /></a></span></td>',$collapse_href);
} else { } else {
$size_limit = $config->GetValue('search','size_limit'); $size_limit = $config->GetValue('search','size_limit');
@ -354,28 +356,27 @@ function draw_tree_html($dn,$ldapserver,$level=0) {
} }
if ((! $child_count) && (! $ldapserver->isShowCreateEnabled())) if ((! $child_count) && (! $ldapserver->isShowCreateEnabled()))
echo '<td class="expander"><nobr><img src="images/minus.png" alt="-" /></nobr></td>'; echo '<td class="expander"><span style="white-space: nowrap;"><img src="images/minus.png" alt="-" /></span></td>';
else else
printf('<td class="expander"><nobr><a href="%s"><img src="images/plus.png" alt="+" /></a></nobr></td>',$expand_href); printf('<td class="expander"><span style="white-space: nowrap;"><a href="%s"><img src="images/plus.png" alt="+" /></a></span></td>',$expand_href);
} }
printf('<td class="icon"><a href="%s" target="right_frame" name="%s_%s"><img src="%s" alt="img" /></a></td>', printf('<td class="icon"><a href="%s" target="right_frame" name="%s_%s"><img src="%s" alt="img" /></a></td>',
$edit_href,$ldapserver->server_id,$encoded_dn,$img_src); $edit_href,$ldapserver->server_id,$encoded_dn,$img_src);
printf('<td class="rdn" colspan="%s"><nobr>',97-$level); printf('<td class="rdn" colspan="%s"><span style="white-space: nowrap;">',97-$level);
printf('<a href="%s" target="right_frame">%s</a>',$edit_href,draw_formatted_dn($ldapserver,$dn)); printf('<a href="%s" target="right_frame">%s</a>',$edit_href,draw_formatted_dn($ldapserver,$dn));
if ($child_count) if ($child_count)
printf(' <span class="count">(%s)</span>',$child_count); printf(' <span class="count">(%s)</span>',$child_count);
echo '</nobr></td></tr>'; echo '</span></td></tr>';
if (isset($tree['browser'][$dn]['open']) && $tree['browser'][$dn]['open']) { if (isset($tree['browser'][$dn]['open']) && $tree['browser'][$dn]['open']) {
/* Draw the "create new" link at the top of the tree list if there are more than 10
entries in the listing for this node. */ if ($config->GetValue('appearance', 'show_top_create'))
if ((count($tree['browser'][$dn]['children']) > 10) && ($ldapserver->isShowCreateEnabled()))
if ((count($tree['browser'][$dn]['children']) > 10) && ($ldapserver->isShowCreateEnabled())) draw_create_link($ldapserver->server_id,$rdn,$level,$encoded_dn);
draw_create_link($ldapserver->server_id,$rdn,$level,$encoded_dn);
foreach ($tree['browser'][$dn]['children'] as $dn) foreach ($tree['browser'][$dn]['children'] as $dn)
draw_tree_html($dn,$ldapserver,$level+1); draw_tree_html($dn,$ldapserver,$level+1);

View File

@ -177,6 +177,10 @@ msgid "Rename"
msgstr "Renombrar" msgstr "Renombrar"
msgid "rename"
msgstr "renombrar"
msgid "Add" msgid "Add"
msgstr "Afegir" msgstr "Afegir"

View File

@ -205,6 +205,10 @@ msgid "Rename"
msgstr "Přejmenovat" msgstr "Přejmenovat"
msgid "rename"
msgstr "přejmenovat"
msgid "Add" msgid "Add"
msgstr "Přidat" msgstr "Přidat"

View File

@ -245,6 +245,10 @@ msgid "Rename"
msgstr "Umbenennen" msgstr "Umbenennen"
msgid "rename"
msgstr "umbenennen"
msgid "Add" msgid "Add"
msgstr "Hinzufügen" msgstr "Hinzufügen"

View File

@ -261,6 +261,10 @@ msgid "Rename"
msgstr "Renombrar" msgstr "Renombrar"
msgid "rename"
msgstr "renombrar"
msgid "Add" msgid "Add"
msgstr "Añadir" msgstr "Añadir"
@ -293,7 +297,7 @@ msgid "Show internal attributes"
msgstr "Mostrar atributos internos" msgstr "Mostrar atributos internos"
msgid "Click to view the schema defintion for attribute type '%s'" msgid "Click to view the schema definition for attribute type '%s'"
msgstr "Haga click para ver el esquema del atributo de tipo '%s'" msgstr "Haga click para ver el esquema del atributo de tipo '%s'"

File diff suppressed because it is too large Load Diff

View File

@ -205,6 +205,10 @@ msgid "Rename"
msgstr "Átnevezés" msgstr "Átnevezés"
msgid "rename"
msgstr "Átnevezés"
msgid "Add" msgid "Add"
msgstr "Hozzáadás" msgstr "Hozzáadás"

View File

@ -169,8 +169,8 @@ msgid "Rename Entry"
msgstr "Rinomina la Voce" msgstr "Rinomina la Voce"
msgid "Rename" msgid "rename"
msgstr "Rinomina" msgstr "rinomina"
msgid "Add" msgid "Add"
@ -234,7 +234,7 @@ msgstr "Aggiungi un Nuovo Attributo Binario"
msgid "Note: '%s' is an alias for '%s'" msgid "Note: '%s' is an alias for '%s'"
msgstr "Alias per" msgstr "Nota: '%s' Ú un alias per '%s'"
msgid "download value" msgid "download value"
@ -392,4 +392,24 @@ msgstr "Nota: ti potrebbe essere chiesto di inserire nuovi attributi<br />che qu
msgid "Syntax" msgid "Syntax"
msgstr "Sintassi" msgstr "Sintassi"
msgid "Use the menu to the left to navigate"
msgstr "Usa il menu sulla sinistra per esplorare l'albero LDAP"
msgid "Check password..."
msgstr "Verifica password..."
msgid "Password Checker Tool"
msgstr "Strumento di verifica password"
msgid "Compare"
msgstr "Confronta"
msgid "To"
msgstr "A"
msgid "Passwords match!"
msgstr "La password corrisponde!"
msgid "Passwords do not match!"
msgstr "La password non corrisponde!"

View File

@ -161,6 +161,10 @@ msgid "Rename"
msgstr "hernoemen" msgstr "hernoemen"
msgid "rename"
msgstr "hernoemen"
msgid "Add" msgid "Add"
msgstr "toevoegen" msgstr "toevoegen"
@ -181,7 +185,7 @@ msgid "Show internal attributes"
msgstr "interne attributen laten zien" msgstr "interne attributen laten zien"
msgid "Click to view the schema defintion for attribute type '%s'" msgid "Click to view the schema definition for attribute type '%s'"
msgstr "klik hier om de schemadefinitie van attribuuttype '%s' te bekijken" msgstr "klik hier om de schemadefinitie van attribuuttype '%s' te bekijken"

View File

@ -213,6 +213,10 @@ msgid "Rename"
msgstr "Renomear" msgstr "Renomear"
msgid "rename"
msgstr "renomear"
msgid "Add" msgid "Add"
msgstr "Inserir" msgstr "Inserir"

View File

@ -209,6 +209,10 @@ msgid "Rename"
msgstr "Переименовать" msgstr "Переименовать"
msgid "rename"
msgstr "ПереОЌеМПвать"
msgid "Add" msgid "Add"
msgstr "Добавить" msgstr "Добавить"

View File

@ -177,6 +177,10 @@ msgid "Rename"
msgstr "Döp om " msgstr "Döp om "
msgid "rename"
msgstr "Döp om "
msgid "Add" msgid "Add"
msgstr "Lägg till" msgstr "Lägg till"

View File

@ -245,6 +245,10 @@ msgid "Rename"
msgstr "¸üÃû" msgstr "¸üÃû"
msgid "rename"
msgstr "žüÃû"
msgid "Add" msgid "Add"
msgstr "Ôö¼Ó" msgstr "Ôö¼Ó"

View File

@ -197,6 +197,10 @@ msgid "Rename"
msgstr "更名" msgstr "更名"
msgid "rename"
msgstr "曎名"
msgid "Add" msgid "Add"
msgstr "新增" msgstr "新增"

View File

@ -26,14 +26,11 @@
<page>1</page> <page>1</page>
<presubmit>=php.GetNextNumber(/,gid)</presubmit> <presubmit>=php.GetNextNumber(/,gid)</presubmit>
<spacer>1</spacer> <spacer>1</spacer>
<!-- <value>=php.GetNextNumber(/,gid,false,(&amp;(objectClass=posixGroup)),*2;+1000)</value> -->
</attribute> </attribute>
<attribute id="memberUid"> <attribute id="memberUid">
<array>10</array>
<display>Users</display> <display>Users</display>
<helper> <value>=php.MultiList(/,(objectClass=posixAccount),uid,%cn% (%uid|-4%))</value>
<location>side</location>
<!-- <value>=php.DrawChooserLink(memberUid,0)</value> -->
</helper>
<hidden>0</hidden> <hidden>0</hidden>
<order>3</order> <order>3</order>
<page>1</page> <page>1</page>

View File

@ -30,15 +30,15 @@
<hint>Automatically determined</hint> <hint>Automatically determined</hint>
<order>3</order> <order>3</order>
<page>1</page> <page>1</page>
<presubmit>=php.GetNextNumber(/,gid)</presubmit> <presubmit>=php.GetNextNumber(/,gid,true,(&amp;(objectClass=sambaDomain)(sambaDomainName=mysambadomain))</presubmit>
<spacer>1</spacer> <spacer>1</spacer>
</attribute> </attribute>
<attribute id="sambaSID"> <attribute id="sambaSID">
<display>Samba SID</display> <display>Samba SID</display>
<helper> <helper>
<id>sidsuffix</id> <id>sidsuffix</id>
<value>=php.GetNextNumber(/,gid,false,(&amp;(objectClass=sambaDomain)(sambaDomainName=mysambadomain)),*2;+1000)</value>
<location>side</location> <location>side</location>
<value></value>
</helper> </helper>
<order>4</order> <order>4</order>
<page>1</page> <page>1</page>
@ -56,12 +56,8 @@
<value id="5">Well-known Group</value> <value id="5">Well-known Group</value>
</attribute> </attribute>
<attribute id="memberUid"> <attribute id="memberUid">
<array>10</array>
<display>Users</display> <display>Users</display>
<helper> <value>=php.MultiList(/,(objectClass=posixAccount),uid,%cn% %uid|-4/U%,memberUid,dmdName=users:::dc=localdomain,root => cn=root; nobody => cn=nobody,cn,10,(&amp;(objectClass=posixAccount)(gidNumber=29999)),uid)</value>
<location>side</location>
<!-- <value>=php.DrawChooserLink(memberUid,0)</value> -->
</helper>
<hidden>0</hidden> <hidden>0</hidden>
<order>10</order> <order>10</order>
<page>1</page> <page>1</page>

View File

@ -82,7 +82,6 @@
<value>ssha</value> <value>ssha</value>
</helper> </helper>
<icon>images/lock.png</icon> <icon>images/lock.png</icon>
<onchange>autoFill:sambaLMPassword,%userPassword%</onchange>
<onchange>autoFill:sambaNTPassword,%userPassword%</onchange> <onchange>autoFill:sambaNTPassword,%userPassword%</onchange>
<order>7</order> <order>7</order>
<page>1</page> <page>1</page>
@ -90,16 +89,9 @@
<type>password</type> <type>password</type>
<verify>1</verify> <verify>1</verify>
</attribute> </attribute>
<attribute id="sambaLMPassword">
<display>LM Password</display>
<order>8</order>
<page>1</page>
<post>=php.SambaPassword(LM,%sambaLMPassword%)</post>
<type>password</type>
</attribute>
<attribute id="sambaNTPassword"> <attribute id="sambaNTPassword">
<display>NT Password</display> <display>NT Password</display>
<order>9</order> <order>8</order>
<page>1</page> <page>1</page>
<post>=php.SambaPassword(NT,%sambaNTPassword%)</post> <post>=php.SambaPassword(NT,%sambaNTPassword%)</post>
<spacer>1</spacer> <spacer>1</spacer>
@ -108,14 +100,14 @@
<attribute id="loginShell"> <attribute id="loginShell">
<display>Login shell</display> <display>Login shell</display>
<icon>images/terminal.png</icon> <icon>images/terminal.png</icon>
<order>10</order> <order>9</order>
<page>1</page> <page>1</page>
<value>=php.PickList(/,(objectClass=posixAccount),loginShell,%loginShell%)</value> <value>=php.PickList(/,(objectClass=posixAccount),loginShell,%loginShell%)</value>
</attribute> </attribute>
<attribute id="gidNumber"> <attribute id="gidNumber">
<display>GID Number</display> <display>GID Number</display>
<onchange>autoFill:homeDirectory,/home/users/%gidNumber|0-0/T%/%uid|3-%</onchange> <onchange>autoFill:homeDirectory,/home/users/%gidNumber|0-0/T%/%uid|3-%</onchange>
<order>11</order> <order>10</order>
<page>1</page> <page>1</page>
<value>=php.PickList(/,(objectClass=posixGroup),gidNumber,%cn%)</value> <value>=php.PickList(/,(objectClass=posixGroup),gidNumber,%cn%)</value>
</attribute> </attribute>
@ -126,7 +118,7 @@
<location>side</location> <location>side</location>
<value></value> <value></value>
</helper> </helper>
<order>13</order> <order>11</order>
<page>1</page> <page>1</page>
<post>=php.Join(-,(%sambaPrimaryGroupSID%,%sidpgsuffix%))</post> <post>=php.Join(-,(%sambaPrimaryGroupSID%,%sidpgsuffix%))</post>
<spacer>1</spacer> <spacer>1</spacer>
@ -134,7 +126,7 @@
</attribute> </attribute>
<attribute id="homeDirectory"> <attribute id="homeDirectory">
<display>Home directory</display> <display>Home directory</display>
<order>14</order> <order>12</order>
<page>1</page> <page>1</page>
</attribute> </attribute>
<attribute id="sambaAcctFlags"> <attribute id="sambaAcctFlags">

View File

@ -14,6 +14,7 @@
<!-- Template Definition --> <!-- Template Definition -->
<!ELEMENT template (title,regexp?,icon?,description?,askcontainer?,rdn?, <!ELEMENT template (title,regexp?,icon?,description?,askcontainer?,rdn?,
destinationcontainer?,action?,
visible?,invalid?,objectClasses,attributes)> visible?,invalid?,objectClasses,attributes)>
<!-- ObjectClasses Definition --> <!-- ObjectClasses Definition -->
@ -46,6 +47,8 @@
<!ELEMENT rdn (#PCDATA)> <!ELEMENT rdn (#PCDATA)>
<!ELEMENT visible (#PCDATA)> <!ELEMENT visible (#PCDATA)>
<!ELEMENT invalid (#PCDATA)> <!ELEMENT invalid (#PCDATA)>
<!ELEMENT destinationcontainer (#PCDATA)>
<!ELEMENT action (#PCDATA)>
<!-- Attribute Parameters --> <!-- Attribute Parameters -->
<!ELEMENT array (#PCDATA)> <!ELEMENT array (#PCDATA)>

View File

@ -1,5 +1,5 @@
<?php <?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/template_header.php,v 1.8 2006/04/29 06:49:32 wurley Exp $ // $Header: /cvsroot/phpldapadmin/phpldapadmin/templates/template_header.php,v 1.10 2006/10/28 11:42:10 wurley Exp $
/** /**
* Header page for engine. * Header page for engine.
@ -9,13 +9,11 @@
include './header.php'; include './header.php';
$time = gettimeofday();
$random_junk = md5(strtotime('now').$time['usec']);
$url_base = sprintf('server_id=%s&amp;dn=%s',$ldapserver->server_id,$encoded_dn); $url_base = sprintf('server_id=%s&amp;dn=%s',$ldapserver->server_id,$encoded_dn);
$export_href_base = sprintf('export_form.php?%s&amp;scope=%s',$url_base,'base'); $export_href_base = sprintf('export_form.php?%s&amp;scope=%s',$url_base,'base');
$export_href_sub = sprintf('export_form.php?%s&amp;scope=%s',$url_base,'sub'); $export_href_sub = sprintf('export_form.php?%s&amp;scope=%s',$url_base,'sub');
$refresh_href = sprintf('template_engine.php?%s&amp;random=%s',$url_base,$random_junk); $refresh_href = sprintf('template_engine.php?%s&amp;random=%s',$url_base,random_junk());
$copy_href = sprintf('copy_form.php?%s',$url_base); $copy_href = sprintf('copy_form.php?%s',$url_base);
$intattr_href = sprintf('template_engine.php?%s&amp;show_internal_attrs=true',$url_base); $intattr_href = sprintf('template_engine.php?%s&amp;show_internal_attrs=true',$url_base);
$delete_href = sprintf('delete_form.php?%s',$url_base); $delete_href = sprintf('delete_form.php?%s',$url_base);
@ -130,7 +128,7 @@ if ($dn) {
$schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s', $schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',
$ldapserver->server_id,real_attr_name($attr)); $ldapserver->server_id,real_attr_name($attr));
printf('<tr><td colspan="2" class="attr"><b><a title="'._('Click to view the schema defintion for attribute type \'%s\'').'" href="%s" />%s</b></td></tr>', printf('<tr><td colspan="2" class="attr"><b><a title="'._('Click to view the schema definition for attribute type \'%s\'').'" href="%s" />%s</b></td></tr>',
$attr,$schema_href,htmlspecialchars($attr)); $attr,$schema_href,htmlspecialchars($attr));
echo '<tr><td class="val"><small>'; echo '<tr><td class="val"><small>';

View File

@ -6,4 +6,4 @@
# This script is run after make_po to merge the existing German translations to messages.po # This script is run after make_po to merge the existing German translations to messages.po
./make_po ./make_po
msgmerge -v ../locale/ca_ES/LC_MESSAGES/messages.po messages.po -o messages.po msgmerge -v ../../locale/ca_ES/LC_MESSAGES/messages.po messages.po -o messages.po

View File

@ -6,4 +6,4 @@
# This script is run after make_po to merge the existing German translations to messages.po # This script is run after make_po to merge the existing German translations to messages.po
./make_po ./make_po
msgmerge -v ../locale/de_DE/LC_MESSAGES/messages.po messages.po -o messages.po msgmerge -v ../../locale/de_DE/LC_MESSAGES/messages.po messages.po -o messages.po

View File

@ -6,4 +6,4 @@
# This script is run to update the existing Spanish translations in messages.po # This script is run to update the existing Spanish translations in messages.po
./make_po ./make_po
msgmerge -v ../locale/es_ES/LC_MESSAGES/messages.po messages.po -o messages.po msgmerge -v ../../locale/es_ES/LC_MESSAGES/messages.po messages.po -o messages.po

View File

@ -6,4 +6,4 @@
# This script is run after make_po to merge the existing German translations to messages.po # This script is run after make_po to merge the existing German translations to messages.po
./make_po ./make_po
msgmerge -v ../locale/fr_FR/LC_MESSAGES/messages.po messages.po -o messages.po msgmerge -v ../../locale/fr_FR/LC_MESSAGES/messages.po messages.po -o messages.po

View File

@ -6,4 +6,4 @@
# This script is run after make_po to merge the existing Hungarian translations to messages.po # This script is run after make_po to merge the existing Hungarian translations to messages.po
./make_po ./make_po
msgmerge -v ../locale/hu_HU/LC_MESSAGES/messages.po messages.po -o messages.po msgmerge -v ../../locale/hu_HU/LC_MESSAGES/messages.po messages.po -o messages.po

View File

@ -6,4 +6,4 @@
# This script is run after make_po to merge the existing German translations to messages.po # This script is run after make_po to merge the existing German translations to messages.po
./make_po ./make_po
msgmerge -v ../locale/it_IT/LC_MESSAGES/messages.po messages.po -o messages.po msgmerge -v ../../locale/it_IT/LC_MESSAGES/messages.po messages.po -o messages.po

View File

@ -6,4 +6,4 @@
# This script is run after make_po to merge the existing Japanese translations to messages.po # This script is run after make_po to merge the existing Japanese translations to messages.po
./make_po ./make_po
msgmerge -v ../locale/ja_JP/LC_MESSAGES/messages.po messages.po -o messages.po msgmerge -v ../../locale/ja_JP/LC_MESSAGES/messages.po messages.po -o messages.po