Compare commits

..

3 Commits

Author SHA1 Message Date
Deon George
388783fc84 RELEASE 1.1.0.7 2009-06-30 22:05:31 +10:00
Deon George
647f86562f RELEASE 1.1.0.6 2009-06-30 21:52:55 +10:00
Deon George
d5f4f91f1b RELEASE 1.1.0.5 2009-06-30 21:51:50 +10:00
138 changed files with 34046 additions and 21433 deletions

View File

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

View File

@@ -1 +1 @@
$Name: RELEASE-1_1_0_4 $
$Name: RELEASE-1_1_0_7 $

View File

@@ -46,7 +46,7 @@
/* phpLDAPadmin can encrypt the content of sensitive cookies if you set this
to a big random string. */
$config->custom->session['blowfish'] = '';
// $config->custom->session['blowfish'] = null;
/* The language setting. If you set this to 'auto', phpLDAPadmin will attempt
to determine your language automatically. Otherwise, available lanaguages
@@ -66,6 +66,12 @@ $config->custom->session['blowfish'] = '';
environments. */
# $config->custom->password['no_random_crypt_salt'] = true;
/* PHP script timeout control. If php runs longer than this many seconds then
PHP will stop with an Maximum Execution time error. Increase this value from
the default if queries to your LDAP server are slow. The default is either
30 seconds or the setting of max_exection_time if this is null. */
// $config->custom->session['timelimit'] = 30;
/*********************************************/
/* Commands */
/*********************************************/
@@ -128,9 +134,22 @@ $config->custom->commands['all'] = array(
An AttributeFactory defines which class to use to represent a given attribute */
// $config->custom->appearance['attribute_factory'] = "AttributeFactory";
/* Just show your custom templates. */
// $config->custom->appearance['custom_templates_only'] = false;
/* Disable the default template. */
// $config->custom->appearance['disable_default_template'] = false;
/* Configure what objects are shown in left hand tree */
// $config->custom->appearance['tree_filter'] = '(objectclass=*)';
/* The height and width of the tree. If these values are not set, then
no tree scroll bars are provided. */
// $config->custom->appearance['tree_height'] = null;
# $config->custom->appearance['tree_height'] = 600;
// $config->custom->appearance['tree_width'] = null;
# $config->custom->appearance['tree_width'] = 250;
/*********************************************/
/* Define your LDAP servers in this section */
/*********************************************/
@@ -150,7 +169,7 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
// $ldapservers->SetValue($i,'server','host','127.0.0.1');
/* The port your LDAP server listens on (no quotes). 389 is standard. */
// $ldapservers->SetValue($i,'server','port','389');
// $ldapservers->SetValue($i,'server','port',389);
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
auto-detect it for you. */
@@ -257,7 +276,8 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
authentication with dn.
This is useful, when users should be able to log in with their uid, but
the ldap administrator wants to log in with his root-dn, that does not
necessarily have the uid attribute. */
necessarily have the uid attribute.
When using this feature, login_class is ignored. */
// $ldapservers->SetValue($i,'login','fallback_dn',false);
/* If you specified 'cookie' or 'session' as the auth_type above, and you
@@ -298,10 +318,10 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
/* The minimum number to use when searching for the next available UID number
(only when 'search' is used for auto_uid_number_mechanism' */
// $ldapservers->SetValue($i,'auto_number','min','1000');
// $ldapservers->SetValue($i,'auto_number','min',1000);
/* The DN of the uidPool entry when 'uidpool' mechanism is used above. */
# $servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com';
// $ldapservers->SetValue($i,'auto_number','uidpool_dn','cn=uidPool,dc=example,dc=com');
/* If you set this, then phpldapadmin will bind to LDAP with this user ID when
searching for the uidnumber. The idea is, this user id would have full
@@ -351,6 +371,25 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
has children. Certain servers are known to allow it, certain are not */
// $ldapservers->SetValue($i,'server','branch_rename',false);
/* If you set this, then phpldapadmin will show these attributes as
internal attributes, even if they are not defined in your schema. */
// $ldapservers->SetValue($i,'server','custom_sys_attrs',array(''));
# $ldapservers->SetValue($i,'server','custom_sys_attrs',array('passwordExpirationTime','passwordAllowChangeTime'));
/* If you set this, then phpldapadmin will show these attributes on
objects, even if they are not defined in your schema. */
// $ldapservers->SetValue($i,'server','custom_attrs',array(''));
# $ldapservers->SetValue($i,'server','custom_attrs',array('nsRoleDN','nsRole','nsAccountLock'));
/* These attributes will be forced to MAY attributes and become option in the
templates. If they are not defined in the templates, then they wont appear
as per normal template processing. You may want to do this becuase your LDAP
server may automatically calculate a default value.
In Fedora Directory Server using the DNA Plugin one could ignore uidNumber,
gidNumber and sambaSID. */
// $ldapservers->SetValue($i,'force_may','attrs',array(''));
# $ldapservers->SetValue($i,'force_may','attrs',array('uidNumber','gidNumber','sambaSID'));
/**************************************************************************
* If you want to configure additional LDAP servers, do so below. *
* Remove the commented lines and use this section as a template for all *
@@ -361,7 +400,7 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server');
$i++;
$ldapservers->SetValue($i,'server','name','LDAP Server');
$ldapservers->SetValue($i,'server','host','127.0.0.1');
$ldapservers->SetValue($i,'server','port','389');
$ldapservers->SetValue($i,'server','port',389);
$ldapservers->SetValue($i,'server','base',array(''));
$ldapservers->SetValue($i,'server','auth_type','cookie');
$ldapservers->SetValue($i,'login','dn','');
@@ -377,7 +416,7 @@ $ldapservers->SetValue($i,'appearance','show_create',true);
$ldapservers->SetValue($i,'auto_number','enable',true);
$ldapservers->SetValue($i,'auto_number','mechanism','search');
$ldapservers->SetValue($i,'auto_number','search_base',null);
$ldapservers->SetValue($i,'auto_number','min','1000');
$ldapservers->SetValue($i,'auto_number','min',1000);
$ldapservers->SetValue($i,'auto_number','dn',null);
$ldapservers->SetValue($i,'auto_number','pass',null);
$ldapservers->SetValue($i,'login','anon_bind',true);
@@ -481,7 +520,7 @@ $friendly_attrs['uid'] = 'User Name';
/*********************************************/
/* Add "modify group members" link to the attribute. */
// $config->custom->modify_member['groupattr'] = array('member','uniqueMember','memberUid')
// $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)';

View File

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

11
doc/uidpool.schema Executable file
View File

@@ -0,0 +1,11 @@
##
## Used for storing the next gid and next uid in the the directory
##
objectclass ( 1.3.6.1.4.1.7165.1.2.2.3 NAME 'uidPool' SUP top AUXILIARY
DESC 'Pool for allocating UNIX uids'
MUST ( uidNumber $ cn ) )
objectclass ( 1.3.6.1.4.1.7165.1.2.2.4 NAME 'gidPool' SUP top AUXILIARY
DESC 'Pool for allocating UNIX gids'
MUST ( gidNumber $ cn ) )

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.20.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr.php,v 1.20.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* Adds an attribute/value pair to an object
@@ -19,11 +19,12 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')),'error','index.php');
$entry = array();
$entry['val'] = get_request('val','POST');
$entry['binary'] = get_request('binary','POST');
@@ -34,7 +35,7 @@ $entry['attr']['string'] = get_request('attr','POST');
$entry['attr']['encode'] = rawurlencode($entry['attr']['string']);
if ((strlen($entry['binary']) <= 0) && (strlen($entry['val']) <= 0))
pla_error(_('You left the attribute value blank. Please go back and try again.'));
error(_('You left the attribute value blank. Please go back and try again.'),'error','index.php');
/*
* Special case for binary attributes (like jpegPhoto and userCertificate):
@@ -48,44 +49,44 @@ if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$entry['attr'
$href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
$ldapserver->server_id,$entry['attr']['string'],$badattr));
pla_error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href));
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href),'error','index.php');
}
if (strlen($entry['binary']) > 0) {
if ($_FILES['val']['size'] == 0)
pla_error(_('The file you chose is either empty or does not exist. Please go back and try again.'));
error(_('The file you chose is either empty or does not exist. Please go back and try again.'),'error','index.php');
if (! is_uploaded_file($_FILES['val']['tmp_name'])) {
if (isset($_FILES['val']['error']))
switch($_FILES['val']['error']) {
case 0: # No error; possible file attack!
pla_error(_('Security error: The file being uploaded may be malicious.'));
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
break;
case 1: # Uploaded file exceeds the upload_max_filesize directive in php.ini
pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'));
error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php');
break;
case 2: # Uploaded file exceeds the MAX_FILE_SIZE directive specified in the html form
pla_error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'));
error(_('The file you uploaded is too large. Please check php.ini, upload_max_size setting'),'error','index.php');
break;
case 3: # Uploaded file was only partially uploaded
pla_error(_('The file you selected was only partially uploaded, likley due to a network error.'));
error(_('The file you selected was only partially uploaded, likley due to a network error.'),'error','index.php');
break;
case 4: # No file was uploaded
pla_error(_('You left the attribute value blank. Please go back and try again.'));
error(_('You left the attribute value blank. Please go back and try again.'),'error','index.php');
break;
default: # A default error, just in case! :)
pla_error(_('Security error: The file being uploaded may be malicious.'));
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
break;
}
else
pla_error(_('Security error: The file being uploaded may be malicious.'));
error(_('Security error: The file being uploaded may be malicious.'),'error','index.php');
}
$binaryfile['name'] = $_FILES['val']['tmp_name'];
@@ -125,7 +126,10 @@ if ($result) {
die();
} else {
pla_error(_('Failed to add the attribute.'),$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Failed to add the attribute.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
/**

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.16.2.2 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_attr_form.php,v 1.16.2.4 2008/12/12 12:20:22 wurley Exp $
/**
* Displays a form for adding an attribute/value to an LDAP entry.
@@ -15,8 +15,9 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
$entry = array();
$entry['dn']['string'] = get_request('dn','GET');
$entry['rdn'] = get_rdn($entry['dn']['string']);
@@ -24,6 +25,7 @@ printf('<h3 class="title">%s <b>%s</b></h3>',_('Add new attribute'),htmlspecialc
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($entry['dn']['string']));
$dn = array();
$dn['attrs'] = $ldapserver->getDNAttrs($entry['dn']['string']);
$dn['oclasses'] = $ldapserver->getDNAttr($entry['dn']['string'],'objectClass');

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass.php,v 1.19 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass.php,v 1.19.2.1 2008/12/12 12:20:22 wurley Exp $
/**
* Adds an objectClass to the specified dn.
@@ -20,11 +20,12 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if ($ldapserver->isAttrReadOnly('objectClass'))
pla_error(_('ObjectClasses are flagged as read only in the phpLDAPadmin configuration.'));
error(_('ObjectClasses are flagged as read only in the phpLDAPadmin configuration.'),'error','index.php');
$entry = array();
$entry['dn']['encode'] = get_request('dn');
$entry['dn']['string'] = urldecode($entry['dn']['encode']);
@@ -42,7 +43,7 @@ if (is_array($entry['new']['attrs']) && count($entry['new']['attrs']) > 0)
$href['search'] = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
$ldapserver->server_id,$attr,$badattr));
pla_error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$entry['dn']['string'],$href['search']));
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$entry['dn']['string'],$href['search']),'error','index.php');
}
$new_entry[$attr] = $val;
@@ -51,7 +52,10 @@ if (is_array($entry['new']['attrs']) && count($entry['new']['attrs']) > 0)
$result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
if (! $result)
pla_error(_('Could not perform ldap_mod_add operation.'),$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not perform ldap_mod_add operation.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
else {
$modified_attrs = array_keys($entry['new']['attrs']);

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass_form.php,v 1.25 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_oclass_form.php,v 1.25.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* This page may simply add the objectClass and take you back to the edit page,
@@ -20,14 +20,15 @@
*/
require './common.php';
$entry = array();
$entry['oclass']['new'] = get_request('new_oclass','REQUEST');
$entry['dn']['string'] = get_request('dn','REQUEST');
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $entry['oclass']['new'])
pla_error(_('You did not select any ObjectClasses for this object. Please go back and do so.'));
error(_('You did not select any ObjectClasses for this object. Please go back and do so.'),'error','index.php');
/* Ensure that the object has defined all MUST attrs for this objectClass.
* If it hasn't, present a form to have the user enter values for all the
@@ -89,12 +90,12 @@ if (count($ldap['attrs']['need']) > 0) {
printf('<input type="hidden" name="dn" value="%s" />',rawurlencode($entry['dn']['string']));
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
echo '<table class="edit_dn" cellspacing="0">';
echo '<table class="entry" cellspacing="0">';
printf('<tr><th colspan="2">%s</th></tr>',_('New Required Attributes'));
foreach ($ldap['attrs']['need'] as $count => $attr) {
printf('<tr><td class="attr">%s</td></tr>',htmlspecialchars($attr->getName()));
printf('<tr><td class="val"><input type="text" name="new_attrs[%s]" value="" size="40" /></td></tr>',htmlspecialchars($attr->getName()));
printf('<tr><td class="title">%s</td></tr>',htmlspecialchars($attr->getName()));
printf('<tr><td class="value"><input type="text" name="new_attrs[%s]" value="" size="40" /></td></tr>',htmlspecialchars($attr->getName()));
}
echo '</table>';
@@ -108,7 +109,10 @@ if (count($ldap['attrs']['need']) > 0) {
$result = $ldapserver->attrModify($entry['dn']['string'],array('objectClass'=>$entry['oclass']['new']));
if (! $result)
pla_error('Could not perform ldap_mod_add operation.',$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not perform ldap_mod_add operation.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
else {
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectClass',

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.21.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value.php,v 1.21.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* Adds a value to an attribute for a given dn.
@@ -18,12 +18,13 @@
*/
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')),'error','index.php');
# The DN and ATTR we are working with.
$entry = array();
$entry['dn']['encode'] = get_request('dn','POST',true);
$entry['dn']['string'] = rawurldecode($entry['dn']['encode']);
$entry['attr']['encode'] = get_request('attr','POST',true);
@@ -34,7 +35,7 @@ $entry['value']['string'] = get_request('new_value','POST',true);
$entry['value']['bin'] = get_request('binary','POST') ? true : false;
if ($ldapserver->isAttrReadOnly($entry['attr']['string']))
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$entry['attr']['html']));
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$entry['attr']['html']),'error','index.php');
/*
* Special case for binary attributes:
@@ -56,7 +57,7 @@ if ($badattr = $ldapserver->checkUniqueAttr($entry['dn']['string'],$entry['attr'
$href = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
$ldapserver->server_id,$entry['attr']['string'],$badattr));
pla_error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href));
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$entry['attr']['string'],$badattr,$entry['dn']['string'],$href),'error','index.php');
}
# Call the custom callback for each attribute modification and verify that it should be modified.
@@ -69,8 +70,11 @@ if (run_hook('pre_attr_add',
$add_result = $ldapserver->attrModify($entry['dn']['string'],$new_entry);
if (! $add_result) {
pla_error(_('Could not perform ldap_mod_add operation.'),
$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not perform ldap_mod_add operation.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
} else {
run_hook('post_attr_modify',
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'attr_name'=>$entry['attr']['string'],'new_value'=>$new_entry));

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.39.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/add_value_form.php,v 1.39.2.6 2008/12/12 12:20:22 wurley Exp $
/**
* Displays a form to allow the user to enter a new value to add
@@ -13,9 +13,10 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
# The DN and ATTR we are working with.
$entry = array();
$entry['dn']['encode'] = get_request('dn','GET',true);
$entry['dn']['string'] = urldecode($entry['dn']['encode']);
$entry['dn']['html'] = htmlspecialchars($entry['dn']['string']);
@@ -34,7 +35,7 @@ $entry['rdn']['html'] = htmlspecialchars($entry['rdn']['string']);
/***************/
if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string']))
pla_error(sprintf(_('The entry (%s) does not exist.'),$entry['dn']['html']),null,-1,true);
error(sprintf(_('The entry (%s) does not exist.'),$entry['dn']['html']),'error','index.php');
$tree = get_cached_item($ldapserver->server_id,'tree');
$entry['ldap'] = null;
@@ -47,12 +48,12 @@ if ($tree) {
$entry['ldap'] = $tree->getEntry($entry['dn']['string']);
}
// define the template of the entry if possible
# Define the template of the entry if possible
eval('$reader = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_reader').'($ldapserver);');
$reader->visit('Start', $entry['ldap']);
if (! $entry['ldap'] || $entry['ldap']->isReadOnly())
pla_error(sprintf(_('The entry (%s) is in readonly mode.'),$entry['dn']['html']),null,-1,true);
error(sprintf(_('The entry (%s) is in readonly mode.'),$entry['dn']['html']),'error','index.php');
/*********************/
/* attribute values */
@@ -62,7 +63,7 @@ eval('$writer = new '.$_SESSION[APPCONFIG]->GetValue('appearance','entry_writer'
$ldap['attr'] = $entry['ldap']->getAttribute($entry['attr']['string']);
if (!$ldap['attr']) {
// define a new attribute for the entry
# Define a new attribute for the entry
$attributefactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','attribute_factory');
eval('$attribute_factory = new '.$attributefactoryclass.'();');
$ldap['attr'] = $attribute_factory->newAttribute($entry['attr']['string'], array());
@@ -71,16 +72,13 @@ if (!$ldap['attr']) {
$ldap['count'] = $ldap['attr']->getValueCount();
if ($ldap['attr']->isReadOnly())
pla_error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),null,-1,true);
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')));
if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')));
error(sprintf(_('The attribute (%s) is in readonly mode.'),$entry['attr']['html']),'error','index.php');
/*
$ldap['attrs'] = $ldapserver->getDNAttr($entry['dn']['string'],$entry['attr']['string']);
$ldap['count'] = count($ldap['attrs']);
*/
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute value')),'error','index.php');
if (($ldap['attr']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('add attribute')),'error','index.php');
$entry['attr']['oclass'] = (strcasecmp($entry['attr']['string'],'objectClass') == 0) ? true : false;
@@ -99,88 +97,50 @@ printf('<h3 class="title">%s <b>%s</b> %s <b>%s</b></h3>',
printf('<h3 class="subtitle">%s <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),$entry['dn']['html']);
if ($ldap['count']) {
printf('%s <b>%s</b> %s <b>%s</b>%s',
_('Current list of'),$ldap['count'],_('values for attribute'),$ldap['attr']->getFriendlyName(),_(':'));
} else {
printf('%s <b>%s</b>.',
_('No current value for attribute'),$ldap['attr']->getFriendlyName());
}
if ($entry['attr']['oclass']) {
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form">';
echo '<input type="hidden" name="cmd" value="add_oclass_form" />';
} else {
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form" enctype="multipart/form-data" onSubmit="return submitForm(this)">';
echo '<input type="hidden" name="cmd" value="update_confirm" />';
//printf('<input type="hidden" name="attr" value="%s" />',$entry['attr']['encode']);
}
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$entry['dn']['encode']);
echo '<center>';
echo '<table class="forminput" border=0>';
echo '<tr>';
if ($ldap['count']) {
// display current attribute values
echo '<table class="edit_dn" cellspacing="0" cellpadding="0" align="center"><tr><td>';
printf('<td class="top">%s <b>%s</b> %s <b>%s</b>%s</td>',
_('Current list of'),$ldap['count'],_('values for attribute'),$ldap['attr']->getFriendlyName(),_(':'));
} else {
printf('<td>%s <b>%s</b>.</td>',
_('No current value for attribute'),$ldap['attr']->getFriendlyName());
}
echo '<td>';
if ($ldap['count']) {
# Display current attribute values
echo '<table border=0><tr><td>';
for ($i = 0; $i < $ldap['count']; $i++) {
$writer->draw('OldValue', $ldap['attr'], $i);
$writer->draw('ReadOnlyValue', $ldap['attr'], $i);
}
echo '</td></tr></table>';
/*
if ($ldapserver->isJpegPhoto($entry['attr']['string'])) {
printf('<table><tr><td>%s</td></tr></table>',
draw_jpeg_photos($ldapserver,$entry['dn']['string'],$entry['attr']['string'],false));
# <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
printf('<p><small>%s</small></p>',
_('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.'));
# <!-- End of temporary warning -->
} elseif ($ldapserver->isAttrBinary($entry['attr']['string'])) {
echo '<ul>';
for ($i=1; $i<=count($vals); $i++) {
$href = sprintf('download_binary_attr.php?server_id=%s&amp;dn=%s&amp;attr=%s&amp;value_num=%s',
$ldapserver->server_id,$entry['dn']['encode'],$entry['attr']['string'],$i-1);
printf('<li><a href="%s"><img src="images/save.png" alt="Save" />%s (%s)</a></li>',
$href,_('download value'),$i);
}
echo '</ul>';
# <!-- Temporary warning until we find a way to add jpegPhoto values without an INAPROPRIATE_MATCHING error -->
printf('<p><small>%s</small></p>',
_('Note: You will get an "inappropriate matching" error if you have not setup an EQUALITY rule on your LDAP server for this attribute.'));
# <!-- End of temporary warning -->
} else {
echo '<ul class="current_values">';
if (strcasecmp($entry['attr']['string'],'userPassword') == 0) {
foreach ($ldap['attrs'] as $key => $value) {
if (obfuscate_password_display(get_enc_type($value)))
echo '<li><span style="white-space: nowrap;">'.preg_replace('/./','*',$value).'<br /></li>';
else
echo '<li><span style="white-space: nowrap;">'.htmlspecialchars($value).'<br /></li>';
}
} else {
foreach ($ldap['attrs'] as $val)
printf('<li><span style="white-space: nowrap;">%s</span></li>',htmlspecialchars($val));
}
echo '</ul>';
}
*/
} else {
echo '<br /><br />';
}
echo '</td>';
echo '</tr>';
echo _('Enter the value you would like to add:');
echo '<br /><br />';
echo '<tr>';
printf('<td class="top">%s</td>',_('Enter the value you would like to add:'));
echo '<td>';
if ($entry['attr']['oclass']) {
// draw objectClass selection
echo '<table class="edit_dn" cellspacing="0" cellpadding="0" align="center"><tr><td>';
# Draw objectClass selection
echo '<table border=0><tr><td>';
echo '<select name="new_oclass[]" multiple="true" size="15">';
foreach ($ldap['oclasses'] as $name => $oclass) {
# exclude any structural ones, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
@@ -195,36 +155,21 @@ if ($entry['attr']['oclass']) {
echo '<br />';
printf('<input id="save_button" type="submit" value="%s" />',_('Add new ObjectClass'));
echo '</td></tr></table>';
echo '<br />';
echo '</td>';
echo '</tr>';
if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints'))
printf('<small><br /><img src="images/light.png" alt="Hint" /><span class="hint">%s</span></small>',
_('Note: You may be required to enter new attributes that these objectClass(es) require'));
printf('<tr><td colspan=2><small><br /><img src="%s/light.png" alt="Hint" /><span class="hint">%s</span></small></td></tr>',
IMGDIR,_('Note: You may be required to enter new attributes that these objectClass(es) require'));
echo '</table>';
echo '</center>';
echo '</form>';
} else {
// draw a blank field
echo '<table class="edit_dn" cellspacing="0" cellpadding="0" align="center"><tr><td>';
$writer->draw('BlankValue', $ldap['attr'], $ldap['count']);
# Draw a blank field
echo '<table border=0><tr><td>';
$writer->draw('BlankValue',$ldap['attr'],$ldap['count'],$reader);
echo '</td></tr><tr><td>';
/*
if ($ldapserver->isAttrBinary($entry['attr']['string'])) {
echo '<input type="file" name="new_value" />';
echo '<input type="hidden" name="binary" value="true" />';
} else {
if ($ldapserver->isMultiLineAttr($entry['attr']['string'])) {
echo '<textarea name="new_value" rows="3" cols="30"></textarea>';
} else {
printf('<input type="text"%s name="new_value" size="40" value="" />',
($ldap['attr']->getMaxLength() ? sprintf(' maxlength="%s"',$ldap['attr']->getMaxLength()) : ''));
# Draw the "browse" button next to this input box if this attr houses DNs:
if ($ldapserver->isDNAttr($entry['attr']['string']))
draw_chooser_link("new_value_form.new_value", false);
}
}
*/
if ($ldap['schema']->getDescription())
printf('<small><b>%s:</b> %s</small><br />',_('Description'),$ldap['schema']->getDescription());
@@ -240,9 +185,12 @@ if ($entry['attr']['oclass']) {
printf('<input type="submit" id="save_button" name="submit" value="%s" />',_('Add New Value'));
echo '</td></tr></table>';
echo '</td></tr>';
echo '</table>';
echo '</center>';
echo '</form>';
// javascript
# Javascript
echo '<script type="text/javascript" language="javascript">
function pla_getComponentById(id) {
return document.getElementById(id);

View File

@@ -1,37 +1,35 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.16.2.2 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare.php,v 1.16.2.7 2008/12/12 12:20:22 wurley Exp $
/**
* Compare two DNs - the destination DN is editable.
* @package phpLDAPadmin
*/
/**
* @todo: Must fix dc/domainComponent evaluation.
*/
require_once './common.php';
$dn_src = isset($_POST['dn_src']) ? $_POST['dn_src'] : null;
$dn_dst = isset($_POST['dn_dst']) ? $_POST['dn_dst'] : null;
$dn_src = get_request('dn_src');
$dn_dst = get_request('dn_dst');
$encoded_dn_src = rawurlencode($dn_src);
$encoded_dn_dst = rawurlencode($dn_dst);
$server_id_src = (isset($_POST['server_id_src']) ? $_POST['server_id_src'] : '');
$server_id_dst = (isset($_POST['server_id_dst']) ? $_POST['server_id_dst'] : '');
$server_id_src = get_request('server_id_src');
$server_id_dst = get_request('server_id_dst');
$ldapserver_src = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_src);
if (! $ldapserver_src->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
$ldapserver_dst = $_SESSION[APPCONFIG]->ldapservers->Instance($server_id_dst);
if (! $ldapserver_src->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
if (! $ldapserver_src->dnExists($dn_src))
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_src)));
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn_src)),'error','index.php');
if (! $ldapserver_dst->dnExists($dn_dst))
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn_dst)));
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn_dst)),'error','index.php');
$attrs_src = $ldapserver_src->getDNAttrs($dn_src,false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
$attrs_dst = $ldapserver_dst->getDNAttrs($dn_dst,false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
@@ -41,38 +39,34 @@ $attrs_all = array_keys($attrs_src);
foreach ($attrs_dst as $key => $val)
if (! in_array($key,$attrs_all))
$attrs_all[] = $key;
?>
<table class="comp_dn" border=0>
<tr><td colspan=6>
<h3 class="title"><?php echo _('Comparing the following DNs'); ?></h3>
</td></tr>
printf('<h3 class="title">%s</h3>',_('Comparing the following DNs'));
<tr>
<td colspan=2 width=20%>
<h3 class="subtitle"><?php echo _('Attribute'); ?><br />&nbsp;</h3>
</td>
<td colspan=2 width=40%>
<h3 class="subtitle"><?php echo _('Server'); ?>: <b><?php echo $ldapserver_src->name; ?></b><br /><?php echo _('Distinguished Name');?>: <b><?php echo htmlspecialchars(($dn_src)); ?></b></h3>
</td>
<td colspan=2 width=40%>
<h3 class="subtitle"><?php echo _('Server'); ?>: <b><?php echo $ldapserver_dst->name; ?></b><br /><?php echo _('Distinguished Name');?>: <b><?php echo htmlspecialchars(($dn_dst)); ?></b></h3>
</td>
</tr>
<tr>
<td colspan=6 align=right>
<form action="cmd.php?cmd=compare" method="post" name="compare_form">
<input type="hidden" name="server_id" value="<?php echo $ldapserver->server_id; ?>" />
<input type="hidden" name="server_id_src" value="<?php echo $ldapserver_dst->server_id; ?>" />
<input type="hidden" name="server_id_dst" value="<?php echo $ldapserver_src->server_id; ?>" />
<input type="hidden" name="dn_src" value="<?php echo htmlspecialchars($dn_dst); ?>" />
<input type="hidden" name="dn_dst" value="<?php echo htmlspecialchars($dn_src); ?>" />
<input type="submit" value="<?php echo _('Switch Entry'); ?>" />
</form>
</td>
</tr>
echo '<table class="entry" width=100% border=0>';
echo '<tr>';
printf('<td colspan=2 width=20%%><h3 class="subtitle">%s<br />&nbsp;</h3></td>',_('Attribute'));
printf('<td colspan=2 width=40%%><h3 class="subtitle">%s: <b>%s</b><br />%s: <b>%s</b></h3></td>',
_('Server'),$ldapserver_src->name,_('Distinguished Name'),htmlspecialchars($dn_src));
printf('<td colspan=2 width=40%%><h3 class="subtitle">%s: <b>%s</b><br />%s: <b>%s</b></h3></td>',
_('Server'),$ldapserver_dst->name,_('Distinguished Name'),htmlspecialchars($dn_dst));
echo '</tr>';
echo '<tr>';
echo '<td colspan=6 align=right>';
echo '<form action="cmd.php?cmd=compare" method="post" name="compare_form">';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="server_id_src" value="%s" />',$ldapserver_dst->server_id);
printf('<input type="hidden" name="server_id_dst" value="%s" />',$ldapserver_src->server_id);
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($dn_dst));
printf('<input type="hidden" name="dn_dst" value="%s" />',htmlspecialchars($dn_src));
printf('<input type="submit" value="%s" />',_('Switch Entry'));
echo '</form>';
echo '</td>';
echo '</tr>';
<?php
if (! $attrs_all || ! is_array($attrs_all)) {
printf('<tr><td colspan="2">(%s)</td></tr>',_('This entry has no attributes'));
print '</table>';
@@ -80,11 +74,10 @@ if (! $attrs_all || ! is_array($attrs_all)) {
}
sort($attrs_all);
$formdisplayed = false;
# Work through each of the attributes.
foreach ($attrs_all as $attr) {
flush();
# If this is the DN, get the next attribute.
if (! strcasecmp($attr,'dn'))
continue;
@@ -92,28 +85,20 @@ foreach ($attrs_all as $attr) {
# Has the config.php specified that this attribute is to be hidden or shown?
if ($ldapserver_src->isAttrHidden($attr) || $ldapserver_dst->isAttrHidden($attr))
continue;
?>
<!-- Begin Attribute -->
<tr>
$schema_attr_src = $ldapserver_src->getSchemaAttribute($attr,$dn_src);
$schema_attr_dst = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
<?php foreach (array('src','dst') as $side) { ?>
# Get the values and see if they are the same.
if (isset($attrs_src[$attr]) && isset($attrs_dst[$attr]) && $attrs_src[$attr] === $attrs_dst[$attr])
echo '<tr>';
else
echo '<tr class="updated">';
<?php
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly()) { ?>
<form action="cmd.php?cmd=update_confirm" method="post" name="edit_form">
<input type="hidden" name="server_id" value="<?php echo $ldapserver_dst->server_id; ?>" />
<input type="hidden" name="dn" value="<?php echo $dn_dst; ?>" />
<?php }
$schema_attr_src = $ldapserver_src->getSchemaAttribute($attr,$dn_src);
$schema_attr_dst = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
foreach (array('src','dst') as $side) {
# Setup the $attr_note, which will be displayed to the right of the attr name (if any)
$attr_note = '';
$required_note = '';
$attr_note = '&nbsp;';
# is there a user-friendly translation available for this attribute?
if ($_SESSION[APPCONFIG]->haveFriendlyName($attr)) {
@@ -122,7 +107,7 @@ foreach ($attrs_all as $attr) {
} else {
$attr_display = $attr;
$attr_note = '';
$attr_note = '&nbsp;';
}
# is this attribute required by an objectClass?
@@ -154,51 +139,49 @@ foreach ($attrs_all as $attr) {
break;
}
if ($side == 'src') { ?>
<td class="attr">
<?php $schema_href="cmd.php?cmd=schema&server_id=$server_id_src&amp;view=attributes&amp;viewvalue=".real_attr_name($attr); ?>
<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>
</td>
# If we are on the source side, show the attr
if ($side == 'src') {
echo '<td class="title">';
$schema_href = sprintf('cmd.php?cmd=schema&amp;server_id=%s&amp;view=attributes&amp;viewvalue=%s',$server_id_src,real_attr_name($attr));
printf('<a title="%s" href="%s">%s</a>',sprintf(_('Click to view the schema definition for attribute type \'%s\''),$attr),$schema_href,$attr_display);
echo '</td>';
<td class="attr_note">
<sup><small><?php echo $attr_note; ?></small></sup>
</td>
<?php }
printf('<td class="note"><sup><small>%s</small></sup></td>',$attr_note);
}
if ($required_by) {
$required_note .= sprintf('<acronym title="%s">%s</acronym>',sprintf(_('Required attribute for objectClass(es) %s'),$required_by),_('required'));
?>
<td colspan=2 class="attr_note">
<sup><small><?php echo $required_note; ?></small></sup>
</td>
<?php } else { ?>
<td colspan=2 class="attr_note">&nbsp;</td>
<?php } ?>
echo '<td colspan=2 class="note">';
<?php if ($ldapserver->isAttrReadOnly($attr)) { ?>
<small>(<acronym title="<?php echo _('This attribute has been flagged as read only by the phpLDAPadmin administrator'); ?>"><?php echo _('read only'); ?></acronym>)</small>
<?php } ?>
</td>
# Create our form if the dst is editable.
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! $formdisplayed) {
$formdisplayed = true;
echo '<form action="cmd.php?cmd=update_confirm" method="post" name="edit_form">';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver_dst->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$dn_dst);
}
<?php } ?>
if ($required_by)
printf('<sup><small><acronym title="%s">%s</acronym></small></sup>',sprintf(_('Required attribute for objectClass(es) %s'),$required_by),_('required'));
echo '</td>';
</tr>
<!-- End of Attribute -->
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'));
}
<!-- Begin Values -->
<tr>
echo '</tr>';
if (isset($attrs_src[$attr]) && isset($attrs_dst[$attr]) && $attrs_src[$attr] === $attrs_dst[$attr])
echo '<tr>';
else
echo '<tr class="updated">';
<?php
foreach (array('src','dst') as $side) {
$vals = null; ?>
$vals = null;
<?php
# If this attribute isnt set, then show a blank.
$toJump = 0;
switch ($side) {
case 'src':
print '<td colspan=2>&nbsp</td><td class="val">';
print '<td colspan=2>&nbsp;</td><td class="value">';
if (! isset($attrs_src[$attr])) {
echo "<small>&lt;". _('No Value')."&gt;</small></td>";
@@ -211,7 +194,7 @@ foreach ($attrs_all as $attr) {
break;
case 'dst':
print '<td colspan=2>&nbsp</td><td class="val">';
print '<td colspan=2>&nbsp;</td><td class="value">';
if (! isset($attrs_dst[$attr])) {
echo "<small>&lt;". _('No Value')."&gt;</small></td>";
@@ -224,19 +207,18 @@ foreach ($attrs_all as $attr) {
break;
}
if ($toJump) continue;
if ($toJump)
continue;
if (! is_array($vals))
$vals = array($vals);
/*
* Is this attribute a jpegPhoto?
*/
# Is this attribute a jpegPhoto?
if ($ldapserver->isJpegPhoto($attr)) {
switch ($side) {
case 'src':
// Don't draw the delete buttons if there is more than one jpegPhoto
// (phpLDAPadmin can't handle this case yet)
# Don't draw the delete buttons if there is more than one jpegPhoto (phpLDAPadmin can't handle this case yet)
draw_jpeg_photos($ldapserver,$dn_src,$attr,false);
break;
@@ -249,14 +231,12 @@ foreach ($attrs_all as $attr) {
break;
}
// proceed to the next attribute
echo "</td>\n";
# proceed to the next attribute
echo '</td>'."\n";
continue;
}
/*
* Is this attribute binary?
*/
# Is this attribute binary?
if ($ldapserver->isAttrBinary($attr)) {
switch ($side) {
case 'src':
@@ -267,36 +247,27 @@ foreach ($attrs_all as $attr) {
$href = sprintf("download_binary_attr.php?server_id=%s&dn=%s&attr=%s",$ldapserver->server_id,$encoded_dn_dst,$attr);
break;
}
?>
<small>
echo '<small>';
echo _('Binary value');
echo '<br />';
<?php echo _('Binary value'); ?><br />
if (count($vals) > 1)
for ($i=1; $i<=count($vals); $i++)
printf('<a href="%s&amp;value_num=%s"><img src="%s/save.png" /> %s(%s)</a><br />',$href,$i,_('download value'),IMGDIR,$i);
else
printf('<a href="%s"><img src="%s/save.png" /> %s</a><br />',$href,IMGDIR,_('download value'));
<?php if (count($vals) > 1) { for($i=1; $i<=count($vals); $i++) { ?>
<a href="<?php echo $href . "&amp;value_num=$i"; ?>"><img
src="images/save.png" /> <?php echo _('download value'); ?>(<?php echo $i; ?>)</a><br />
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! $ldapserver->isAttrReadOnly($attr))
printf('<a href="javascript:deleteAttribute(\'%s\');" style="color:red;"><img src="%s/trash.png" /> %s</a>',$attr,IMGDIR,_('delete attribute'));
<?php } } else { ?>
<a href="<?php echo $href; ?>"><img src="images/save.png" /> <?php echo _('download value'); ?></a><br />
echo '</small>';
echo '</td>';
<?php }
if ($side == 'dst' && ! $ldapserver_dst->isReadOnly() && ! $ldapserver->isAttrReadOnly($attr)) { ?>
<a href="javascript:deleteAttribute('<?php echo $attr; ?>');" style="color:red;"><img src="images/trash.png" /> <?php echo _('delete attribute'); ?></a>
<?php } ?>
</small>
</td>
<?php continue;
continue;
}
/*
* Note: at this point, the attribute must be text-based (not binary or jpeg)
*/
# Note: at this point, the attribute must be text-based (not binary or jpeg)
/*
* If this server is in read-only mode or this attribute is configured as read_only,
@@ -306,67 +277,58 @@ foreach ($attrs_all as $attr) {
if ($side == 'dst' && ($ldapserver->isReadOnly() || $ldapserver->isAttrReadOnly($attr))) {
if (is_array($vals)) {
foreach ($vals as $i => $val) {
if (trim($val) == "")
echo "<span style=\"color:red\">[" . _('empty') . "]</span><br />\n";
if (trim($val) == '')
printf('<span style="color:red">[%s]</span><br />',_('empty'));
elseif (0 == strcasecmp($attr,'userPassword') && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$val) . "<br />";
elseif (strcasecmp($attr,'userPassword') == 0 && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$val).'<br />';
else
echo htmlspecialchars($val) . "<br />";
echo htmlspecialchars($val).'<br />';
}
// @todo: redundant - $vals is always an array.
# @todo: redundant - $vals is always an array.
} else {
if (0 == strcasecmp($attr,'userPassword') && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$vals) . "<br />";
if (strcasecmp($attr,'userPassword') == 0 && $_SESSION[APPCONFIG]->GetValue('appearance','obfuscate_password_display'))
echo preg_replace('/./','*',$vals).'<br />';
else
echo $vals . "<br />";
echo $vals.'<br />';
}
echo "</td>";
echo '</td>';
continue;
}
/*
* Is this a userPassword attribute?
*/
# Is this a userPassword attribute?
if (! strcasecmp($attr,'userpassword')) {
$user_password = $vals[0];
$enc_type = get_enc_type($user_password);
// Set the default hashing type if the password is blank (must be newly created)
# Set the default hashing type if the password is blank (must be newly created)
if ($user_password == '') {
$enc_type = get_default_hash($server_id);
}
if ($side == 'dst') { ?>
if ($side == 'dst') {
printf('<input type="hidden" name="old_values[userpassword]" value="%s" />',htmlspecialchars($user_password));
echo '<!-- Special case of enc_type to detect changes when user changes enc_type but not the password value -->';
printf('<input size="38" type="hidden" name="old_enc_type" value="%s" />',$enc_type == '' ? 'clear' : $enc_type);
}
<input type="hidden" name="old_values[userpassword]" value="<?php echo htmlspecialchars($user_password); ?>" />
<!-- Special case of enc_type to detect changes when user changes enc_type but not the password value -->
<input size="38" type="hidden" name="old_enc_type" value="<?php echo ($enc_type==''?'clear':$enc_type); ?>" />
<?php }
if (obfuscate_password_display($enc_type)) {
if (obfuscate_password_display($enc_type))
echo htmlspecialchars(preg_replace('/./','*',$user_password));
} else {
else
echo htmlspecialchars($user_password);
} ?>
<br />
echo '<br />';
<?php if ($side == 'dst') { ?>
if ($side == 'dst') {
printf('<input style="width: 260px" type="password" name="new_values[userpassword]" value="%s" />',htmlspecialchars($user_password));
echo enc_type_select_list($enc_type,'enc','userpassword',0);
}
<input style="width: 260px" type="password" name="new_values[userpassword]" value="<?php echo htmlspecialchars($user_password); ?>" />
<?php echo enc_type_select_list($enc_type);
} ?>
<br />
<script language="javascript">
echo '<br />';
?>
<script type="text/javascript" language="javascript">
<!--
function passwordComparePopup()
{
@@ -377,187 +339,168 @@ foreach ($attrs_all as $attr) {
}
-->
</script>
<?php
<small><a href="javascript:passwordComparePopup()"><?php echo _('Check password'); ?></a></small>
printf('<small><a href="javascript:passwordComparePopup()">%s</a></small>',_('Check password'));
</td>
<?php continue;
echo '</td>';
continue;
}
/*
* Is this a boolean attribute?
*/
# Is this a boolean attribute?
if ($ldapserver->isAttrBoolean($attr)) {
$val = $vals[0];
if ($side = 'dst') {?>
if ($side = 'dst') {
printf('<input type="hidden" name="old_values[%s]" value="%s" />',htmlspecialchars($attr),htmlspecialchars($val));
<input type="hidden" name="old_values[<?php echo htmlspecialchars($attr); ?>]" value="<?php echo htmlspecialchars($val); ?>" />
printf('<select name="new_values[%s]">',htmlspecialchars($attr));
printf('<option value="TRUE"%s>%s</option>',$val == 'TRUE' ? ' selected' : '',_('true'));
printf('<option value="FALSE"%s>%s</option>',$val == 'FALSE' ? ' selected' : '',_('false'));
printf('<option value="">(%s)</option>',_('none, remove value'));
echo '</select>';
}
<select name="new_values[<?php echo htmlspecialchars($attr); ?>]">
<option value="TRUE"<?php echo ($val=='TRUE' ? ' selected' : ''); ?>><?php echo _('true'); ?></option>
<option value="FALSE"<?php echo ($val=='FALSE' ? ' selected' : ''); ?>><?php echo _('false'); ?></option>
<option value="">(<?php echo _('none, remove value'); ?>)</option>
</select>
<?php } ?>
</td>
<?php continue;
echo '</td>';
continue;
}
/*
* End of special case attributes (non plain text).
*/
# End of special case attributes (non plain text).
foreach ($vals as $i => $val) {
if ($side == 'dst') {
$input_name = "new_values[" . htmlspecialchars($attr) . "][$i]";
// We smack an id="..." tag in here that doesn't have [][] in it to allow the
// draw_chooser_link() to identify it after the user clicks.
$input_id = "new_values_" . htmlspecialchars($attr) . "_" . $i; ?>
$input_name = sprintf('new_values[%s][%s]',htmlspecialchars($attr),$i);
<!-- The old_values array will let update.php know if the entry contents changed
between the time the user loaded this page and saved their changes. -->
<input type="hidden" name="old_values[<?php echo htmlspecialchars($attr); ?>][<?php echo $i; ?>]" value="<?php echo htmlspecialchars($val); ?>" />
<?php }
/* We smack an id="..." tag in here that doesn't have [][] in it to allow the
* draw_chooser_link() to identify it after the user clicks.*/
$input_id = sprintf('"new_values_%s_%s',htmlspecialchars($attr),$i);
// Is this value is a structural objectClass, make it read-only
if (0 == strcasecmp($attr,'objectClass')) { ?>
echo '<!-- The old_values array will let update.php know if the entry contents changed
between the time the user loaded this page and saved their changes. -->';
printf('<input type="hidden" name="old_values[%s][%s]" value="%s" />',htmlspecialchars($attr),$i,htmlspecialchars($val));
}
<a title="<?php echo _('View the schema description for this objectClass'); ?>" href="cmd.php?cmd=schema&server_id=<?php echo $ldapserver->server_id; ?>&amp;view=objectClasses&amp;viewvalue=<?php echo htmlspecialchars($val); ?>"><img src="images/info.png" /></a>
# Is this value is a structural objectClass, make it read-only
if (0 == strcasecmp($attr,'objectClass')) {
<?php $schema_object = $ldapserver->getSchemaObjectClass($val);
printf('<a title="%s" href="cmd.php?cmd=schema&amp;server_id=%s&amp;view=objectClasses&amp;viewvalue=%s"><img src="%s/info.png" /></a>',
_('View the schema description for this objectClass'),$ldapserver->server_id,htmlspecialchars($val),IMGDIR);
if ($schema_object->getType() == 'structural') {
echo "$val <small>(<acronym title=\"" . sprintf(_('This is a structural ObjectClass and cannot be removed.')) . "\">" . _('structural') . "</acronym>)</small><br />";
$schema_object = $ldapserver->getSchemaObjectClass($val);
if ($side == 'dst') {?>
if ($schema_object->getType() == 'structural') {
printf('%s <small>(<acronym title="%s">%s</acronym>)</small><br />',
$val,_('This is a structural ObjectClass and cannot be removed.'),_('structural'));
<input type="hidden" name="<?php echo $input_name; ?>" id="<?php echo $input_id; ?>" value="<?php echo htmlspecialchars($val); ?>" />
if ($side == 'dst')
printf('<input type="hidden" name="%s" id="%s" value="%s" />',$input_name,$input_id,htmlspecialchars($val));
<?php }
continue;
continue;
}
}
if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) { ?>
if (is_dn_string($val) || $ldapserver->isDNAttr($attr))
printf('<a title="%s" href="cmd.php?cmd=template_engine&amp;server_id=%s&amp;dn=%s"><img style="vertical-align: top" src="%s/go.png" /></a>',
sprintf(_('Go to %s'),htmlspecialchars($val)),$ldapserver->server_id,rawurlencode($val),IMGDIR);
<a title="<?php echo sprintf(_('Go to %s'),htmlspecialchars($val)); ?>" href="cmd.php?cmd=template_engine&server_id=<?php echo $ldapserver->server_id; ?>&amp;dn=<?php echo rawurlencode($val); ?>"><img style="vertical-align: top" src="images/go.png" /></a>
elseif (is_mail_string($val))
printf('<a href="mailto:%s><img style="vertical-align: center" src="%s/mail.png" /></a>',htmlspecialchars($val),IMGDIR);
<?php } elseif (is_mail_string($val)) { ?>
<a href="mailto:<?php echo htmlspecialchars($val); ?>"><img style="vertical-align: center" src="images/mail.png" /></a>
<?php } elseif (is_url_string($val)) { ?>
<a href="<?php echo htmlspecialchars($val); ?>" target="new"><img style="vertical-align: center" src="images/dc.png" /></a>
<?php }
elseif (is_url_string($val))
printf('<a href="%s" target="new"><img style="vertical-align: center" src="%s/dc.png" /></a>',htmlspecialchars($val),IMGDIR);
if ($ldapserver->isMultiLineAttr($attr,$val)) {
if ($side == 'dst') {?>
<textarea class="val" rows="3" cols="30" name="<?php echo $input_name; ?>" id="<?php echo $input_id; ?>"><?php echo htmlspecialchars($val); ?></textarea>
<?php } else {
echo htmlspecialchars($val);
}
} else {
if ($side == 'dst') {?>
<input type="text" class="val" name="<?php echo $input_name; ?>" id="<?php echo $input_id; ?>" value="<?php echo htmlspecialchars($val); ?>" />
<?php } else {
echo htmlspecialchars($val);
}
}
// draw a link for popping up the entry browser if this is the type of attribute
// that houses DNs.
if ($ldapserver->isDNAttr($attr))
draw_chooser_link("edit_form.$input_id",false); ?>
<br />
<?php } ?>
</td>
<?php } /* end foreach value */ ?>
</tr>
<?php
/* Draw the "add value" link under the list of values for this attributes */
if (! $ldapserver_dst->isReadOnly()) {
// First check if the required objectClass is in this DN
$isOK = 0;
$src_oclass = array();
$attr_object = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
foreach ($attr_object->used_in_object_classes as $oclass) {
if (in_array(strtolower($oclass),arrayLower($attrs_dst['objectClass']))) {
$isOK = 1;
break;
} else {
// Find oclass that the source has that provides this attribute.
if (in_array($oclass,$attrs_src['objectClass']))
$src_oclass[] = $oclass;
}
}
print "<tr><td colspan=2></td><td colspan=2>&nbsp</td><td>&nbsp;</td><td>";
if (! $isOK) {
if (count($src_oclass) == 1) {
$add_href = sprintf('cmd.php?cmd=add_oclass_form&server_id=%s&dn=%s&new_oclass=%s',
$ldapserver_dst->server_id,$encoded_dn_dst,$src_oclass[0]);
} else {
$add_href = sprintf('cmd.php?cmd=add_value_form&server_id=%s&dn=%s&attr=objectClass',
$ldapserver_dst->server_id,$encoded_dn_dst);
}
if ($attr == 'objectClass')
printf('<div class="add_oclass">(<a href="%s" title="%s">%s</a>)</div>',$add_href,_('Add ObjectClass and Attributes'),_('add value'));
if ($side == 'dst')
printf('<textarea class="value" rows="3" cols="30" name="%s" id="%s">%s</textarea>',$input_name,$input_id,htmlspecialchars($val));
else
printf('<div class="add_oclass">(<a href="%s" title="%s">%s</a>)</div>',$add_href,sprintf(_('You need one of the following ObjectClass(es) to add this attribute %s.'),implode(" ",$src_oclass)),_('Add new ObjectClass'));
echo htmlspecialchars($val);
} else {
if (! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) {
if ($side == 'dst')
printf('<input type="text" class="value" name="%s" id="%s" value="%s" />',$input_name,$input_id,htmlspecialchars($val));
else
echo htmlspecialchars($val);
}
$add_href = sprintf('cmd.php?cmd=add_value_form&server_id=%s&dn=%s&attr=%s',
$ldapserver_dst->server_id,$encoded_dn_dst,rawurlencode($attr));
# draw a link for popping up the entry browser if this is the type of attribute that houses DNs.
if ($ldapserver->isDNAttr($attr))
draw_chooser_link("edit_form.$input_id",false);
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'));
}
echo '<br />';
}
echo '</td>';
} /* end foreach value */
echo '</tr>';
# Draw the "add value" link under the list of values for this attributes
if (! $ldapserver_dst->isReadOnly()) {
# First check if the required objectClass is in this DN
$isOK = 0;
$src_oclass = array();
$attr_object = $ldapserver_dst->getSchemaAttribute($attr,$dn_dst);
foreach ($attr_object->used_in_object_classes as $oclass) {
if (in_array(strtolower($oclass),arrayLower($attrs_dst['objectClass']))) {
$isOK = 1;
break;
} else {
# Find oclass that the source has that provides this attribute.
if (in_array($oclass,$attrs_src['objectClass']))
$src_oclass[] = $oclass;
}
}
print "</td></tr>"; ?>
echo '<tr><td colspan=2></td><td colspan=2>&nbsp;</td><td>&nbsp;</td><td>';
if (! $isOK) {
</td>
if (count($src_oclass) == 1)
$add_href = sprintf('cmd.php?cmd=add_oclass_form&amp;server_id=%s&amp;dn=%s&amp;new_oclass=%s',
$ldapserver_dst->server_id,$encoded_dn_dst,$src_oclass[0]);
else
$add_href = sprintf('cmd.php?cmd=add_value_form&amp;server_id=%s&amp;dn=%s&amp;attr=objectClass',
$ldapserver_dst->server_id,$encoded_dn_dst);
</tr>
if ($attr == 'objectClass')
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',$add_href,_('Add ObjectClass and Attributes'),_('add value'));
else
printf('<div class="add_value">(<a href="%s" title="%s">%s</a>)</div>',
$add_href,sprintf(_('You need one of the following ObjectClass(es) to add this attribute %s.'),implode(" ",$src_oclass)),
_('Add new ObjectClass'));
<?php } /* End foreach ($attrs as $attr => $vals) */
} else {
if (! $schema_attr_dst->getIsSingleValue() || (! isset($vals))) {
if (! $ldapserver_dst->isReadOnly()) { ?>
$add_href = sprintf('cmd.php?cmd=add_value_form&amp;erver_id=%s&amp;dn=%s&amp;attr=%s',
$ldapserver_dst->server_id,$encoded_dn_dst,rawurlencode($attr));
<td colspan="2">&nbsp</td><td colspan=2><center><input type="submit" value="<?php echo _('Save Changes'); ?>" /></center></td></tr></form>
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'));
}
}
}
<?php } ?>
echo '</td></tr>';
</table>
# Get the values and see if they are the same.
if (isset($attrs_src[$attr]) && isset($attrs_dst[$attr]) && $attrs_src[$attr] === $attrs_dst[$attr])
echo '<tr>';
else
echo '<tr class="updated"><td class="bottom" colspan="0">&nbsp;</td></tr>';
<?php /* If this entry has a binary attribute,we need to provide a form for it to submit when deleting it. */ ?>
} /* End foreach ($attrs as $attr => $vals) */
<script language="javascript">
if (! $ldapserver_dst->isReadOnly())
printf('<tr><td colspan=3>&nbsp;</td><td colspan=3><center><input type="submit" value="%s" /></center></form></td></tr>',_('Save Changes'));
echo '</table>';
# If this entry has a binary attribute,we need to provide a form for it to submit when deleting it. */
?>
<script type="text/javascript" language="javascript">
//<!--
function deleteAttribute(attrName)
{

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare_form.php,v 1.5 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/compare_form.php,v 1.5.2.1 2008/12/12 07:29:55 wurley Exp $
/**
* Compares to DN entries side by side.
@@ -14,7 +14,7 @@
require_once './common.php';
$dn = (isset($_GET['dn']) ? $_GET['dn'] : '');
$dn = get_request('dn','GET');
$rdn = get_rdn($dn);
$select_server_html = server_select_list($ldapserver->server_id,true,'server_id_dst');

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.44.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy.php,v 1.44.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* Copies a given object to create a new one.
@@ -17,8 +17,9 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_move'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('copy entry')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('copy entry')),'error','index.php');
$entry = array();
$entry['src']['id'] = get_request('server_id');
$entry['dst']['id'] = get_request('dest_server_id');
@@ -26,10 +27,10 @@ $entry['src']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry
$entry['dst']['ldapserver'] = $_SESSION[APPCONFIG]->ldapservers->Instance($entry['dst']['id']);
if ($entry['dst']['ldapserver']->isReadOnly())
pla_error(_('Destination server is currently READ-ONLY.'));
error(_('Destination server is currently READ-ONLY.'),'error','index.php');
if (! $entry['src']['ldapserver']->haveAuthInfo() || ! $entry['dst']['ldapserver']->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
$entry['src']['dn'] = get_request('old_dn');
$entry['dst']['dn'] = get_request('new_dn');
@@ -38,19 +39,19 @@ $entry['src']['remove'] = (get_request('remove') == 'yes') ? true : false;
# Error checking
if (strlen(trim($entry['dst']['dn'])) == 0)
pla_error(_('You left the destination DN blank.'));
error(_('You left the destination DN blank.'),'error','index.php');
if (pla_compare_dns($entry['src']['dn'],$entry['dst']['dn']) == 0 && $entry['src']['id'] == $entry['dst']['id'])
pla_error(_('The source and destination DN are the same.'));
error(_('The source and destination DN are the same.'),'error','index.php');
if ($entry['dst']['ldapserver']->dnExists($entry['dst']['dn']))
pla_error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($entry['dst']['dn'])));
error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($entry['dst']['dn'])),'error','index.php');
if (! $entry['dst']['ldapserver']->dnExists(get_container($entry['dst']['dn'])))
pla_error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($entry['dst']['dn']))));
error(sprintf(_('The destination container (%s) does not exist.'),pretty_print_dn(get_container($entry['dst']['dn']))),'error','index.php');
if ($entry['src']['recursive']) {
$filter = isset($_POST['filter']) ? $_POST['filter'] : '(objectClass=*)';
$filter = get_request('filter','POST',false,'(objectClass=*)');
# Build a tree similar to that of the tree browser to give to r_copy_dn
$snapshot_tree = array();
@@ -141,7 +142,11 @@ function copy_dn($ldapserver_src,$ldapserver_dst,$dn_src,$dn_dst) {
$add_result = $ldapserver_dst->add($dn_dst,$new_entry);
if (! $add_result) {
echo '</small><br /><br />';
pla_error(_('Failed to copy DN: ').$dn_dst,$ldapserver_dst->error(),$ldapserver_dst->errno());
system_message(array(
'title'=>_('Failed to copy DN.').sprintf(' (%s)',$dn_dst),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
} else {
run_hook('post_entry_create',
array('server_id'=>$ldapserver_dst->server_id,'dn'=>$dn_dst,'attrs'=>$new_entry));

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.30.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/copy_form.php,v 1.30.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* Copies a given object to create a new one.
@@ -15,8 +15,9 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
$entry = array();
$entry['dn'] = get_request('dn','GET');
$entry['rdn'] = get_rdn($entry['dn']);
@@ -99,7 +100,7 @@ echo '</table></form>';
echo "\n";
if ($_SESSION[APPCONFIG]->GetValue('appearance','show_hints'))
printf('<small><img src="images/light.png" alt="Light" /><span class="hint">%s</span></small>',_('Hint: Copying between different servers only works if there are no schema violations'));
printf('<small><img src="%s/light.png" alt="Light" /><span class="hint">%s</span></small>',IMGDIR,_('Hint: Copying between different servers only works if there are no schema violations'));
echo '</center>';
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.48.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/create.php,v 1.48.2.4 2008/12/12 12:20:22 wurley Exp $
/**
* Creates a new object.
@@ -19,12 +19,12 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'), null, -1, true);
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('create entry')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('create entry')),'error','index.php');
$rdn_attr = isset($_POST['rdn_attribute']) ? $_POST['rdn_attribute'] : null;
$rdn_attr = get_request('rdn_attribute');
$entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory');
eval('$entry_factory = new '.$entryfactoryclass.'();');
@@ -36,7 +36,7 @@ $entry->accept($reader);
$container = $entry->getContainer();
if (!$container || !$ldapserver->dnExists($container))
pla_error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),htmlspecialchars($container)),null,-1,true);
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),htmlspecialchars($container)),'error','index.php');
$tree = get_cached_item($ldapserver->server_id,'tree');
if ($tree) {
@@ -46,18 +46,18 @@ if ($tree) {
$container_entry = $tree->getEntry($container);
if ($container_entry->isLeaf())
pla_error(sprintf(_('The container (%s) is a leaf.'), htmlspecialchars($container)), null, -1, true);
error(sprintf(_('The container (%s) is a leaf.'), htmlspecialchars($container)),'error','index.php');
}
$entry->setRdnAttributeName($rdn_attr);
if (!$entry->getRdnAttribute())
pla_error(sprintf(_('The Rdn attribute (%s) does not exist.'), htmlspecialchars($rdn_attr)), null, -1, true);
error(sprintf(_('The Rdn attribute (%s) does not exist.'), htmlspecialchars($rdn_attr)),'error','index.php');
$new_dn = $entry->getDn();
if (! $new_dn)
pla_error(_('You left the RDN field blank.'));
error(_('You left the RDN field blank.'),'error','index.php');
$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : false;
$redirect = get_request('redirect','POST',false,false);
$new_entry = array();
$attrs = $entry->getAttributes();
@@ -69,8 +69,9 @@ foreach ($attrs as $attr) {
$new_vals[] = $val;
}
if ($attr->isRequired() && !$new_vals)
pla_error(sprintf(_('You left the value blank for required attribute (%s).'), htmlspecialchars($attr->getName())));
if ($attr->isRequired() && !$new_vals && !$ldapserver->isIgnoredAttr($attr->getName()))
error(sprintf(_('You left the value blank for required attribute (%s).'),htmlspecialchars($attr->getName())),'error','index.php');
if ($new_vals)
$new_entry[$attr->getName()] = $new_vals;
@@ -83,7 +84,7 @@ foreach ($new_entry as $attr => $vals) {
# Check to see if this is a unique Attribute
if ($badattr = $ldapserver->checkUniqueAttr($new_dn,$attr,$vals)) {
$search_href = sprintf('?cmd=search&amp;search=true&amp;form=advanced&amp;server_id=%s&amp;filter=%s=%s', $ldapserver->server_id,$attr,$badattr);
pla_error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$new_dn,$search_href));
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),$attr,$badattr,$new_dn,$search_href),'error','index.php');
}
}
@@ -129,6 +130,9 @@ if ($add_result) {
}
} else {
pla_error(_('Could not add the object to the LDAP server.'),$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not add the object to the LDAP server.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.27.2.2 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete.php,v 1.27.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* Deletes a DN and presents a "job's done" message.
@@ -15,24 +15,25 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')),'error','index.php');
$entry = array();
$entry['dn'] = get_request('dn');
if (! $entry['dn'])
pla_error(_('You must specify a DN'));
error(_('You must specify a DN'),'error','index.php');
if (! $ldapserver->dnExists($entry['dn']))
pla_error(sprintf(_('No such entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'));
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),'error','index.php');
# Check the user-defined custom callback first.
if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn'])))
$result = $ldapserver->delete($entry['dn']);
else
pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'));
error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),'error','index.php');
if ($result) {
# Custom callback
@@ -46,7 +47,9 @@ if ($result) {
sprintf('index.php?server_id=%s',$ldapserver->server_id));
} else {
pla_error(sprintf(_('Could not delete the entry: %s'),'<b>'.pretty_print_dn($entry['dn']).'</b>'),
$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.16.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_attr.php,v 1.16.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* Deletes an attribute from an entry with NO confirmation.
@@ -15,23 +15,24 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')),'error','index.php');
$entry = array();
$entry['dn']['string'] = get_request('dn');
$entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
$entry['attr'] = get_request('attr');
if (! $entry['dn']['string'])
pla_error(_('No DN specified'));
error(_('No DN specified'),'error','index.php');
if (! $entry['attr'])
pla_error(_('No attribute name specified.'));
error(_('No attribute name specified.'),'error','index.php');
if ($ldapserver->isAttrReadOnly($entry['attr']))
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($entry['attr'])));
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),htmlspecialchars($entry['attr'])),'error','index.php');
$update_array = array();
$update_array[$entry['attr']] = array();
@@ -47,6 +48,9 @@ if ($result) {
die();
} else {
pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not perform ldap_modify operation.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.26 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/delete_form.php,v 1.26.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* delete_form.php
@@ -16,8 +16,9 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
$entry = array();
$entry['dn']['string'] = get_request('dn','GET');
$entry['dn']['html'] = htmlspecialchars($entry['dn']['string']);
@@ -40,7 +41,7 @@ if (count($entry['children'])) {
$search['href'] = htmlspecialchars(sprintf('cmd.php?cmd=search&search=true&;server_id=%s&filter=%s&base_dn=%s&form=advanced&scope=sub',
$ldapserver->server_id,rawurlencode('objectClass=*'),rawurlencode($entry['dn']['string'])));
echo '<table class="delete" border=0>';
echo '<table class="forminput" border=0>';
echo '<tr>';
echo '<td colspan=2>';
printf(_('This entry is the root of a sub-tree containing %s entries.'),$search['count']);
@@ -65,7 +66,7 @@ if (count($entry['children'])) {
echo '<input type="hidden" name="cmd" value="rdelete" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="submit" class="scary" value="%s" />',sprintf(_('Delete all %s objects'),$search['count']));
printf('<input type="submit" value="%s" />',sprintf(_('Delete all %s objects'),$search['count']));
echo '</form>';
echo '</center></td>';
@@ -74,7 +75,7 @@ if (count($entry['children'])) {
echo '<input type="hidden" name="cmd" value="template_engine" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel'));
printf('<input type="submit" name="submit" value="%s" />',_('Cancel'));
echo '</form>';
echo '</center></td>';
echo '</tr>';
@@ -97,7 +98,7 @@ if (count($entry['children'])) {
echo "\n";
} else {
echo '<table class="delete" border=0>';
echo '<table class="forminput" border=0>';
printf('<tr><td colspan=4>%s</td></tr>',_('Are you sure you want to permanently delete this object?'));
echo '<tr><td colspan=4>&nbsp;</td></tr>';
@@ -114,7 +115,7 @@ if (count($entry['children'])) {
echo '<input type="hidden" name="cmd" value="delete" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="submit" name="submit" value="%s" class="scary" />',_('Delete'));
printf('<input type="submit" name="submit" value="%s" />',_('Delete'));
echo '</form>';
echo '</center></td>';
@@ -124,7 +125,7 @@ if (count($entry['children'])) {
echo '<input type="hidden" name="cmd" value="template_engine" />';
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($entry['dn']['string']));
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="submit" name="submit" value="%s" class="cancel" />',_('Cancel'));
printf('<input type="submit" name="submit" value="%s" />',_('Cancel'));
echo '</form>';
echo '</center></td>';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.15.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.15.2.4 2008/12/12 12:20:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -12,27 +12,32 @@
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.'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
$dn = rawurldecode($_GET['dn']);
$attr = $_GET['attr'];
if (! $ldapserver->haveAuthInfo())
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
$dn = rawurldecode(get_request('dn','GET'));
$attr = get_request('attr','GET');
# if there are multiple values in this attribute, which one do you want to see?
$value_num = isset($_GET['value_num']) ? $_GET['value_num'] : null;
$value_num = get_request('value_num','GET');
if (! $ldapserver->dnExists($dn))
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn)));
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($dn)),'error','index.php');
$search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
# Dump the binary data to the browser
if (ob_get_level()) ob_end_clean();
$obStatus = ob_get_status();
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
ob_end_clean();
header('Content-type: octet-stream');
header("Content-disposition: attachment; filename=$attr");
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
if ($value_num && is_array($search[$attr][$dn]))
echo $search[$dn][$attr][$value_num];
else

View File

@@ -1,41 +1,42 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/draw_tree_node.php,v 1.2.2.1 2007/12/21 12:11:55 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/draw_tree_node.php,v 1.2.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* @package phpLDAPadmin
*/
$entry['dn'] = get_request('dn','REQUEST');
$entry['server_id'] = get_request('server_id','REQUEST');
$entry['code'] = get_request('code','REQUEST');
$entry['action'] = get_request('action','REQUEST');
$entry = array();
$entry['dn'] = get_request('dn','REQUEST');
$entry['server_id'] = get_request('server_id','REQUEST');
$entry['code'] = get_request('code','REQUEST');
$entry['action'] = get_request('action','REQUEST');
$tree = Tree::getInstance($entry['server_id']);
if (! $tree)
die();
$dnentry = $tree->getEntry($entry['dn']);
if (! $dnentry) {
$tree->addEntry($entry['dn']);
$dnentry = $this->getEntry($entry['dn']);
}
if (! $dnentry)
die();
if ($entry['action'] == 0) {
$dnentry->close();
} elseif ($entry['action'] == 2) {
$dnentry->open();
} else {
$dnentry->open();
if ($entry['dn']) {
echo $tree->draw_children($dnentry,$entry['code']);
} else {
$tree->draw(true);
}
}
$tree = Tree::getInstance($entry['server_id']);
if (! $tree)
die();
$dnentry = $tree->getEntry($entry['dn']);
if (! $dnentry) {
$tree->addEntry($entry['dn']);
$dnentry = $this->getEntry($entry['dn']);
}
if (! $dnentry)
die();
if ($entry['action'] == 0) {
$dnentry->close();
} elseif ($entry['action'] == 2) {
$dnentry->open();
} else {
$dnentry->open();
if ($entry['dn']) {
echo $tree->draw_children($dnentry,$entry['code']);
} else {
$tree->draw(true);
}
}
die();
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.31.2.2 2007/12/29 08:24:10 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/entry_chooser.php,v 1.31.2.5 2008/12/12 12:20:22 wurley Exp $
/**
* Display a selection (popup window) to pick a DN.
@@ -10,13 +10,14 @@
include './common.php';
include HTDOCDIR.'header.php';
$entry = array();
$entry['container'] = get_request('container','GET');
$entry['element'] = get_request('form_element','GET');
$entry['rdn'] = get_request('rdn','GET');
echo '<body>';
echo '<div class="entry_chooser">';
printf('<h3>%s</h3>',_('Entry Chooser'));
echo '<div class="popup">';
printf('<h3 class="subtitle">%s</h3>',_('Entry Chooser'));
?>
<script type="text/javascript" language="javascript">
@@ -27,18 +28,18 @@ printf('<h3>%s</h3>',_('Entry Chooser'));
</script>
<?php
echo '<table class="entry_chooser" border=0>';
echo '<table class="forminput" width=100% border=0>';
if ($entry['container']) {
printf('<tr><td class="head" colspan=3>%s:</td><td class="value">%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
printf('<tr><td class="head" colspan=3>%s:</td><td class="value">%s</td></tr>',_('Looking in'),htmlspecialchars($entry['container']));
echo '<tr><td class="spacer" colspan=4>&nbsp;</td></tr>';
printf('<tr><td class="heading" colspan=3>%s:</td><td>%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
printf('<tr><td class="heading" colspan=3>%s:</td><td>%s</td></tr>',_('Looking in'),htmlspecialchars($entry['container']));
echo '<tr><td class="blank" colspan=4>&nbsp;</td></tr>';
}
/* Has the use already begun to descend into a specific server tree? */
if (isset($ldapserver) && ! is_null($entry['container'])) {
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
$entry['children'] = $ldapserver->getContainerContents($entry['container'],0,'(objectClass=*)',$_SESSION[APPCONFIG]->GetValue('deref','tree'));
sort($entry['children']);
@@ -60,13 +61,13 @@ if (isset($ldapserver) && ! is_null($entry['container'])) {
}
echo '<tr>';
echo '<td class="spacer">&nbsp;</td>';
printf('<td class="icon"><a href="%s"><img src="images/up.png" alt="Up" /></a></td>',$href['up']);
printf('<td class="value" colspan=2><a href="%s">%s</a></td>',$href['up'],_('Back Up...'));
echo '<td class="blank">&nbsp;</td>';
printf('<td class="icon"><a href="%s"><img src="%s/up.png" alt="Up" /></a></td>',$href['up'],IMGDIR);
printf('<td colspan=2><a href="%s">%s</a></td>',$href['up'],_('Back Up...'));
echo '</tr>';
if (! count($entry['children']))
printf('<td class="spacer" colspan=2>&nbsp;</td><td class="body" colspan=2">(%s)</td>',_('no entries'));
printf('<td class="blank" colspan=2>&nbsp;</td><td colspan=2">(%s)</td>',_('no entries'));
else
foreach ($entry['children'] as $dn) {
@@ -75,10 +76,10 @@ if (isset($ldapserver) && ! is_null($entry['container'])) {
$ldapserver->server_id,$entry['element'],$entry['rdn'],rawurlencode($dn)));
echo '<tr>';
echo '<td class="spacer">&nbsp;</td>';
printf('<td class="icon"><a href="%s"><img src="images/plus.png" alt="Plus" /></a></td>',$href['expand']);
echo '<td class="blank">&nbsp;</td>';
printf('<td class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
printf('<td colspan=2 class="body"><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($dn));
printf('<td colspan=2><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($dn));
echo '</tr>';
echo "\n\n";
}
@@ -95,10 +96,10 @@ if (isset($ldapserver) && ! is_null($entry['container'])) {
continue;
else {
printf('<tr><td class="head" colspan=3>%s:</td><td class="value">%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
printf('<tr><td class="heading" colspan=3>%s:</td><td class="heading">%s</td></tr>',_('Server'),htmlspecialchars($ldapserver->name));
foreach ($ldapserver->getBaseDN() as $dn) {
if (! $dn) {
printf('<tr><td class="spacer">&nbsp;</td><td class="body" colspan=3>(%s)</td></tr>',_('Could not determine base DN'));
printf('<tr><td class="blank">&nbsp;</td><td colspan=3>(%s)</td></tr>',_('Could not determine base DN'));
} else {
$href['return'] = sprintf("javascript:returnDN('%s%s')",($entry['rdn'] ? sprintf('%s,',$entry['rdn']) : ''),rawurlencode($dn));
@@ -106,13 +107,13 @@ if (isset($ldapserver) && ! is_null($entry['container'])) {
$ldapserver->server_id,$entry['element'],$entry['rdn'],rawurlencode($dn)));
echo '<tr>';
echo '<td class="spacer">&nbsp;</td>';
printf('<td colspan=2 class="icon"><a href="%s"><img src="images/plus.png" alt="Plus" /></a></td>',$href['expand']);
printf('<td colspan=2 class="body"><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($dn));
echo '<td class="blank">&nbsp;</td>';
printf('<td colspan=2 class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
printf('<td colspan=2><a href="%s">%s</a></td>',$href['return'],htmlspecialchars($dn));
}
}
echo '<tr><td class="spacer" colspan=4>&nbsp;</td></tr>';
echo '<tr><td class="blank" colspan=4>&nbsp;</td></tr>';
}
}
}
@@ -120,5 +121,5 @@ if (isset($ldapserver) && ! is_null($entry['container'])) {
echo '</table>';
echo '</div>';
echo '</body></html>';
echo '</body>';
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.18.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export.php,v 1.18.2.4 2008/12/12 12:20:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -15,8 +15,9 @@ ini_set('session.cache_limiter','');
require LIBDIR.'export_functions.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('export'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('export')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('export')),'error','index.php');
$entry = array();
$entry['base_dn'] = get_request('dn');
$entry['format'] = get_request('format','POST',false,'unix');
$entry['scope'] = get_request('scope','POST',false,'base');
@@ -40,8 +41,8 @@ if ($entry['sys_attr']) {
array_push($attributes,'+');
}
(! is_null($entry['exporter_id'])) or pla_error(_('You must choose an export format.'));
isset($exporters[$entry['exporter_id']]) or pla_error(_('Invalid export format'));
(! is_null($entry['exporter_id'])) or error(_('You must choose an export format.'),'error','index.php');
isset($exporters[$entry['exporter_id']]) or error(_('Invalid export format'),'error','index.php');
# Initialisation of other variables
$friendly_rdn = get_rdn($entry['base_dn'],1);
@@ -85,13 +86,13 @@ switch ($entry['exporter_id']) {
default:
# truly speaking,this default case will never be reached. See check at the bottom.
pla_error(_('No available exporter found.'));
error(_('No available exporter found.'),'error','index.php');
}
# set the CLRN
$exporter->setOutputFormat($br);
if (isset($_REQUEST['compress']) && $_REQUEST['compress'] = 'on')
if (get_request('compress','REQUEST') == 'on')
$exporter->compress(true);
# prevent script from bailing early for long search
@@ -99,7 +100,10 @@ if (isset($_REQUEST['compress']) && $_REQUEST['compress'] = 'on')
# send the header
if ($entry['file']) {
if (ob_get_level()) ob_end_clean();
$obStatus = ob_get_status();
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
ob_end_clean();
header('Content-type: application/download');
header(sprintf('Content-Disposition: filename="%s.%s"',$friendly_rdn,$exporters[$entry['exporter_id']]['extension'].($exporter->isCompressed()?'.gz':'')));
$exporter->export();

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.26 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/export_form.php,v 1.26.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* export_form.php
@@ -13,6 +13,7 @@ require './common.php';
require LIBDIR.'export_functions.php';
$entry = array();
$entry['format'] = get_request('format','GET',false,get_line_end_format());
$entry['scope'] = get_request('scope','GET',false,'base');
$entry['id'] = get_request('exporter_id','GET',false,0);
@@ -38,7 +39,7 @@ echo '<br />';
echo '<center>';
echo '<form name="export_form" action="cmd.php" method="post">';
echo '<input type="hidden" name="cmd" value="export" />';
echo '<table class="export">';
echo '<table class="forminput">';
echo '<tr>';
echo '<td>';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.27.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/header.php,v 1.27.2.2 2008/01/27 11:57:38 wurley Exp $
/**
* @package phpLDAPadmin
@@ -35,30 +35,30 @@ if (isset($_SESSION[APPCONFIG]))
$css = $_SESSION[APPCONFIG]->GetValue('appearance','stylesheet');
else
$css = 'style.css';
printf('<link type="text/css" rel="stylesheet" href="%s%s" media="screen" />','../htdocs/'.CSSDIR,$css);
printf('<link type="text/css" rel="stylesheet" href="%s%s" media="screen" />',CSSDIR,$css);
if (isset($server_id)) {
$custom_file = get_custom_file($server_id,'style.css','../htdocs/'.CSSDIR);
$custom_file = get_custom_file($server_id,'style.css',CSSDIR);
if (strcmp($custom_file,'style.css') != 0)
printf('<link type="text/css" rel="stylesheet" href="%s" media="screen" />',$custom_file);
}
printf('<script type="text/javascript" src="%sentry_chooser.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sie_png_work_around.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sgeneric_utils.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sto_ascii.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%smodify_member.js"></script>','../htdocs/'.JSDIR);
printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />','../htdocs/'.JSDIR);
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="%sgeneric_utils.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sto_ascii.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%smodify_member.js"></script>',JSDIR);
printf('<link type="text/css" rel="stylesheet" media="all" href="%s/jscalendar/calendar-blue.css" title="blue" />',JSDIR);
echo "\n<!--\n";
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sdate_selector.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/lang/calendar-en.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar-setup.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sdate_selector.js"></script>',JSDIR);
echo "\n-->\n";
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>','../htdocs/'.JSDIR);
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css"></link>',JSDIR);
if (isset($meta_refresh_variable))
printf('<meta http-equiv="refresh" content="%s" />',$meta_refresh_variable);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 B

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 648 B

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 902 B

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

BIN
htdocs/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 661 B

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.49.2.4 2008/01/04 12:33:03 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.49.2.10 2008/12/12 12:20:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -40,6 +40,10 @@ if (! is_readable(LIBDIR.'functions.php')) {
if (ob_get_level())
ob_end_clean();
# Make sure this PHP install has pcre
if (! extension_loaded('pcre'))
die('<p>Your install of PHP appears to be missing PCRE support.</p><p>Please install PCRE support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>');
require LIBDIR.'functions.php';
# Define the path to our configuration file.
@@ -48,9 +52,30 @@ if (defined('CONFDIR'))
else
$app['config_file'] = 'config.php';
# Make sure this PHP install has session support
if (! extension_loaded('session'))
error('<p>Your install of PHP appears to be missing php-session support.</p><p>Please install php-session support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>','error',null,true);
# Make sure this PHP install has gettext, we use it for language translation
if (! extension_loaded('gettext'))
pla_error('<p>Your install of PHP appears to be missing GETTEXT support.</p><p>GETTEXT is used for language translation.</p><p>Please install GETTEXT support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>');
system_message(array(
'title'=>_('Missing required extension'),
'body'=>'Your install of PHP appears to be missing GETTEXT support.</p><p>GETTEXT is used for language translation.</p><p>Please install GETTEXT support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small>',
'type'=>'error'));
# Make sure this PHP install has all our required extensions
if (! extension_loaded('ldap'))
system_message(array(
'title'=>_('Missing required extension'),
'body'=>'Your install of PHP appears to be missing LDAP support.<br /><br />Please install LDAP support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small>',
'type'=>'error'));
# Make sure that we have php-xml loaded.
if (! function_exists('xml_parser_create'))
system_message(array(
'title'=>_('Missing required extension'),
'body'=>'Your install of PHP appears to be missing XML support.<br /><br />Please install XML support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small>',
'type'=>'error'));
/**
* Helper functions.
@@ -59,10 +84,10 @@ if (! extension_loaded('gettext'))
if (isset($app['function_files']) && is_array($app['function_files']))
foreach ($app['function_files'] as $file_name ) {
if (! file_exists($file_name))
pla_error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name));
error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name),'error',null,true);
if (! is_readable($file_name))
pla_error(sprintf('Fatal error: Cannot read the file "%s", its permissions may be too strict.',$file_name));
error(sprintf('Fatal error: Cannot read the file "%s", its permissions may be too strict.',$file_name),'error',null,true);
ob_start();
require $file_name;
@@ -71,29 +96,10 @@ if (isset($app['function_files']) && is_array($app['function_files']))
# Configuration File check
if (! file_exists($app['config_file'])) {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"';
echo '"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
echo '<html>';
echo '<head>';
printf('<title>%s - %s</title>','phpLDAPadmin',pla_version());
echo '<link type="text/css" rel="stylesheet" href="css/style.css" />';
echo '</head>';
echo '<body>';
printf('<h3 class="title">Configure %s</h3>','phpLDAPadmin');
echo '<br /><br />';
echo '<center>';
printf(_('You need to configure %s. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),'phpLDAPadmin',$app['config_file'],$app['config_file']);
echo '</center>';
echo '</body>';
echo '</html>';
die();
error(sprintf(_('You need to configure %s. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),'phpLDAPadmin',$app['config_file'],$app['config_file']),'error',null,true);
} elseif (! is_readable($app['config_file'])) {
pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$app['config_file']));
error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$app['config_file']),'error',null,true);
}
# If our config file fails the sanity check, then stop now.
@@ -106,5 +112,8 @@ if (! check_config($app['config_file'])) {
exit;
}
if ($uri = get_request('URI','GET'))
header(sprintf('Location: cmd.php?%s',base64_decode($uri)));
include './cmd.php';
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import.php,v 1.35.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import.php,v 1.35.2.4 2008/12/12 12:20:22 wurley Exp $
/**
* Imports an LDIF file to the specified server_id.
@@ -16,8 +16,9 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('import'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('import')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('import')),'error','index.php');
$entry = array();
$entry['continuous_mode'] = get_request('continuous_mode') ? true : false;
$entry['ldif'] = get_request('ldif');
@@ -31,20 +32,20 @@ if ($entry['ldif']) {
$entry['size'] = $_FILES['ldif_file']['size'];
if (! is_array($_FILES['ldif_file'])) {
pla_error(_('Missing uploaded file.'),null,-1,false);
error(_('Missing uploaded file.'),'error');
return;
}
if (! file_exists($file)) {
pla_error(_('No LDIF file specified. Please try again.'),null,-1,false);
error(_('No LDIF file specified. Please try again.'),'error');
return;
}
if ($entry['size'] <= 0) {
pla_error(_('Uploaded LDIF file is empty.'),null,-1,false);
error(_('Uploaded LDIF file is empty.'),'error');
return;
}
} else {
pla_error(_('You must either upload a file or provide an LDIF in the text box.'),null,-1,false);
error(_('You must either upload a file or provide an LDIF in the text box.'),'error');
return;
}
@@ -113,10 +114,10 @@ if ($entry['continuous_mode']) {
if ($ldapWriter->ldapModify($currentEntry))
printf(' <span style="color:green;">%s</span></small><br />',_('Success'));
else {
printf('<span style="color:red;">%s</span></small><br />',_('Failed'));
printf('<small><span style="color:red;">%s: %s</span></small><br />',
printf(' <span style="color:red;">%s</span></small><br />',_('Failed'));
printf(' <small><span style="color:red;">%s: %s</span></small><br />',
_('Error code'),$ldapserver->errno());
printf('<small><span style="color:red;">%s: %s</span></small><br />',
printf(' <small><span style="color:red;">%s: %s</span></small><br />',
_('Description'),$ldapserver->error());
}
}
@@ -182,7 +183,7 @@ function display_pla_parse_error($exception,$faultyEntry) {
$errorMessage = $actionErrorMsg[$faultyEntry->getChangeType()];
echo '<center>';
echo '<table class="error"><tr><td class="img"><img src="images/warning.png" /></td>';
printf('<table class="error"><tr><td class="img"><img src="%s/warning.png" /></td>',IMGDIR);
echo '<td>';
printf('<center><h2>%s</h2></center>',_('LDIF Parse Error'));
echo '<br />';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import_form.php,v 1.22 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/ldif_import_form.php,v 1.22.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* Displays a form to allow the user to upload and import
@@ -13,35 +13,37 @@
require './common.php';
if (! ini_get('file_uploads'))
pla_error(_('Your PHP.INI does not have file_uploads = ON. Please enable file uploads in PHP.'));
error(_('Your PHP.INI does not have file_uploads = ON. Please enable file uploads in PHP.'),'error','index.php');
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
printf('<h3 class="title">%s</h3>',_('Import LDIF File'));
printf('<h3 class="subtitle">%s: <b>%s</b></h3>',_('Server'),htmlspecialchars($ldapserver->name));
echo '<br /><br />';
echo _('Select an LDIF file');
echo '<br /><br />';
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
printf('<h3 class="title" colspan=0>%s</h3>',_('Import LDIF File'));
printf('<h3 class="subtitle" colspan=0>%s: <b>%s</b></h3>',_('Server'),htmlspecialchars($ldapserver->name));
echo '<center>';
echo '<form action="cmd.php" method="post" class="new_value" enctype="multipart/form-data">';
echo '<input type="hidden" name="cmd" value="ldif_import" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
echo '<input type="file" name="ldif_file" /> <br />';
printf('<div style="margin-top: 5px;"><input type="checkbox" name="continuous_mode" value="1" /><span style="font-size: 90%%;">%s</span></div>',
echo '<input type="hidden" name="cmd" value="ldif_import" />';
echo '<table class="forminput" border=0>';
echo '<tr><td colspan=2>&nbsp;</td></tr>';
echo '<tr>';
printf('<td>%s</td>',_('Select an LDIF file'));
echo '<td>';
echo '<input type="file" name="ldif_file" />';
echo '</td></tr>';
printf('<tr><td>&nbsp;</td><td class="small"><b>%s %s</b></td></tr>',_('Maximum file size'),ini_get('upload_max_filesize'));
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td>%s</td></tr>',_('Or paste your LDIF here'));
echo '<tr><td colspan=2><textarea name="ldif" rows="20" cols="100"></textarea></td></tr>';
echo '<tr><td colspan=2>&nbsp;</td></tr>';
printf('<tr><td>&nbsp;</td><td class="small"><input type="checkbox" name="continuous_mode" value="1" />%s</td></tr>',
_("Don't stop on errors"));
printf('<div style="margin-top:10px;"><input type="submit" value="%s" /></div>',_('Proceed >>'));
printf('<br /><small><b>%s %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
echo '</form>';
echo '<br /><br />';
echo _('Paste your LDIF here');
echo '<form action="cmd.php" method="post" class="new_value" enctype="multipart/form-data">';
echo '<input type="hidden" name="cmd" value="ldif_import" />';
echo '<textarea name="ldif" rows="10" cols="60"></textarea>';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<div style="margin-top: 5px;"><input type="checkbox" name="continuous_mode" value="1" /><span style="font-size: 90%%;">%s</span></div>',_("Don't stop on errors"));
printf('<div style="margin-top:10px;"><input type="submit" value="%s" /></div>',_('Proceed >>'));
printf('<tr><td>&nbsp;</td><td><input type="submit" value="%s" /></td></tr>',_('Proceed >>'));
echo '</table>';
echo '</form>';
echo '</center>';
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.56.2.4 2008/01/04 12:29:15 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login.php,v 1.56.2.5 2008/12/12 12:20:22 wurley Exp $
/**
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me the
@@ -149,7 +149,7 @@ if (! is_resource($ds)) {
}
$ldapserver->auth_type = $save_auth_type;
$ldapserver->setLoginDN($login['dn'],$login['pass'],$anon_bind) or pla_error(_('Could not set cookie.'));
$ldapserver->setLoginDN($login['dn'],$login['pass'],$anon_bind) or error(_('Could not set cookie.'),'error','index.php');
set_lastactivity($ldapserver);
if (! $anon_bind) {

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.29.2.2 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/login_form.php,v 1.29.2.7 2008/12/12 12:20:22 wurley Exp $
/**
* Displays the login form for a server for users who specify 'cookie' or 'session' for their auth_type.
@@ -14,12 +14,12 @@
require './common.php';
if (! in_array($ldapserver->auth_type, array('cookie','session')))
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)));
error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)),'error','index.php');
printf('<h3 class="title">%s %s</h3>',_('Authenticate to server'),$ldapserver->name);
# Check for a secure connection
if (! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') {
if (! isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') {
echo '<br />';
echo '<center>';
echo '<span style="color:red">';
@@ -36,22 +36,22 @@ echo '<form action="cmd.php" method="post" name="login_form">';
echo '<input type="hidden" name="cmd" value="login" />';
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']));
if (get_request('redirect','GET',false,false))
printf('<input type="hidden" name="redirect" value="%s" />',rawurlencode(get_request('redirect','GET')));
echo '<center>';
echo '<table class="login">';
echo '<table class="forminput">';
printf('<tr><td><b>%s:</b></td></tr>',
$ldapserver->login_attr == 'dn' ? _('Login DN') : $_SESSION[APPCONFIG]->getFriendlyName($ldapserver->login_attr));
printf('<tr><td><input type="text" id="pla_login" name="%s" size="40" value="%s" /></td></tr>',
printf('<tr><td><input type="text" id="login" name="%s" size="40" value="%s" /></td></tr>',
$ldapserver->login_attr,
$ldapserver->login_attr == 'dn' ? $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><input type="password" id="password" 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.
@@ -66,18 +66,18 @@ echo '</table>';
echo '</center>';
echo '</form>';
echo '<script type="text/javascript" language="javascript">document.getElementById(\'pla_login\').focus()</script>';
echo '<script type="text/javascript" language="javascript">document.getElementById(\'login\').focus()</script>';
if( $ldapserver->isAnonBindAllowed() ) { ?>
<script type="text/javascript" language="javascript">
<!--
function toggle_disable_login_fields(anon_checkbox) {
if (anon_checkbox.checked) {
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = true;
anon_checkbox.form.<?php echo $ldapserver->login_attr; ?>.disabled = true;
anon_checkbox.form.login_pass.disabled = true;
} else {
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.disabled = false;
anon_checkbox.form.<?php echo $ldapserver->isLoginAttrEnabled() ? 'uid' : 'login_dn'; ?>.focus();
anon_checkbox.form.<?php echo $ldapserver->login_attr; ?>.disabled = false;
anon_checkbox.form.<?php echo $ldapserver->login_attr; ?>.focus();
anon_checkbox.form.login_pass.disabled = false;
}
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20.2.1 2007/12/26 03:25:38 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/logout.php,v 1.20.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* For servers whose auth_type is set to 'cookie' or 'session'. Pass me
@@ -16,18 +16,18 @@
require './common.php';
if (! $ldapserver->haveAuthInfo())
pla_error(_('No one is logged in to that server.'));
error(_('No one is logged in to that server.'),'error','index.php');
if (in_array($ldapserver->auth_type, array('cookie','session','http'))) {
syslog_notice (sprintf('Logout for %s',$ldapserver->getLoggedInDN()));
if($ldapserver->auth_type!='http')
$ldapserver->unsetLoginDN() or pla_error(_('Could not logout.'));
$ldapserver->unsetLoginDN() or error(_('Could not logout.'),'error','index.php');
unset_lastactivity($ldapserver);
@session_destroy();
} else
pla_error(sprintf(_('Unknown auth_type: %s'), htmlspecialchars($ldapserver->auth_type)));
error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($ldapserver->auth_type)),'error','index.php');
system_message(array(
'title'=>_('Logout'),

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/mass_delete.php,v 1.17.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/mass_delete.php,v 1.17.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* Enables user to mass delete multiple entries using checkboxes.
@@ -19,23 +19,23 @@
require './common.php';
if( $ldapserver->isReadOnly() )
pla_error(_('Unable to delete, server is in READY-ONLY mode.'));
if ($ldapserver->isReadOnly())
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'mass_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete mass entries')));
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','mass_delete'))
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete mass entries')),'error','index.php');
$confirmed = isset($_POST['confirmed']) ? true : false;
isset($_POST['mass_delete']) or
pla_error(_('Error calling mass_delete.php. Missing mass_delete in POST vars.'));
error(_('Error calling mass_delete.php. Missing mass_delete in POST vars.'),'error','index.php');
$mass_delete = $_POST['mass_delete'];
is_array($mass_delete) or
pla_error(_('mass_delete POST var is not an array.'));
error(_('mass_delete POST var is not an array.'),'error','index.php');
$ldapserver->isMassDeleteEnabled() or
pla_error(_('Mass deletion is not enabled. Please enable it in config.php before proceeding.'));
error(_('Mass deletion is not enabled. Please enable it in config.php before proceeding.'),'error','index.php');
printf('<h3 class="title">%s</h3>',_('Mass Deleting'));
@@ -48,7 +48,7 @@ if ($confirmed == true) {
$failed_dns = array();
if (! is_array($mass_delete))
pla_error(_('Malformed mass_delete array.'));
error(_('Malformed mass_delete array.'),'error','index.php');
if (count($mass_delete) == 0) {
echo '<br />';
@@ -104,7 +104,7 @@ if ($confirmed == true) {
printf('<input type="hidden" name="mass_delete[%s]" value="on" /><li>%s</li>',htmlspecialchars($dn),htmlspecialchars($dn));
echo '</ol></td></tr></table>';
printf('<input class="scary" type="submit" value="%s" /></center>',_('Yes, delete!'));
printf('<input type="submit" value="%s" /></center>',_('Yes, delete!'));
echo '</form>';
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/modify_member_form.php,v 1.5.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/modify_member_form.php,v 1.5.2.6 2008/12/12 12:20:22 wurley Exp $
/**
* Displays a form to allow the user to modify group members.
@@ -18,12 +18,12 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
$attr = $_GET['attr'];
$dn = isset($_GET['dn']) ? $_GET['dn'] : null;
$attr = get_request('attr','GET');
$dn = get_request('dn','GET');
$encoded_dn = rawurlencode($dn);
$encoded_attr = rawurlencode($attr);
@@ -39,7 +39,7 @@ if ($current_members)
else
$num_current_members = 0;
sort($current_members);
usort($current_members,'pla_compare_dns');
# Loop through all base dn's and search possible member entries
foreach ($ldapserver->getBaseDN() as $base_dn) {
@@ -74,6 +74,7 @@ printf('<h3 class="subtitle">%s <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>'
printf('%s <b>%s</b> %s <b>%s</b>:',
_('There are'),$num_current_members,_('members in group'),htmlspecialchars($rdn));
$possible_members = array();
for ($i=0; $i<count($possible_values); $i++) {
if (preg_match("/^$attr$/i",$_SESSION[APPCONFIG]->GetValue('modify_member','posixgroupattr')))
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->GetValue('modify_member','posixattr')];
@@ -81,7 +82,7 @@ for ($i=0; $i<count($possible_values); $i++) {
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->GetValue('modify_member','attr')];
}
sort($possible_members);
usort($possible_members,'pla_compare_dns');
/*
* Show only user that are not already in group.
@@ -110,8 +111,8 @@ echo '<input type="hidden" name="cmd" value="update_confirm" />';
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'));
printf('<td><img src="%s/user.png" alt="Users" /> %s</td>',IMGDIR,_('Available members'));
printf('<td><img src="%s/uniquegroup.png" alt="Members" /> %s</td>',IMGDIR,_('Group members'));
echo '</tr>';
# Generate select box from all possible members

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/password_checker.php,v 1.10 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/password_checker.php,v 1.10.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -8,11 +8,14 @@
*/
require './common.php';
include './header.php';
include HTDOCDIR.'header.php';
echo '<body>';
$entry = array();
$entry['hash'] = get_request('hash','REQUEST');
$entry['password'] = get_request('check_password','REQUEST');
$entry['action'] = get_request('action','REQUEST');
$entry['componentid'] = get_request('componentid','REQUEST');
if (get_request('base64','REQUEST')) {
$entry['hash'] = base64_decode($entry['hash']);
@@ -21,23 +24,23 @@ if (get_request('base64','REQUEST')) {
$entry['enc_type'] = get_enc_type($entry['hash']);
echo '<div class="password_checker">';
echo '<div class="popup">';
printf('<h3 class="subtitle">%s</h3>',_('Password Checker Tool'));
echo '<form action="password_checker.php" method="post">';
echo '<input type="hidden" name="action" value="compare" />';
echo '<table class="password_checker" border=0>';
echo '<table class="forminput" width=100% border=0>';
echo '<tr>';
printf('<td class="head">%s</td>',_('Compare'));
printf('<td class="body"><input type="%s" name="hash" id="hash" value="%s" /></td>',
$entry['enc_type'] ? 'text' : 'password',htmlspecialchars($entry['hash']));
printf('<td class="heading">%s</td>',_('Compare'));
printf('<td><input type="%s" name="hash" id="hash" value="%s" /></td>',
(obfuscate_password_display($entry['enc_type']) ? 'password' : 'text'),htmlspecialchars($entry['hash']));
echo '</tr>';
echo '<tr>';
printf('<td class="head">%s</td>',_('To'));
printf('<td class="body"><input type="password" name="check_password" value="%s" /></td>',
printf('<td class="heading">%s</td>',_('To'));
printf('<td><input type="password" name="check_password" value="%s" /></td>',
htmlspecialchars($entry['password']));
echo '</tr>';
@@ -62,10 +65,11 @@ echo '</tr>';
echo '</table>';
echo '</form>';
echo '</div>';
echo '</body>';
if (isset($_REQUEST['componentid'])) {
if ($entry['componentid']) {
echo '<script language="javascript">';
printf('var c = window.opener.document.getElementById(\'%s\');', $_REQUEST['componentid']);
printf('var c = window.opener.document.getElementById(\'%s\');',$entry['componentid']);
printf('var h = document.getElementById(\'%s\');', 'hash');
echo 'if (c && h) { h.value = c.value; }';
echo '</script>';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/purge_cache.php,v 1.9.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/purge_cache.php,v 1.9.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -10,7 +10,7 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('purge'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('purge')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('purge')),'error','index.php');
$purge_session_keys = array('cache');

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.28.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rdelete.php,v 1.28.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* Recursively deletes the specified DN and all of its children
@@ -15,17 +15,18 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'simple_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')));
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','simple_delete'))
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete entry')),'error','index.php');
$entry['dn'] = $_POST['dn'];
$entry = array();
$entry['dn'] = get_request('dn');
if (! $entry['dn'])
pla_error(_('You must specify a DN'));
error(_('You must specify a DN'),'error','index.php');
if (! $ldapserver->dnExists($entry['dn']))
pla_error(sprintf(_('No such entry: %s'),htmlspecialchars($entry['dn'])));
error(sprintf('%s (%s)',_('No such entry.'),htmlspecialchars($entry['dn'])),'error','index.php');
printf('<h3 class="title">'._('Deleting %s').'</h3>',htmlspecialchars(get_rdn($entry['dn'])));
printf('<h3 class="subtitle">%s</h3>',_('Recursive delete progress'));
@@ -42,8 +43,10 @@ if ($result) {
printf(_('Entry %s and sub-tree deleted successfully.'),'<b>'.htmlspecialchars($entry['dn']).'</b>');
} else {
pla_error(sprintf(_('Could not delete the entry: %s'),htmlspecialchars($entry['dn'])),
$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
function pla_rdelete($ldapserver,$dn) {
@@ -60,8 +63,10 @@ function pla_rdelete($ldapserver,$dn) {
return true;
} else {
pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)),
$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
} else {
@@ -77,8 +82,10 @@ function pla_rdelete($ldapserver,$dn) {
return true;
} else {
pla_error(sprintf(_('Failed to delete entry %s'),htmlspecialchars($dn)),
$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($entry['dn'])),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
}
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/refresh.php,v 1.18.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/refresh.php,v 1.18.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* This script alters the session variable 'tree', by re-querying
@@ -14,7 +14,7 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('server_refresh'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('refresh server')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('refresh server')),'error','index.php');
unset($_SESSION['cache'][$ldapserver->server_id]['tree']);

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.33.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename.php,v 1.33.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* Renames a DN to a different name.
@@ -18,25 +18,25 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_rename'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('rename entry')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('rename entry')),'error','index.php');
$dn = ($_POST['dn']);
$dn = get_request('dn');
if (! $ldapserver->isBranchRenameEnabled()) {
# we search all children, not only the visible children in the tree
$children = $ldapserver->getContainerContents($dn);
if (count($children) > 0)
pla_error(_('You cannot rename an entry which has children entries (eg, the rename operation is not allowed on non-leaf entries)'));
error(_('You cannot rename an entry which has children entries (eg, the rename operation is not allowed on non-leaf entries)'),'error','index.php');
}
$new_rdn = ($_POST['new_rdn']);
$new_rdn = get_request('new_rdn');
$container = get_container($dn);
$new_dn = sprintf('%s,%s',$new_rdn,$container);
if ($new_dn == $dn)
pla_error(_('You did not change the RDN'));
error(_('You did not change the RDN'),'error','index.php');
$old_dn_attr = explode('=',$dn);
$old_dn_attr = $old_dn_attr[0];
@@ -44,7 +44,7 @@ $old_dn_attr = $old_dn_attr[0];
$new_dn_value = explode('=',$new_rdn,2);
if (count($new_dn_value) != 2 || ! isset($new_dn_value[1]))
pla_error(_('Invalid RDN value'));
error(_('Invalid RDN value'),'error','index.php');
$new_dn_attr = $new_dn_value[0];
$new_dn_value = $new_dn_value[1];
@@ -58,7 +58,7 @@ if ($success) {
$success = $ldapserver->rename($dn,$new_rdn,$container,$deleteoldrdn);
} else {
pla_error(_('Could not rename the entry') );
error(_('Could not rename the entry'),'error','index.php');
}
if ($success) {

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename_form.php,v 1.11 2007/12/15 07:50:30 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/rename_form.php,v 1.11.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* Displays a form for renaming an LDAP entry.
@@ -17,9 +17,9 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
if (! $ldapserver->haveAuthInfo())
pla_error(_('Not enough information to login to server. Please check your configuration.'));
error(_('Not enough information to login to server. Please check your configuration.'),'error','index.php');
$dn = $_GET['dn'];
$rdn = get_rdn($dn);
@@ -28,10 +28,10 @@ printf('<h3 class="title">%s <b>%s</b></h3>',_('Rename Entry'),htmlspecialchars(
printf('<h3 class="subtitle">%s: <b>%s</b> &nbsp;&nbsp;&nbsp; %s: <b>%s</b></h3>',
_('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn));
echo '<br /><center><form action="cmd.php?cmd=rename" method="post" class="edit_dn" />';
echo '<br /><center><form action="cmd.php?cmd=rename" method="post" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($dn));
printf('<input type="text" name="new_rdn" size="30" value="%s" />',htmlspecialchars($rdn));
printf('<input class="update_dn" type="submit" value="%s" />',_('Rename'));
printf('<input type="submit" value="%s" />',_('Rename'));
echo '</form></center>';
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.67.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/schema.php,v 1.67.2.7 2008/12/12 12:20:22 wurley Exp $
/**
* Displays the schema for the specified server_id
@@ -17,8 +17,9 @@
require './common.php';
if (! $_SESSION[APPCONFIG]->isCommandAvailable('schema'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view schema')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view schema')),'error','index.php');
$entry = array();
$entry['view'] = get_request('view','GET','false','objectClasses');
$entry['value'] = get_request('viewvalue','GET');
@@ -38,10 +39,10 @@ printf('<h3 class="title">%s <b>%s</b></h3>',
htmlspecialchars($ldapserver->name));
$entry['schema_types'] = array(
'objectClasses'=>'ObjectClasses',
'attributes'=>'Attribute Types',
'syntaxes'=>'Syntaxes',
'matching_rules'=>'Matching Rules');
'objectClasses'=>_('ObjectClasses'),
'attributes'=>_('Attribute Types'),
'syntaxes'=>_('Syntaxes'),
'matching_rules'=>_('Matching Rules'));
echo '<br />';
echo '<center>';
@@ -63,16 +64,17 @@ echo '<br />';
switch($entry['view']) {
case 'syntaxes':
$highlight_oid = isset($_GET['highlight_oid']) ? $_GET['highlight_oid'] : false;
$highlight_oid = get_request('highlight_oid','GET',false,false);
print '<table class="schema" border=0>';
printf('<tr class="name"><td>%s</td><td>%s</td></tr>',_('Syntax OID'),_('Description'));
echo '<center>';
print '<table class="result_table" border=0>';
printf('<tr class="heading"><td>%s</td><td>%s</td></tr>',_('Syntax OID'),_('Description'));
$counter = 1;
$schema_syntaxes = $ldapserver->SchemaSyntaxes(null,true);
if (! $schema_syntaxes)
pla_error($schema_error_str);
error($schema_error_str,'error','index.php');
foreach ($schema_syntaxes as $syntax) {
$counter++;
@@ -85,10 +87,11 @@ switch($entry['view']) {
else
printf('<tr class="%s">',$counter%2==0?'even':'odd');
printf('<td class="type">%s</td><td class="type">%s</td></tr>',$oid,$desc);
printf('<td>%s</td><td>%s</td></tr>',$oid,$desc);
}
print '</table>';
echo '</center>';
break;
case 'attributes':
@@ -106,14 +109,15 @@ switch($entry['view']) {
'usage' => _('Usage'),
'maximum_length' => _('Maximum Length'),
'aliases' => _('Aliases'),
'used_by_objectclasses' => _('Used by objectClasses')
'used_by_objectclasses' => _('Used by objectClasses'),
'force_as_may' => _('Force as MAY by config')
);
$schema_attrs = $ldapserver->SchemaAttributes();
$schema_object_classes = $ldapserver->SchemaObjectClasses();
if (! $schema_attrs || ! $schema_object_classes)
pla_error($schema_error_str);
error($schema_error_str,'error','index.php');
printf('<small>%s:</small>',_('Jump to an attribute type'));
echo '<form action="cmd.php" method="get">';
@@ -137,8 +141,8 @@ switch($entry['view']) {
if (! is_null($entry['value']))
$entry['viewed'] = true;
echo '<table class="schema" border=0>';
printf('<tr class="name"><td colspan=2><a name="%s">%s</a></td></tr>',
echo '<table class="result_table" width=100% border=0>';
printf('<tr class="heading"><td colspan=2><a name="%s">%s</a></td></tr>',
strtolower($attr->getName()),$attr->getName());
$counter = 0;
@@ -146,7 +150,7 @@ switch($entry['view']) {
foreach ($entry['attr_types'] as $item => $value) {
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
printf('<td class="type">%s</td>',$value);
printf('<td class="title">%s</td>',$value);
switch ($item) {
case 'desc':
@@ -156,7 +160,7 @@ switch($entry['view']) {
print '</tr>';
printf('<tr class="%s">',++$counter%2 ? 'odd' : 'even');
echo '<td class="type"><acronym title="Object Identier">OID</acronym></td>';
echo '<td class="title"><acronym title="Object Identier">OID</acronym></td>';
printf('<td>%s</td>',$attr->getOID());
break;
@@ -277,6 +281,10 @@ switch($entry['view']) {
print '</td>';
break;
case 'force_as_may':
printf('<td>%s</td>',$attr->forced_as_may ? _('Yes') : _('No'));
break;
}
print '</tr>';
}
@@ -290,7 +298,7 @@ switch($entry['view']) {
case 'matching_rules':
$schema_matching_rules = $ldapserver->MatchingRules(null,true);
if (! $schema_matching_rules)
pla_error($schema_error_str);
error($schema_error_str,'error','index.php');
printf('<small>%s</small><br />',_('Jump to a matching rule'));
@@ -311,8 +319,8 @@ switch($entry['view']) {
printf('<input type="submit" value="%s" />',_('Go'));
print '</form>';
print '<table class="schema" border=0>';
printf('<tr class="name"><td>%s</td><td>%s</td><td>%s</td></tr>',
print '<table class="result_table" width=100% border=0>';
printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td></tr>',
_('Matching Rule OID'),_('Name'),_('Used by Attributes'));
$counter = 1;
@@ -334,22 +342,22 @@ switch($entry['view']) {
$desc .= sprintf(' <span style="color:red">%s</span>',_('Obsolete'));
printf('<tr class="%s">',$counter%2 ? 'odd' : 'even');
printf('<td class="type">%s</td>',$oid);
printf('<td class="type">%s</td>',$desc);
printf('<td>%s</td>',$oid);
printf('<td>%s</td>',$desc);
print '<td class="type">';
print '<td>';
if (count($rule->getUsedByAttrs()) == 0) {
printf('<center>(%s)</center><br /><br />',_('none'));
} else {
print '<table width=100% border=0><tr><td style="text-align: right">';
print '<table width=100% border=0><tr><td>';
print '<form action="cmd.php" method="get">';
print '<input type="hidden" name="cmd" value="schema" />';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
print '<input type="hidden" name="view" value="attributes" />';
print '<select style="width: 150px; color:black; background-color: #eee" size="4" name="viewvalue">';
print '<select size="4" name="viewvalue">';
foreach ($rule->getUsedByAttrs() as $attr)
printf('<option>%s</option>',$attr);
print '</select><br />';
@@ -369,7 +377,7 @@ switch($entry['view']) {
case 'objectClasses':
$schema_oclasses = $ldapserver->SchemaObjectClasses();
if (! $schema_oclasses)
pla_error($schema_error_str);
error($schema_error_str,'error','index.php');
printf('<small>%s:</small>',_('Jump to an objectClass'));
@@ -395,19 +403,19 @@ switch($entry['view']) {
if (! is_null($entry['value']))
$entry['viewed'] = true;
echo '<table class="schema_oclass" border=0>';
printf('<tr class="name"><td colspan=4><a name="%s">%s</a></td></tr>',$name,$oclass->getName());
printf('<tr class="detail"><td colspan=4>%s: <b>%s</b></td></tr>',_('OID'),$oclass->getOID());
echo '<table class="result_table" width=100% border=0>';
printf('<tr class="heading"><td colspan=4><a name="%s">%s</a></td></tr>',$name,$oclass->getName());
printf('<tr class="odd"><td colspan=4>%s: <b>%s</b></td></tr>',_('OID'),$oclass->getOID());
if ($oclass->getDescription())
printf('<tr class="detail"><td colspan=4>%s: <b>%s</b></td></tr>',_('Description'),$oclass->getDescription());
printf('<tr class="odd"><td colspan=4>%s: <b>%s</b></td></tr>',_('Description'),$oclass->getDescription());
printf('<tr class="detail"><td colspan=4>%s: <b>%s</b></td></tr>',_('Type'),$oclass->getType());
printf('<tr class="odd"><td colspan=4>%s: <b>%s</b></td></tr>',_('Type'),$oclass->getType());
if ($oclass->getIsObsolete())
printf('<tr class="detail"><td colspan=4>%s</td></tr>',_('This objectClass is obsolete.'));
printf('<tr class="odd"><td colspan=4>%s</td></tr>',_('This objectClass is obsolete.'));
printf('<tr class="detail"><td colspan=4>%s: <b>',_('Inherits from'));
printf('<tr class="odd"><td colspan=4>%s: <b>',_('Inherits from'));
if (count($oclass->getSupClasses()) == 0)
printf('(%s)',_('none'));
@@ -423,7 +431,7 @@ switch($entry['view']) {
}
echo '</b></td></tr>';
printf('<tr class="detail"><td colspan=4>%s: <b>',_('Parent to'));
printf('<tr class="odd"><td colspan=4>%s: <b>',_('Parent to'));
if (strcasecmp($oclass->getName(),'top') == 0) {
$href = htmlspecialchars(sprintf($entry['href']['objectClasses'],''));
printf('(<a href="%s">all</a>)',$href);
@@ -441,16 +449,15 @@ switch($entry['view']) {
}
echo '</b></td></tr>';
printf('<tr class="attrshead"><td class="left">&nbsp;</td><td><b>%s</b></td><td><b>%s</b></td><td class="right">&nbsp;</td></tr>',
printf('<tr class="even"><td class="blank" rowspan=2>&nbsp;</td><td><b>%s</b></td><td><b>%s</b></td><td class="blank" rowspan=2>&nbsp;</td></tr>',
_('Required Attributes'),_('Optional Attributes'));
echo '<tr class="attrs">';
echo '<td class="left">&nbsp;</td>';
echo '<tr class="odd">';
echo '<td>';
if (count($oclass->getMustAttrs($schema_oclasses)) > 0) {
echo '<ul class="schema">';
echo '<ul class="list">';
foreach ($oclass->getMustAttrs($schema_oclasses) as $attr) {
echo '<li>';
$href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getName())));
@@ -473,7 +480,7 @@ switch($entry['view']) {
if (count($oclass->getMayAttrs($schema_oclasses)) > 0) {
echo '<ul class="schema">';
echo '<ul class="list">';
foreach ($oclass->getMayAttrs($schema_oclasses) as $attr) {
echo '<li>';
$href = htmlspecialchars(sprintf($entry['href']['attributes'],strtolower($attr->getName())));
@@ -484,6 +491,11 @@ switch($entry['view']) {
$href = htmlspecialchars(sprintf($entry['href']['objectClasses'],strtolower($attr->getSource())));
printf('<small>(%s <a href="%s">%s</a>)</small>',_('Inherited from'),$href,$attr->getSource());
}
if ($oclass->isForceMay($attr->getName())) {
echo '<br />';
printf('<small>%s</small>',_('This attribute has been forced as a MAY attribute by the configuration'));
}
echo '</li>';
}
echo '</ul>';
@@ -492,7 +504,6 @@ switch($entry['view']) {
printf('(%s)',_('none'));
echo '</td>';
echo '<td class="right">&nbsp;</td>';
echo '</tr>';
echo '</table>';
echo '<br />';
@@ -502,5 +513,5 @@ switch($entry['view']) {
}
if (! is_null($entry['value']) && ! $entry['viewed'])
pla_error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($entry['value'])));
error(sprintf(_('No such schema item: "%s"'),htmlspecialchars($entry['value'])),'error','index.php');
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.78.2.4 2007/12/29 08:24:10 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/search.php,v 1.78.2.8 2008/12/12 12:20:22 wurley Exp $
/**
* Perform LDAP searches and draw the advanced/simple search forms
@@ -24,6 +24,7 @@ define('SIZE_LIMIT_EXCEEDED',4);
$result_formats = array('list','table');
# Our incoming variables
$entry = array();
$entry['format'] = get_request('format','GET','false',$_SESSION[APPCONFIG]->GetValue('search','display'));
$entry['form'] = get_request('form','GET',false,get_request('form','SESSION'));
@@ -78,7 +79,7 @@ if ($entry['base_dn']['string']) {
if (isset($ldapserver))
$base_dns = $ldapserver->getBaseDN();
printf('<script type="text/javascript" src="%ssearch_util.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%ssearch_util.js"></script>',JSDIR);
echo '<center>';
$entry['command']['as'] = $_SESSION[APPCONFIG]->isCommandAvailable('search','advanced_search');
@@ -117,15 +118,15 @@ echo '<br />';
if ($entry['search']) {
if ($entry['form'] == 'advanced') {
if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','advanced_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('advanced search')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('advanced search')),'error','index.php');
} elseif ($entry['form'] == 'predefined') {
if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','predefined_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('predefined search')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('predefined search')),'error','index.php');
} elseif ($entry['form'] == 'simple') {
if (! $_SESSION[APPCONFIG]->isCommandAvailable('search','simple_search'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('simple search')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('simple search')),'error','index.php');
}
if ($entry['form'] == 'advanced') {
@@ -247,7 +248,10 @@ if ($entry['search']) {
$entry['scope'],$entry['orderby']['array'],$_SESSION[APPCONFIG]->GetValue('deref','search'));
if ((! $results) && $ldapserver->errno())
pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Encountered an error while performing search.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
$errno = $ldapserver->errno();
@@ -259,21 +263,21 @@ if ($entry['search']) {
$end_entry = min($start_entry+$size_limit+1,$count+1);
# Search Results Table
echo '<table class="search_result" border=0>';
echo '<table class="result" border=0>';
echo '<tr class="header">';
printf('<td>%s%s <b>%s</b> <small>(%s %s)</small></td>',_('Entries found'),_(':'),
echo '<tr class="heading">';
printf('<td>%s%s <b>%s</b><div class="execution_time">(%s %s)</div></td>',_('Entries found'),_(':'),
number_format($count),$time_elapsed,_('seconds'));
if ($_SESSION[APPCONFIG]->isCommandAvailable('export')) {
$href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s',
$ldapserver->server_id,$entry['scope'],$base_dn,rawurlencode($entry['filter']['clean']),rawurlencode(join(', ',$search_result_attributes))));
printf('<td style="text-align: right"><small>[ <a href="%s"><img src="images/save.png" alt="Save" /> %s</a> ]',
$href,_('export results'));
printf('<td style="text-align: right"><small>[ <a href="%s"><img src="%s/save.png" alt="Save" /> %s</a> ]',
$href,IMGDIR,_('export results'));
}
printf('[ <img src="images/rename.png" alt="rename" /> %s%s',_('Format'),_(':'));
printf('[ <img src="%s/rename.png" alt="rename" /> %s%s',IMGDIR,_('Format'),_(':'));
foreach ($result_formats as $f) {
echo '&nbsp;';
@@ -380,17 +384,13 @@ if ($entry['search']) {
elseif ($entry['format'] == 'table')
require LIBDIR.'search_results_table.php';
else
pla_error(sprintf(_('Unrecognized search result format: %s'),htmlspecialchars($entry['format'])));
error(sprintf(_('Unrecognized search result format: %s'),htmlspecialchars($entry['format'])),'error','index.php');
echo '<br />';
if (trim($pager_html))
printf('<center>%s</center>',$pager_html);
}
}
printf('<br /><br /><div class="search_result"><center><small><span style="font-weight:normal;font-size:75%%;">%s <b>%s</b> %s.</span></small></center></div>',
_('Search performed by phpLDAPadmin in'),$time_elapsed,_('seconds'));
}
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.27.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/server_info.php,v 1.27.2.4 2008/12/12 12:20:22 wurley Exp $
/**
* Fetches and displays all information that it can from the specified server
@@ -13,7 +13,7 @@
*/
if (! $_SESSION[APPCONFIG]->isCommandAvailable('server_info'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view server informations')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('view server information')),'error','index.php');
# The attributes we'll examine when searching the LDAP server's RootDSE
$root_dse_attributes = array(
@@ -72,20 +72,20 @@ if (count($attrs) == 0) {
return;
}
echo '<table class="edit_dn">';
echo '<table class="result" border=0>';
foreach ($attrs as $attr => $values) {
if ($attr == 'dn')
continue;
$schema_href = sprintf('schema.php?server_id=%s&amp;view=attributes&amp;viewvalue=%s',$ldapserver->server_id,$attr);
$schema_href = sprintf('cmd.php?cmd=schema&amp;server_id=%s&amp;view=attributes&amp;viewvalue=%s',$ldapserver->server_id,$attr);
echo '<tr><td class="attr">';
echo '<tr class="list_item"><td class="heading" rowspan=2>';
printf('<a title="'._('Click to view the schema definition for attribute type \'%s\'').'" href="%s">%s</a>',
$attr,$schema_href,htmlspecialchars($attr));
echo '</td></tr>';
echo '<tr><td class="val">';
echo '<table class="edit_dn">';
echo '<tr class="list_item"><td class="blank">&nbsp;</td><td class="value">';
echo '<table class="result" border=0>';
if (is_array($values))
foreach ($values as $value) {
@@ -94,8 +94,8 @@ foreach ($attrs as $attr => $values) {
print '<tr>';
if (preg_match('/^[0-9]+\.[0-9]+/',$value)) {
printf('<td width=5%%><img src="images/rfc.png" title="%s" alt="%s" /></td>',
htmlspecialchars($value), htmlspecialchars($value));
printf('<td width=5%%><img src="%s/rfc.png" title="%s" alt="%s" /></td>',
IMGDIR,htmlspecialchars($value), htmlspecialchars($value));
if ($oidtext = support_oid_to_text($value))
if (isset($oidtext['ref']))
@@ -118,7 +118,7 @@ foreach ($attrs as $attr => $values) {
}
else
printf('<tr><td>%s</td></tr>',htmlspecialchars($values));
printf('<tr><td>%s&nbsp;</td></tr>',htmlspecialchars($values));
echo '</table>';
echo '</td></tr>';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/show_cache.php,v 1.3.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/show_cache.php,v 1.3.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* This script shows the contents of the cache for debugging purposes
@@ -11,6 +11,7 @@
require './common.php';
$entry = array();
$entry['key'] = get_request('key','REQUEST');
$entry['index'] = get_request('index','REQUEST');
@@ -80,7 +81,7 @@ if (! $_SESSION[APPCONFIG]->GetValue('appearance','hide_debug_info')) {
poststr += "&index=" + encodeURI(xx);
}
obj.innerHTML = '<img src="images/ajax-spinner.gif" /> Loading...';
obj.innerHTML = '<img src="<?php echo IMGDIR ?>/ajax-spinner.gif" /> Loading...';
makePOSTRequest('cmd.php',poststr,'alertCacheContents','cancelCacheContents');
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.45.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/template_engine.php,v 1.45.2.2 2008/12/12 12:20:22 wurley Exp $
/**
* Template render engine.
@@ -15,6 +15,7 @@
require_once './common.php';
$entry = array();
$entry['dn']['encode'] = get_request('dn','REQUEST');
$entry['dn']['string'] = rawurldecode($entry['dn']['encode']);
$entry['template'] = get_request('template','REQUEST',false,'');
@@ -22,7 +23,7 @@ $entry['template'] = get_request('template','REQUEST',false,'');
# If we have a DN, then this is to edit the entry.
if ($entry['dn']['string']) {
$ldapserver->dnExists($entry['dn']['string'])
or pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($entry['dn']['string'])));
or error(sprintf('%s (%s)',_('No such entry'),pretty_print_dn($entry['dn']['string'])),'error','index.php');
$tree = get_cached_item($ldapserver->server_id,'tree');
@@ -51,7 +52,7 @@ if ($entry['dn']['string']) {
} else {
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
# Create a new empty entry
$entryfactoryclass = $_SESSION[APPCONFIG]->GetValue('appearance','entry_factory');

View File

@@ -1,41 +0,0 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/timeout.php,v 1.5.2.1 2007/12/21 12:11:55 wurley Exp $
/**
* Time out page to be displayed on the right frame
*
* Variables that come in as GET vars:
* - server_id
*
* @package phpLDAPadmin
*/
/**
*/
require './common.php';
if (! isset($ldapserver)) {
header("Location: index.php");
die();
}
include './header.php';
# If $session_timeout not defined, use ( session_cache_expire() - 1 )
$session_timeout = $ldapserver->session_timeout ? $ldapserver->session_timeout : session_cache_expire()-1;
?>
<h3 class="title"><?php echo $ldapserver->name; ?></h3>
<br />
<br />
<center>
<b><?php printf('%s %s %s',_('Your Session timed out after'),$session_timeout,_('min. of inactivity. You have been automatically logged out.')); ?></b>
<br />
<br />
<?php echo _('To log back in please click on the following link:'); ?><br />
<a href="cmd.php?cmd=login_form&server_id=<?php echo $ldapserver->server_id; ?>"><?php echo _('Login...'); ?></a>
</center>
</body>
</html>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update.php,v 1.29.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update.php,v 1.29.2.4 2009/01/05 14:25:48 wurley Exp $
/**
* Updates or deletes a value from a specified attribute for a specified dn.
@@ -26,24 +26,25 @@
require './common.php';
$entry = array();
$entry['dn']['string'] = get_request('dn');
$entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
# If cancel was submited, got back to the edit display.
if (isset($_REQUEST['cancel'])) {
if (get_request('cancel','REQUEST')) {
header(sprintf('Location: cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,$entry['dn']['encode']));
die();
}
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
$entry['update'] = get_request('update_array','POST',false,array());
$entry['skip'] = get_request('skip_array','POST',false,array());
$failed_attrs = array();
if (! is_array($entry['update']))
pla_error(_('update_array is malformed. This might be a phpLDAPadmin bug. Please report it.'));
error(_('update_array is malformed. This might be a phpLDAPadmin bug. Please report it.'),'error','index.php');
run_hook ('pre_update',
array('server_id'=>$ldapserver->server_id,'dn'=>$entry['dn']['string'],'update_array'=>$entry['update']));
@@ -58,13 +59,14 @@ foreach ($entry['update'] as $attr => $val) {
$entry['update'][$attr] = array();
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('delete attribute')),'error','index.php');
} else { # Skip change
$entry['update'][$attr] = $val;
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')
&& ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')),'error','index.php');
}
} else {
@@ -77,7 +79,7 @@ foreach ($entry['update'] as $attr => $val) {
if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value')
&& ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete_value'))
pla_error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')));
error(sprintf('%s%s %s',_('This operation is not permitted by the configuration'),_(':'),_('modify attribute values')),'error','index.php');
}
}
}
@@ -89,8 +91,8 @@ foreach ($entry['update'] as $attr_name => $val) {
$href['search'] = sprintf('cmd.php?cmd=search&search=true&form=advanced&server_id=%s&filter=%s=%s',
$ldapserver->server_id,$attr_name,$badattr);
pla_error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href="%s">search</a> for that entry.'),
$attr_name,$badattr,$entry['dn']['string'],$href['search']));
error(sprintf(_('Your attempt to add <b>%s</b> (<i>%s</i>) to <br><b>%s</b><br> is NOT allowed. That attribute/value belongs to another entry.<p>You might like to <a href=\'%s\'>search</a> for that entry.'),
$attr_name,$badattr,$entry['dn']['string'],$href['search']),'error','index.php');
}
if (run_hook('pre_attr_modify',
@@ -100,8 +102,9 @@ foreach ($entry['update'] as $attr_name => $val) {
$failed_attrs[$attr_name] = $val;
} elseif ($ldapserver->isAttrReadOnly($attr)) {
pla_error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),
htmlspecialchars($attr_name)));
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),
htmlspecialchars($attr_name)),'error','index.php');
} else {
// binary values
if (isset($_SESSION['submitform'][$attr_name])) {
@@ -175,6 +178,9 @@ if ($result) {
die();
} else {
pla_error(_('Could not perform ldap_modify operation.'),$ldapserver->error(),$ldapserver->errno());
system_message(array(
'title'=>_('Could not perform ldap_modify operation.'),
'body'=>ldap_error_msg($ldapserver->error(),$ldapserver->errno()),
'type'=>'error'));
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.49.2.2 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/update_confirm.php,v 1.49.2.4 2008/12/12 12:20:22 wurley Exp $
/**
* Takes the results of clicking "Save" in template_engine.php and determines which
@@ -16,17 +16,18 @@
require './common.php';
if ($ldapserver->isReadOnly())
pla_error(_('You cannot perform updates while server is in read-only mode'));
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
/***************/
/* get entry */
/***************/
$entry = array();
$entry['dn']['string'] = get_request('dn');
$entry['dn']['encode'] = rawurlencode($entry['dn']['string']);
if (! $entry['dn']['string'] || ! $ldapserver->dnExists($entry['dn']['string']))
pla_error(sprintf(_('The entry (%s) does not exist.'),htmlspecialchars($entry['dn']['string'])),null,-1,true);
error(sprintf(_('The entry (%s) does not exist.'),htmlspecialchars($entry['dn']['string'])),'error','index.php');
$tree = get_cached_item($ldapserver->server_id,'tree');
$entry['ldap'] = null;
@@ -40,7 +41,7 @@ if ($tree) {
}
if (! $entry['ldap'] || $entry['ldap']->isReadOnly())
pla_error(sprintf(_('The entry (%s) is in readonly mode.'),htmlspecialchars($entry['dn']['string'])),null,-1,true);
error(sprintf(_('The entry (%s) is in readonly mode.'),htmlspecialchars($entry['dn']['string'])),'error','index.php');
/***************/
/* old values */
@@ -96,9 +97,9 @@ $attr_to_delete = array();
// if objectClass attribute is modified
if (isset($entry['values']['new']['objectClass'])) {
if (!isset($entry['values']['old']['objectClass'])) {
pla_error(_('An entry should have one structural objectClass.'));
}
if (!isset($entry['values']['old']['objectClass']))
error(_('An entry should have one structural objectClass.'),'error','index.php');
// deleted objectClasses
foreach ($entry['values']['old']['objectClass'] as $oldOC) {
if (!in_array($oldOC, $entry['values']['new']['objectClass'])) {
@@ -195,7 +196,7 @@ if (count($entry['values']['new']) > 0) {
echo '<form action="cmd.php" method="post">';
echo '<input type="hidden" name="cmd" value="update" />';
echo "\n";
echo '<table class="confirm">';
echo '<table class="result_table">';
echo "\n";
printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
@@ -278,10 +279,8 @@ if (count($entry['values']['new']) > 0) {
printf('<td><input name="skip_array[%s]" type="checkbox" %s %s/></td>',htmlspecialchars($attr),$input_disabled,$input_onclick);
echo '</tr>'."\n\n";
}
echo '</table>';
echo '</table><table class="form">';
echo '<tr>';
echo '<td>';
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
printf('<input type="hidden" name="dn" value="%s" />',$entry['dn']['string']);
@@ -301,25 +300,18 @@ if (count($entry['values']['new']) > 0) {
}
}
printf('<input type="submit" value="%s" class="happy" />',_('Commit'));
echo '</td>';
echo '<td>';
printf('<input type="submit" name="cancel" value="%s" class="scary" />',_('Cancel'));
echo '</td>';
echo '</tr>';
echo '</table>';
echo '<br />';
printf('<input type="submit" value="%s" />',_('Commit'));
printf('<input type="submit" name="cancel" value="%s" />',_('Cancel'));
echo '</form>';
if (count($attr_to_delete) > 0) {
echo '<table class="form"><tr><td><br/>';
echo _('The deletion of objectClass(es)');
echo _(':');
echo ' <b>';
echo implode('</b>, <b>', $oc_to_delete);
echo '</b><br/>';
echo _('will delete the attribute(s)');
echo _(':');
echo ' <b>';
echo '<table class="result_table"><tr>';
printf('<td class="heading">%s%s</td>',_('The deletion of objectClass(es)'),_(':'));
printf('<td class="value"><b>%s</b></td>',implode('</b>, <b>', $oc_to_delete));
echo '</tr><tr>';
printf('<td class="heading">%s%s</td>',_('will delete the attribute(s)'),_(':'));
echo '<td class="value"><b>';
$i = 0;
foreach ($attr_to_delete as $attr) {
if ($i++ != 0) echo '</b>, <b>';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/view_jpeg_photo.php,v 1.11.2.1 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/view_jpeg_photo.php,v 1.11.2.3 2008/12/12 12:20:22 wurley Exp $
/**
* @package phpLDAPadmin
@@ -9,27 +9,29 @@
require './common.php';
$file = array();
$file['name'] = get_request('file','GET');
/* Security check (we don't want anyone tryting to get at /etc/passwd or something)
* Slashes and dots are not permitted in these names.
*/
if (! preg_match('/^pla/',$file['name']) || preg_match('/[\.\/\\\\]/',$file['name']))
pla_error(sprintf('%s: %s',_('Unsafe file name'),htmlspecialchars($file['name'])));
error(sprintf('%s: %s',_('Unsafe file name'),htmlspecialchars($file['name'])),'error','index.php');
/* Little security measure here (prevents users from accessing
files, like /etc/passwd for example).*/
$file['name'] = basename(addcslashes($file['name'],'/\\'));
$file['name'] = sprintf('%s/%s',$_SESSION[APPCONFIG]->GetValue('jpeg','tmpdir'),$file['name']);
if (! file_exists($file['name']))
pla_error(sprintf('%s%s %s',_('No such file'),_(':'),htmlspecialchars($file['name'])));
error(sprintf('%s%s %s',_('No such file'),_(':'),htmlspecialchars($file['name'])),'error','index.php');
$file['handle'] = fopen($file['name'],'r');
$file['data'] = fread($file['handle'],filesize($file['name']));
fclose($file['handle']);
if (ob_get_level())
ob_clean();
$obStatus = ob_get_status();
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
ob_end_clean();
Header('Content-type: image/jpeg');
Header('Content-disposition: inline; filename=jpeg_photo.jpg');

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/welcome.php,v 1.26.2.2 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/welcome.php,v 1.26.2.4 2008/12/12 08:41:30 wurley Exp $
/**
* @package phpLDAPadmin
@@ -13,7 +13,7 @@ require './common.php';
echo '<center>';
echo '<br /><br />';
printf('<img src="images/logo.jpg" title="%s" alt="%s" />',_('phpLDAPadmin logo'),_('phpLDAPadmin logo'));
printf('<img src="%s/logo.png" title="%s" alt="%s" />',IMGDIR,_('phpLDAPadmin logo'),_('phpLDAPadmin logo'));
echo '<br /><br />';
echo _('Use the menu to the left to navigate');
echo '<br /><br />';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/AJAXTree.php,v 1.2 2007/12/15 07:50:31 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/AJAXTree.php,v 1.2.2.2 2008/12/12 06:46:15 wurley Exp $
/**
* @package phpLDAPadmin
@@ -101,7 +101,7 @@ class AJAXTree extends PLMTree {
}
echo '<a href="'.$edit_href.'" onclick="return displayMainPage(\''.$edit_href_params.'\');" title="'.$dn.'" >';
echo '<img align="top" border="0" class="imgs" id="jt'.$node_id.'folder" src="images/'.$entry->getIcon($ldapserver).'" alt="->" />';
printf('<img align="top" border="0" class="imgs" id="jt%sfolder" src="%s/%s" alt="->" />',$node_id,IMGDIR,$entry->getIcon($ldapserver));
echo '</a>';
echo '&nbsp;';
echo '<a href="'.$edit_href.'" onclick="return displayMainPage(\''.$edit_href_params.'\');" title="'.$dn.'" class="phplm">';
@@ -131,6 +131,10 @@ class AJAXTree extends PLMTree {
$first_child = $this->get_plm_before_first_child($parent_entry,$code);
$last_child = $this->get_plm_after_last_child($parent_entry,$code);
# If compression is on, we need to compress this output - but only if called by draw_tree_node
if (function_exists('isCompress') && isCompress() && get_request('cmd','REQUEST') == 'draw_tree_node')
ob_start();
echo $first_child;
for ($i=0; $i<count($children); $i++) {
@@ -141,6 +145,12 @@ class AJAXTree extends PLMTree {
}
echo $last_child;
# If compression is on, we need to compress this output
if (function_exists('isCompress') && isCompress() && get_request('cmd','REQUEST') == 'draw_tree_node') {
$output = ob_get_clean();
echo gzencode($output);
}
}
/**
@@ -272,7 +282,7 @@ class AJAXTree extends PLMTree {
}
//folderLayer.src = \'js/phplayersmenu/menuimages/tree_folder_open.png\';
//folderLayer.src = \'js/phplayersmenu/menuimages/tree_folder_closed.png\';
nodeLayer.src = \'images/ajax-spinner.gif\';
nodeLayer.src = \''.IMGDIR.'ajax-spinner.gif\';
// perform action
if (action == 2) {
@@ -310,7 +320,7 @@ class AJAXTree extends PLMTree {
}
function displayMainPage(urlParameters) {
var mainPageDiv = getMainPageDiv();
if (mainPageDiv) includeHTML(mainPageDiv, \'<img src="images/ajax-progress.gif"><br><small>'._('Retrieving DN').'...<\/small>\');
if (mainPageDiv) includeHTML(mainPageDiv, \'<img src="'.IMGDIR.'ajax-progress.gif"><br><small>'._('Retrieving DN').'...<\/small>\');
makeGETRequest(\'cmd.php\', urlParameters+\'&meth=get_body\', \'alertMainPage\', \'cancelMainPage\');
return false;
}
@@ -337,7 +347,7 @@ class AJAXTree extends PLMTree {
$output .= $this->get_indentation($level);
$output .= '<img align="top" border="0" class="imgs" src="js/phplayersmenu/menuimages/tree_split.png" alt="--" />';
$output .= '<a href="'.htmlspecialchars($href).'" title="'.$entry->getDn().'">';
$output .= '<img align="top" border="0" class="imgs" src="images/star.png" alt="->" />';
$output .= sprintf('<img align="top" border="0" class="imgs" src="%s/star.png" alt="->" />',IMGDIR);
$output .= '</a>';
$output .= '&nbsp;';
$output .= '<a href="'.htmlspecialchars($href).'" title="'._('Create new entry here').'" class="phplm">';
@@ -361,7 +371,7 @@ class AJAXTree extends PLMTree {
$output .= $this->get_indentation($level);
$output .= '<img align="top" border="0" class="imgs" src="js/phplayersmenu/menuimages/tree_corner.png" alt="--" />';
$output .= '<a href="'.htmlspecialchars($href).'" title="'.$entry->getDn().'">';
$output .= '<img align="top" border="0" class="imgs" src="images/star.png" alt="->" />';
$output .= sprintf('<img align="top" border="0" class="imgs" src="%s/star.png" alt="->" />',IMGDIR);
$output .= '</a>';
$output .= '&nbsp;';
$output .= '<a href="'.htmlspecialchars($href).'" title="'._('Create new entry here').'" class="phplm">';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Attribute.php,v 1.2.2.2 2007/12/26 09:26:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Attribute.php,v 1.2.2.3 2008/11/28 23:26:51 wurley Exp $
/**
* @package phpLDAPadmin
@@ -253,10 +253,7 @@ class Attribute {
public function isRdn() {
if ($this->entry) {
//$rdn = get_rdn($this->entry->getDn());
//$attr = $this->name;
//return preg_match("/^${attr}=/", $rdn);
return ($this->name == $this->entry->getRdnAttributeName());
return (preg_grep('/'.$this->name.'/',$this->entry->getRdnAttributeName()));
} else {
return false;
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultCreatingEntry.php,v 1.2.2.2 2007/12/29 08:24:10 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultCreatingEntry.php,v 1.2.2.3 2008/11/29 01:35:47 wurley Exp $
/**
* @package phpLDAPadmin
@@ -145,8 +145,8 @@ class DefaultCreatingEntry extends Entry {
public function getRdnAttributeName() {
$attr = $this->getRdnAttribute();
if ($attr) return $attr->getName();
else return '';
if ($attr) return array($attr->getName());
else return array('');
}
public function getRdnAttribute() {

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultEditingEntry.php,v 1.2.2.2 2007/12/29 08:25:24 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/DefaultEditingEntry.php,v 1.2.2.3 2008/03/01 02:13:03 wurley Exp $
/**
* @package phpLDAPadmin
@@ -32,10 +32,20 @@ class DefaultEditingEntry extends Entry {
if (!$int_attrs_vals) $int_attrs_vals = array();
elseif (!is_array($int_attrs_vals)) $int_attrs_vals = array($int_attrs_vals);
$custom_int_attrs_vals = $ldapserver->getCustomDNSysAttrs($this->getDn());
if (! $custom_int_attrs_vals) $attrs_vals = array();
elseif (! is_array($custom_int_attrs_vals)) $custom_int_attrs_vals = array($custom_int_attrs_vals);
$attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
if (! $attrs_vals) $attrs_vals = array();
elseif (! is_array($attrs_vals)) $attrs_vals = array($attrs_vals);
$custom_attrs_vals = $ldapserver->getCustomDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
if (! $custom_attrs_vals) $attrs_vals = array();
elseif (! is_array($custom_attrs_vals)) $custom_attrs_vals = array($custom_attrs_vals);
$int_attrs_vals = array_merge($int_attrs_vals,$custom_int_attrs_vals);
$attrs_vals = array_merge($attrs_vals,$custom_attrs_vals);
$attrs_vals = array_merge($attrs_vals, $int_attrs_vals);
uksort($attrs_vals,'sortAttrs'); # Sort these entries

View File

@@ -1,5 +1,7 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Entry.php,v 1.2.2.2 2008/01/04 14:31:05 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Entry.php,v 1.2.2.5 2009/03/20 07:33:34 wurley Exp $
define('TMPDEBUG',0);
/**
* @package phpLDAPadmin
@@ -11,8 +13,8 @@
abstract class Entry {
protected $dn;
# the tree to which the entry belongs
protected $tree;
# the server_id to which the entry belongs
protected $server_id;
# is the entry a leaf ?
private $leaf;
@@ -58,23 +60,30 @@ abstract class Entry {
}
public function getRdnAttributeName() {
$attr = '';
$attr = array();
if ($this->dn) {
$i = strpos($this->dn, '=');
if ($i !== false) $attr = substr($this->dn, 0, $i);
$i = strpos($this->dn, ',');
if ($i !== false) {
$attrs = split('\+',substr($this->dn, 0, $i));
foreach ($attrs as $id => $attr) {
list ($name,$value) = split('=',$attr);
$attrs[$id] = $name;
}
$attr = array_unique($attrs);
}
}
return $attr;
}
public function setTree($tree) {
$this->tree = $tree;
public function setTree($index) {
$this->server_id = $index;
}
private function readChildren($nolimit=false) {
if (DEBUG_ENABLED)
debug_log('Entered with ()',1,__FILE__,__LINE__,__METHOD__);
$ldapserver = ($this->tree ? $this->tree->getLdapServer() : null);
$ldapserver = (isset($this->server_id) ? $_SESSION[APPCONFIG]->ldapservers->Instance($this->server_id) : null);
if (DEBUG_ENABLED)
debug_log('LdapServer (%s)',1,__FILE__,__LINE__,__METHOD__, $ldapserver ? $ldapserver->server_id : -1);
@@ -86,18 +95,22 @@ abstract class Entry {
if (DEBUG_ENABLED)
debug_log('Children of (%s) are (%s)',64,__FILE__,__LINE__,__METHOD__,$this->getDn(),$ldap['children']);
if ($this->tree) {
if (isset($this->server_id)) {
$this->reading_children = true;
$tree = get_cached_item($ldapserver->server_id,'tree');
foreach ($ldap['children'] as $dn) {
if (DEBUG_ENABLED)
debug_log('Adding (%s)',64,__FILE__,__LINE__,__METHOD__,$dn);
if (! $this->tree->getEntry($dn))
$this->tree->addEntry($dn);
if (! $tree->getEntry($dn))
$tree->addEntry($dn);
}
set_cached_item($ldapserver->server_id,'tree','null',$tree);
usort($this->children,'pla_compare_dns');
$this->reading_children = false;
}
if (count($this->children) == $ldap['child_limit'])
$this->size_limited = true;
else

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryReader.php,v 1.2.2.1 2007/12/29 08:24:10 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryReader.php,v 1.2.2.5 2008/12/12 12:20:22 wurley Exp $
define('ENTRY_READER_CREATION_CONTEXT', '1');
define('ENTRY_READER_EDITING_CONTEXT', '2');
@@ -12,11 +12,11 @@ define('ENTRY_READER_EDITING_CONTEXT', '2');
* Visit an entry and its attributes to initialize their values
*/
class EntryReader extends Visitor {
protected $ldapserver;
protected $index;
protected $context;
public function __construct($ldapserver) {
$this->ldapserver = $ldapserver;
$this->index = $ldapserver->server_id;
$this->context = 0;
}
@@ -109,10 +109,15 @@ class EntryReader extends Visitor {
debug_log('Enter with (%s) for attribute (%s)',1,__FILE__,__LINE__,__METHOD__,$attribute,$attribute->getName());
$name = $attribute->getName();
// @todo editing objectclasses
if (($this->context == ENTRY_READER_CREATION_CONTEXT) && ($name == 'objectClass')) return;
$old_vals = $this->get('OldValues', $attribute);
if ($this->context == ENTRY_READER_EDITING_CONTEXT)
$old_vals = $this->get('OldValues', $attribute);
else
$old_vals = array();
$new_vals = $this->get('NewValues', $attribute);
if (isset($_POST['old_values'][$name])) {
@@ -140,8 +145,6 @@ class EntryReader extends Visitor {
}
foreach ($new_vals as $i => $new_val) {
//$new_val = trim($new_val); // no trim if binary value
// if the attribute has not been already modified by a post of a previous page
if (!$attribute->hasBeenModified()) {
// if the value has changed (added or modified/deleted)
@@ -157,7 +160,6 @@ class EntryReader extends Visitor {
}
// old value deletion
//if (($this->context == ENTRY_READER_EDITING_CONTEXT) && !$attribute->isInternal()) {
if (isset($_POST['old_values'][$name]) && !$attribute->isInternal()) {
for ($i = count($new_vals); $i < count($old_vals); $i++) {
$attribute->addValue('', $i);
@@ -207,7 +209,7 @@ class EntryReader extends Visitor {
}
if (is_null($val)) {
pla_error(sprintf(_('Your template is missing variable (%s)'), $request));
error(sprintf(_('Your template is missing variable (%s)'),$request),'error','index.php');
}
return $val;
@@ -220,22 +222,17 @@ class EntryReader extends Visitor {
switch ($matches[1]) {
case 'Password' :
preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',$matches[2],$matchall);
//if (!isset($_POST['enc_type'][$i]) || !$_POST['enc_type'][$i]) {
// pla_error(sprintf(_('Your template is missing variable (%s)'),'enc_type'));
//}
//$enc = $_POST['enc_type'][$i]; //$_REQUEST[$matchall[1][0]];
$enc = $this->get('RequestValue', $attribute, $i, $val, $matchall[1][0]);
$password = $val; //$_REQUEST['form'][$matchall[1][1]];
$password = $val;
if ($password) {
$val = password_hash($password, $enc);
}
break;
case 'SambaPassword' :
$matchall = explode(',',$matches[2]);
//$attr = preg_replace('/%/','',$matchall[1]);
# If we have no password, then dont hash nothing!
if (strlen($val) <= 0) //if (! trim($_REQUEST['form'][$attr]))
if (strlen($val) <= 0)
break;
$sambapassword = new smbHash;
@@ -253,15 +250,6 @@ class EntryReader extends Visitor {
$values = array();
foreach ($matchall[1] as $joinattr) {
//$joinattribute = null;
//if ($attribute->getEntry()) {
// $joinattribute = $attribute->getEntry()->getAttribute($joinattr);
//}
//if ($joinattribute) {
// $values = array_merge($values, $joinattribute->getValues());
//} else {
// pla_error(sprintf(_('Your template is missing variable (%s)'),$joinattr));
//}
$values[] = $this->get('RequestValue', $attribute, $i, $val, $joinattr);
}
@@ -271,7 +259,7 @@ class EntryReader extends Visitor {
if (function_exists($matches[1])) {
$val = call_user_func($matches[1], $matches[2], $attribute, $i, $val);
} else {
pla_error(sprintf(_('Your template has an unknown post function (%s).'), $matches[1]));
error(sprintf(_('Your template has an unknown post function (%s).'),$matches[1]),'error','index.php');
}
}
}
@@ -308,11 +296,10 @@ class EntryReader extends Visitor {
$attribute->addFileName($filename, $i);
foreach ($file as $filepath => $binaries) {
$attribute->addFilePath($filepath, $i);
//$attribute->addValue($binaries, $i);
$bin = $binaries;
}
}
$vals[] = $bin; //$new_val;
$vals[] = $bin;
$i++;
}
}
@@ -333,7 +320,7 @@ class EntryReader extends Visitor {
$key = md5("$file_name|$file_path");
$_SESSION['submitform'][$name][$key][$file_name][$file_path] = $binary_data;
$vals[] = $binary_data; //$key;
$vals[] = $binary_data;
$i++;
}
}
@@ -365,8 +352,14 @@ class EntryReader extends Visitor {
if ($attribute->hasProperty('post')) {
$val = $this->get('Attribute::PostValue', $attribute, $i, $val);
} elseif (strlen($val) > 0) {
$val = password_hash($val, get_default_hash($this->ldapserver->server_id));
if (isset($_REQUEST['enc'][$attribute->getName()][$i]))
$enc = $_REQUEST['enc'][$attribute->getName()][$i];
else
$enc = get_default_hash($this->index);
$val = password_hash($val, $enc);
}
return $val;
}
@@ -398,5 +391,4 @@ class EntryReader extends Visitor {
return $val;
}
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter.php,v 1.2.2.1 2008/01/27 06:48:59 wurley Exp $
define('ENTRY_WRITER_CREATION_CONTEXT', '1');
define('ENTRY_WRITER_EDITING_CONTEXT', '2');
@@ -13,7 +13,7 @@ define('ENTRY_WRITER_EDITING_CONTEXT', '2');
*/
class EntryWriter extends Visitor {
# Ldapserver from context
protected $ldapserver;
protected $index;
# Context : creation or editing
protected $context;
@@ -27,11 +27,20 @@ class EntryWriter extends Visitor {
protected $visit_attributes;
public function __construct($ldapserver) {
$this->ldapserver = $ldapserver;
$this->index = $ldapserver->server_id;
$this->visit_attributes = true;
$this->context = 0;
}
public function getLDAPServer() {
static $CACHE;
if (! isset($CACHE[$this->index]))
$CACHE[$this->index] = $_SESSION[APPCONFIG]->ldapservers->Instance($this->index);
return $CACHE[$this->index];
}
/**************************/
/* Paint an Entry */
/**************************/

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter2.php,v 1.2.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/EntryWriter2.php,v 1.2.2.4 2008/11/29 11:33:53 wurley Exp $
/**
* @package phpLDAPadmin
@@ -145,7 +145,7 @@ class EntryWriter2 extends EntryWriter1 {
protected function drawAttribute($attribute) {
if ($attribute->isVisible()) {
if (($this->context == ENTRY_WRITER_EDITING_CONTEXT) && $attribute->hasBeenModified()) {
echo '<tr class="updated_attr">';
echo '<tr class="updated">';
} else {
echo '<tr>';
}
@@ -157,7 +157,7 @@ class EntryWriter2 extends EntryWriter1 {
if ($attribute->isVisible()) {
echo '</tr>';
if (($this->context == ENTRY_WRITER_EDITING_CONTEXT) && $attribute->hasBeenModified()) {
//echo '<tr class="updated_attr"><td class="bottom" colspan="3"></td></tr>';
//echo '<tr class="updated"><td class="bottom" colspan="3"></td></tr>';
}
if ($attribute->hasProperty('spacer') && $attribute->getProperty('spacer')) {
echo '<tr class="spacer"><td colspan="3">&nbsp;</td></tr>';
@@ -205,7 +205,7 @@ class EntryWriter2 extends EntryWriter1 {
if ($attr_note) printf('<sup><small>%s</small></sup>', $attr_note);
if ($attribute->isReadOnly() && $this->ldapserver->isAttrReadOnly($attribute->getName())) {
if ($attribute->isReadOnly() && $this->getLDAPServer()->isAttrReadOnly($attribute->getName())) {
printf('<small>(<acronym title="%s">%s</acronym>)</small>',
_('This attribute has been flagged as read only by the phpLDAPadmin administrator'),
_('read only'));
@@ -246,9 +246,9 @@ class EntryWriter2 extends EntryWriter1 {
}
protected function drawAttributeMenu($attribute) {
if ($attribute->getHint() /*&& $_SESSION[APPCONFIG]->GetValue('appearance', 'show_hints')*/) {
echo '<img src="images/light.png" alt="Hint" /> <span class="hint">'.$attribute->getHint().'</span>';
}
if ($attribute->getHint())
printf('<img src="%s/light.png" alt="Hint" /> <span class="hint">%s</span>',IMGDIR,$attribute->getHint());
parent::drawAttributeMenu($attribute);
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/HTMLTree.php,v 1.2.2.2 2007/12/29 07:23:45 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/HTMLTree.php,v 1.2.2.10 2008/12/13 02:13:13 wurley Exp $
/**
* @package phpLDAPadmin
@@ -38,10 +38,14 @@ class HTMLTree extends Tree {
printf('<tr><td class="blank" colspan="%s">&nbsp;</td></tr>',$this->getDepth()+3);
if ($ldapserver->isReadOnly())
printf('<tr><td class="spacer"></td><td class="links" colspan="%s">(%s)</td></tr>',$this->getDepth()+3-1,_('read only'));
printf('<tr><td class="spacer"></td><td class="logged_in" colspan="%s">(%s)</td></tr>',$this->getDepth()+3-1,_('read only'));
else
printf('<tr><td class="blank" colspan="%s">&nbsp;</td></tr>',$this->getDepth()+3);
printf('<tr><td>&nbsp;</td><td><div style="overflow: auto; %s%s"><table class="tree" border=0>',
$_SESSION[APPCONFIG]->GetValue('appearance','tree_width') ? sprintf('width: %spx; ',$_SESSION[APPCONFIG]->GetValue('appearance','tree_width')) : '',
$_SESSION[APPCONFIG]->GetValue('appearance','tree_height') ? sprintf('height: %spx; ',$_SESSION[APPCONFIG]->GetValue('appearance','tree_height')) : '');
foreach ($ldapserver->getBaseDN() as $base_dn) {
# Did we get a base_dn for this server somehow?
if ($base_dn) {
@@ -51,7 +55,7 @@ class HTMLTree extends Tree {
if (! $ldapserver->dnExists($base_dn)) {
$javascript_id++;
printf('<tr><td class="spacer"></td><td class="spacer"></td><td><img src="images/unknown.png" /></td><td colspan="%s">%s</td></tr>',$this->getDepth()+3-3,pretty_print_dn($base_dn));
printf('<tr><td class="spacer"></td><td class="spacer"></td><td><img src="%s/unknown.png" /></td><td colspan="%s">%s</td></tr>',IMGDIR,$this->getDepth()+3-3,pretty_print_dn($base_dn));
/* Move this form and add it to the end of the html - otherwise the javascript
* doesnt work when isMassDeleteEnabled returning true.
@@ -83,6 +87,7 @@ class HTMLTree extends Tree {
continue;
}
}
echo '</table></div></td></tr>';
} else { // end if( $ldapserver->connect(false) )
# @todo: need this message to display the LDAP server name, so we know which one is the problematic one.
@@ -98,9 +103,10 @@ class HTMLTree extends Tree {
}
} else { // end if $ldapserver->haveAuthInfo()
/* We don't have enough information to login to this server
* Draw the "login..." link
*/
$this->draw_login_link();
* Draw the "login..." link */
if ($ldapserver->auth_type != 'http')
$this->draw_login_link();
}
$this->draw_mass_deletion_submit_button();
@@ -148,14 +154,14 @@ class HTMLTree extends Tree {
$ldapserver = $this->getLdapServer();
echo '<tr class="server">';
printf('<td class="icon"><img src="images/server.png" alt="%s" /></td>',_('Server'));
printf('<td class="icon"><img src="%s/server.png" alt="%s" /></td>',IMGDIR,_('Server'));
printf('<td class="name" colspan="%s">',$this->getDepth()+3-1);
printf('%s',htmlspecialchars($ldapserver->name));
if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') {
if ($ldapserver->haveAuthInfo() && ! in_array($ldapserver->auth_type,array('config','http'))) {
$m = sprintf(_('Inactivity will log you off at %s'),
strftime('%H:%M',time() + ($ldapserver->session_timeout*60)));
printf(' <img width=14 height=14 src="images/timeout.png" title="%s" alt="%s"/>',$m,$m);
printf(' <img width=14 height=14 src="%s/timeout.png" title="%s" alt="%s"/>',IMGDIR,$m,$m);
}
echo '</td></tr>';
}
@@ -204,7 +210,7 @@ class HTMLTree extends Tree {
if ($_SESSION[APPCONFIG]->isCommandAvailable('export')) return $this->get_export_menu_item();
else return '';
case 6 :
if ($ldapserver->auth_type != 'config') return $this->get_logout_menu_item();
if (! in_array($ldapserver->auth_type,array('config','http'))) return $this->get_logout_menu_item();
else return '';
default :
return false;
@@ -215,63 +221,63 @@ class HTMLTree extends Tree {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=schema&server_id=%s',$ldapserver->server_id);
return sprintf('<a title="%s %s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('View schema for'),$ldapserver->name,htmlspecialchars($href),'images/schema.png',_('schema'),_('schema'));
return sprintf('<a title="%s %s" href="%s"><img src="%s/%s" alt="%s" /><br />%s</a>',
_('View schema for'),$ldapserver->name,htmlspecialchars($href),IMGDIR,'schema.png',_('schema'),_('schema'));
}
protected function get_search_menu_item() {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=search&server_id=%s&form=undefined',$ldapserver->server_id);
return sprintf('<a title="%s %s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('search'),$ldapserver->name,htmlspecialchars($href),'images/search.png',_('search'),_('search'));
return sprintf('<a title="%s %s" href="%s"><img src="%s/%s" alt="%s" /><br />%s</a>',
_('search'),$ldapserver->name,htmlspecialchars($href),IMGDIR,'search.png',_('search'),_('search'));
}
protected function get_refresh_menu_item() {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=refresh&server_id=%s',$ldapserver->server_id);
return sprintf('<a title="%s %s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('Refresh all expanded containers for'),$ldapserver->name,htmlspecialchars($href),'images/refresh-big.png',_('refresh'),_('refresh'));
return sprintf('<a title="%s %s" href="%s"><img src="%s/%s" alt="%s" /><br />%s</a>',
_('Refresh all expanded containers for'),$ldapserver->name,htmlspecialchars($href),IMGDIR,'refresh-big.png',_('refresh'),_('refresh'));
}
protected function get_info_menu_item() {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=server_info&server_id=%s',$ldapserver->server_id);
return sprintf('<a title="%s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('View server-supplied information'),htmlspecialchars($href),'images/info.png',_('info'),_('info'));
return sprintf('<a title="%s" href="%s"><img src="%s/%s" alt="%s" /><br />%s</a>',
_('View server-supplied information'),htmlspecialchars($href),IMGDIR,'info.png',_('info'),_('info'));
}
protected function get_import_menu_item() {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=ldif_import_form&server_id=%s',$ldapserver->server_id);
return sprintf('<a title="%s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('Import entries from an LDIF file'),htmlspecialchars($href),'images/import.png',_('import'),_('import'));
return sprintf('<a title="%s" href="%s"><img src="%s/%s" alt="%s" /><br />%s</a>',
_('Import entries from an LDIF file'),htmlspecialchars($href),IMGDIR,'import.png',_('import'),_('import'));
}
protected function get_export_menu_item() {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=export_form&server_id=%s',$ldapserver->server_id);
return sprintf('<a title="%s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('Export entries'),htmlspecialchars($href),'images/export.png',_('export'),_('export'));
return sprintf('<a title="%s" href="%s"><img src="%s/%s" alt="%s" /><br />%s</a>',
_('Export entries'),htmlspecialchars($href),IMGDIR,'export.png',_('export'),_('export'));
}
protected function get_logout_menu_item() {
$ldapserver = $this->getLdapServer();
$href = sprintf('cmd.php?cmd=logout&server_id=%s',$ldapserver->server_id);
return sprintf('<a title="%s" href="%s"><img src="%s" alt="%s" /><br />%s</a>',
_('Logout of this server'),htmlspecialchars($href),'images/logout.png',_('logout'),_('logout'));
return sprintf('<a title="%s" href="%s"><img src="%s/%s" alt="%s" /><br />%s</a>',
_('Logout of this server'),htmlspecialchars($href),IMGDIR,'logout.png',_('logout'),_('logout'));
}
protected function draw_logged_in_dn() {
$ldapserver = $this->getLdapServer();
$logged_in_dn = $ldapserver->getLoggedInDN();
printf('<tr><td class="spacer"></td><td class="links" colspan="%s"><span style="white-space: nowrap;">%s%s ',$this->getDepth()+3-1,_('Logged in as'),_(':'));
printf('<tr><td class="spacer"></td><td class="logged_in" colspan="%s">%s%s ',$this->getDepth()+3-1,_('Logged in as'),_(':'));
if ($ldapserver->getDNBase($logged_in_dn) == $logged_in_dn) {
$logged_in_branch = '';
@@ -294,7 +300,7 @@ class HTMLTree extends Tree {
if (strcasecmp('anonymous',$logged_in_dn)) {
foreach ($logged_in_dn_array as $rdn_piece) {
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$ldapserver->server_id,rawurlencode($rdn));
printf('<a class="logged_in_dn" href="%s">%s</a>',htmlspecialchars($href),pretty_print_dn($rdn_piece));
printf('<a href="%s">%s</a>',htmlspecialchars($href),pretty_print_dn($rdn_piece));
if ($rdn_piece != end($logged_in_dn_array))
echo ',';
@@ -306,7 +312,7 @@ class HTMLTree extends Tree {
echo 'Anonymous';
}
echo '</span></td></tr>';
echo '</td></tr>';
}
/**
@@ -333,10 +339,10 @@ class HTMLTree extends Tree {
$href['expand'] = sprintf('cmd.php?cmd=expand&server_id=%s&amp;dn=%s',$ldapserver->server_id,$encoded_dn);
$href['collapse'] = sprintf('cmd.php?cmd=collapse&server_id=%s&amp;dn=%s',$ldapserver->server_id,$encoded_dn);
$href['edit'] = sprintf('cmd.php?cmd=template_engine&server_id=%s&amp;dn=%s',$ldapserver->server_id,$encoded_dn);
$img_src = sprintf('images/%s',$dnEntry->getIcon($ldapserver));
$img_src = sprintf('%s/%s',IMGDIR,$dnEntry->getIcon($ldapserver));
$rdn = get_rdn($dn);
echo '<tr>';
echo '<tr class="option">';
$colspan = $this->getDepth()+3+$level+1;
for ($i=0;$i<=$level;$i++) {
@@ -357,15 +363,15 @@ class HTMLTree extends Tree {
# Is this node expanded? (deciding whether to draw "+" or "-")
if ($dnEntry->isOpened()) {
if (!$child_count && !$ldapserver->isShowCreateEnabled()) {
echo '<td class="expander"><img src="images/minus.png" alt="-" /></td>';
printf('<td class="expander"><img src="%s/minus.png" alt="-" /></td>',IMGDIR);
} else {
printf('<td class="expander"><a href="%s"><img src="images/minus.png" alt="-" /></a></td>',$href['collapse']);
printf('<td class="expander"><a href="%s"><img src="%s/minus.png" alt="-" /></a></td>',$href['collapse'],IMGDIR);
}
} else {
if (($child_count !== false) && (!$child_count) && (!$ldapserver->isShowCreateEnabled())) {
echo '<td class="expander"><img src="images/minus.png" alt="-" /></td>';
printf('<td class="expander"><img src="%s/minus.png" alt="-" /></td>',IMGDIR);
} else {
printf('<td class="expander"><a href="%s"><img src="images/plus.png" alt="+" /></a></td>',$href['expand']);
printf('<td class="expander"><a href="%s"><img src="%s/plus.png" alt="+" /></a></td>',$href['expand'],IMGDIR);
}
}
$colspan--;
@@ -373,7 +379,7 @@ class HTMLTree extends Tree {
printf('<td class="icon"><a href="%s" name="%s_%s"><img src="%s" alt="img" /></a></td>',$href['edit'],$ldapserver->server_id,$encoded_dn,$img_src);
$colspan--;
printf('<td class="rdn" colspan="%s" width=100%%><span style="white-space: nowrap;">',$colspan);
printf('<td class="logged_in" colspan="%s" width=100%%><span style="white-space: nowrap;">',$colspan);
printf('<a href="%s">%s</a>',$href['edit'],$this->get_formatted_dn($dnEntry,$level));
if ($child_count)
@@ -453,8 +459,8 @@ class HTMLTree extends Tree {
echo '<td class="spacer"></td>';
echo '<td class="spacer"></td>';
printf('<td class="icon"><a href="%s"><img src="images/star.png" alt="%s" /></a></td>',$href,_('new'));
printf('<td class="create" colspan="%s"><a href="%s" title="%s %s">%s</a></td>',
printf('<td class="icon"><a href="%s"><img src="%s/star.png" alt="%s" /></a></td>',$href,IMGDIR,_('new'));
printf('<td class="link" colspan="%s"><a href="%s" title="%s %s">%s</a></td>',
$this->getDepth()+3-$level-1-3,$href,_('Create a new entry in'),$rdn,_('Create new entry here'));
echo '</tr>';
}
@@ -467,9 +473,9 @@ class HTMLTree extends Tree {
$href = htmlspecialchars(
sprintf('cmd.php?cmd=%s&server_id=%s',get_custom_file($ldapserver->server_id,'login_form',''),$ldapserver->server_id));
echo '<tr><td class="spacer"></td>';
printf('<td class="icon"><a href="%s"><img src="images/uid.png" alt="%s" /></a></td>',$href,_('login'));
printf('<td class="rdn" colspan="%s"><a href="%s">%s</a></td>',$this->getDepth()+3-2,$href,_('Login').'...');
echo '<tr class="option"><td class="spacer"></td>';
printf('<td class="icon"><a href="%s"><img src="%s/uid.png" alt="%s" /></a></td>',$href,IMGDIR,_('login'));
printf('<td class="logged_in" colspan="%s"><a href="%s">%s</a></td>',$this->getDepth()+3-2,$href,_('Login').'...');
echo '</tr>';
printf('<tr><td class="blank" colspan="%s">&nbsp;</td>',$this->getDepth()+3);
@@ -484,7 +490,7 @@ class HTMLTree extends Tree {
protected function draw_logout_link() {
$ldapserver = $this->getLdapServer();
if ($ldapserver->auth_type != 'config') {
if (! in_array($ldapserver->auth_type,array('config','http'))) {
printf('<tr><td class="spacer"></td><td colspan="%s"><small><a href="cmd.php?cmd=%s&server_id=%s">%s</a></small></td></tr>',
$this->getDepth()+3-1,get_custom_file($ldapserver->server_id,'logout',''),$ldapserver->server_id,_('logout'));
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/PLMTree.php,v 1.2 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/PLMTree.php,v 1.2.2.1 2008/11/29 11:33:53 wurley Exp $
require HTDOCDIR.JSDIR.'phplayersmenu/lib/PHPLIB.php';
require HTDOCDIR.JSDIR.'phplayersmenu/lib/layersmenu-common.inc.php';
@@ -41,8 +41,8 @@ class PLMTree extends HTMLTree {
if (! isset($tm)) {
$tm = new TreeMenu();
$tm->setDirroot(JSDIR.'phplayersmenu/');
$tm->setIcondir(HTDOCDIR.'/images/');
$tm->setIconwww('images/');
$tm->setIcondir(IMGDIR);
$tm->setIconwww(IMGDIR);
$tm->setImgwww(JSDIR.'phplayersmenu/menuimages/');
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateCreatingEntry.php,v 1.3.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateCreatingEntry.php,v 1.3.2.2 2008/11/28 12:50:20 wurley Exp $
/**
* @package phpLDAPadmin
@@ -66,7 +66,10 @@ class TemplateCreatingEntry extends DefaultCreatingEntry {
}
public function hasDefaultTemplate() {
return $this->default_template;
if ($_SESSION[APPCONFIG]->GetValue('appearance','disable_default_template'))
return false;
else
return $this->default_template;
}
public function getAttributes() {

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateEditingEntry.php,v 1.3.2.2 2007/12/29 08:24:11 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/TemplateEditingEntry.php,v 1.3.2.4 2008/11/28 12:50:20 wurley Exp $
/**
* @package phpLDAPadmin
@@ -19,7 +19,7 @@ class TemplateEditingEntry extends DefaultEditingEntry {
parent::__construct($dn);
$this->templates = array();
$this->valid = false;
$this->default_template = false;
$this->default_template = true;
$this->selected_template = '';
}
@@ -81,7 +81,10 @@ class TemplateEditingEntry extends DefaultEditingEntry {
}
public function hasDefaultTemplate() {
return $this->default_template;
if ($_SESSION[APPCONFIG]->GetValue('appearance','disable_default_template'))
return false;
else
return $this->default_template;
}
public function getAttributes() {
@@ -105,12 +108,22 @@ class TemplateEditingEntry extends DefaultEditingEntry {
$int_attrs_vals = $ldapserver->getDNSysAttrs($this->getDn());
if (! $int_attrs_vals) $attrs_vals = array();
elseif (! is_array($int_attrs_vals)) $int_attrs_vals = array($attrs_vals);
elseif (! is_array($int_attrs_vals)) $int_attrs_vals = array($int_attrs_vals);
$custom_int_attrs_vals = $ldapserver->getCustomDNSysAttrs($this->getDn());
if (! $custom_int_attrs_vals) $attrs_vals = array();
elseif (! is_array($custom_int_attrs_vals)) $custom_int_attrs_vals = array($custom_int_attrs_vals);
$attrs_vals = $ldapserver->getDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
if (! $attrs_vals) $attrs_vals = array();
elseif (! is_array($attrs_vals)) $attrs_vals = array($attrs_vals);
$custom_attrs_vals = $ldapserver->getCustomDNAttrs($this->getDn(),false,$_SESSION[APPCONFIG]->GetValue('deref','view'));
if (! $custom_attrs_vals) $attrs_vals = array();
elseif (! is_array($custom_attrs_vals)) $custom_attrs_vals = array($custom_attrs_vals);
$int_attrs_vals = array_merge($int_attrs_vals,$custom_int_attrs_vals);
$attrs_vals = array_merge($attrs_vals,$custom_attrs_vals);
$attrs_vals = array_merge($attrs_vals,$int_attrs_vals);
$selected_tmpl = isset($this->templates[$this->selected_template])

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Tree.php,v 1.2.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/Tree.php,v 1.2.2.2 2008/01/27 07:23:43 wurley Exp $
/**
* @package phpLDAPadmin
@@ -127,7 +127,7 @@ abstract class Tree {
debug_log('New ENTRY (%s) for (%s).',64,__FILE__,__LINE__,__METHOD__,$dnlower,$dn);
$this->entries[$dnlower] = $entry_factory->newEditingEntry($dn);
$this->entries[$dnlower]->setTree($this);
$this->entries[$dnlower]->setTree($ldapserver->server_id);
if ($ldapserver->isReadOnly())
$this->entries[$dnlower]->setReadOnly();

View File

@@ -12,12 +12,15 @@
*/
class Visitor {
public function __call($method,$args) {
$methods = array();
$class = '';
$fnct = '';
$a0 = isset($args[0]) ? $args[0] : '';
for ($i = 0; $i < strlen($a0); $i++) {
if ($class) {
if ($a0[$i] != ':') $fnct .= $a0[$i];
} else {
if ($a0[$i] != ':') {
$fnct .= $a0[$i];
@@ -42,11 +45,20 @@ class Visitor {
$c = $class;
$call = "$method$class$fnct";
while ($class && !method_exists($this,$call)) {
array_push($methods,$call);
while ($class && ! method_exists($this,$call)) {
$class = get_parent_class($class);
$call = "$method$class$fnct";
array_push($methods,$call);
}
if (defined('TMPDEBUG') && TMPDEBUG)
printf('<font size=-2><i>Calling Methods: %s</i></font><br >',join('|',$methods));
if (defined('TMPDEBUG') && TMPDEBUG && method_exists($this,$call))
printf('<font size=-2><b>Invoking Method: %s::%s</b></font><br >',get_class($this),$call);
if ($class) {
$call .= '($obj';
for ($i = 2; $i < count($args); $i++) {

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/blowfish.php,v 1.4 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/blowfish.php,v 1.4.2.1 2008/12/12 12:20:22 wurley Exp $
/**
* The Cipher_blowfish:: class implements the Cipher interface enryption data
@@ -13,7 +13,7 @@
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*
* @author Mike Cochrane <mike@graftonhall.co.nz>
* @version $Revision: 1.4 $
* @version $Revision: 1.4.2.1 $
* @since Horde 2.2
* @package horde.cipher
*/
@@ -440,9 +440,9 @@ class Horde_Cipher_blowfish {
$unpack = unpack('N*', $block);
if (! is_array($unpack))
pla_error(
error(
sprintf('BLOWFISH: decryptBock()<br>We expected unpack to produce an array, but instead it produced [%s]. This function was entered with (%s,%s). If you think that this is a bug, then please tell the PLA developers how you got here. You are using PLA [%s,%s]',
serialize($unpack),rawurlencode($block),$key,pla_version(),phpversion()));
serialize($unpack),rawurlencode($block),$key,pla_version(),phpversion()),'error','index.php');
list($L, $R) = array_values($unpack);

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.80.2.8 2008/01/04 12:33:03 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/common.php,v 1.80.2.17 2008/12/13 08:57:09 wurley Exp $
/**
* Contains code to be executed at the top of each application page.
@@ -26,7 +26,9 @@ if (! defined('APPCONFIG'))
*/
$app['direct_scripts'] = array('cmd.php','index.php',
'view_jpeg_photo.php','entry_chooser.php',
'password_checker.php','download_binary_attr.php');
'password_checker.php','download_binary_attr.php',
'unserialize.php'
);
foreach ($app['direct_scripts'] as $script) {
$scriptOK = false;
@@ -132,20 +134,35 @@ error_reporting(E_ALL);
# Start our session.
pla_session_start();
# Initialise the hooks
require_once LIBDIR.'hooks.php';
# If we get here, and $_SESSION[APPCONFIG] is not set, then redirect the user to the index.
if (! isset($_SESSION[APPCONFIG])) {
if (isset($_REQUEST['server_id']))
header(sprintf('Location: index.php?server_id=%s',$_REQUEST['server_id']));
else
header('Location: index.php');
header(sprintf('Location: index.php?URI=%s',base64_encode($_SERVER['QUERY_STRING'])));
die();
} else {
# SF Bug #1903987
if (! method_exists($_SESSION[APPCONFIG],'CheckCustom'))
error('Unknown situation, $_SESSION[APPCONFIG] exists, but method CheckCustom() does not','error',null,true,true);
# Check our custom variables.
# @todo: Change this so that we dont process a cached session.
$_SESSION[APPCONFIG]->CheckCustom();
}
# Check for safe mode.
if (ini_get('safe_mode') && ! get_request('cmd','GET'))
system_message(array(
'title'=>_('PHP Safe Mode'),
'body'=>_('You have PHP Safe Mode enabled. PLA may work unexpectedly in Safe Mode.'),
'type'=>'info'));
# Set our timezone, if it is specified in config.php
if ($_SESSION[APPCONFIG]->GetValue('appearance','timezone'))
date_default_timezone_set($_SESSION[APPCONFIG]->GetValue('appearance','timezone'));
# If we are here, $_SESSION is set - so enabled DEBUGing if it has been configured.
if (($_SESSION[APPCONFIG]->GetValue('debug','syslog') || $_SESSION[APPCONFIG]->GetValue('debug','file'))
&& $_SESSION[APPCONFIG]->GetValue('debug','level'))
@@ -159,11 +176,11 @@ if (DEBUG_ENABLED)
# Set our PHP timelimit.
if ($_SESSION[APPCONFIG]->GetValue('session','timelimit'))
set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit'));
@set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit'));
# If debug mode is set, increase the time_limit, since we probably need it.
if (DEBUG_ENABLED && $_SESSION[APPCONFIG]->GetValue('session','timelimit'))
set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit') * 5);
@set_time_limit($_SESSION[APPCONFIG]->GetValue('session','timelimit') * 5);
/**
* Language configuration. Auto or specified?
@@ -200,7 +217,7 @@ if ($language == 'auto') {
(file_exists($language_dir) && is_readable($language_dir))) {
# 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
bindtextdomain('messages',LANGDIR);
@@ -221,7 +238,7 @@ if ($language == 'auto') {
$language = 'en_GB';
# 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
bindtextdomain('messages',LANGDIR);
@@ -257,16 +274,23 @@ if (isset($_REQUEST['server_id'])) {
* Look/evaluate our timeout
*/
if (isset($ldapserver) && is_object($ldapserver) && method_exists($ldapserver,'haveAuthInfo')) {
if ($ldapserver->haveAuthInfo() && isset($ldapserver->auth_type) && $ldapserver->auth_type != 'config') {
if ($ldapserver->haveAuthInfo() && isset($ldapserver->auth_type) && ! in_array($ldapserver->auth_type,array('config','http'))) {
/**
* If time out value has been reached:
* - log out user
* - put $server_id in array of recently timed out servers
*/
if (function_exists('session_timed_out') && session_timed_out($ldapserver)) {
$app['url_timeout'] = sprintf('cmd.php?cmd=timeout&server_id=%s',$_REQUEST['server_id']);
printf('<script type="text/javascript" language="javascript">location.href=\'%s\'</script>',
htmlspecialchars($app['url_timeout']));
# If $session_timeout not defined, use ( session_cache_expire() - 1 )
$session_timeout = $ldapserver->session_timeout ? $ldapserver->session_timeout : session_cache_expire()-1;
system_message(array(
'title'=>_('Session Timed Out'),
'body'=>sprintf('%s %s %s',
_('Your Session timed out after'),$session_timeout,
_('min. of inactivity. You have been automatically logged out.')),
'type'=>'info'),'index.php');
die();
}
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.27.2.5 2008/01/10 12:29:21 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/config_default.php,v 1.27.2.9 2008/12/12 12:20:22 wurley Exp $
/**
* Configuration processing and defaults.
@@ -84,10 +84,18 @@ class Config {
'desc'=>'Array of attributes that should show a the time when showing the jscalendar',
'default'=>array(''));
$this->default->appearance['disable_default_template'] = array(
'desc'=>'Disabled the Default Template',
'default'=>false);
$this->default->appearance['hide_debug_info'] = array(
'desc'=>'Hide the features that may provide sensitive debugging information to the browser',
'default'=>true);
$this->default->appearance['timezone'] = array(
'desc'=>'Define our timezone, if not defined in php.ini',
'default'=>null);
/** Language
* The language setting. If you set this to 'auto', phpLDAPadmin will
* attempt to determine your language automatically. Otherwise, available
@@ -189,9 +197,13 @@ class Config {
'desc'=>'LDAP attribute to show in the tree',
'default'=>'%rdn');
$this->default->appearance['tree_height'] = array(
'desc'=>'Pixel height of the tree browser',
'default'=>null);
$this->default->appearance['tree_width'] = array(
'desc'=>'Pixel width of the left frame view (tree browser)',
'default'=>320);
'desc'=>'Pixel width of the tree browser',
'default'=>null);
/**
* Tree display filter
@@ -316,7 +328,7 @@ class Config {
'default'=>null);
$this->default->debug['addr'] = array(
'desc'=>'IP address of PLA client to provide debugging info.',
'desc'=>'IP address of client to provide debugging info.',
'default'=>null);
$this->default->debug['append'] = array(
@@ -500,10 +512,10 @@ class Config {
if (! isset($config[$key]))
error(sprintf('A call was made in [%s] to GetValue requesting [%s] that isnt predefined.',
basename($_SERVER['PHP_SELF']),$key));
basename($_SERVER['PHP_SELF']),$key),'error',null,true);
if (! isset($config[$key][$index]))
error("Requesting a index [$index] that isnt predefined.");
error(sprintf('Requesting an index [%s] in key [%s] that isnt predefined.',$index,$key),'error',null,true);
return isset($config[$key][$index]['value']) ? $config[$key][$index]['value'] : $config[$key][$index]['default'];
}
@@ -518,23 +530,23 @@ class Config {
if (isset($this->default->$masterkey)) {
if (! is_array($masterdetails))
error("Error in configuration file, [$masterdetails] should be an ARRAY.");
error(sprintf('Error in configuration file, [%s] should be an ARRAY.',$masterdetails),'error',null,true);
foreach ($masterdetails as $key => $value) {
# Test that the key is correct.
if (! in_array($key,array_keys($this->default->$masterkey)))
error("Error in configuration file, [$key] has not been defined as a PLA configurable variable.");
error(sprintf('Error in configuration file, [%s] has not been defined as a configurable variable.',$key),'error',null,true);
# Test if its should be an array or not.
if (is_array($this->default->{$masterkey}[$key]['default']) && ! is_array($value))
error("Error in configuration file, {$masterkey}['$key'] SHOULD be an array of values.");
error(sprintf('Error in configuration file, %s[\'%s\'] SHOULD be an array of values.',$masterkey,$key),'error',null,true);
if (! is_array($this->default->{$masterkey}[$key]['default']) && is_array($value))
error("Error in configuration file, {$masterkey}['$key'] should NOT be an array of values.");
error(sprintf('Error in configuration file, %s[\'%s\'] should NOT be an array of values.',$masterkey,$key),'error',null,true);
}
} else {
error("Error in configuration file, [$masterkey] has not been defined as a PLA MASTER configurable variable.");
error(sprintf('Error in configuration file, [%s] has not been defined as a MASTER configurable variable.',$masterkey),'error',null,true);
}
}
}

View File

@@ -1,6 +1,6 @@
<?php
/*
$Id: createlm.php,v 1.4.2.1 2007/12/21 12:11:55 wurley Exp $
$Id: createlm.php,v 1.4.2.2 2009/01/05 14:35:23 wurley Exp $
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2004 - 2006 Roland Gruber
@@ -327,7 +327,7 @@ var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5
* @return string hash value
*/
function nthash($password = "") {
return strtoupper(bin2hex(hash('md4', iconv("UTF-8","UTF-16LE",$password),true)));
return strtoupper(bin2hex(mhash(MHASH_MD4,iconv('UTF-8','UTF-16LE',$password))));
}
/**

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/emuhash_functions.php,v 1.6.10.1 2007/12/21 12:11:55 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/emuhash_functions.php,v 1.6.10.2 2008/12/12 12:20:23 wurley Exp $
/*******************************************************************************
* emuhash - partly emulates the php mhash functions
@@ -64,7 +64,7 @@ if( ! function_exists( 'mhash' ) && ! function_exists( 'mhash_keygen_s2k' ) ) {
$pwhandle = fopen( $tmpfile, "w" );
if( ! $pwhandle )
pla_error( "Unable to create a temporary file '$tmpfile' to create hashed password" );
error(sprintf('Unable to create a temporary file %s to create hashed password',$tmpfile) ,'error','index.php');
fwrite( $pwhandle, $password_clear );
fclose( $pwhandle );

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.36.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/export_functions.php,v 1.36.2.2 2008/12/12 12:20:23 wurley Exp $
/**
* Fuctions and classes for exporting ldap entries to others formats
@@ -249,8 +249,10 @@ class PlaLdapExporter extends PlaAbstractExporter {
# if no result, there is a something wrong
if (! $this->results && $this->ldap_info->ldapserver->errno())
pla_error(_('Encountered an error while performing search.'),$this->ldap_info->ldapserver->error(),
$this->ldap_info->ldapserver->errno());
system_message(array(
'title'=>_('Encountered an error while performing search.'),
'body'=>ldap_error_msg($this->ldap_info->ldapserver->error(),$this->ldap_info->ldapserver->errno()),
'type'=>'error'));
usort($this->results,'pla_compare_dns');
$this->num_entries = count($this->results);

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.303.2.21 2008/01/10 12:30:13 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/functions.php,v 1.303.2.41 2008/12/12 12:52:26 wurley Exp $
/**
* A collection of common generic functions used throughout the application.
@@ -37,8 +37,6 @@ $app['function_files'] = array(
LIBDIR.'template_functions.php',
# Functions for hashing passwords with OpenSSL binary (only if mhash not present)
LIBDIR.'emuhash_functions.php',
# Functions for running various hooks
LIBDIR.'hooks.php',
# Functions for creating Samba passwords
LIBDIR.'createlm.php',
# Functions for timeout and automatic logout feature
@@ -66,6 +64,15 @@ function __autoload($className) {
'type'=>'error'));
}
/**
* If gettext is not installed, we will emulate it here.
*/
if (! function_exists('_')) {
function _($msg) {
return $msg;
}
}
/**
* Generic Utility Functions
*/
@@ -151,7 +158,7 @@ function pla_error_handler($errno,$errstr,$file,$lineno) {
}
# If this is a more serious error, call the error call.
error(sprintf('%s: %s',$errtype,$errstr),'error',-1,true,true);
error(sprintf('%s: %s',$errtype,$errstr),'error',null,true,true);
}
/**
@@ -161,6 +168,11 @@ function pla_error_handler($errno,$errstr,$file,$lineno) {
* @return string The current version as read from the VERSION file.
*/
function pla_version() {
static $return = null;
if ($return)
return $return;
$version_file = realpath(LIBDIR.'../VERSION');
if (! file_exists($version_file))
$return = 'UNKNOWN';
@@ -223,35 +235,14 @@ function check_config($config_file) {
# Make sure their PHP version is current enough
if (strcmp(phpversion(),REQUIRED_PHP_VERSION) < 0)
pla_error(sprintf('phpLDAPadmin requires PHP version %s or greater.<br /><small>(You are using %s)</small>',
REQUIRED_PHP_VERSION,phpversion()));
# Make sure this PHP install has all our required extensions
if (! extension_loaded('ldap'))
system_message(array(
'title'=>_('Missing required extension'),
'body'=> 'Your install of PHP appears to be missing LDAP support.<br /><br />Please install LDAP support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small>',
'type'=>'error'));
# Make sure that we have php-xml loaded.
if (! function_exists('xml_parser_create'))
system_message(array(
'title'=>_('Missing required extension'),
'body'=> 'Your install of PHP appears to be missing XML support.<br /><br />Please install XML support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small>',
'type'=>'error'));
# Make sure their session save path is writable, if they are using a file system session module, that is.
if (! strcasecmp('Files',session_module_name() && ! is_writable(realpath(session_save_path()))))
system_message(array(
'title'=>_('Missing required extension'),
'body'=> 'Your PHP session configuration is incorrect. Please check the value of session.save_path in your php.ini to ensure that the directory specified there exists and is writable. The current setting of "'.session_save_path().'" is un-writable by the web server.',
'title'=>_('Incorrect version of PHP'),
'body'=>sprintf('phpLDAPadmin requires PHP version %s or greater.<br /><small>(You are using %s)</small>',
REQUIRED_PHP_VERSION,phpversion()),
'type'=>'error'));
$config = new Config;
/* Check for syntax errors in config.php
As of php 4.3.5, this NO longer catches fatal errors :( */
ob_start();
require $config_file;
$str = '';
@@ -272,48 +263,41 @@ function check_config($config_file) {
$file = file($config_file);
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"'."\n";
echo ' "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">'."\n";
echo "\n";
$body = '<h3 class="title">Config file ERROR</h3>';
$body .= sprintf('<h3 class="subtitle">%s (%s) on line %s</h3>',$error_type,$error,$line_num);
echo '<html>';
echo '<head>';
echo '<title>phpLDAPadmin Config File Error</title>';
echo '<link type="text/css" rel="stylesheet" href="css/style.css" />';
echo '</head>';
$body .= '<center>';
$body .= sprintf('Looks like your config file has an ERROR on line %s.<br />',$line_num);
$body .= 'Here is a snippet around that line <br />';
$body .= '<br />'."\n";
echo '<body>';
echo '<h3 class="title">Config File ERROR</h3>';
printf('<h3 class="subtitle">%s (%s) on line %s</h3>',$error_type,$error,$line_num);
echo '<center>';
printf('Looks like your config file has an ERROR on line %s.<br />',$line_num);
echo 'Here is a snippet around that line <br />';
echo '<br />'."\n";
echo '<div style="text-align: left; font-family: monospace; margin-left: 80px; margin-right: 80px; border: 1px solid black; padding: 10px;">';
$body .= '<div style="text-align: left; font-family: monospace; margin-left: 80px; margin-right: 80px; border: 1px solid black; padding: 10px;">';
for ($i = $line_num-9; $i<$line_num+5; $i++) {
if ($i+1 == $line_num)
echo '<div style="color:red;background:#fdd">';
$body .= '<div style="color:red;background:#fdd">';
if ($i < 0)
continue;
printf('<b>%s</b>: %s<br />',$i+1,htmlspecialchars($file[$i]));
$body .= sprintf('<b>%s</b>: %s<br />',$i+1,htmlspecialchars($file[$i]));
if ($i+1 == $line_num)
echo '</div>';
$body .= '</div>';
}
echo '</div>';
echo '<br />';
echo 'Hint: Sometimes these errors are caused by lines <b>preceding</b> the line reported.';
echo '</center>';
echo '</body>';
echo '</html>';
$body .= '</div>';
$body .= '<br />';
$body .= 'Hint: Sometimes these errors are caused by lines <b>preceding</b> the line reported.';
$body .= '</center>';
return false;
$block = new block();
$block->SetBody($body);
$www['page'] = new page();
$www['page']->block_add('body',$block);
$www['page']->display();
die();
}
}
@@ -360,19 +344,19 @@ function check_config($config_file) {
*/
function cmd_control_pane() {
return array(
'home'=>array('link'=>sprintf('<a href="cmd.php?cmd=welcome" title="%s"><img src="images/home-big.png" alt="%s" /><br />%s</a>',_('Home'),_('Home'),_('Home'))),
'purge'=>array('link'=>sprintf('<a href="cmd.php?cmd=purge_cache" title="%s"><img src="images/trash-big.png" alt="%s" /><br />%s</a>',
_('Purge caches'),_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'))),
'external_links:feature'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="images/request-feature.png" alt="%s" /><br />%s</a>',
get_href('add_rfe'),_('Request feature'),_('light'),_('Request feature'))),
'external_links:bug'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="images/bug-big.png" alt="%s" /><br />%s</a>',
get_href('add_bug'),_('Report a bug'),_('bug'),_('Report a bug'))),
'external_links:donation'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="images/smile-big.png" alt="%s" /><br />%s</a>',
get_href('donate'),_('Donate'),_('Donate'),_('Donate'))),
'appearance:hide_debug_info'=>array('link'=>sprintf('<a href="cmd.php?cmd=show_cache" title="%s"><img src="images/debug-cache.png" alt="%s" /><br />%s</a>',
_('Show Cache'),_('Show Cache'),_('Show Cache'))),
'external_links:help'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="images/help-big.png" alt="%s" /><br />%s</a>',
get_href('documentation'),_('Help'),_('Help'),_('Help')))
'home'=>array('link'=>sprintf('<a href="cmd.php?cmd=welcome" title="%s"><img src="%s/home-big.png" alt="%s" /><br />%s</a>',_('Home'),IMGDIR,_('Home'),_('Home'))),
'purge'=>array('link'=>sprintf('<a href="cmd.php?cmd=purge_cache" title="%s"><img src="%s/trash-big.png" alt="%s" /><br />%s</a>',
_('Purge caches'),IMGDIR,_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'))),
'external_links:feature'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="%s/request-feature.png" alt="%s" /><br />%s</a>',
get_href('add_rfe'),_('Request feature'),IMGDIR,_('light'),_('Request feature'))),
'external_links:bug'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="%s/bug-big.png" alt="%s" /><br />%s</a>',
get_href('add_bug'),_('Report a bug'),IMGDIR,_('bug'),_('Report a bug'))),
'external_links:donation'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="%s/smile-big.png" alt="%s" /><br />%s</a>',
get_href('donate'),_('Donate'),IMGDIR,_('Donate'),_('Donate'))),
'appearance:hide_debug_info'=>array('link'=>sprintf('<a href="cmd.php?cmd=show_cache" title="%s"><img src="%s/debug-cache.png" alt="%s" /><br />%s</a>',
_('Show Cache'),IMGDIR,_('Show Cache'),_('Show Cache'))),
'external_links:help'=>array('link'=>sprintf('<a href="%s" target="new" title="%s"><img src="%s/help-big.png" alt="%s" /><br />%s</a>',
get_href('documentation'),_('Help'),IMGDIR,_('Help'),_('Help')))
);
}
@@ -396,6 +380,14 @@ function debug_dump($variable,$die=false,$onlydebugaddr=false) {
die();
}
/**
* This function generates a backtrace
* @param boolean Whether to stop execution or not.
*/
function debug_dump_backtrace($msg='Calling BackTrace',$die=false) {
error($msg,'note',null,$die,true);
}
/**
* Debug Logging to Syslog
*
@@ -505,7 +497,7 @@ function debug_log($msg,$level=0) {
/**
* Display an error message in the system message panel of the page.
*/
function error($msg,$type='note',$fatal=false,$backtrace=false) {
function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) {
global $www;
global $counter;
@@ -515,9 +507,12 @@ function error($msg,$type='note',$fatal=false,$backtrace=false) {
# if the error is fatal, we'll need to stop here.
if (! isset($www['page']))
$www['page'] = new page(null);
$www['page'] = new page();
$www['page']->setsysmsg(array('title'=>_('Error'),'body'=>$msg,'type'=>$type));
if ($fatal)
$www['page']->setsysmsg(array('title'=>_('Error'),'body'=>$msg,'type'=>$type));
else
system_message(array('title'=>_('Error'),'body'=>$msg,'type'=>$type),$redirect);
# Spin loop detection
if ($counter++ > 20) {
@@ -530,26 +525,35 @@ function error($msg,$type='note',$fatal=false,$backtrace=false) {
$backtraceblock = new block();
$backtraceblock->SetTitle('PHP Debug Backtrace');
$body = '<table class="search_result_table">';
$body = '<table class="result_table">';
$body .= "\n";
foreach (debug_backtrace() as $error => $line) {
$body .= sprintf('<tr class="hightlight"><td colspan="2"><b><small>%s</small></b></td><td>%s (%s)</td></tr>',
_('File'),isset($line['file']) ? $line['file'] : '',isset($line['line']) ? $line['line'] : '');
foreach (debug_backtrace() as $error => $line) {
$_SESSION['backtrace'][$error]['file'] = $line['file'];
$_SESSION['backtrace'][$error]['line'] = $line['line'];
$body .= sprintf('<tr class="hightlight"><td colspan="2"><b><small>%s</small></b></td><td>%s (%s)</td></tr>',
_('File'),isset($line['file']) ? $line['file'] : $last['file'],isset($line['line']) ? $line['line'] : '');
$_SESSION['backtrace'][$error]['function'] = $line['function'];
$body .= sprintf('<tr><td>&nbsp;</td><td><b><small>%s</small></b></td><td><small>%s',
_('Function'),$line['function']);
if (isset($line['args']))
if (isset($line['args'])) {
$display = strlen(serialize($line['args'])) < 50 ? serialize($line['args']) : substr(serialize($line['args']),0,50).'...<TRUNCATED>';
$_SESSION['backtrace'][$error]['args'] = $line['args'];
if (file_exists(LIBDIR.'../tools/unserialize.php'))
$body .= sprintf('&nbsp;(<a href="%s?var=%s">%s</a>)',
'/tools/unserialize.php',
htmlspecialchars(serialize($line['args'])),
htmlspecialchars(serialize($line['args'])));
$body .= sprintf('&nbsp;(<a href="%s?index=%s" target="backtrace">%s</a>)',
'../tools/unserialize.php',$error,htmlspecialchars($display));
else
$body .= sprintf('&nbsp;(%s)',htmlspecialchars(serialize($line['args'])));
$body .= sprintf('&nbsp;(%s)',htmlspecialchars($display));
}
$body .= '</small></td></tr>';
$body .= "\n";
if ($line['file'])
$last['file'] = $line['file'];
}
$body .= '</table>';
$body .= "\n";
$backtraceblock->SetBody($body);
@@ -616,7 +620,16 @@ function system_message($msg,$redirect=null) {
$_SESSION['sysmsg'][] = $msg;
if (get_request('redirect','GET'))
debug_dump_backtrace('Redirect Loop Detected',true);
if ($redirect) {
if (preg_match('/\?/',$redirect))
$redirect .= '&';
else
$redirect .= '?';
$redirect .= 'redirect=true';
header("Location: $redirect");
die();
}
@@ -1156,17 +1169,17 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false
$base_dn = $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','search_base');
if (is_null($base_dn))
pla_error(sprintf(_('You specified the "auto_uid_number_mechanism" as "search" in your
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
"auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name));
"auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name),'error','index.php');
} else {
$base_dn = $startbase;
}
if (! $ldapserver->dnExists($base_dn))
pla_error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'),
$ldapserver->name));
error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'),
$ldapserver->name),'error','index.php');
$filter = '(|(uidNumber=*)(gidNumber=*))';
$results = array();
@@ -1177,12 +1190,13 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false
$_SESSION[APPCONFIG]->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));
error(sprintf(_('Unable to bind to <b>%s</b> with your with auto_uid credentials. Please check your configuration file.'),$ldapserver->name),
'error','index.php');
$search = $ldapserver->search($con,$base_dn,$filter,array('uidNumber','gidNumber'),'sub',false,$_SESSION[APPCONFIG]->GetValue('deref','search'));
if (! is_array($search))
pla_error('Untrapped error.');
error(_('Untrapped error.'),'error','index.php');
foreach ($search as $dn => $attrs) {
$attrs = array_change_key_case($attrs);
@@ -1205,7 +1219,7 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false
}
break;
default :
pla_error(sprintf('Unknown type [%s] in search',$type));
error(sprintf('Unknown type [%s] in search',$type),'error','index.php');
}
}
@@ -1241,13 +1255,15 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false
$_SESSION[APPCONFIG]->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));
error(sprintf(_('Unable to bind to <b>%s</b> with your with auto_uid credentials. Please check your configuration file.'),$ldapserver->name),
'error','index.php');
# assume that uidpool dn is set in config file if no filter given
if (empty($filter))
if (empty($filter)) {
$uidpool_dn = $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','uidpool_dn');
$filter = '(objectclass=*)';
else {
} else {
$filter = str_replace(array('&amp;',':::'),array('&',','),$filter);
$dns = $ldapserver->search($con,$startbase,$filter,array('dn'),'sub');
@@ -1256,10 +1272,10 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false
break;
case '0':
pla_error(_('Uidpool dn not found, please change filter parameter'));
error(_('Uidpool dn not found, please change filter parameter'),'error','index.php');
default:
pla_error(_('There is more than one dn for uidpool,please change filter parameter'));
error(_('There is more than one dn for uidpool,please change filter parameter'),'error','index.php');
}
list ($key,$attrs) = each($dns);
@@ -1267,31 +1283,38 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid',$increment=false
$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'));
# Check that the UIDPOOL DN exists.
if (empty($uidpool_dn) || (! $ldapserver->dnExists($uidpool_dn)))
error(_('uidpool_dn not found. Please check filter (arg 3) or set up uidpool_dn in config file'),'error','index.php');
$attrs = array($type);
$key = strtolower($type);
$realkey = $type;
switch ($type) {
case 'uid' : $attr = 'uidnumber';
break;
case 'gid' : $attr = 'gidnumber';
break;
default :
error(_('Unknown uidpool type.'),'error','index.php');
}
$number = $ldapserver->search($con,$uidpool_dn,$filter,$attrs,'base');
list($rkey,$number) = each($number);
$number = array_change_key_case($number);
$number = $number[$key];
$number = $ldapserver->search($con,$uidpool_dn,$filter,array($attr),'base');
$numbers = array_change_key_case($number[$uidpool_dn]);
if (isset($increment) && ($increment == 'true')) {
$updatedattr = array ($key => $number + 1);
if (! isset($numbers[$attr]))
error(_('A query on the uidpool_dn did return a valid uidNumber.'),'error','index.php');
else
if ($increment) {
$updatedattr = array($attr => $numbers[$attr] + 1);
$ldapserver->modify($uidpool_dn,$updatedattr);
}
return $number;
return $numbers[$attr];
break;
# No other cases allowed. The user has an error in the configuration
default :
pla_error( sprintf( _('You specified an invalid value for auto_uid_number_mechanism ("%s")
in your configration. Only "uidpool" and "search" are valid.
Please correct this problem.') , $mechanism) );
error(sprintf(_('You specified an invalid value for auto_uid_number_mechanism ("%s") in your configration. Only "uidpool" and "search" are valid.
Please correct this problem.'),$mechanism),'error','index.php');
}
}
@@ -1387,7 +1410,7 @@ function get_icon( $ldapserver, $dn ) {
$cval = explode( '=', $tmp[0], 2 );
$cval = isset( $cval[1] ) ? $cval[1] : false;
if( $cval && false === strpos( $cval, ".." ) &&
file_exists( realpath( sprintf("./images/countries/%s.png",strtolower($cval)) ) ) )
file_exists(realpath(sprintf('%s/countries/%s.png',IMGDIR,strtolower($cval)))))
return sprintf("countries/%s.png",strtolower($cval));
@@ -1739,56 +1762,28 @@ function support_oid_to_text($oid_id) {
}
/**
* Prints an HTML-formatted error string. If you specify the optional
* parameters $ldap_err_msg and $ldap_err_no, this function will
* lookup the error number and display a verbose message in addition
* to the message you pass it.
*
* @param string $msg The error message to display.
* @param string $ldap_err_msg (optional) The error message supplied by the LDAP server
* @param string $ldap_err_no (optional) The hexadecimal error number string supplied by the LDAP server
* @param bool $fatal (optional) If true, phpLDAPadmin will terminate execution with the PHP die() function.
*
* @see die
* @see ldap_errno
* @see pla_verbose_error
* Print an LDAP error message
*/
function pla_error($msg,$ldap_err_msg=null,$ldap_err_no=-1,$fatal=true) {
if (defined('DEBUG_ENABLED') && (DEBUG_ENABLED))
debug_log('Entered with (%s,%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,
$msg,$ldap_err_msg,$ldap_err_no,$fatal,$backtrace);
function ldap_error_msg($msg,$errnum) {
$body = '<table border=0>';
$title = '';
$errnum = ('0x'.str_pad(dechex($errnum),2,0,STR_PAD_LEFT));
$verbose_error = pla_verbose_error($errnum);
if (function_exists('syslog_err'))
syslog_err($msg);
$body .= sprintf('<tr><td><b>%s</b>:</td><td>%s</td></tr>',_('LDAP said'),htmlspecialchars($msg));
if ($ldap_err_msg)
$title = sprintf('<b>%s</b>: %s',_('LDAP said'),htmlspecialchars($ldap_err_msg));
if ($ldap_err_no != -1) {
$body = '<table>';
$ldap_err_no = ('0x'.str_pad(dechex($ldap_err_no),2,0,STR_PAD_LEFT));
$verbose_error = pla_verbose_error($ldap_err_no);
if ($verbose_error) {
$body .= sprintf('<tr><td colspan="2"><b>%s</b>: %s (%s)</td></tr>',_('Error number'),$ldap_err_no,$verbose_error['title']);
$body .= sprintf('<tr><td colspan="2"><b>%s</b>: %s</td></tr>',_('Description'),$verbose_error['desc']);
} else {
$body .= sprintf('<tr><td colspan="2"><b>%s</b>: %s</td></tr>',_('Error number'),$ldap_err_no);
$body .= sprintf('<tr><td colspan="2"><b>%s</b>: (%s)</td></tr>',_('Description'),_('no description available'));
}
$body .= '</table>';
if (function_exists('syslog_err'))
syslog_err(sprintf('%s %s',_('Error number'),$ldap_err_no));
if ($verbose_error) {
$body .= sprintf('<tr><td><b>%s</b>:</td><td>%s (%s)</td></tr>',_('Error number'),$errnum,$verbose_error['title']);
$body .= sprintf('<tr><td><b>%s</b>:</td><td>%s</td></tr>',_('Description'),$verbose_error['desc']);
} else {
$body = $msg;
$body .= sprintf('<tr><td><b>%s</b>:</td><td>%s</td></tr>',_('Error number'),$errnum);
$body .= sprintf('<tr><td><b>%s</b>:</td><td>(%s)</td></tr>',_('Description'),_('no description available'));
}
system_message(array('title'=>$title ? $title : 'Error','body'=>$body,'type'=>'error'),$fatal ? 'index.php' : null);
$body .= '</table>';
return $body;
}
/**
@@ -1839,7 +1834,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu
$jpeg_temp_dir = realpath($_SESSION[APPCONFIG]->GetValue('jpeg','tmpdir').'/');
if (! is_writable($jpeg_temp_dir))
pla_error(_('Please set $jpeg_temp_dir to a writable directory in the phpLDAPadmin config.php') );
error(_('Please set $jpeg_temp_dir to a writable directory in the phpLDAPadmin config.php'),'error','index.php');
if (! is_array($jpeg_data[$attr_name]))
$jpeg_data[$attr_name] = array($jpeg_data[$attr_name]);
@@ -1848,7 +1843,8 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu
$jpeg_filename = tempnam($jpeg_temp_dir.'/','pla');
$outjpeg = @fopen($jpeg_filename,'wb');
if (! $outjpeg)
pla_error(sprintf(_('Could not write to the $jpeg_temp_dir directory %s. Please verify that your web server can write files there.'),$jpeg_temp_dir));
error(sprintf(_('Could not write to the $jpeg_temp_dir directory %s. Please verify that your web server can write files there.'),$jpeg_temp_dir),
'error','index.php');
fwrite($outjpeg,$jpeg);
fclose ($outjpeg);
@@ -1909,7 +1905,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu
}
closedir($handle);
} else {
pla_error(sprintf('failed to open dir %s : permission denied', $jpeg_temp_dir), null, -1, false, false);
error(sprintf('failed to open dir %s : permission denied',$jpeg_temp_dir),'error');
}
}
@@ -1939,21 +1935,21 @@ function password_hash( $password_clear, $enc_type ) {
case 'ext_des':
// extended des crypt. see OpenBSD crypt man page.
if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 )
pla_error( _('Your system crypt library does not support extended DES encryption.') );
error(_('Your system crypt library does not support extended DES encryption.'),'error','index.php');
$new_value = '{CRYPT}' . crypt( $password_clear, '_' . random_salt(8) );
break;
case 'md5crypt':
if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 )
pla_error( _('Your system crypt library does not support md5crypt encryption.') );
error(_('Your system crypt library does not support md5crypt encryption.'),'error','index.php');
$new_value = '{CRYPT}' . crypt( $password_clear , '$1$' . random_salt(9) );
break;
case 'blowfish':
if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 )
pla_error( _('Your system crypt library does not support blowfish encryption.') );
error(_('Your system crypt library does not support blowfish encryption.'),'error','index.php');
// hardcoded to second blowfish version and set number of rounds
$new_value = '{CRYPT}' . crypt( $password_clear , '$2a$12$' . random_salt(13) );
@@ -1972,7 +1968,7 @@ function password_hash( $password_clear, $enc_type ) {
$new_value = '{SHA}' . base64_encode( mhash( MHASH_SHA1, $password_clear) );
} else {
pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') );
error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php');
}
break;
@@ -1983,7 +1979,7 @@ function password_hash( $password_clear, $enc_type ) {
$new_value = "{SSHA}".base64_encode( mhash( MHASH_SHA1, $password_clear.$salt ).$salt );
} else {
pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') );
error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php');
}
break;
@@ -1994,7 +1990,7 @@ function password_hash( $password_clear, $enc_type ) {
$new_value = "{SMD5}".base64_encode( mhash( MHASH_MD5, $password_clear.$salt ).$salt );
} else {
pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') );
error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php');
}
break;
@@ -2033,7 +2029,8 @@ function password_check( $cryptedpassword, $plainpassword ) {
// check php mhash support before using it
if( function_exists( 'mhash' ) ) {
$hash = base64_decode($cryptedpassword);
$salt = substr($hash, -4);
# OpenLDAP uses a 4 byte salt, SunDS uses an 8 byte salt - both from char 20.
$salt = substr($hash,20);
$new_hash = base64_encode( mhash( MHASH_SHA1, $plainpassword.$salt).$salt );
if( strcmp( $cryptedpassword, $new_hash ) == 0 )
@@ -2042,7 +2039,7 @@ function password_check( $cryptedpassword, $plainpassword ) {
return false;
} else {
pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') );
error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php');
}
break;
@@ -2060,7 +2057,7 @@ function password_check( $cryptedpassword, $plainpassword ) {
return false;
} else {
pla_error( _('Your PHP install does not have the mhash() function. Cannot do SHA hashes.') );
error(_('Your PHP install does not have the mhash() function. Cannot do SHA hashes.'),'error','index.php');
}
break;
@@ -2087,7 +2084,7 @@ function password_check( $cryptedpassword, $plainpassword ) {
// make sure that web server supports blowfish crypt
if( ! defined( 'CRYPT_BLOWFISH' ) || CRYPT_BLOWFISH == 0 )
pla_error( _('Your system crypt library does not support blowfish encryption.') );
error(_('Your system crypt library does not support blowfish encryption.'),'error','index.php');
list(,$version,$rounds,$salt_hash) = explode('$',$cryptedpassword);
@@ -2102,7 +2099,7 @@ function password_check( $cryptedpassword, $plainpassword ) {
// make sure that web server supports md5 crypt
if( ! defined( 'CRYPT_MD5' ) || CRYPT_MD5 == 0 )
pla_error( _('Your system crypt library does not support md5crypt encryption.') );
error(_('Your system crypt library does not support md5crypt encryption.'),'error','index.php');
list(,$type,$salt,$hash) = explode('$',$cryptedpassword);
@@ -2117,7 +2114,7 @@ function password_check( $cryptedpassword, $plainpassword ) {
// make sure that web server supports ext_des
if ( ! defined( 'CRYPT_EXT_DES' ) || CRYPT_EXT_DES == 0 )
pla_error( _('Your system crypt library does not support extended DES encryption.') );
error(_('Your system crypt library does not support extended DES encryption.'),'error','index.php');
if( crypt($plainpassword, $cryptedpassword ) == $cryptedpassword )
return true;
@@ -2225,7 +2222,7 @@ function draw_chooser_link( $form_element, $include_choose_text=true, $rdn="none
$title = _('Click to popup a dialog to select an entry (DN) graphically');
printf('<a href="%s" title="%s"><img class="chooser" src="images/find.png" alt="Find" /></a>',$href,$title);
printf('<a href="%s" title="%s"><img class="chooser" src="%s/find.png" alt="Find" /></a>',$href,$title,IMGDIR);
if ($include_choose_text)
printf('<span class="x-small"><a href="%s" title="%s">%s</a></span>',$href,$title,_('browse'));
}
@@ -2337,7 +2334,7 @@ function dn_unescape($dn) {
*/
function get_href($type,$extra_info='') {
$sf = 'https://sourceforge.net';
$pla = 'http://phpldapadmin.wiki.sourceforge.net';
$pla = 'http://phpldapadmin.sourceforge.net';
$group_id = '61828';
$bug_atid = '498546';
$rfe_atid = '498549';
@@ -2928,13 +2925,15 @@ function server_info_list($visible=false) {
return $server_info_list;
}
function enc_type_select_list($enc_type) {
function enc_type_select_list($enc_type,$id,$attributename,$i) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$enc_type);
debug_log('Entered with (%s,%s,%s,%s)',1,__FILE__,__LINE__,__METHOD__,$enc_type,$id,$attributename,$i);
$html = sprintf('<select id="%s_%s_%s" name="%s[%s][%s]">',
$id,htmlspecialchars($attributename),$i,
$id,htmlspecialchars($attributename),$i);
$html = '<select name="enc_type[]">';
$html .= '<option>clear</option>';
foreach (array('crypt','ext_des','md5crypt','blowfish','md5','smd5','sha','ssha') as $option)
$html .= sprintf('<option%s>%s</option>',($enc_type == $option ? ' selected="true"' : ''),$option);
@@ -3206,7 +3205,7 @@ function draw_date_selector_link( $attr ) {
$href = "javascript:dateSelector('$attr');";
$title = _('Click to popup a dialog to select a date graphically');
printf('<a href="%s" title="%s"><img class="chooser" src="images/calendar.png" id="f_trigger_%s" style="cursor: pointer;" alt="Calendar" /></a>',$href,$title,$attr);
printf('<a href="%s" title="%s"><img class="chooser" src="%s/calendar.png" id="f_trigger_%s" style="cursor: pointer;" alt="Calendar" /></a>',$href,$title,IMGDIR,$attr);
}
/**
@@ -3228,4 +3227,13 @@ function random_junk() {
function htmlid($sid,$dn) {
return sprintf('SID%s:%s',$sid,preg_replace('/[\ =,]/','_',$dn));
}
/**
* Is compression enabled for output
*/
function isCompress() {
return (isset($_SESSION[APPCONFIG]) && $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& ! ini_get('zlib.output_compression')
&& eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING']));
}
?>

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.10.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/hooks.php,v 1.10.2.3 2008/11/28 04:44:54 wurley Exp $
/**
* Functions related to hooks management.
@@ -52,7 +52,6 @@ function sort_array_by_priority($a,$b) {
function run_hook($hook_name,$args) {
$hooks = isset($_SESSION[APPCONFIG]) ? $_SESSION[APPCONFIG]->hooks : array();
$debug = 0;
syslog_debug("Running hook $hook_name.");
if (! array_key_exists($hook_name,$hooks)) {
@@ -109,17 +108,17 @@ function run_hook($hook_name,$args) {
* called upon failure.
*/
function add_hook($hook_name,$priority,$hook_function,$rollback_function) {
global $config;
if (! array_key_exists($hook_name,$config->hooks)) {
$config->hooks[$hook_name] = array();
}
if (! array_key_exists($hook_name,$_SESSION[APPCONFIG]->hooks))
$_SESSION[APPCONFIG]->hooks[$hook_name] = array();
remove_hook($hook_name,-1,$hook_function,'');
array_push($config->hooks[$hook_name],array('priority' => $priority,'hook_function' => $hook_function,'rollback_function' => $rollback_function));
array_push($_SESSION[APPCONFIG]->hooks[$hook_name],array(
'priority' => $priority,
'hook_function' => $hook_function,
'rollback_function' => $rollback_function));
uasort($config->hooks[$hook_name],"sort_array_by_priority");
uasort($_SESSION[APPCONFIG]->hooks[$hook_name],'sort_array_by_priority');
}
/**
@@ -138,17 +137,15 @@ function add_hook($hook_name,$priority,$hook_function,$rollback_function) {
* as a rollback will be removed.
*/
function remove_hook($hook_name,$priority,$hook_function,$rollback_function) {
global $config;
if (array_key_exists($hook_name,$_SESSION[APPCONFIG]->hooks)) {
reset($_SESSION[APPCONFIG]->hooks[$hook_name]);
if (array_key_exists($hook_name,$config->hooks)) {
reset($config->hooks[$hook_name]);
while (list($key,$hook) = each($config->hooks[$hook_name])) {
while (list($key,$hook) = each($_SESSION[APPCONFIG]->hooks[$hook_name])) {
if (($priority >= 0 && $priority == $hook['priority']) ||
($hook_function && $hook_function == $hook['hook_function']) ||
($rollback_function && $rollback_function == $hook['rollback_function'])) {
unset($config->hooks[$hook_name][$key]);
unset($_SESSION[APPCONFIG]->hooks[$hook_name][$key]);
}
}
}
@@ -160,22 +157,18 @@ function remove_hook($hook_name,$priority,$hook_function,$rollback_function) {
* @param hook_name Name of hook to clear.
*/
function clear_hooks($hook_name) {
global $config;
if (!isset($config) && isset($_SESSION[APPCONFIG]))
$config = $_SESSION[APPCONFIG];
if (array_key_exists($hook_name,$config->hooks))
unset($config->hooks[$hook_name]);
if (array_key_exists($hook_name,$_SESSION[APPCONFIG]->hooks))
unset($_SESSION[APPCONFIG]->hooks[$hook_name]);
}
# Evaluating user-made hooks
if (is_dir(HOOKSDIR.'functions')) {
$dir = dir(HOOKSDIR.'functions');
while (false !== ($entry = $dir->read())) {
$filename = sprintf('%s/%s/%s',HOOKSDIR,'functions',$entry);
while (false !== ($hookfile = $dir->read())) {
$filename = sprintf('%s/%s/%s',HOOKSDIR,'functions',$hookfile);
if (is_file($filename) and eregi('php[0-9]?$',$entry))
if (is_file($filename) and eregi('php[0-9]?$',$hookfile))
require_once "$filename";
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/page.php,v 1.3.2.13 2008/01/10 12:30:14 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/page.php,v 1.3.2.16 2008/12/12 09:20:06 wurley Exp $
/**
* Page Rendering Functions
@@ -28,7 +28,7 @@ class page {
# Default Values for configurable items.
$this->_default['stylecss'] = CSSDIR.'style.css';
$this->_default['logo'] = IMGDIR.'logo_small.jpg';
$this->_default['logo'] = IMGDIR.'logo-small.png';
$this->_default['sysmsg']['error'] = IMGDIR.'warning.png';
$this->_default['sysmsg']['warn'] = IMGDIR.'notice.png';
$this->_default['sysmsg']['info'] = IMGDIR.'light-big.png';
@@ -45,11 +45,7 @@ class page {
}
header('Content-type: text/html; charset="UTF-8"');
if (isset($_SESSION[APPCONFIG])
&& $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING'])
&& ! ini_get('zlib.output_compression')) {
if (isCompress()) {
header('Content-Encoding: gzip');
if (DEBUG_ENABLED)
@@ -107,17 +103,17 @@ class page {
# Style sheet.
printf('<link type="text/css" rel="stylesheet" href="%s" />',$this->_app['urlcss']);
printf('<link rel="shortcut icon" href="%s/images/favicon.ico" type="image/vnd.microsoft.icon" />','../htdocs/');
printf('<link rel="shortcut icon" href="%s/favicon.ico" type="image/vnd.microsoft.icon" />',IMGDIR);
if (defined('JSDIR')) {
printf('<link type="text/css" rel="stylesheet" media="all" href="%sjscalendar/calendar-blue.css" title="blue" />',JSDIR);
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css" />','../htdocs/'.JSDIR);
printf('<link type="text/css" rel="stylesheet" href="%s/phplayersmenu/layerstreemenu.css" />',JSDIR);
echo "\n";
printf('<script type="text/javascript" src="%spla_ajax.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%stree_hide.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sentry_chooser.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sto_ascii.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>','../htdocs/'.JSDIR);
printf('<script type="text/javascript" src="%sto_ascii.js"></script>',JSDIR);
printf('<script type="text/javascript" src="%sjscalendar/calendar.js"></script>',JSDIR);
echo "\n";
}
@@ -304,11 +300,7 @@ class page {
echo $object->draw('body');
}
if ($compress && ob_get_level() && isset($_SESSION[APPCONFIG])
&& $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& ! ini_get('zlib.output_compression')
&& eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING'])) {
if ($compress && ob_get_level() && isCompress()) {
$output = ob_get_contents();
ob_end_clean();
@@ -324,7 +316,9 @@ class page {
if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
debug_log('Entered with ()',129,__FILE__,__LINE__,__METHOD__);
printf('<tr class="foot"><td colspan=3>%s</td></tr>',pla_version());
printf('<tr class="foot"><td><small>%s</small></td><td colspan=2>%s</td></tr>',
isCompress() ? '[C]' : '&nbsp;',
pla_version());
}
public function display($filter=array()) {
@@ -384,11 +378,7 @@ class page {
echo '</html>';
# compress output
if (ob_get_level() && isset($_SESSION[APPCONFIG])
&& $_SESSION[APPCONFIG]->GetValue('appearance','compress')
&& ! ini_get('zlib.output_compression')
&& eregi('gzip',$_SERVER['HTTP_ACCEPT_ENCODING'])) {
if (ob_get_level() && isCompress()) {
$output = ob_get_contents();
ob_end_clean();

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/schema_functions.php,v 1.92 2007/12/15 07:50:32 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/schema_functions.php,v 1.92.2.1 2008/11/29 09:23:11 wurley Exp $
/**
* Classes and functions for fetching and parsing schema from an LDAP server.
@@ -61,6 +61,8 @@ class ObjectClass extends SchemaItem {
var $must_attrs;
# Arrays of attribute names that this objectClass allows, but does not require
var $may_attrs;
# Arrays of attribute names that this objectClass has been forced to MAY attrs, due to configuration
var $force_may;
# Boolean value indicating whether this objectClass is obsolete
var $is_obsolete;
# Array of objectClasses which inherit from this one (must be set at runtime explicitly by the caller)
@@ -76,6 +78,7 @@ class ObjectClass extends SchemaItem {
$this->sup_classes = array();
$this->type = $ldapserver->schema_oclass_default;
$this->must_attrs = array();
$this->force_may = array();
$this->may_attrs = array();
$this->is_obsolete = false;
$this->children_objectclasses = array();
@@ -265,11 +268,17 @@ class ObjectClass extends SchemaItem {
foreach ($attrs as $string) {
$attr = new ObjectClass_ObjectClassAttribute($string,$this->name);
array_push($this->must_attrs,$attr);
if ($ldapserver->isForceMay($attr->name)) {
array_push($this->force_may,$attr);
array_push($this->may_attrs,$attr);
} else
array_push($this->must_attrs,$attr);
}
if (DEBUG_ENABLED)
debug_log('Case MUST returned (%s)',8,__FILE__,__LINE__,__METHOD__,$this->must_attrs);
debug_log('Case MUST returned (%s) (%s)',8,__FILE__,__LINE__,__METHOD__,$this->must_attrs,$this->force_may);
break;
case 'MAY':
@@ -304,8 +313,8 @@ class ObjectClass extends SchemaItem {
$this->description = preg_replace("/\'$/",'',$this->description);
if (DEBUG_ENABLED)
debug_log('Returning () - NAME (%s), DESCRIPTION (%s), MUST (%s), MAY (%s)',9,__FILE__,__LINE__,__METHOD__,
$this->name,$this->description,$this->must_attrs,$this->may_attrs);
debug_log('Returning () - NAME (%s), DESCRIPTION (%s), MUST (%s), MAY (%s), FORCE MAY (%s)',9,__FILE__,__LINE__,__METHOD__,
$this->name,$this->description,$this->must_attrs,$this->may_attrs,$this->force_may);
}
/**
@@ -547,6 +556,17 @@ class ObjectClass extends SchemaItem {
$this->may_attrs = array_values(array_unique(array_merge($this->may_attrs,$new_may_attrs)));
}
/**
* Determine if an array is listed in the force_may attrs
*/
function isForceMay($attr) {
foreach ($this->force_may as $forcemay)
if ($forcemay->getName() == $attr)
return true;
return false;
}
}
/**
@@ -628,6 +648,8 @@ class AttributeType extends SchemaItem {
var $used_in_object_classes;
# A list of object class names that require this attribute type.
var $required_by_object_classes;
# This attribute has been forced a MAY attribute by the configuration.
var $forced_as_may;
/**
* Initialize the class' member variables
@@ -654,10 +676,11 @@ class AttributeType extends SchemaItem {
$this->type = null;
$this->used_in_object_classes = array();
$this->required_by_object_classes = array();
$this->forced_as_may = false;
}
/**
* Creates a new AttributeType objcet from a raw LDAP AttributeType string.
* Creates a new AttributeType object from a raw LDAP AttributeType string.
*/
function AttributeType($raw_ldap_attr_string) {
if (DEBUG_ENABLED)
@@ -1108,6 +1131,13 @@ class AttributeType extends SchemaItem {
function getRequiredByObjectClasses() {
return $this->required_by_object_classes;
}
/**
* This function will mark this attribute as a forced MAY attribute
*/
function setForceMay() {
$this->forced_as_may = true;
}
}
/**

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.26.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_advanced.php,v 1.26.2.2 2008/01/13 05:37:02 wurley Exp $
/**
* @package phpLDAPadmin
@@ -22,14 +22,15 @@ function focus_filter() {
}
</script>
<form action="cmd.php" method="get" class="search" name="advanced_search_form">
<h3 class="title"><?php echo _('Advanced Search Form'); ?></h3>
<br />
<form action="cmd.php" name="advanced_search_form">
<input type="hidden" name="cmd" value="search" />
<input type="hidden" name="search" value="true" />
<input type="hidden" name="form" value="advanced" />
<input type="hidden" name="format" value="<?php echo $entry['format']; ?>" />
<table class="search" border=0>
<tr><td class="title" colspan=2><?php echo _('Advanced Search Form'); ?></td></tr>
<table class="forminput" border=0>
<?php
$ss = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'simple_search');
@@ -57,26 +58,26 @@ function focus_filter() {
<tr><td colspan=2>&nbsp;</td></tr>
<tr><td><small><?php echo _('Server'); ?></small></td><td><?php echo $server_menu_html; ?></td></tr>
<tr><td><?php echo _('Server'); ?></td><td><?php echo $server_menu_html; ?></td></tr>
<tr>
<td><small><?php echo _('Base DN'); ?></small></td>
<td><?php echo _('Base DN'); ?></td>
<td><input type="text" name="base_dn" value="<?php echo count($base_dns) == 1 ? $base_dns[0] : '' ?>" style="width: 200px" id="base_dn" />
<?php
draw_chooser_link('advanced_search_form.base_dn');
if (isset($entry['base_dn']['invalid']) && $entry['base_dn']['invalid'])
printf('<small style="color:red; white-space: nowrap">%s</small>',_('This is not a valid DN.'));
printf('<tr><td>&nbsp;</td><td><small style="color:red; white-space: nowrap">%s</small></td></tr>',_('This is not a valid DN.'));
if (isset($entry['base_dn']['exist']) && $entry['base_dn']['exist'])
printf('<small style="color:red; white-space: nowrap">%s</small>',_('This entry does not exist.'));
printf('<tr><td>&nbsp;</td><td><small style="color:red; white-space: nowrap">%s</small></td></tr>',_('This entry does not exist.'));
?>
</td>
</tr>
<tr>
<td><small><acronym title="<?php echo _('The scope in which to search'); ?>"><?php echo _('Search Scope'); ?></acronym></small></td>
<td><acronym title="<?php echo _('The scope in which to search'); ?>"><?php echo _('Search Scope'); ?></acronym></td>
<td>
<select name="scope" style="width: 200px">
<option<?php echo $entry['scope']=='sub'?' selected':''; ?> value="sub">
@@ -93,14 +94,14 @@ if (isset($entry['base_dn']['exist']) && $entry['base_dn']['exist'])
</tr>
<tr>
<td><small><acronym title="<?php echo htmlspecialchars(_('Standard LDAP search filter. Example: (&(sn=Smith)(givenname=David))')); ?>">
<?php echo _('Search Filter'); ?></acronym></small></td>
<td><acronym title="<?php echo htmlspecialchars(_('Standard LDAP search filter. Example: (&(sn=Smith)(givenname=David))')); ?>">
<?php echo _('Search Filter'); ?></acronym></td>
<td><input type="text" name="filter" id="filter" style="width: 200px" value="<?php echo $entry['filter']['clean'] ? htmlspecialchars($entry['filter']['clean']) : 'objectClass=*'; ?>" /></td>
</tr>
<tr>
<td><small><acronym title="<?php echo _('A list of attributes to display in the results (comma-separated)'); ?>">
<?php echo _('Show Attributtes'); ?></acronym></small></td>
<td><acronym title="<?php echo _('A list of attributes to display in the results (comma-separated)'); ?>">
<?php echo _('Show Attributtes'); ?></acronym></td>
<td><input type="text" name="display_attrs" style="width: 200px" value="<?php
echo $entry['display']['string'] ? htmlspecialchars($entry['display']['string']) :
@@ -108,7 +109,7 @@ if (isset($entry['base_dn']['exist']) && $entry['base_dn']['exist'])
</tr>
<tr>
<td><small><acronym title="<?php echo htmlspecialchars(_('Order by').'...'); ?>"><?php echo _('Order by'); ?></acronym></small></td>
<td><acronym title="<?php echo htmlspecialchars(_('Order by').'...'); ?>"><?php echo _('Order by'); ?></acronym></td>
<td><input type="text" name="orderby" id="orderby" style="width: 200px" value="<?php echo htmlspecialchars($entry['orderby']['string']) ?>" /></td>
</tr>

View File

@@ -1,25 +1,26 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.10.2.1 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.10.2.2 2008/01/13 05:37:02 wurley Exp $
/**
* @package phpLDAPadmin
*/
echo '<form action="cmd.php" method="get" class="search">';
printf('<h3 class="title">%s</h3>',_('Predefined Searches'));
echo '<br />';
echo '<form action="cmd.php">';
echo '<input type="hidden" name="cmd" value="search" />';
echo '<input type="hidden" name="search" value="true" />';
echo '<input type="hidden" name="form" value="predefined" />';
printf('<input type="hidden" name="format" value="%s" />',$entry['format']);
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
echo '<table class="search" border=0>';
echo '<table class="forminput" border=0>';
if ($entry['predefined'])
$selected_q_number = intval($entry['predefined']);
else
$selected_q_number = null;
printf('<tr><td class="title" colspan=2>%s</td></tr>',_('Predefined Searches'));
$ss = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'simple_search');
$as = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'advanced_search');
@@ -42,7 +43,7 @@ if (! isset($_SESSION[APPCONFIG]->queries) || ! is_array($_SESSION[APPCONFIG]->q
} else {
echo '<tr>';
printf('<td><small>%s: </small></td>',_('Select a predefined search'));
printf('<td>%s:</td>',_('Select a predefined search'));
echo '<td>';
echo '<select name="predefined">';

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_simple.php,v 1.16.2.2 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_simple.php,v 1.16.2.3 2008/01/13 05:37:02 wurley Exp $
/**
* @package phpLDAPadmin
@@ -12,15 +12,16 @@
}
</script>
<form action="cmd.php" method="get" class="search" name="simple_search_form">
<h3 class="title"><?php echo _('Simple Search Form'); ?></h3>
<br />
<form action="cmd.php" name="simple_search_form">
<input type="hidden" name="cmd" value="search" />
<input type="hidden" name="search" value="true" />
<input type="hidden" name="form" value="simple" />
<input type="hidden" name="scope" value="sub" />
<input type="hidden" name="format" value="<?php echo $entry['format']; ?>" />
<table class="search" border=0>
<tr><td class="title"><?php echo _('Simple Search Form'); ?></td></tr>
<table class="forminput" border=0>
<?php
$as = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'advanced_search');

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_list.php,v 1.7.2.2 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_list.php,v 1.7.2.5 2008/11/30 13:19:49 wurley Exp $
/**
* @package phpLDAPadmin
@@ -17,10 +17,10 @@ foreach ($results as $dn => $dndetails) {
if ($i >= $end_entry)
break;
echo '<table class="search_result" border=0>';
echo '<table class="result" border=0>';
echo '<tr class="list_dn">';
printf('<td class="icon"><img src="images/%s" alt="icon" /></td>',get_icon($ldapserver,$dn));
echo '<tr class="list_title">';
printf('<td class="icon"><img src="%s/%s" alt="icon" /></td>',IMGDIR,get_icon($ldapserver,$dn));
$formatted_dn = get_rdn($dn);
if (!$_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
@@ -33,7 +33,7 @@ foreach ($results as $dn => $dndetails) {
echo '</tr>';
if ($_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
printf('<tr class="list_attr"><td class="blank">&nbsp;</td><td class="attr">dn</td><td class="val">%s</td></tr>',htmlspecialchars(dn_unescape($dn)));
printf('<tr class="list_item"><td class="blank">&nbsp;</td><td class="heading">dn</td><td class="value">%s</td></tr>',htmlspecialchars(dn_unescape($dn)));
}
# Iterate over each attribute for this entry
@@ -45,11 +45,11 @@ foreach ($results as $dn => $dndetails) {
if ($ldapserver->isAttrBinary($attr))
$values = array('(binary)');
echo '<tr class="list_attr">';
echo '<tr class="list_item">';
echo '<td class="blank">&nbsp;</td>';
printf('<td class="attr" valign="top">%s</td>',$_SESSION[APPCONFIG]->getFriendlyHTML($attr));
printf('<td class="heading" valign="top">%s</td>',$_SESSION[APPCONFIG]->getFriendlyHTML($attr));
echo '<td class="val">';
echo '<td class="value">';
if ($ldapserver->isJpegPhoto($attr))
draw_jpeg_photos($ldapserver,$dn,$attr,false,false,'align="left"');

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_table.php,v 1.9.2.2 2007/12/26 09:26:33 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_results_table.php,v 1.9.2.4 2008/11/29 11:33:53 wurley Exp $
/**
* Incoming variables (among others)
@@ -31,7 +31,7 @@ foreach ($results as $dn => $dndetails) {
$edit_url = sprintf('cmd.php?cmd=template_engine&amp;server_id=%s&amp;dn=%s',$ldapserver->server_id,rawurlencode($dn));
$attrs_display = array();
$attrs_display[''] = sprintf('<center><a href="%s"><img src="images/%s" alt="icon" /></a></center>',$edit_url,get_icon($ldapserver,$dn));
$attrs_display[''] = sprintf('<center><a href="%s"><img src="%s/%s" alt="icon" /></a></center>',$edit_url,IMGDIR,get_icon($ldapserver,$dn));
if ($_SESSION[APPCONFIG]->isCommandAvailable('schema')) {
$dn_display = strlen($dn) > 40
@@ -91,7 +91,7 @@ $header_row .= '</tr>';
# Begin drawing table
echo '<br />';
echo '<center>';
echo '<table class="search_result_table">';
echo '<table class="result_table">';
for ($i=0;$i<count($entries_display);$i++) {
$result = $entries_display[$i];
@@ -99,10 +99,7 @@ for ($i=0;$i<count($entries_display);$i++) {
if ($i %10 == 0)
echo $header_row;
if ($i % 2 == 0 )
echo '<tr class="highlight">';
else
echo '<tr>';
printf('<tr class="%s">',$i%2 ? 'even' : 'odd');
foreach ($all_attrs as $attr) {
echo '<td>';

View File

@@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.51.2.6 2007/12/31 06:27:34 wurley Exp $ */
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/server_functions.php,v 1.51.2.20 2009/03/20 07:48:45 wurley Exp $
/**
* Classes and functions for LDAP server configuration and capability
@@ -77,7 +77,7 @@ class LDAPserver {
$return = false;
# For session or cookie auth_types, we check the session or cookie to see if a user has logged in.
if (in_array($this->auth_type,array('session','cookie','http'))) {
if (in_array($this->auth_type,array('session','cookie'))) {
/* we don't look at getLoggedInPass() cause it may be null for anonymous binds
* getLoggedInDN() will never return null if someone is really logged in. */
@@ -88,11 +88,30 @@ class LDAPserver {
/* whether or not the login_dn or pass is specified, we return
* true here. (if they are blank, we do an anonymous bind anyway) */
} elseif ($this->auth_type == 'http') {
# This is temp, to avoid multiple displays of this message
static $shown = false;
if (! $this->getLoggedInDN() && ! $shown) {
system_message(array(
'title'=>_('No HTTP AUTH information'),
'body'=>_('Your configuration file has authentication set to http_auth, however, there was none presented to phpLDAPadmin'),
'type'=>'error'));
$shown = true;
}
if ($this->getLoggedInDN())
$return = true;
else
$return = false;
} elseif ($this->auth_type == 'config') {
$return = true;
} else {
pla_error(sprintf(_('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.'),htmlspecialchars($this->auth_type)));
error(sprintf(_('Error: You have an error in your config file. The only four allowed values for auth_type in the $servers section are \'http\', \'session\', \'cookie\', and \'config\'. You entered \'%s\', which is not allowed.'),htmlspecialchars($this->auth_type)),'error',null,true);
}
if (DEBUG_ENABLED)
@@ -130,6 +149,8 @@ class LDAPserver {
debug_log('Creating new connection [%s] for Server ID [%s]',16,__FILE__,__LINE__,__METHOD__,
$connect_id,$this->server_id);
$this->connection[$connect_id]['resource'] = null;
# Grab the AUTH INFO based on the auth_type for this server
if ($connect_id == 'anonymous') {
if (DEBUG_ENABLED)
@@ -158,6 +179,15 @@ class LDAPserver {
$this->connection[$connect_id]['login_pass'] ? md5($this->connection[$connect_id]['login_pass']) : '');
}
} elseif ($this->auth_type == 'http') {
if (! $dn && ! $pass)
$connect_id = 'anonymous';
else {
$this->connection[$connect_id]['login_dn'] = $dn;
$this->connection[$connect_id]['login_pass'] = $pass;
}
} else {
if (DEBUG_ENABLED)
debug_log('This IS some other login',80,__FILE__,__LINE__,__METHOD__);
@@ -259,8 +289,8 @@ class LDAPserver {
# Try to fire up TLS is specified in the config
if ($this->isTLSEnabled()) {
function_exists('ldap_start_tls') or pla_error(_('Your PHP install does not support TLS.'));
@ldap_start_tls($resource) or pla_error(_('Could not start TLS. Please check your LDAP server configuration.'),ldap_error($resource));
function_exists('ldap_start_tls') or error(_('Your PHP install does not support TLS.'),'error');
@ldap_start_tls($resource) or error(_('Could not start TLS. Please check your LDAP server configuration.'),'error',null,true);
}
$bind_result = false;
@@ -274,7 +304,7 @@ class LDAPserver {
# No support for ldap_sasl_bind?
if (! function_exists('ldap_sasl_bind'))
pla_error(_('Your PHP installation does not support ldap_sasl_bind() function. This function is present in PHP 5.x when compiled with --with-ldap-sasl.'));
error(_('Your PHP installation does not support ldap_sasl_bind() function. This function is present in PHP 5.x when compiled with --with-ldap-sasl.'),'error');
# Fill variables
$props = $this->connection[$connect_id]['sasl_props'];
@@ -307,9 +337,9 @@ class LDAPserver {
# invalid regex?
if (is_null($authz_id)) {
pla_error(sprintf(_('It seems that sasl_authz_id_regex "%s"." contains invalid PCRE regular expression.'),
$this->connection[$connect_id]['sasl_authz_id_regex']).
((isset($php_errormsg)) ? ' Error message: '.$php_errormsg : ''));
error(sprintf(_('It seems that sasl_authz_id_regex "%s"." contains invalid PCRE regular expression.'),
$this->connection[$connect_id]['sasl_authz_id_regex']).((isset($php_errormsg)) ? ' Error message: '.$php_errormsg : '')
,'error','index.php');
}
}
@@ -336,16 +366,16 @@ class LDAPserver {
if ($process_error) {
switch (ldap_errno($resource)) {
case 0x31:
error(_('Bad username or password. Please try again.'),'error',true);
error(_('Bad username or password. Please try again.'),'error');
break;
case 0x32:
error(_('Insufficient access rights.'),'error',true);
error(_('Insufficient access rights.'),'error');
break;
case -1:
error(sprintf(_('Could not connect to "%s" on port "%s"'),$host,$port),'error',true);
error(sprintf(_('Could not connect to "%s" on port "%s"'),$host,$port),'error');
break;
default:
error(_('Could not bind to the LDAP server (%s).',ldap_err2str($resource),$resource),'error',true);
error(sprintf(_('Could not bind to the LDAP server (%s).'),ldap_err2str($resource)),'error');
}
} else {
@@ -364,7 +394,10 @@ class LDAPserver {
debug_log('Leaving with Connect [%s], Resource [%s]',16,__FILE__,__LINE__,__METHOD__,
$connect_id,$this->connection[$connect_id]['resource']);
return $this->connection[$connect_id]['resource'];
if (isset($this->connection[$connect_id]['resource']))
return $this->connection[$connect_id]['resource'];
else
return false;
}
/**
@@ -694,8 +727,8 @@ class LDAPserver {
# This error message is not localized as only developers should ever see it
if (! in_array($schema_to_fetch,$valid_schema_to_fetch))
pla_error(sprintf('Bad parameter provided to function to %s::getRawSchema(). "%s" is not valid for the schema_to_fetch parameter.',
get_class($this),htmlspecialchars($schema_to_fetch)));
error(sprintf('Bad parameter provided to function to %s::getRawSchema(). "%s" is not valid for the schema_to_fetch parameter.',
get_class($this),htmlspecialchars($schema_to_fetch)),'error','index.php');
# Try to get the schema DN from the specified entry.
$schema_dn = $this->getSchemaDN($dn);
@@ -839,7 +872,7 @@ class LDAPserver {
# We need to have objectclasses and attribues, so display an error, asking the user to get us this information.
if (in_array($schema_to_fetch,$schema_error_message_array)) {
pla_error(sprintf('Our attempts to find your SCHEMA for "%s" have FAILED.<br /><br />%s',$schema_to_fetch,$schema_error_message));
error(sprintf('Our attempts to find your SCHEMA for "%s" have FAILED.<br /><br />%s',$schema_to_fetch,$schema_error_message),'error','index.php');
} else {
$return = false;
@@ -854,8 +887,8 @@ class LDAPserver {
# Did we get something unrecognizable?
if (gettype($schema_search) != 'resource') {
if (in_array($schema_to_fetch,$schema_error_message_array)) {
pla_error(sprintf('Our attempts to find your SCHEMA for "%s" has return UNEXPECTED results.<br /><br /><small>(We expected a "resource" for $schema_search, instead, we got (%s))</small><br /><br />%s<br /><br />Dump of $schema_search:<hr /><pre><small>%s</small></pre>',
$schema_to_fetch,gettype($schema_search),$schema_error_message,serialize($schema_search)));
error(sprintf('Our attempts to find your SCHEMA for "%s" has return UNEXPECTED results.<br /><br /><small>(We expected a "resource" for $schema_search, instead, we got (%s))</small><br /><br />%s<br /><br />Dump of $schema_search:<hr /><pre><small>%s</small></pre>',
$schema_to_fetch,gettype($schema_search),$schema_error_message,serialize($schema_search)),'error','index.php');
} else {
$return = false;
@@ -877,8 +910,8 @@ class LDAPserver {
if(! isset($schema_entries[0][$schema_to_fetch])) {
if (in_array($schema_to_fetch,$schema_error_message_array)) {
pla_error(sprintf('Our attempts to find your SCHEMA for "%s" has return UNEXPECTED results.<br /><br /><small>(We expected a "%s" in the $schema array but it wasnt there.)</small><br /><br />%s<br /><br />Dump of $schema_search:<hr /><pre><small>%s</small></pre>',
$schema_to_fetch,gettype($schema_search),$schema_error_message,serialize($schema_entries)));
error(sprintf('Our attempts to find your SCHEMA for "%s" has return UNEXPECTED results.<br /><br /><small>(We expected a "%s" in the $schema array but it wasnt there.)</small><br /><br />%s<br /><br />Dump of $schema_search:<hr /><pre><small>%s</small></pre>',
$schema_to_fetch,gettype($schema_search),$schema_error_message,serialize($schema_entries)),'error','index.php');
} else {
$return = false;
@@ -1241,8 +1274,8 @@ class LDAPserver {
}
if (! isset($attrs[strtolower($sup_attr_name)])){
pla_error(sprintf('Schema error: attributeType "%s" inherits from "%s", but attributeType "%s" does not exist.',
$attr->getName(),$sup_attr_name,$sup_attr_name));
error(sprintf('Schema error: attributeType "%s" inherits from "%s", but attributeType "%s" does not exist.',
$attr->getName(),$sup_attr_name,$sup_attr_name),'error','index.php');
return;
}
@@ -1323,6 +1356,15 @@ class LDAPserver {
}
}
# Force May
foreach ($object_class->force_may as $attr_name) {
if (isset($attrs[strtolower($attr_name->name)]))
$attrs[strtolower($attr_name->name)]->setForceMay();
else {
#echo "Warning, attr not set: $attr_name<br />";
}
}
}
$return = $attrs;
@@ -1519,7 +1561,10 @@ class LDAPserver {
function rename($dn,$new_rdn,$container,$deleteoldrdn) {
$this->lastop = 'write';
if (! @ldap_rename($this->connect(true,$this->lastop,false,false),$dn,$new_rdn,$container,$deleteoldrdn)) {
pla_error(_('Could not rename the entry'),$this->error(),$this->errno(),false);
system_message(array(
'title'=>_('Could not rename the entry.'),
'body'=>ldap_error_msg($this->error(),$this->errno()),
'type'=>'error'));
} else {
# Update the tree
@@ -1776,10 +1821,16 @@ class LDAPserver {
if ($attr = ldap_first_attribute($resource,$entry_id,$attrs)) {
if (DEBUG_ENABLED)
debug_log('Processing ATTR [%s].',64,__FILE__,__LINE__,__METHOD__,$attr);
debug_log('Processing First ATTR [%s].',64,__FILE__,__LINE__,__METHOD__,$attr);
# Iterate over the attributes
while ($attr) {
/* It seems that OpenDS complains when you do a ldap_get_values on these attributes - we'll skip them as a workaround */
if (in_array($attr,array('isMemberOf'))) {
$attr = ldap_next_attribute($resource,$entry_id,$attrs);
continue;
}
if ($this->isAttrBinary($attr))
$values = ldap_get_values_len($resource,$entry_id,$attr);
else
@@ -1795,6 +1846,10 @@ class LDAPserver {
$return[$dn][$attr] = $values;
$attr = ldap_next_attribute($resource,$entry_id,$attrs);
if (DEBUG_ENABLED)
debug_log('Processing Next ATTR [%s].',64,__FILE__,__LINE__,__METHOD__,$attr);
} # end while attr
}
@@ -1970,7 +2025,7 @@ class LDAPserver {
break;
default:
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($this->auth_type)));
error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($this->auth_type)),'error','index.php');
break;
}
}
@@ -2042,7 +2097,7 @@ class LDAPserver {
break;
default:
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($auth_type)));
error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($auth_type)),'error','index.php');
break;
}
}
@@ -2151,7 +2206,7 @@ class LDAPserver {
# See what the server schema says about this attribute
$schema_attr = $this->getSchemaAttribute($attr_name);
if (! $schema_attr) {
if (! is_object($schema_attr)) {
/* Strangely, some attributeTypes may not show up in the server
* schema. This behavior has been observed in MS Active Directory.*/
@@ -2170,6 +2225,7 @@ class LDAPserver {
strcasecmp($attr_name,'networkaddress') == 0 ||
strcasecmp($attr_name,'objectGUID') == 0 ||
strcasecmp($attr_name,'objectSID') == 0 ||
strcasecmp($attr_name,'jpegPhoto') == 0 ||
$syntax == '1.3.6.1.4.1.1466.115.121.1.10' ||
$syntax == '1.3.6.1.4.1.1466.115.121.1.28' ||
$syntax == '1.3.6.1.4.1.1466.115.121.1.5' ||
@@ -2336,7 +2392,7 @@ class LDAPserver {
break;
default:
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($this->auth_type)));
error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($this->auth_type)),'error','index.php');
}
}
@@ -2383,11 +2439,11 @@ class LDAPserver {
break;
case 'http':
if (isset($_SERVER['PHP_AUTH_USER']))
{
if (isset($_SERVER['PHP_AUTH_USER'])) {
if ($this->isLoginAttrEnabled()) {
if ($this->isLoginStringEnabled()) {
$return = str_replace('<username>',$_SERVER['PHP_AUTH_USER'],$this->getLoginString());
} else {
if ($this->login_dn)
$this->connect(true,'user',false,true,$this->login_dn,$this->login_pass);
@@ -2404,38 +2460,40 @@ class LDAPserver {
$result = $this->search(null,$base_dn,$filter,array('dn'));
$result = array_pop($result);
$return = $result['dn'];
if ($return) break;
if ($return)
break;
}
}
} else {
$return = $_SERVER['PHP_AUTH_USER'];
}
}
else
} else
$return = false;
if ($return) {
$dn = $return;
$pass = '';
if (isset($_SERVER['PHP_AUTH_PW'])) $pass = $_SERVER['PHP_AUTH_PW'];
if (isset($_SERVER['PHP_AUTH_PW']))
$pass = $_SERVER['PHP_AUTH_PW'];
if ($this->userIsAllowedLogin($dn)) {
$ds = $this->connect(false,'user',true,true,$dn,$pass);
if (! is_resource($ds)) {
system_message(array(
'title'=>_('Authenticate to server'),
'body'=>_('Bad username or password. Please try again.'),
'type'=>'error'),
sprintf('cmd.php?cmd=login_form&server_id=%s',$this->server_id));
syslog_notice("Authentification FAILED for $dn");
}
$this->auth_type = 'config';
$this->login_dn = $dn;
$this->login_pass = $pass;
} else {
$this->auth_type = 'session';
$return = false;
}
}
@@ -2447,7 +2505,7 @@ class LDAPserver {
break;
default:
pla_error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($auth_type)));
error(sprintf(_('Unknown auth_type: %s'),htmlspecialchars($auth_type)),'error','index.php');
}
}
@@ -2507,6 +2565,108 @@ class LDAPserver {
return $return_attrs;
}
/**
* Gets the user defined operational attributes for an entry. Given a DN, this function fetches that entry's
* operational (ie, system or internal) attributes.
*
* These attributes should be treated as internal attributes.
*
* The returned associative array is of this form:
* <code>
* Array (
* [nsroleDN] => Array (
* [0] => "cn=nsManagedDisabledRole,dc=example,dc=com",
* [1] => "cn=nsDisabledRole,dc=example,dc=com",
* [2] => "cn=nsAdminRole,dc=example,dc=com"
* )
* [passwordExpirationTime]=> Array (
* [0] => "20080314183611Z"
* )
* [passwordAllowChangeTime] => Array (
* [0] => "20080116175354Z"
* )
* )
* </code>
*
* @param string $dn The DN of the entry whose interal attributes are desired.
* @param int $deref For aliases and referrals, this parameter specifies whether to
* follow references to the referenced DN or to fetch the attributes for
* the referencing DN. See http://php.net/ldap_search for the 4 valid
* options.
* @return array An associative array whose keys are attribute names and whose values
* are arrays of values for the aforementioned attribute.
*/
function getCustomDNSysAttrs($dn,$deref=LDAP_DEREF_NEVER) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$deref);
$attrs = $this->custom_sys_attrs;
$search = $this->search(null,$dn,'(objectClass=*)',$attrs,'base',false,$deref);
$return_attrs = array();
foreach ($search as $dn => $attrs)
foreach ($attrs as $attr => $value) {
if (is_array($value)) {
foreach ($value as $val) $return_attrs[$attr][] = $val;
} else {
$return_attrs[$attr][] = $value;
}
}
return $return_attrs;
}
/**
* Gets the user defined operational attributes for an entry. Given a DN, this function fetches that entry's
* operational (ie, system or internal) attributes.
*
* These attributes should be treated as regular attributes, not as internal attributes.
*
* The returned associative array is of this form:
* <code>
* Array (
* [nsroleDN] => Array (
* [0] => "cn=nsManagedDisabledRole,dc=example,dc=com",
* [1] => "cn=nsDisabledRole,dc=example,dc=com",
* [2] => "cn=nsAdminRole,dc=example,dc=com"
* )
* [passwordExpirationTime]=> Array (
* [0] => "20080314183611Z"
* )
* [passwordAllowChangeTime] => Array (
* [0] => "20080116175354Z"
* )
* )
* </code>
*
* @param string $dn The DN of the entry whose interal attributes are desired.
* @param int $deref For aliases and referrals, this parameter specifies whether to
* follow references to the referenced DN or to fetch the attributes for
* the referencing DN. See http://php.net/ldap_search for the 4 valid
* options.
* @return array An associative array whose keys are attribute names and whose values
* are arrays of values for the aforementioned attribute.
*/
function getCustomDNAttrs($dn,$deref=LDAP_DEREF_NEVER) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s,%s)',17,__FILE__,__LINE__,__METHOD__,$dn,$deref);
$attrs = $this->custom_attrs;
$search = $this->search(null,$dn,'(objectClass=*)',$attrs,'base',false,$deref);
$return_attrs = array();
foreach ($search as $dn => $attrs)
foreach ($attrs as $attr => $value) {
if (is_array($value)) {
foreach ($value as $val) $return_attrs[$attr][] = $val;
} else {
$return_attrs[$attr][] = $value;
}
}
return $return_attrs;
}
/**
* Gets the attributes/values of an entry. Returns an associative array whose
* keys are attribute value names and whose values are arrays of values for
@@ -2634,7 +2794,7 @@ class LDAPserver {
$return = $dn;
foreach ($this->getBaseDN() as $base_dn) {
if (preg_match("/${base_dn}$/",$dn)) {
if (preg_match("/${base_dn}$/i",$dn)) {
$return = $base_dn;
break;
}
@@ -2731,7 +2891,8 @@ class LDAPserver {
$_SESSION[APPCONFIG]->ldapservers->GetValue($this->server_id,'unique_attrs','pass'));
if (! $con)
pla_error(sprintf(_('Unable to bind to <b>%s</b> with your with unique_attrs credentials. Please check your configuration file.'),$this->name));
error(sprintf(_('Unable to bind to <b>%s</b> with your with unique_attrs credentials. Please check your configuration file.'),$this->name),
'error','index.php');
# Build our search filter to double check each attribute.
$searchfilter = '(|';
@@ -2893,6 +3054,20 @@ class LDAPserver {
return null;
}
/**
* This function determines if the specified attribute is contained in the force_may list
* as configured in config.php.
*
* @return bool True if the specified attribute is in the $force_may list and false
* otherwise.
*/
function isForceMay($attr_name) {
if (DEBUG_ENABLED)
debug_log('Entered with (%s)',17,__FILE__,__LINE__,__METHOD__,$attr_name);
return in_array($attr_name,$this->force_may);
}
}
class LDAPservers {
@@ -2918,7 +3093,7 @@ class LDAPservers {
$this->default->server['port'] = array(
'desc'=>'Port Number',
'var'=>'port',
'default'=>'389');
'default'=>389);
/* Normally PLA will direct all read/write operations to host/port above. However,
* if you specify hostwr/portwr, then write operations will be directed to that host/port.
@@ -2931,7 +3106,7 @@ class LDAPservers {
$this->default->server['portwr'] = array(
'desc'=>'Port Number for write replica',
'var'=>'portwr',
'default'=>'389');
'default'=>389);
$this->default->server['base'] = array(
'desc'=>'Base DN',
@@ -3050,6 +3225,15 @@ class LDAPservers {
'desc'=>'Password for DN to use when evaluating numbers',
'default'=>null);
$this->default->auto_number['uidpool_dn'] = array(
'desc'=>'DN to use for the uidPool',
'default'=>'cn=uidPool,dc=example,dc=com');
$this->default->force_may['attrs'] = array(
'desc'=>'Attributes to force as MAY attributes, even though the schema may indicate that they are MUST attributes',
'var' => 'force_may',
'default'=>array());
$this->default->unique_attrs['dn'] = array(
'desc'=>'DN to use when evaluating uniqueness',
'default'=>null);
@@ -3096,6 +3280,16 @@ class LDAPservers {
'desc' => 'SASL properties',
'var' => 'sasl_props',
'default' => null);
$this->default->server['custom_attrs'] = array(
'desc' => 'Custom operational attributes to be treated as regular attributes',
'var' => 'custom_attrs',
'default' => array(''));
$this->default->server['custom_sys_attrs'] = array(
'desc' => 'Custom operational attributes to be treated as internal attributes',
'var' => 'custom_sys_attrs',
'default' => array(''));
}
function SetValue($server_id,$key,$index,$value) {
@@ -3104,21 +3298,21 @@ class LDAPservers {
$server_id,$key,$index,$value);
if (! isset($this->default->$key))
pla_error("ERROR: Setting a key [$key] that isnt predefined.");
error("ERROR: Setting a key [$key] that isnt predefined.",'error','index.php');
else
$default = $this->default->$key;
if (! isset($default[$index]))
pla_error("ERROR: Setting a index [$index] that isnt predefined.");
error("ERROR: Setting a index [$index] that isnt predefined.",'error','index.php');
else
$default = $default[$index];
# Test if its should be an array or not.
if (is_array($default['default']) && ! is_array($value))
pla_error("Error in configuration file, {$key}['$index'] SHOULD be an array of values.");
error("Error in configuration file, {$key}['$index'] SHOULD be an array of values.",'error','index.php');
if (! is_array($default['default']) && is_array($value))
pla_error("Error in configuration file, {$key}['$index'] should NOT be an array of values.");
error("Error in configuration file, {$key}['$index'] should NOT be an array of values.",'error','index.php');
# Some special processing.
# @todo: Add ldaps port details here.

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/session_functions.php,v 1.18.2.3 2007/12/29 08:24:11 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/session_functions.php,v 1.18.2.5 2008/12/12 12:20:23 wurley Exp $
/**
* A collection of functions to handle sessions throughout phpLDAPadmin.
@@ -69,7 +69,7 @@ function pla_session_verify_id() {
function pla_session_param() {
/* 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 */
return (SID != '') ? sprintf('&%s=%s',session_name(),session_id()) : '';
}
@@ -117,16 +117,16 @@ function pla_session_start() {
@header('Cache-control: private'); // IE 6 Fix
if (pla_session_id_paranoid && ! pla_session_verify_id())
pla_error('Session inconsistent or session timeout');
error('Session inconsistent or session timeout','error','index.php');
# Check we have the correct version of the SESSION cache
if (isset($_SESSION['cache']) || isset($_SESSION[pla_session_id_init])) {
if (!is_array($_SESSION[pla_session_id_init])) $_SESSION[pla_session_id_init] = array();
if (! is_array($_SESSION[pla_session_id_init])) $_SESSION[pla_session_id_init] = array();
if (!isset($_SESSION[pla_session_id_init]['version']) || !isset($_SESSION[pla_session_id_init]['config'])
if (! isset($_SESSION[pla_session_id_init]['version']) || ! isset($_SESSION[pla_session_id_init]['config'])
|| $_SESSION[pla_session_id_init]['version'] !== pla_version()
|| $_SESSION[pla_session_id_init]['config'] != filemtime(CONFDIR.'config.php')) {
$_SESSION[pla_session_id_init]['version'] = pla_version();
$_SESSION[pla_session_id_init]['config'] = filemtime(CONFDIR.'config.php');
@@ -160,6 +160,6 @@ function pla_session_start() {
* Stops the current session.
*/
function pla_session_close() {
@session_write_close();
@session_write_close();
}
?>

View File

@@ -1,5 +1,5 @@
<?php
/* $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.43.2.3 2008/01/04 14:29:44 wurley Exp $ */
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/template_functions.php,v 1.43.2.9 2009/01/09 06:08:21 wurley Exp $
/**
* Classes and functions for the template engine.ation and capability
@@ -42,9 +42,10 @@ class xml2array {
$this->strXmlData = xml_parse($this->resParser,$strInputXML);
if (! $this->strXmlData)
die(sprintf('XML error: %s at line %d',
die(sprintf('XML error: %s at line %d in file %s',
xml_error_string(xml_get_error_code($this->resParser)),
xml_get_current_line_number($this->resParser)));
xml_get_current_line_number($this->resParser),
$file));
xml_parser_free($this->resParser);
@@ -113,7 +114,7 @@ class Templates {
while( ( $file = readdir( $dir ) ) !== false ) {
if (! preg_match('/.xml$/',$file)) continue;
if ($_SESSION['plaConfig']->GetValue('appearance','custom_templates_only')
if ($_SESSION[APPCONFIG]->GetValue('appearance','custom_templates_only')
&& ! preg_match('/^custom_/',$file))
continue;
@@ -141,7 +142,7 @@ class Templates {
if (! preg_match('/.xml$/',$file))
continue;
if ($_SESSION['plaConfig']->GetValue('appearance','custom_templates_only')
if ($_SESSION[APPCONFIG]->GetValue('appearance','custom_templates_only')
&& ! preg_match('/^custom_/',$file))
continue;
@@ -264,7 +265,10 @@ class Templates {
break;
default :
$template[$xml_key] = $xml_value['#text'];
if (isset($xml_value['#text']))
$template[$xml_key] = $xml_value['#text'];
else
$template[$xml_key] = $xml_value;
}
}
@@ -682,7 +686,7 @@ class Templates {
$args[0] = $_SESSION[APPCONFIG]->ldapservers->GetValue($ldapserver->server_id,'auto_number','search_base');
$container = $ldapserver->getContainerParent($container,$args[0]);
$vals = get_next_number($ldapserver,$container,$args[1],(!empty($args[2]) && ($args[2] == 'true')) ? true : false,(!empty($args[3])) ? $args[3] : false);
$vals = get_next_number($ldapserver,$container,$args[1],(!empty($args[2]) && ($args[2] == 'false')) ? false : true,(!empty($args[3])) ? $args[3] : false);
# operate calculus on next number.
if (!empty($args[4])) {
$mod = split(';',$args[4]);
@@ -981,8 +985,8 @@ class Templates {
if (isset($_POST['form'][$varname]))
$function_args[] = $_POST['form'][$varname];
else
pla_error(sprintf(_('Your template calls php.Function for a default value, however (%s) is NOT available in the POST FORM variables. The following variables are available [%s].'),$varname,
(isset($_POST['form']) ? implode('|',array_keys($_POST['form'])) : 'NONE')));
error(sprintf(_('Your template calls php.Function for a default value, however (%s) is NOT available in the POST FORM variables. The following variables are available [%s].'),$varname,
(isset($_POST['form']) ? implode('|',array_keys($_POST['form'])) : 'NONE')),'error','index.php');
} else {
$function_args[] = $arg;
}

View File

@@ -1,5 +1,5 @@
<?php
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/timeout_functions.php,v 1.10.2.1 2007/12/29 08:24:11 wurley Exp $
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/timeout_functions.php,v 1.10.2.4 2008/12/13 08:57:09 wurley Exp $
/**
* A collection of functions used throughout phpLDAPadmin for the timeout and automatic logout feature
@@ -11,7 +11,6 @@
/**
* Responsible for setting/updating two session-vars that are used for the timeout and auto logout feature:
* - "activity" var records the server last activity.
* - "rightframe_server_id" var records the ID of the server active on the right frame.
* where X is the * ID of the server which the user is working on
*
* @param object $ldapserver The LDAPServer object of the server which the user has logged in.
@@ -22,7 +21,6 @@ function set_lastactivity($ldapserver) {
debug_log('Entered with (%s)',1,__FILE__,__LINE__,__METHOD__,$ldapserver->server_id);
$_SESSION['activity']['server'][$ldapserver->server_id] = time();
$_SESSION['activity']['rightframe_server_id'] = $ldapserver->server_id;
return true;
}
@@ -44,7 +42,6 @@ function unset_lastactivity($ldapserver) {
* Check if custom session timeout has been reached for server $ldapserver.
* If it has:
* - automatically log out user by calling $ldapserver->unsetLoginDN()
* - if $server_id is equal to right frame $server_id, load timeout.php page in the right frame
* - return true
*
* @param object $ldapserver The LDAPServer object of the server which the user has logged in.
@@ -63,7 +60,7 @@ function session_timed_out($ldapserver) {
else
$session_timeout = $ldapserver->session_timeout;
# Get the $last_activity and $rightframe_server_id value
# Get the $last_activity value
$last_activity = $_SESSION['activity']['server'][$ldapserver->server_id];
# If diff between current time and last activity greater than $session_timeout, log out user
@@ -71,7 +68,7 @@ function session_timed_out($ldapserver) {
if (in_array($ldapserver->auth_type,array('cookie','session'))) {
syslog_notice('Logout for '.$ldapserver->getLoggedInDN());
$ldapserver->unsetLoginDN() or pla_error(_('Could not logout.'));
$ldapserver->unsetLoginDN() or error(_('Could not logout.'),'error','index.php');
}
return true;

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More