From eccabca011cb9bc3426b8a49b94e47c4c3b6907c Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 30 Jun 2009 20:40:03 +1000 Subject: [PATCH] RELEASE 1.0.0 --- INSTALL | 4 +- VERSION | 2 +- config/config.php.example | 130 ++++++++++----- doc/README-translation.txt | 2 +- htdocs/add_attr.php | 2 +- htdocs/add_attr_form.php | 2 +- htdocs/add_oclass.php | 2 +- htdocs/add_oclass_form.php | 2 +- htdocs/add_value.php | 2 +- htdocs/add_value_form.php | 22 +-- htdocs/collapse.php | 10 +- htdocs/compare.php | 4 +- htdocs/compare_form.php | 105 ++++++------ htdocs/copy.php | 9 +- htdocs/copy_form.php | 35 ++-- htdocs/create.php | 2 +- htdocs/create_form.php | 2 +- htdocs/css/style.css | 24 +-- htdocs/delete.php | 2 +- htdocs/delete_attr.php | 2 +- htdocs/delete_form.php | 219 ++++++++++++------------- htdocs/download_binary_attr.php | 2 +- htdocs/entry_chooser.php | 6 +- htdocs/expand.php | 10 +- htdocs/export.php | 2 +- htdocs/export_form.php | 6 +- htdocs/header.php | 7 +- htdocs/help.php | 2 +- htdocs/index.php | 13 +- htdocs/js/phplayersmenu/lib/PHPLIB.php | 2 +- htdocs/ldif_import.php | 2 +- htdocs/ldif_import_form.php | 2 +- htdocs/login.php | 11 +- htdocs/login_form.php | 18 +- htdocs/logout.php | 2 +- htdocs/mass_delete.php | 2 +- htdocs/password_checker.php | 2 +- htdocs/purge_cache.php | 2 +- htdocs/rdelete.php | 10 +- htdocs/refresh.php | 2 +- htdocs/rename.php | 6 +- htdocs/rename_form.php | 4 +- htdocs/schema.php | 2 +- htdocs/search.php | 10 +- htdocs/server_info.php | 17 +- htdocs/template_engine.php | 148 ++++++----------- htdocs/tree.php | 14 +- htdocs/update.php | 25 +-- htdocs/update_confirm.php | 33 ++-- htdocs/view_jpeg_photo.php | 2 +- htdocs/welcome.php | 2 +- lib/common.php | 16 +- lib/config_default.php | 4 +- lib/createlm.php | 28 +--- lib/export_functions.php | 2 +- lib/functions.php | 117 ++++--------- lib/hooks.php | 14 +- lib/ldif_functions.php | 2 +- lib/schema_functions.php | 3 +- lib/search_form_advanced.php | 8 +- lib/search_form_predefined.php | 2 +- lib/search_form_simple.php | 2 +- lib/search_results_list.php | 2 +- lib/search_results_table.php | 2 +- lib/server_functions.php | 159 +++++++++++++++--- lib/session_functions.php | 2 +- lib/syslog.php | 2 +- lib/template_functions.php | 6 +- lib/timeout_functions.php | 2 +- lib/tree_functions.php | 46 +++--- locale/ja_JP/LC_MESSAGES/messages.po | 2 +- templates/creation/custom.php | 8 +- templates/template_header.php | 38 +++-- tools/po/make_po_ca | 2 +- tools/po/make_po_de | 2 +- tools/po/make_po_es | 2 +- tools/po/make_po_fr | 2 +- tools/po/make_po_hu | 2 +- tools/po/make_po_it | 2 +- tools/po/make_po_ja | 2 +- tools/po/messages.header | 2 +- 81 files changed, 710 insertions(+), 723 deletions(-) diff --git a/INSTALL b/INSTALL index 7618b9a..78ea6f7 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ For install instructions in non-English languages, see the wiki: - http://wiki.phpldapadmin.info + http://wiki.pldapadmin.com * Requirements @@ -17,7 +17,7 @@ For install instructions in non-English languages, see the wiki: * For additional help See the wiki: - http://wiki.phpldapadmin.info + http://wiki.pldapadmin.com Join our mailing list: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel diff --git a/VERSION b/VERSION index 63161b2..11e7b29 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -$Name: RELEASE-0_9_8_1 $ +$Name: RELEASE-1_0_0 $ diff --git a/config/config.php.example b/config/config.php.example index 11a5b2f..1e4c80f 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -1,9 +1,4 @@ default->appearance['lang'] = array( - * 'desc'=>'Language', - * 'default'=>'auto'); + * 'desc'=>'Language', + * 'default'=>'auto'); * * to override this, use $config->custom->appearance['lang'] = 'en'; * @@ -115,6 +110,50 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server'); /* Use TLS (Transport Layer Security) to connect to the LDAP server. */ // $ldapservers->SetValue($i,'server','tls',false); +/************************************ + * SASL Authentication * + ************************************/ + +/* Enable SASL authentication LDAP SASL authentication requires PHP 5.x + configured with --with-ldap-sasl=DIR. If this option is disabled (ie, set to + false), then all other sasl options are ignored. */ +// $ldapservers->SetValue($i,'server','sasl_auth', false); + +/* SASL auth mechanism */ +// $ldapservers->SetValue($i,'server','sasl_mech', "PLAIN"); + +/* SASL authentication realm name */ +// $ldapservers->SetValue($i,'server','sasl_realm',''); +# $ldapservers->SetValue($i,'server','sasl_realm',"example.com"); + +/* SASL authorization ID name + If this option is undefined, authorization id will be computed from bind DN, + using sasl_authz_id_regex and sasl_authz_id_replacement. */ +// $ldapservers->SetValue($i,'server','sasl_authz_id', null); + +/* SASL authorization id regex and replacement + When sasl_authz_id property is not set (default), phpLDAPAdmin will try to + figure out authorization id by itself from bind distinguished name (DN). + + This procedure is done by calling preg_replace() php function in the + following way: + + $authz_id = preg_replace($sasl_authz_id_regex,$sasl_authz_id_replacement, + $bind_dn); + + For info about pcre regexes, see: + - pcre(3), perlre(3) + - http://www.php.net/preg_replace */ +// $ldapservers->SetValue($i,'server','sasl_authz_id_regex',null); +// $ldapservers->SetValue($i,'server','sasl_authz_id_replacement',null); +# $ldapservers->SetValue($i,'server','sasl_authz_id_regex','/^uid=([^,]+)(.+)/i'); +# $ldapservers->SetValue($i,'server','sasl_authz_id_replacement','$1'); + +/* SASL auth security props. + See http://beepcore-tcl.sourceforge.net/tclsasl.html#anchor5 for explanation. +*/ +// $ldapservers->SetValue($i,'server','sasl_props',null); + /* If the link between your web server and this LDAP server is slow, it is recommended that you set 'low_bandwidth' to true. This will enable phpLDAPadmin to forego some "fancy" features to conserve bandwidth. */ @@ -146,7 +185,7 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server'); /* If 'login_attr' is used above such that phpLDAPadmin will search for your DN at login, you may restrict the search to a specific objectClass. EG, set this to 'posixAccount' or 'inetOrgPerson', depending upon your setup. */ -// $ldapservers->SetValue($i,'login','class',null); +// $ldapservers->SetValue($i,'login','class',''); /* Specify true If you want phpLDAPadmin to not display or permit any modification to the LDAP server. */ @@ -169,50 +208,50 @@ $ldapservers->SetValue($i,'server','name','My LDAP Server'); // $ldapservers->SetValue($i,'auto_number','mechanism','search'); /* The DN of the search base when the 'search' mechanism is used above. */ -# $ldapservers->SetValue($i,'auto_number','search_base','ou=People,dc=example,dc=com'); +// $ldapservers->SetValue($i,'auto_number','search_base','ou=People,dc=example,dc=com'); /* The minimum number to use when searching for the next available UID number (only when 'search' is used for auto_uid_number_mechanism' */ // $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'; +// $servers[$i]['auto_uid_number_uid_pool_dn'] = 'cn=uidPool,dc=example,dc=com'; /* If you set this, then phpldapadmin will bind to LDAP with this user ID when searching for the uidnumber. The idea is, this user id would have full (readonly) access to uidnumber in your ldap directory (the logged in user may not), so that you can be guaranteed to get a unique uidnumber for your directory. */ -// $ldapservers->SetValue($i,'auto_number','dn',null); +// $ldapservers->SetValue($i,'auto_number','dn',''); /* The password for the dn above. */ -// $ldapservers->SetValue($i,'auto_number','pass',null); +// $ldapservers->SetValue($i,'auto_number','pass',''); /* Enable anonymous bind login. */ // $ldapservers->SetValue($i,'login','anon_bind',true); /* Use customized page with prefix when available. */ -# $ldapservers->SetValue($i,'custom','pages_prefix','custom_'); +// $ldapservers->SetValue($i,'custom','pages_prefix','custom_'); /* If you set this, then phpldapadmin will bind to LDAP with this user when testing for unique attributes (as set in unique_attrs array). If you want to enforce unique attributes, than this id should have full (readonly) access to the attributes in question (the logged in user may not have enough access) */ -// $ldapservers->SetValue($i,'unique_attrs','dn',null); +// $ldapservers->SetValue($i,'unique_attrs','dn',''); /* The password for the dn above */ -// $ldapservers->SetValue($i,'unique_attrs','pass',null); +// $ldapservers->SetValue($i,'unique_attrs','pass',''); /* If you set this, then only these DNs are allowed to log in. This array can contain individual users, groups or ldap search filter(s). Keep in mind that the user has not authenticated yet, so this will be an anonymous search to the LDAP server, so make your ACLs allow these searches to return results! */ -# $ldapservers->SetValue($i,'login','allowed_dns',array( -# 'uid=stran,ou=People,dc=example,dc=com', -# '(&(gidNumber=811)(objectClass=groupOfNames))', -# '(|(uidNumber=200)(uidNumber=201))', -# 'cn=callcenter,ou=Group,dc=example,dc=com')); +# $ldapservers->SetValue($i,'login','allowed_dns',array( +# 'uid=stran,ou=People,dc=example,dc=com', +# '(&(gidNumber=811)(objectClass=groupOfNames))', +# '(|(uidNumber=200)(uidNumber=201))', +# 'cn=callcenter,ou=Group,dc=example,dc=com')); /* Set this if you dont want this LDAP server to show in the tree */ // $ldapservers->SetValue($i,'appearance','visible',true); @@ -245,20 +284,29 @@ $ldapservers->SetValue($i,'server','tls',false); $ldapservers->SetValue($i,'server','low_bandwidth',false); $ldapservers->SetValue($i,'appearance','password_hash','md5'); $ldapservers->SetValue($i,'login','attr','dn'); -$ldapservers->SetValue($i,'login','string',null); -$ldapservers->SetValue($i,'login','class',null); +$ldapservers->SetValue($i,'login','string',''); +$ldapservers->SetValue($i,'login','class',''); $ldapservers->SetValue($i,'server','read_only',false); $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','search_base',''); $ldapservers->SetValue($i,'auto_number','min','1000'); -$ldapservers->SetValue($i,'auto_number','dn',null); -$ldapservers->SetValue($i,'auto_number','pass',null); +$ldapservers->SetValue($i,'auto_number','dn',''); +$ldapservers->SetValue($i,'auto_number','pass',''); $ldapservers->SetValue($i,'login','anon_bind',true); $ldapservers->SetValue($i,'custom','pages_prefix','custom_'); -$ldapservers->SetValue($i,'unique_attrs','dn',null); -$ldapservers->SetValue($i,'unique_attrs','pass',null); +$ldapservers->SetValue($i,'unique_attrs','dn',''); +$ldapservers->SetValue($i,'unique_attrs','pass',''); + +# SASL auth +$ldapservers->SetValue($i,'server','sasl_auth', true); +$ldapservers->SetValue($i,'server','sasl_mech', "PLAIN"); +$ldapservers->SetValue($i,'server','sasl_realm', "EXAMPLE.COM"); +$ldapservers->SetValue($i,'server','sasl_authz_id', null); +$ldapservers->SetValue($i,'server','sasl_authz_id_regex', '/^uid=([^,]+)(.+)/i'); +$ldapservers->SetValue($i,'server','sasl_authz_id_replacement', '$1'); +$ldapservers->SetValue($i,'server','sasl_props', null); */ /*********************************************/ @@ -270,7 +318,7 @@ $ldapservers->SetValue($i,'unique_attrs','pass',null); $friendly_attrs = array(); $friendly_attrs['facsimileTelephoneNumber'] = 'Fax'; -$friendly_attrs['telephoneNumber'] = 'Phone'; +$friendly_attrs['telephoneNumber'] = 'Phone'; /*********************************************/ /* Support for attrs display order */ @@ -282,16 +330,16 @@ $friendly_attrs['telephoneNumber'] = 'Phone'; attributes that are not specified in this array will be displayed after in alphabetical order. */ # $attrs_display_order = array( -# 'givenName', -# 'sn', -# 'cn', -# 'displayName', -# 'uid', -# 'uidNumber', -# 'gidNumber', -# 'homeDirectory', -# 'mail', -# 'userPassword' +# 'givenName', +# 'sn', +# 'cn', +# 'displayName', +# 'uid', +# 'uidNumber', +# 'gidNumber', +# 'homeDirectory', +# 'mail', +# 'userPassword' # ); /*********************************************/ @@ -310,8 +358,8 @@ $friendly_attrs['telephoneNumber'] = 'Phone'; /* Hidden attributes in read-only mode. If undefined, it will be equal to $hidden_attrs. */ # $hidden_attrs_ro = array( -# 'objectClass','shadowWarning', 'shadowLastChange', 'shadowMax', -# 'shadowFlag', 'shadowInactive', 'shadowMin', 'shadowExpire'); +# 'objectClass','shadowWarning', 'shadowLastChange', 'shadowMax', +# 'shadowFlag', 'shadowInactive', 'shadowMin', 'shadowExpire'); /** **/ /** Read-only attributes **/ @@ -362,7 +410,7 @@ $queries[$q]['scope'] = 'sub'; $queries[$q]['filter'] = '(&(objectClass=posixAccount)(uid=*))'; /* The attributes to return */ -$queries[$q]['attributes'] = 'cn, uid, homeDirectory, telephonenumber, jpegphoto'; +$queries[$q]['attributes'] = 'cn, uid, homeDirectory'; /* If you want to configure more pre-defined queries, copy and paste the above (including the "$q++;") */ $q++; diff --git a/doc/README-translation.txt b/doc/README-translation.txt index 8c4cc33..fa1141a 100644 --- a/doc/README-translation.txt +++ b/doc/README-translation.txt @@ -1,2 +1,2 @@ -Please see http://wiki.phpldapadmin.info/Translating now for information on +Please see http://wiki.pldapadmin.com/Translating now for information on translating PLA. diff --git a/htdocs/add_attr.php b/htdocs/add_attr.php index c8e9aa1..5157089 100644 --- a/htdocs/add_attr.php +++ b/htdocs/add_attr.php @@ -1,5 +1,5 @@ getDNAttr($dn,$attr); -if ($current_values) { - if (! is_array($current_values)) - $current_values = array($current_values); - - $num_current_values = count($current_values); - -} else { - $current_values = array(); +if ($current_values) + $num_current_values = (is_array($current_values) ? count($current_values) : 1); +else $num_current_values = 0; -} $is_object_class = (strcasecmp($attr, 'objectClass') == 0) ? true : false; @@ -113,18 +107,18 @@ if ($num_current_values) { if (strcasecmp($attr,'userPassword') == 0) { foreach ($current_values as $key => $value) { if (obfuscate_password_display(get_enc_type($value))) - echo '
  • '.preg_replace('/./','*',$value).'
  • '; + echo '
  • '.preg_replace('/./','*',$value).'
  • '; else - echo '
  • '.htmlspecialchars($value).'
  • '; + echo '
  • '.htmlspecialchars($value).'
  • '; } } else { foreach ($current_values as $val) - printf('
  • %s
  • ',htmlspecialchars($val)); + printf('
  • %s
  • ',htmlspecialchars($val)); } } else { - printf('
  • %s
  • ',htmlspecialchars($current_values)); + printf('
  • %s
  • ',htmlspecialchars($current_values)); } echo ''; diff --git a/htdocs/collapse.php b/htdocs/collapse.php index 70f0259..bf84298 100644 --- a/htdocs/collapse.php +++ b/htdocs/collapse.php @@ -1,5 +1,5 @@ server_id,'tree'); $tree['browser'][$dn]['open'] = false; set_cached_item($ldapserver->server_id,'tree','null',$tree); +/* This is for Opera. By putting "random junk" in the query string, it thinks + that it does not have a cached version of the page, and will thus + fetch the page rather than display the cached version */ +$time = gettimeofday(); +$random_junk = md5(strtotime('now').$time['usec']); + /* If cookies were disabled, build the url parameter for the session id. It will be append to the url to be redirect */ $id_session_param = ''; if (SID != '') $id_session_param = sprintf('&%s=%s',session_name(),session_id()); -header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param)); +header(sprintf('Location:tree.php?foo=%s#%s_%s%s',$random_junk,$ldapserver->server_id,rawurlencode($dn),$id_session_param)); ?> diff --git a/htdocs/compare.php b/htdocs/compare.php index 0831f6e..78971d7 100644 --- a/htdocs/compare.php +++ b/htdocs/compare.php @@ -1,5 +1,5 @@ - + diff --git a/htdocs/compare_form.php b/htdocs/compare_form.php index bd049e4..4fda703 100644 --- a/htdocs/compare_form.php +++ b/htdocs/compare_form.php @@ -1,5 +1,5 @@ haveAuthInfo()) - pla_error(_('Not enough information to login to server. Please check your configuration.')); +if( ! $ldapserver->haveAuthInfo()) + pla_error( _('Not enough information to login to server. Please check your configuration.') ); $dn = (isset($_GET['dn']) ? $_GET['dn'] : ''); -$rdn = get_rdn($dn); + +$encoded_dn = rawurlencode( $dn ); +$rdn = get_rdn( $dn ); +$container = get_container( $dn ); + +$attrs = $ldapserver->getDNAttrs($dn); $select_server_html = server_select_list($ldapserver->server_id,true,'server_id_dst'); -include './header.php'; +include './header.php'; ?> -echo ''; + -printf('

    %s %s

    ',_('Compare another DN with'),htmlspecialchars($rdn)); -printf('

    %s: %s',_('Server'),$ldapserver->name); -if ($dn) - printf('   %s: %s',_('Distinguished Name'),htmlspecialchars($dn)); -echo '

    '; -echo "\n"; +

    +

    : name; ?> + +     : + +

    -echo '
    '; -printf('%s %s %s
    ',_('Compare'),htmlspecialchars($rdn),_('with ')); +
    + :
    +
    -echo '
    '; -printf('',$ldapserver->server_id); -echo "\n"; + + -echo ''; -echo "\n"; -echo ' + + +
    '; + + + + + + + + + + + + + + + -if (! $dn) { - printf('%s:',_('Compare this DN with another'),_('Source DN')); - echo ' + + + -} else - printf('',htmlspecialchars($dn)); - -echo ''; -echo "\n"; - -echo ''; -printf('',_('Compare this DN with another'),_('Destination DN')); -echo ''; -echo ''; -echo "\n"; - -printf('',_('Destination Server'),$select_server_html); -echo "\n"; - -printf('',_('Compare')); -echo "\n"; - -echo '
    : + +
    : + +
    '; - printf('',htmlspecialchars($dn)); - draw_chooser_link('compare_form.dn_src','true',$rdn); +
    :
    %s:'; -echo ''; -draw_chooser_link('compare_form.dn_dst','true',''); -echo '
    %s:%s
    '; -echo ''; -echo ''; -echo ''; -echo ''; -?> +
    + +
    + + diff --git a/htdocs/copy.php b/htdocs/copy.php index 0786c73..143ae24 100644 --- a/htdocs/copy.php +++ b/htdocs/copy.php @@ -1,5 +1,5 @@ '; printf('',$delete_url); } @@ -99,7 +99,7 @@ function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_ds debug_log('r_copy_dn: Entered with (%s,%s,%s,%s,%s)',1, $ldapserver_src->server_id,$ldapserver_dst->server_id,$snapshottree,$root_dn,$dn_dst); - printf('%s %s...',_('Copying'),htmlspecialchars($root_dn)); + printf('%s %s...',_('Copying '),htmlspecialchars($root_dn)); flush(); $copy_result = copy_dn($ldapserver_src,$ldapserver_dst,$root_dn,$dn_dst); @@ -107,7 +107,7 @@ function r_copy_dn($ldapserver_src,$ldapserver_dst,$snapshottree,$root_dn,$dn_ds if (! $copy_result) return false; - printf('%s
    ',_('Success')); + printf('%s

    ',_('Success')); flush(); $children = isset($snapshottree[$root_dn]) ? $snapshottree[$root_dn] : null; @@ -172,7 +172,6 @@ function build_tree($ldapserver,$dn,$buildtree) { debug_log('build_tree: Entered with (%s,%s,%s)',1, $ldapserver->server_id,$dn,$buildtree); - # we search all children, not only the visible children in the tree $children = $ldapserver->getContainerContents($dn,0); if (is_array($children) && count($children) > 0) { diff --git a/htdocs/copy_form.php b/htdocs/copy_form.php index 755b096..5b3d006 100644 --- a/htdocs/copy_form.php +++ b/htdocs/copy_form.php @@ -1,5 +1,5 @@ 0) { ?> echo ''; -printf('

    %s %s

    ',_('Copy'),htmlspecialchars($rdn)); -printf('

    %s: %s     %s: %s

    ',_('Server'),$ldapserver->name, - _('Distinguished Name'),htmlspecialchars($dn)); -echo "\n"; +printf('

    %s %s

    ',_('Copy '),$rdn); +printf('

    %s: %s     %s: %s

    ',_('Server'),$ldapserver->name,_('Distinguished Name'),$dn); echo '
    '; -printf('%s %s %s:

    ',_('Copy'),htmlspecialchars($rdn),_('to a new object')); +printf('%s %s %s:

    ',_('Copy '),htmlspecialchars($rdn),_('to a new object')); echo '
    '; -printf('',htmlspecialchars($dn)); +printf('',$dn); printf('',$ldapserver->server_id); -echo "\n"; echo ''; -echo "\n"; - echo ''; -printf('', - _('The full DN of the new entry to be created when copying the source entry'),_('Destination DN')); +printf('',_('The full DN of the new entry to be created when copying the source entry'),_('Destination DN')); printf(''; -echo "\n"; printf('',_('Destination Server'),$select_server_html); -echo "\n"; if (is_array($children) && count($children) > 0) { echo ''; printf('',_('Recursive copy')); echo '',_('Recursively copy all children of this object as well.')); - echo ''."\n"; - - echo ''; + echo ''; printf('',_('When performing a recursive copy, only copy those entries which match this filter'),_('Filter')); echo ''."\n"; - - echo ''; + echo ''; printf('',_('Delete after copy (move):')); echo '',_('Delete after copy (move):')); } -echo "\n"; printf('',_('Copy ')); -echo "\n"; echo '
    %s:%s:',htmlspecialchars($dn)); -draw_chooser_link('copy_form.new_dn','true',htmlspecialchars($rdn)); +draw_chooser_link('copy_form.new_dn','true',$rdn); echo '
    %s%s
    :'; printf('(%s)
    %s:'; - echo '
    %s'; printf('(%s)',_('Make sure your filter (above) will select all child records.')); @@ -101,12 +89,9 @@ if (is_array($children) && count($children) > 0) { } else { printf('
    %s
    '; -echo "\n"; echo ''; if ($config->GetValue('appearance','show_hints')) - printf('Light%s',_('Hint: Copying between different servers only works if there are no schema violations')); + printf('%s',_('Hint: Copying between different servers only works if there are no schema violations')); echo '
    '; ?> diff --git a/htdocs/create.php b/htdocs/create.php index 10d3efa..2a04ec0 100644 --- a/htdocs/create.php +++ b/htdocs/create.php @@ -1,5 +1,5 @@ '; printf('

    '._('Delete %s').'

    ',htmlspecialchars(get_rdn($dn))); printf('

    %s: %s     %s: %s

    ', - _('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars($dn)); -echo "\n"; - -echo '
    '; + _('Server'),$ldapserver->name,_('Distinguished Name'),htmlspecialchars(($dn))); if ($has_children) { + echo '
    '; printf('%s

    ',_('Permanently delete all children also?')); flush(); # get the total number of child objects (whole sub-tree) $s = $ldapserver->search(null,dn_escape($dn),'objectClass=*',array('dn')); $sub_tree_count = count($s); - - echo ''; - echo ''; - echo ''; - echo ''; - echo '

    '; - printf(_('This entry is the root of a sub-tree containing %s entries.'),$sub_tree_count); - printf('(%s)', - $ldapserver->server_id,rawurlencode('objectClass=*'),rawurlencode($dn),_('view entries')); - echo '

    '; - - printf(_('phpLDAPadmin can recursively delete this entry and all %s of its children. See below for a list of all the entries that this action will delete. Do you want to do this?'),($sub_tree_count-1)); - echo '

    '; - - printf('%s', - _('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.')); - echo '

    '; - echo "\n"; - - echo ''; - echo ''; - echo ''; - - echo ''; - echo ''; - echo '
    '; - echo '
    '; - printf('',htmlspecialchars($dn)); - printf('',$ldapserver->server_id); - printf('',sprintf(_('Delete all %s objects'),$sub_tree_count)); - echo '
    '; - echo '
    '; - echo '
    '; - printf('',htmlspecialchars($dn)); - printf('',$ldapserver->server_id); - printf('',_('Cancel')); - echo '
    '; - echo '
    '; - echo "\n"; - - echo '

    '; - echo "\n"; - - flush(); - - echo '

    '; - echo _('List of entries to be deleted:'); - echo '
    '; - - printf(''; - echo "\n"; - -} else { - echo ''; - echo ''; - - echo ''; - echo ''; - echo '
    '; - echo _('Are you sure you want to permanently delete this object?'); - echo '

    '; - - printf('%s: %s',_('Distinguished Name'),_('DN'),pretty_print_dn($dn)); - echo '
    '; - printf('%s: %s',_('Server'),htmlspecialchars($ldapserver->name)); - echo '

    '; - echo "\n"; - - echo ''; - echo ''; - - echo ''; - - echo ''; - echo ''; - echo '
    '; - echo '
    '; - printf('',htmlspecialchars($dn)); - printf('',$ldapserver->server_id); - printf('',_('Delete')); - echo '
    '; - - echo '
    '; - echo '
    '; - printf('',htmlspecialchars($dn)); - printf('',$ldapserver->server_id); - printf('',_('Cancel')); - echo '
    '; - - echo '
    '; - echo "\n"; - - echo '
    '; - echo "\n"; - -} - -echo '
    '; -echo '
    '; -echo ''; -echo ''; ?> + + + + + +
    +

    + + () +
    +
    + +
    +
    + + +
    +
    + + + + + + +
    +
    +
    + + + +
    +
    +
    +
    +
    + + + +
    +
    +
    +

    + + +
    +
    +
    + + +
    + +
    + + + +
    + + + + +
    +
    +
    + :
    + : name); ?>
    +
    + + + + + + + +
    +
    +
    + + + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    + + + + + diff --git a/htdocs/download_binary_attr.php b/htdocs/download_binary_attr.php index b7b5472..49e40b7 100644 --- a/htdocs/download_binary_attr.php +++ b/htdocs/download_binary_attr.php @@ -1,5 +1,5 @@ ', $ldapserver->server_id,$return_form_element,$rdn,rawurlencode($dn)); diff --git a/htdocs/expand.php b/htdocs/expand.php index 8526114..0334bf7 100644 --- a/htdocs/expand.php +++ b/htdocs/expand.php @@ -1,5 +1,5 @@ server_id,'tree'); $tree['browser'][$dn]['open'] = true; set_cached_item($ldapserver->server_id,'tree','null',$tree); +/* This is for Opera. By putting "random junk" in the query string, it thinks + that it does not have a cached version of the page, and will thus + fetch the page rather than display the cached version */ +$time = gettimeofday(); +$random_junk = md5(strtotime('now').$time['usec']); + /* If cookies were disabled, build the url parameter for the session id. It will be append to the url to be redirect */ $id_session_param = ''; if (SID != '') $id_session_param = sprintf('&%s=%s',session_name(),session_id()); -header(sprintf('Location:tree.php?foo=%s#%s_%s%s',random_junk(),$ldapserver->server_id,rawurlencode($dn),$id_session_param)); +header(sprintf('Location:tree.php?foo=%s#%s_%s%s',$random_junk,$ldapserver->server_id,rawurlencode($dn),$id_session_param)); ?> diff --git a/htdocs/export.php b/htdocs/export.php index 96f33ba..a378be5 100755 --- a/htdocs/export.php +++ b/htdocs/export.php @@ -1,5 +1,5 @@ %s%s',_('Server'),server_select_list()); echo ''; printf('%s',_('Base DN')); -printf(' ',htmlspecialchars($dn)); +printf(' ',htmlspecialchars($dn)); draw_chooser_link('export_form.dn'); -echo ''; +echo ''; echo ''; echo ''; diff --git a/htdocs/header.php b/htdocs/header.php index c036155..394ff67 100644 --- a/htdocs/header.php +++ b/htdocs/header.php @@ -1,5 +1,5 @@ GetValue('appearance','language') : 'auto'; # text/xml won't work with MSIE, but is very useful for debugging xhtml code. @@ -16,8 +17,8 @@ $language = isset($config) ? $language = $config->GetValue('appearance','languag # XML version and encoding for well-behaved browsers echo ''."\n"; -echo ''."\n"; +echo ''."\n"; printf('',$language,$language); echo "\n\n"; diff --git a/htdocs/help.php b/htdocs/help.php index 77d9840..8aa6af6 100644 --- a/htdocs/help.php +++ b/htdocs/help.php @@ -1,5 +1,5 @@ (PEARification) // Martin Jansen (PEAR conformance) // -// $Id: PHPLIB.php,v 1.1.2.1 2005/11/27 03:55:50 wurley Exp $ +// $Id: PHPLIB.php,v 1.2 2005/12/10 10:34:54 wurley Exp $ // //require_once "PEAR.php"; diff --git a/htdocs/ldif_import.php b/htdocs/ldif_import.php index f171397..964a3d9 100644 --- a/htdocs/ldif_import.php +++ b/htdocs/ldif_import.php @@ -1,5 +1,5 @@ auth_type; if ($anon_bind) { - if (DEBUG_ENABLED) + if (DEBUG_ENABLED) debug_log('Anonymous Login was posted [%s].',64,$anon_bind); $dn = null; @@ -78,15 +78,14 @@ if ($anon_bind) { # Got through each of the BASE DNs and test the login. foreach ($ldapserver->getBaseDN() as $base_dn) { - if (DEBUG_ENABLED) + if (DEBUG_ENABLED) debug_log('Searching LDAP with base [%s]',64,$base_dn); - $result = $ldapserver->search(null,$base_dn,$filter,array('dn')); - $result = array_pop($result); + $result = array_pop($ldapserver->search(null,$base_dn,$filter,array('dn'))); $dn = $result['dn']; if ($dn) { - if (DEBUG_ENABLED) + if (DEBUG_ENABLED) debug_log('Got DN [%s] for user ID [%s]',64,$dn,$uid); break; } diff --git a/htdocs/login_form.php b/htdocs/login_form.php index 32d7082..d7c7a91 100644 --- a/htdocs/login_form.php +++ b/htdocs/login_form.php @@ -1,5 +1,5 @@
    +isAnonBindAllowed() ) { ?> + + + + + - +
    diff --git a/htdocs/logout.php b/htdocs/logout.php index 02f982d..4e62c79 100644 --- a/htdocs/logout.php +++ b/htdocs/logout.php @@ -1,5 +1,5 @@ getContainerContents($dn); if (! is_array($children) || count($children) == 0) { - printf('%s %s...',_('Deleting'),htmlspecialchars($dn)); + printf(''._('Deleting %s').'...',htmlspecialchars($dn)); flush(); if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if ($ldapserver->delete($dn)) { run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); - printf(' %s
    ',_('Success')); + printf(' %s

    ',_('Success')); return true; } else { @@ -74,13 +74,13 @@ function pla_rdelete($ldapserver,$dn) { foreach ($children as $child_dn) pla_rdelete($ldapserver,$child_dn); - printf('%s %s...',_('Deleting'),htmlspecialchars($dn)); + printf(''._('Deleting %s').'...',htmlspecialchars($dn)); flush(); if (run_hook('pre_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn))) if ($ldapserver->delete($dn)) { run_hook('post_entry_delete',array('server_id'=>$ldapserver->server_id,'dn'=>$dn)); - printf(' %s
    ',_('Success')); + printf(' %s

    ',_('Success')); return true; } else { diff --git a/htdocs/refresh.php b/htdocs/refresh.php index 720bcca..1fcae71 100644 --- a/htdocs/refresh.php +++ b/htdocs/refresh.php @@ -1,5 +1,5 @@ $ldapserver->server_id,'old_dn'=>dn_escape($dn),'new_dn'=>dn_escape($new_dn_value))); +$success = run_hook('pre_rename_entry',array('server_id'=>$ldapserver->server_id,'old_dn'=>$dn,'new_dn'=>$new_dn_value)); if ($success) { $success = false; $deleteoldrdn = $old_dn_attr == $new_dn_attr; - $success = $ldapserver->rename(dn_escape($dn),dn_escape($new_rdn),$container,$deleteoldrdn); + $success = $ldapserver->rename($dn,$new_rdn,$container,$deleteoldrdn); } else { pla_error(_('Could not rename the entry') ); diff --git a/htdocs/rename_form.php b/htdocs/rename_form.php index bc3a06c..0cbaefa 100644 --- a/htdocs/rename_form.php +++ b/htdocs/rename_form.php @@ -1,5 +1,5 @@ %s: %s     %s: %s echo '
    '; printf('',$ldapserver->server_id); -printf('',htmlspecialchars($dn)); +printf('',$dn); printf('',htmlspecialchars($rdn)); printf('',_('Rename')); echo '
    '; diff --git a/htdocs/schema.php b/htdocs/schema.php index 373a672..69f4f69 100644 --- a/htdocs/schema.php +++ b/htdocs/schema.php @@ -1,5 +1,5 @@ search(null,dn_escape($base_dn),$filter, - $search_result_attributes,$scope,$orderby,$config->GetValue('deref','search')); + $results = $ldapserver->search(null,dn_escape($base_dn),$filter,$search_result_attributes,$scope,true,$config->GetValue('deref','search')); if ((! $results) && $ldapserver->errno()) pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno()); @@ -235,8 +233,8 @@ if (isset($_GET['search'])) { Save %s ]', - $ldapserver->server_id,htmlspecialchars($scope),urlencode($base_dn),urlencode($filter), + printf('[ %s ]', + $ldapserver->server_id,$scope,urlencode($base_dn),urlencode($filter), urlencode(join(', ',$search_result_attributes)),_('export results')); printf('[ %s:',_('Format')); diff --git a/htdocs/server_info.php b/htdocs/server_info.php index 5da5882..b85ab8f 100644 --- a/htdocs/server_info.php +++ b/htdocs/server_info.php @@ -1,5 +1,5 @@ haveAuthInfo()) pla_error( _('Not enough information to login to server. Please check your configuration.') ); # Fetch basic RootDSE attributes using the + and *. -$attrs = $ldapserver->search(null,'','objectClass=*',array('+','*'),'base'); -$attrs = array_pop($attrs); +$attrs = array_pop($ldapserver->search(null,'','objectClass=*',array('+','*'),'base')); /* After fetching the "basic" attributes from the RootDSE, try fetching the more advanced ones (from ths list). Add them to the list of attrs to display if they weren't already fetched. (this was added as a work-around for OpenLDAP on RHEL 3. */ -$attrs2 = $ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base'); -$attrs2 = array_pop($attrs2); +$attrs2 = array_pop($ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base')); -if (is_array($attrs2)) - foreach ($attrs2 as $attr => $values) - if (! isset($attrs[$attr])) - $attrs[$attr] = $attrs2[$attr]; +foreach ($attrs2 as $attr => $values) + if (! isset($attrs[$attr])) + $attrs[$attr] = $attrs2[$attr]; include './header.php'; @@ -85,7 +82,7 @@ foreach ($attrs as $attr => $values) { $schema_href = sprintf('schema.php?server_id=%s&view=attributes&viewvalue=%s',$ldapserver->server_id,$attr); echo ''; - printf('%s', + printf('%s', $attr,$schema_href,htmlspecialchars($attr)); echo ''; diff --git a/htdocs/template_engine.php b/htdocs/template_engine.php index 2f64b37..104f92e 100644 --- a/htdocs/template_engine.php +++ b/htdocs/template_engine.php @@ -1,5 +1,5 @@ haveAuthInfo()) pla_error(_('Not enough information to login to server. Please check your configuration.')); - $ldapserver->dnExists(dn_escape($dn)) + $ldapserver->dnExists($dn) or pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn))); $rdn = get_rdn($dn); @@ -87,7 +87,7 @@ if (isset($template['empty_attrs'])) { $new_dn = sprintf('%s=%s,%s',$template['rdn'],$_REQUEST['form'][$template['rdn']],$_REQUEST['container']); echo '
    '; - printf('',htmlspecialchars($new_dn)); + printf('',$new_dn); } else { echo ''; @@ -188,7 +188,7 @@ if (isset($template['empty_attrs'])) { } printf('',$ldapserver->server_id); - printf('',htmlspecialchars($_REQUEST['template'])); + printf('',$_REQUEST['template']); printf('',rawurlencode(serialize(array_values($template['objectclass'])))); printf('',$page+1); @@ -217,12 +217,12 @@ if (isset($template['empty_attrs'])) { echo 'Container DN:'; printf('', htmlspecialchars($_REQUEST['container'])); - printf('',htmlspecialchars($_REQUEST['container'])); + printf('',$_REQUEST['container']); echo ''; } } else { - printf('',htmlspecialchars($_REQUEST['container'])); + printf('',$_REQUEST['container']); } $count = 0; @@ -256,7 +256,7 @@ if (isset($template['empty_attrs'])) { # Some conditional checking. # $detail['must'] & $detail['disable'] cannot be set at the same time. if (isset($detail['must']) && $detail['must'] && isset($detail['disable']) && $detail['disable']) - pla_error(sprintf(_('Attribute [%s] is a MUST attribute, so it cannot be disabled.'),$attr)); + pla_error(printf(_('Attribute [%s] is a MUST attribute, so it cannot be disabled.'),$attr)); # If this attribute is disabled, go to the next one. if (isset($detail['disable']) && $detail['disable']) @@ -294,17 +294,13 @@ if (isset($template['empty_attrs'])) { $type = 'select'; } + # @todo: $detail['must'] && $detail['hidden'] must have $detail['value'] (with a value). # @todo: if value is a select list, then it cannot be hidden. # If this is a hidden attribute, then set its value. if (isset($detail['hidden']) && $detail['hidden']) { - if (isset($detail['value'])) { - printf('','hidden',$attr,$attr,$detail['value']); - continue; - - } else { - pla_error(sprintf(_('Attribute [%s] is a HIDDEN attribute, however, it is missing a VALUE in your template.'),$attr)); - } + printf('','hidden',$attr,$attr,$detail['value']); + continue; } # This is a displayed attribute. @@ -319,7 +315,7 @@ if (isset($template['empty_attrs'])) { # Display the icon if one is required. if (isset($detail['icon']) && trim($detail['icon'])) - printf('Icon',$detail['icon']); + printf('',$detail['icon']); else printf(' '); @@ -328,12 +324,8 @@ if (isset($template['empty_attrs'])) { # Display the label. if (isset($detail['description']) && (trim($detail['description']))) printf('%s:',$detail['description'],$detail['display']); - - elseif (isset($detail['display'])) - printf('%s:',$detail['display']); - else - printf('%s:',_('No DISPLAY/DESCRIPTION attribute in template file')); + printf('%s:',$detail['display']); echo ''; @@ -489,7 +481,7 @@ if (isset($template['empty_attrs'])) { # If there is no count, display the summary if (! $count) { - printf('Create%s :%s', + printf('%s :%s', $template['icon'],_('Create Object'),htmlspecialchars($new_dn)); echo ''; @@ -498,7 +490,7 @@ if (isset($template['empty_attrs'])) { foreach ($_REQUEST['form'] as $attr => $value) { # Remove blank attributes. - if (! is_array($_REQUEST['form'][$attr]) && trim($_REQUEST['form'][$attr]) == '') { + if (! $_REQUEST['form'][$attr]) { unset($_REQUEST['form'][$attr]); continue; } @@ -519,11 +511,9 @@ if (isset($template['empty_attrs'])) { else { $display = $value; - if (isset($template['attribute'][$attr]['type']) && $template['attribute'][$attr]['type'] == 'password') { - $enc = (isset($_REQUEST['enc'])) ? $_REQUEST['enc'] : get_enc_type($value); - if (obfuscate_password_display($enc)) + if (isset($template['attribute'][$attr]['type']) && $template['attribute'][$attr]['type'] == 'password') + if (obfuscate_password_display($_REQUEST['enc'])) $display = '********'; - } printf('',$value); printf('%s%s',$attr,htmlspecialchars($display)); @@ -531,14 +521,12 @@ if (isset($template['empty_attrs'])) { } - if (isset($_SESSION['submitform'])) { - echo ''; - foreach (array_keys($_SESSION['submitform']) as $attr) { + echo ''; + foreach (array_keys($_SESSION['submitform']) as $attr) { - printf('%s%s', - ($counter++%2==0?'even':'odd'),$attr,_('Binary value not displayed')); - printf('',$attr); - } + printf('%s%s', + ($counter++%2==0?'even':'odd'),$attr,_('Binary value not displayed')); + printf('',$attr); } } @@ -744,7 +732,7 @@ foreach ($template['attrs'] as $attr => $vals) { $schema_href = sprintf('schema.php?server_id=%s&view=attributes&viewvalue=%s', $ldapserver->server_id,real_attr_name($attr)); - printf('%s',$attr,$schema_href,$attr_display); + printf('%s',$attr,$schema_href,$attr_display); echo ''; echo ''; @@ -802,15 +790,15 @@ foreach ($template['attrs'] as $attr => $vals) { if (count($vals) > 1) { for ($i=1; $i<=count($vals); $i++) - printf('Save %s(%s)
    ', + printf(' %s(%s)
    ', $href,$i,_('download value'),$i); } else { - printf('Save %s
    ',$href,_('download value')); + printf(' %s
    ',$href,_('download value')); } if (! $ldapserver->isReadOnly() && ! $ldapserver->isAttrReadOnly($attr)) - printf('Trash %s', + printf(' %s', $attr,_('delete attribute')); echo '
    '; @@ -852,11 +840,10 @@ foreach ($template['attrs'] as $attr => $vals) { if (trim($val) == '') printf('[%s]
    ',_('empty')); - elseif (! strcasecmp($attr,'userPassword') && $config->GetValue('appearance','obfuscate_password_display')) { - $user_password = $val; + elseif (! strcasecmp($attr,'userPassword') && $config->GetValue('appearance','obfuscate_password_display')) echo preg_replace('/./','*',$val).'
    '; - } elseif (in_array(strtolower($attr),$shadow_format_attrs)) { + elseif (in_array(strtolower($attr),$shadow_format_attrs)) { $shadow_date = shadow_date($attrs,$attr); echo htmlspecialchars($val).' '; echo ''; @@ -870,46 +857,24 @@ foreach ($template['attrs'] as $attr => $vals) { echo ''; - } else { - if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) - - if ($ldapserver->dnExists($val)) { - printf('Go %s ', - htmlspecialchars($val),$ldapserver->server_id, - rawurlencode($val),dn_unescape($val)); - } else { - printf('N/E %s ', - htmlspecialchars($val),$ldapserver->server_id, - rawurlencode($val),dn_unescape($val)); - } - - elseif (is_mail_string($val)) - printf('Mail %s ', - htmlspecialchars($val),$val); - - elseif (is_url_string($val)) - printf(' %s ', - htmlspecialchars($val),$val); - - else + } else echo htmlspecialchars($val).'
    '; - - } } + +//@todo: redundant? + } else { + + if (! strcasecmp($attr,'userPassword') && obfuscate_password_display()) + echo preg_replace('/./','*',$vals).'
    '; + else + echo $vals.'
    '; + } - if (! strcasecmp($attr,'userPassword') && isset($user_password)) + if (! strcasecmp($attr,'userPassword')) printf('%s',base64_encode($user_password),_('Check password...')); - if (preg_match("/^${attr}=/",$rdn) && - !($ldapserver->isReadOnly() || $ldapserver->isAttrReadOnly($attr))) + if (preg_match("/^${attr}=/",$rdn)) printf('(%s)',$rename_href,_('rename')); echo ''; @@ -942,8 +907,8 @@ foreach ($template['attrs'] as $attr => $vals) { echo htmlspecialchars($user_password); echo '
    '; - printf('', - (obfuscate_password_display($enc_type) ? 'password' : 'text'),htmlspecialchars($user_password)); + printf('', + (obfuscate_password_display($enc_type) ? 'password' : 'text')); echo enc_type_select_list($enc_type); @@ -1001,10 +966,10 @@ foreach ($template['attrs'] as $attr => $vals) { $val = $vals[0]; printf('',htmlspecialchars($attr),htmlspecialchars($val)); - printf(' ', + printf('
     ', $attr,htmlspecialchars($attr),htmlspecialchars($val)); draw_date_selector_link($attr); - echo ''; + echo ''; echo ''; $js[] = sprintf('',$attr,$js_date_attrs[$attr]); @@ -1037,13 +1002,12 @@ foreach ($template['attrs'] as $attr => $vals) { # Is this value is a structural objectClass, make it read-only if (! strcasecmp($attr,'objectClass')) { - printf('Info ', - _('View the schema description for this objectClass'),$ldapserver->server_id,strtolower(htmlspecialchars($val))); + printf(' ', + _('View the schema description for this objectClass'),$ldapserver->server_id,htmlspecialchars($val)); $schema_object = $ldapserver->getSchemaObjectClass($val); - # This should be an object, but we'll test it anyway - if (is_object($schema_object) && $schema_object->getType() == 'structural') { + if ($schema_object->getType() == 'structural') { printf(' %s (%s)
    ', $val,_('This is a structural ObjectClass and cannot be removed.'),_('structural')); printf('',$input_name,$input_id,htmlspecialchars($val)); @@ -1055,23 +1019,23 @@ foreach ($template['attrs'] as $attr => $vals) { if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) if ($ldapserver->dnExists($val)) { - printf('Go ', + printf(' ', htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val)); } else { - printf('N/E ', + printf(' ', htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val)); } elseif (is_mail_string($val)) - printf('Mail ',htmlspecialchars($val)); + printf(' ',htmlspecialchars($val)); elseif (is_url_string($val)) - printf('URL ',htmlspecialchars($val)); + printf(' ',htmlspecialchars($val)); if ($ldapserver->isMultiLineAttr($attr,$val)) - printf('',$input_name,$input_id,htmlspecialchars(dn_unescape($val))); + printf('',$input_name,$input_id,htmlspecialchars($val)); else - printf(' ',$input_name,$input_id,htmlspecialchars(dn_unescape($val))); + printf(' ',$input_name,$input_id,htmlspecialchars($val)); /* draw a link for popping up the entry browser if this is the type of attribute that houses DNs. */ @@ -1102,12 +1066,8 @@ foreach ($template['attrs'] as $attr => $vals) { $description = isset($group['description']) ? $group['description'] : null; - if (is_array($description)) { - foreach ($description as $item) - printf(' (%s)',htmlspecialchars($item)); - } else { + if ($description) printf(' (%s)',htmlspecialchars($description)); - } echo ''; } @@ -1164,7 +1124,7 @@ else - +
    diff --git a/htdocs/tree.php b/htdocs/tree.php index 9ed9a68..9b6b1ea 100644 --- a/htdocs/tree.php +++ b/htdocs/tree.php @@ -1,5 +1,5 @@ '; echo ''; printf('',_('Home')); -printf('',_('Home')); +printf('',_('Home')); printf('',_('Purge caches')); -printf('',_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches')); +printf('',_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches')); echo ''; if (! $config->GetValue('appearance','hide_configuration_management')) { printf('',_('light')); - printf('',get_href('add_rfe'),_('Request feature')); + printf('',get_href('add_rfe'),_('Request feature')); printf('',_('bug')); - printf('',get_href('add_bug'),_('Report a bug')); + printf('',get_href('add_bug'),_('Report a bug')); echo ''; printf('',_('Donate')); - printf('',get_href('donate'),_('Donate')); + printf('',get_href('donate'),_('Donate')); } printf('',_('Help')); -printf('',_('Help')); +printf('',_('Help')); echo '
    %s%s%s%s%s%s
    %s%s%s%s%s%s
    %s%s%s%s%s%s
    '; echo "\n\n"; diff --git a/htdocs/update.php b/htdocs/update.php index 0d00689..3caacd0 100644 --- a/htdocs/update.php +++ b/htdocs/update.php @@ -1,5 +1,5 @@ $ldapserver->server_id,'dn'=>$dn,'update_array'=>$update_array)); # Check for delete attributes (indicated by the attribute entry appearing like this: attr => '' -foreach ($update_array as $attr => $val) { - if (! is_array($val)) { +foreach ($update_array as $attr => $val) + if (! is_array($val)) if (array_key_exists($attr,$skip_array)) unset($update_array[$attr]); + elseif ($val == '') $update_array[$attr] = array(); # Skip change - else { - if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) - $val=dn_escape($val); + else $update_array[$attr] = $val; - } - } else { + + else if (array_key_exists($attr,$skip_array)) unset($update_array[$attr]); else - foreach ($val as $i => $v) { - if (is_dn_string($v) || $ldapserver->isDNAttr($attr)) - $v=dn_escape($v); + foreach ($val as $i => $v) $update_array[$attr][$i] = $v; - } - } -} -run_hook ('pre_update',array('server_id'=>$ldapserver->server_id,'dn'=>$dn,'update_array'=>$update_array)); -#die(); /* Call the custom callback for each attribute modification and verify that it should be modified.*/ diff --git a/htdocs/update_confirm.php b/htdocs/update_confirm.php index 03ca4af..c603d34 100644 --- a/htdocs/update_confirm.php +++ b/htdocs/update_confirm.php @@ -1,5 +1,5 @@ $old_val) { } # Check user password with new encoding. -if (isset($new_values['userpassword']) && is_array($new_values['userpassword'])) { +if (isset($new_values['userpassword']) && is_array($new_values['userpassword'])) foreach ($new_values['userpassword'] as $key => $userpassword) { if ($userpassword) { - if ($old_values['userpassword'][$key] == $new_values['userpassword'][$key] && - get_enc_type($old_values['userpassword'][$key]) == $_POST['enc_type'][$key]) - continue; + $new_val[$key] = password_hash($userpassword,$_POST['enc_type'][$key]); - $new_values['userpassword'][$key] = password_hash($userpassword,$_POST['enc_type'][$key]); + if ($new_val[$key] != $old_values['userpassword'][$key]) + $update_array['userpassword'][$key] = $new_val[$key]; } } - if ($old_values['userpassword'] != $new_values['userpassword']) - $update_array['userpassword'] = $new_values['userpassword']; -} - # strip empty vals from update_array and ensure consecutive indices for each attribute foreach ($update_array as $attr => $val) { if (is_array($val)) { @@ -144,25 +139,25 @@ if (count($update_array) > 0) { printf('',$counter%2 ? 'even' : 'odd'); printf('%s',htmlspecialchars($attr)); - echo ''; + echo ''; if (strcasecmp($attr,'userPassword') == 0) { foreach ($old_values[$attr] as $key => $value) { if (obfuscate_password_display(get_enc_type($old_values[$attr][$key]))) echo preg_replace('/./','*',$old_values[$attr][$key]).'
    '; else - echo nl2br(htmlspecialchars(dn_unescape($old_values[$attr][$key]))).'
    '; + echo nl2br(htmlspecialchars($old_values[$attr][$key])).'
    '; } } elseif (is_array($old_values[$attr])) foreach ($old_values[$attr] as $v) - echo nl2br(htmlspecialchars(dn_unescape($v))).'
    '; + echo nl2br(htmlspecialchars($v)).'
    '; else - echo nl2br(htmlspecialchars(dn_unescape($old_values[$attr]))).'
    '; + echo nl2br(htmlspecialchars($old_values[$attr])).'
    '; - echo '
    '; - echo ''; + echo ''; + echo ''; # Is this a multi-valued attribute? if (is_array($new_val)) { @@ -172,7 +167,7 @@ if (count($update_array) > 0) { if (obfuscate_password_display(get_enc_type($new_val[$key]))) echo preg_replace('/./','*',$new_val[$key]).'
    '; else - echo htmlspecialchars(dn_unescape($new_val[$key])).'
    '; + echo htmlspecialchars($new_val[$key]).'
    '; } } @@ -185,7 +180,7 @@ if (count($update_array) > 0) { $update_array[$attr] = array_values($update_array[$attr]); } else { - echo nl2br(htmlspecialchars(dn_unescape($v))).'
    '; + echo nl2br(htmlspecialchars($v)).'
    '; } } } @@ -201,7 +196,7 @@ if (count($update_array) > 0) { } elseif ($new_val != '') printf('%s',_('[attribute deleted]')); - echo '
    '; + echo ''; printf('',htmlspecialchars($attr)); echo ''."\n\n"; diff --git a/htdocs/view_jpeg_photo.php b/htdocs/view_jpeg_photo.php index f9ad520..bafccb0 100644 --- a/htdocs/view_jpeg_photo.php +++ b/htdocs/view_jpeg_photo.php @@ -1,5 +1,5 @@ For a PHP4 application, please use a 0.9.x version.'); + /* Our custom error handler receives all error notices that pass the error_reporting() level set above. */ set_error_handler('pla_error_handler'); @@ -51,13 +55,7 @@ require_once realpath(LIBDIR.'config_default.php'); ob_end_clean(); # We are now ready for error reporting. -# Turn on all notices and warnings. This helps us write cleaner code (we hope at least) -if (phpversion() >= '5') { - # E_DEBUG is PHP5 specific and prevents warnings about using 'var' to declare class members - error_reporting(E_DEBUG); -} else - # For PHP4 - error_reporting(E_ALL); +error_reporting(E_DEBUG); /** * At this point we have read all our additional function PHP files and our configuration. @@ -107,7 +105,6 @@ if ($language == 'auto') { # Set language 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); bind_textdomain_codeset('messages','UTF-8'); @@ -128,7 +125,6 @@ if ($language == 'auto') { # Set language putenv('LANG='.$language); # e.g. LANG=de_DE - $language .= '.UTF-8'; setlocale(LC_ALL,$language); # set LC_ALL to de_DE bindtextdomain('messages',LANGDIR); bind_textdomain_codeset('messages','UTF-8'); diff --git a/lib/config_default.php b/lib/config_default.php index 46f985a..2104172 100644 --- a/lib/config_default.php +++ b/lib/config_default.php @@ -1,5 +1,5 @@ default->appearance['obfuscate_password_display'] = array( 'desc'=>'Obfuscate the display of passwords', - 'default'=>true); + 'default'=>false); $this->default->appearance['show_clear_password'] = array( 'desc'=>'Whether to show clear passwords if we dont obfuscate them', diff --git a/lib/createlm.php b/lib/createlm.php index 90d2922..0be0b7e 100644 --- a/lib/createlm.php +++ b/lib/createlm.php @@ -1,6 +1,6 @@ x($ret) > 4294967296) { - $ret = (2*4294967296) - $this->x($ret); - } - return $ret; + return ($X&$Y) | ((~$X)&$Z); } function G($X, $Y, $Z) { @@ -480,9 +468,6 @@ var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5 $sum[1] &= 0xffff; $sum[0] &= 0xffff; $ret = ($sum[0]<<16) | $sum[1]; - if ($this->x($ret) > 4294967296) { - $ret = (2*4294967296) - $this->x($ret); - } return $ret; } @@ -508,14 +493,7 @@ var $sbox = array(array(array(14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5 # Renamed to prevent clash with SAMBA/source/libsmb/smbdes.c:lshift function md4lshift($x, $s) { $x &= 0xFFFFFFFF; - if ($this->x($x) > 4294967296) { - $x = (2*4294967296) - $this->x($x); - } - $ret = ((($x<<$s)&0xFFFFFFFF) | $this->unsigned_shift_r($x, (32-$s))); - if ($this->x($ret) > 4294967296) { - $ret = (2*4294967296) - $this->x($ret); - } - return $ret; + return ((($x<<$s)&0xFFFFFFFF) | $this->unsigned_shift_r($x, (32-$s))); } /** diff --git a/lib/export_functions.php b/lib/export_functions.php index 9053dad..af0ab42 100755 --- a/lib/export_functions.php +++ b/lib/export_functions.php @@ -1,5 +1,5 @@ $element ) { $element = htmlspecialchars($element); @@ -316,10 +313,6 @@ function pla_compare_dns($dn1,$dn2) { $dn1_parts = pla_explode_dn(pla_reverse_dn($dn1)); $dn2_parts = pla_explode_dn(pla_reverse_dn($dn2)); - - if (! $dn1_parts || ! $dn2_parts) - return; - assert(is_array($dn1_parts)); assert(is_array($dn2_parts)); @@ -424,16 +417,15 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid') { if (is_null($base_dn)) pla_error(sprintf(_('You specified the "auto_uid_number_mechanism" as "search" in your - configuration for server %s, but you did not specify the - "auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name)); + configuration for server %s, but you did not specify the + "auto_uid_number_search_base". Please specify it before proceeding.'),$ldapserver->name)); } 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)); + pla_error(sprintf(_('Your phpLDAPadmin configuration specifies an invalid auto_uid_search_base for server %s'),$ldapserver->name)); $filter = '(|(uidNumber=*)(gidNumber=*))'; $results = array(); @@ -505,8 +497,8 @@ function get_next_number(&$ldapserver,$startbase='',$type='uid') { # 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) ); + in your configration. Only "uidpool" and "search" are valid. + Please correct this problem.') , $mechanism) ); } } @@ -1020,7 +1012,7 @@ function pla_error( $msg, $ldap_err_msg=null, $ldap_err_no=-1, $fatal=true ) { ?>
    - +
    Warning


    @@ -1093,16 +1085,15 @@ function pla_error( $msg, $ldap_err_msg=null, $ldap_err_no=-1, $fatal=true ) { * * @see set_error_handler */ -function pla_error_handler($errno,$errstr,$file,$lineno) { +function pla_error_handler( $errno, $errstr, $file, $lineno ) { if (DEBUG_ENABLED) debug_log('pla_error_handler(): Entered with (%s,%s,%s,%s)',1,$errno,$errstr,$file,$lineno); - /* error_reporting will be 0 if the error context occurred - * within a function call with '@' preprended (ie, @ldap_bind() ); - * So, don't report errors if the caller has specifically - * disabled them with '@' - */ - if (ini_get('error_reporting') == 0 || error_reporting() == 0) + // error_reporting will be 0 if the error context occurred + // within a function call with '@' preprended (ie, @ldap_bind() ); + // So, don't report errors if the caller has specifically + // disabled them with '@' + if( 0 == ini_get( 'error_reporting' ) || 0 == error_reporting() ) return; $file = basename( $file ); @@ -1127,7 +1118,7 @@ function pla_error_handler($errno,$errstr,$file,$lineno) { $errstr = preg_replace("/\s+/"," ",$errstr); if( $errno == E_NOTICE ) { - echo sprintf(_('
    Warning + echo sprintf(_('
    @@ -1222,8 +1213,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu if (isset($table_html_attrs) && trim($table_html_attrs) ) printf('
    You found a non-fatal phpLDAPadmin bug!
    Error:%s (%s)
    File: %s line %s, caller %s
    Versions:PLA: %s, PHP: %s, SAPI: %s
    Web server:%s
    - - - - - diff --git a/lib/search_form_predefined.php b/lib/search_form_predefined.php index 2e42150..e9550b6 100644 --- a/lib/search_form_predefined.php +++ b/lib/search_form_predefined.php @@ -1,5 +1,5 @@ _connect($connect_id); - if (is_resource($resource) && ! $reconnect) + if ($resource && ! $reconnect) return $resource; if (DEBUG_ENABLED) @@ -204,6 +214,20 @@ class LDAPserver { } } + # SASL auth + if ($this->sasl_auth) { + $this->connections[$connect_id]['sasl_auth'] = true; + $this->connections[$connect_id]['sasl_mech'] = $this->sasl_mech; + $this->connections[$connect_id]['sasl_realm'] = $this->sasl_realm; + $this->connections[$connect_id]['sasl_authz_id'] = $this->sasl_authz_id; + $this->connections[$connect_id]['sasl_authz_id_regex'] = $this->sasl_authz_id_regex; + $this->connections[$connect_id]['sasl_authz_id_replacement'] = $this->sasl_authz_id_replacement; + $this->connections[$connect_id]['sasl_props'] = $this->sasl_props; + + } else { + $this->connections[$connect_id]['sasl_auth'] = false; + } + if (DEBUG_ENABLED) debug_log('%s::connect(): Config settings, DN [%s], PASS [%s]',80, get_class($this),$this->connections[$connect_id]['login_dn'], @@ -219,7 +243,7 @@ class LDAPserver { # Now that we have worked out the connect_id, lets just check and see if we have already connected. $resource = $this->_connect($connect_id); - if (is_resource($resource) && ! $reconnect) + if ($resource && ! $reconnect) return $resource; run_hook('pre_connect',array('server_id'=>$this->server_id,'connect_id'=>$connect_id)); @@ -247,8 +271,68 @@ class LDAPserver { @ldap_start_tls($resource) or pla_error(_('Could not start TLS. Please check your LDAP server configuration.'),ldap_error($resource)); } - $bind_result = @ldap_bind($resource,$this->connections[$connect_id]['login_dn'], - $this->connections[$connect_id]['login_pass']); + $bind_result = false; + + /** + * Implementation of SASL ldap_bind() + * This option requires PHP 5.x compiled with --with-ldap-sasl=DIR + */ + if (isset($this->connections[$connect_id]['sasl_auth']) && # admin marked this server to use SASL auth + $this->connections[$connect_id]['sasl_auth'] == true) { + + # 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.')); + + # Fill variables + $props = $this->connections[$connect_id]['sasl_props']; + $mech = $this->connections[$connect_id]['sasl_mech']; + $realm = $this->connections[$connect_id]['sasl_realm']; + $authz_id = null; + + if (DEBUG_ENABLED) + debug_log('%s::connect(): Resource [%s], Using SASL bind method. Bind DN [%s]',9, + get_class($this),$resource,$this->connections[$connect_id]['login_dn']); + + # do we need to rewrite authz_id? + if (isset($this->connections[$connect_id]['sasl_authz_id']) && + strlen($this->connections[$connect_id]['sasl_authz_id']) > 0) + + $authz_id = $this->connections[$connect_id]['sasl_authz_id']; + + else { + + # ok, here we go + if (DEBUG_ENABLED) + debug_log('%s::connect(): Resource [%s], Rewriting bind DN [%s] -> authz_id with regex [%s] and replacement [%s].',9, + get_class($this),$resource,$this->connections[$connect_id]['login_dn'], + $this->connections[$connect_id]['sasl_authz_id_regex'], + $this->connections[$connect_id]['sasl_authz_id_replacement']); + + $authz_id = @preg_replace($this->connections[$connect_id]['sasl_authz_id_regex'], + $this->connections[$connect_id]['sasl_authz_id_replacement'], + $this->connections[$connect_id]['login_dn']); + + # invalid regex? + if (is_null($authz_id)) { + pla_error(sprintf(_('It seems that sasl_authz_id_regex "%s"." contains invalid PCRE regular expression.'), + $this->connections[$connect_id]['sasl_authz_id_regex']). + ((isset($php_errormsg)) ? ' Error message: '.$php_errormsg : '')); + } + } + + if (DEBUG_ENABLED) + debug_log('%s::connect(): Resource [%s], SASL OPTIONS: mech [%s], realm [%s], authz_id [%s], props [%s]',9, + get_class($this),$resource,$mech,$realm,$authz_id,$props); + + $bind_result = @ldap_sasl_bind($resource, + $this->connections[$connect_id]['login_dn'],$this->connections[$connect_id]['login_pass'], + $mech,$realm,$authz_id,$props); + + } else { + $bind_result = @ldap_bind($resource,$this->connections[$connect_id]['login_dn'], + $this->connections[$connect_id]['login_pass']); + } if (DEBUG_ENABLED) debug_log('%s::connect(): Resource [%s], Bind Result [%s]',16,get_class($this),$resource,$bind_result); @@ -335,8 +419,7 @@ class LDAPserver { debug_log('%s::getBaseDN(): Connect to LDAP to find BaseDN',80,get_class($this)); if ($this->connect()) { - $r = $this->search(null,'','objectClass=*',array('namingContexts'),'base'); - $r = array_pop($r); + $r = array_pop($this->search(null,'','objectClass=*',array('namingContexts'),'base')); if (is_array($r)) $r = array_change_key_case($r); @@ -1671,13 +1754,13 @@ class LDAPserver { * @param array $attrs An array of attributes to include in the search result (example: array( "objectClass", "uid", "sn" )). * @param string $scope The LDAP search scope. Must be one of "base", "one", or "sub". Standard LDAP search scope. * @param bool $sort_results Specify false to not sort results by DN or true to have the - * returned array sorted by DN (uses ksort) + * returned array sorted by DN (uses ksort) * @param int $deref When handling aliases or referrals, this specifies whether to follow referrals. Must be one of - * LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, or LDAP_DEREF_FINDING. See the PHP LDAP API for details. + * LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, or LDAP_DEREF_FINDING. See the PHP LDAP API for details. * @param int $size_limit Size limit for search * @todo: Add entries to tree cache. */ - function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=false,$deref=LDAP_DEREF_NEVER,$size_limit=0) { + function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=true,$deref=LDAP_DEREF_NEVER,$size_limit=0) { if (DEBUG_ENABLED) debug_log('%s::search(): Entered with (%s,%s,%s,%s,%s,%s,%s)',17, get_class($this),is_resource($this),$base_dn,$filter,$attrs,$scope,$sort_results,$deref); @@ -1698,16 +1781,16 @@ class LDAPserver { switch ($scope) { case 'base': - $search = @ldap_read($resource,dn_escape($base_dn),$filter,$attrs,0,$size_limit,0,$deref); + $search = @ldap_read($resource,$base_dn,$filter,$attrs,0,$size_limit,0,$deref); break; case 'one': - $search = @ldap_list($resource,dn_escape($base_dn),$filter,$attrs,0,$size_limit,0,$deref); + $search = @ldap_list($resource,$base_dn,$filter,$attrs,0,$size_limit,0,$deref); break; case 'sub': default: - $search = @ldap_search($resource,dn_escape($base_dn),$filter,$attrs,0,$size_limit,0,$deref); + $search = @ldap_search($resource,$base_dn,$filter,$attrs,0,$size_limit,0,$deref); break; } @@ -1720,10 +1803,6 @@ class LDAPserver { $return = array(); - if ($sort_results && is_array($return)) - if (version_compare(phpversion(),'4.2.0','>=')) - ldap_sort($resource, $search,$sort_results); - # Get the first entry identifier if ($entry_id = ldap_first_entry($resource,$search)) @@ -1763,6 +1842,8 @@ class LDAPserver { } # End while entry_id + if ($sort_results && is_array($return)) + ksort($return); if (DEBUG_ENABLED) debug_log('%s::search(): Returning (%s)',17,get_class($this),$return); @@ -2253,7 +2334,7 @@ class LDAPserver { */ function getLoggedInPass() { if (DEBUG_ENABLED) - debug_log('%s::getLoggedInPass(): Entered with ()',17,get_class($this)); + debug_log('%s:getLoggedInPass(): Entered with ()',17,get_class($this)); if (! $this->auth_type) return false; @@ -2306,9 +2387,6 @@ class LDAPserver { # Set default return $return = false; - if (DEBUG_ENABLED) - debug_log('%s::getLoggedInDN(): auth_type is [%s]',66,get_class($this),$this->auth_type); - if ($this->auth_type) { switch ($this->auth_type) { case 'cookie': @@ -2341,7 +2419,7 @@ class LDAPserver { } if (DEBUG_ENABLED) - debug_log('%s::getLoggedInDN(): Entered with (), Returning (%s)',17,get_class($this),$return); + debug_log('%s:getLoggedInDN(): Entered with (), Returning (%s)',17,get_class($this),$return); return $return; } @@ -2443,8 +2521,7 @@ class LDAPserver { debug_log('%s:getDNAttrs(): Entered with (%s,%s,%s)',17, get_class($this),$dn,$lower_case_attr_names,$deref); - $attrs = $this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref); - $attrs = array_pop($attrs); + $attrs = array_pop($this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref)); if (is_array($attrs)) { if ($lower_case_attr_names) @@ -2944,6 +3021,40 @@ class LDAPservers { 'desc'=>'Path to custom pages', 'default'=>null); + $this->default->server['sasl_auth'] = array( + 'desc' => 'Use SASL authentication when binding LDAP server', + 'var' => 'sasl_auth', + 'default' => false); + + $this->default->server['sasl_mech'] = array( + 'desc' => 'SASL mechanism used while binding LDAP server', + 'var' => 'sasl_mech', + 'default' => 'PLAIN'); + + $this->default->server['sasl_realm'] = array( + 'desc' => 'SASL realm name', + 'var' => 'sasl_realm', + 'default' => ''); + + $this->default->server['sasl_authz_id'] = array( + 'desc' => 'SASL authorization id', + 'var' => 'sasl_authz_id', + 'default' => ''); + + $this->default->server['sasl_authz_id_regex'] = array( + 'desc' => 'SASL authorization id PCRE regular expression', + 'var' => 'sasl_authz_id_regex', + 'default' => null); + + $this->default->server['sasl_authz_id_replacement'] = array( + 'desc' => 'SASL authorization id PCRE regular expression replacement string', + 'var' => 'sasl_authz_id_replacement', + 'default' => null); + + $this->default->server['sasl_props'] = array( + 'desc' => 'SASL properties', + 'var' => 'sasl_props', + 'default' => null); } function SetValue($server_id,$key,$index,$value) { diff --git a/lib/session_functions.php b/lib/session_functions.php index ec8abf2..99ad853 100644 --- a/lib/session_functions.php +++ b/lib/session_functions.php @@ -1,5 +1,5 @@ ";print_r($matchall); //0 = highlevel match, 1 = attr, 2 = subst, 3 = mod @@ -670,7 +670,7 @@ class Templates { else # @todo: Enable size and width configuration in template - $html = sprintf('',$id); + $html = sprintf('',$id); } else { if (is_array($helper)) { diff --git a/lib/timeout_functions.php b/lib/timeout_functions.php index fb01e3a..b6fe45a 100644 --- a/lib/timeout_functions.php +++ b/lib/timeout_functions.php @@ -1,5 +1,5 @@ '; printf('',_('Server')); printf(''; + echo ''; /* do we have what it takes to authenticate here, or do we need to present the user with a login link (for 'cookie' and 'session' auth_types)? */ @@ -62,7 +62,7 @@ function draw_server_tree() { # Draw the quick-links below the server name: echo ''; + echo ' )'; if ($ldapserver->auth_type != 'config') { $logged_in_dn = $ldapserver->getLoggedInDN(); - echo ''; + echo ''; } if ($ldapserver->isReadOnly()) - printf('',_('read only')); + printf('',_('read only')); $javascript_forms = ''; $javascript_id = 0; @@ -192,6 +190,9 @@ function draw_server_tree() { $icon = isset($tree['browser'][$base_dn]['icon']) ? $tree['browser'][$base_dn]['icon'] : get_icon($ldapserver,$base_dn); + # Shall we draw the "mass-delete" checkbox? + if ($ldapserver->isMassDeleteEnabled()) + printf('',htmlspecialchars($base_dn)); if ($config->GetValue('appearance','tree_plm')) { $tree_plm .= sprintf(".|%s|%s|%s|%s|%s|%s\n", @@ -199,19 +200,14 @@ function draw_server_tree() { } else { echo ''; - - # Shall we draw the "mass-delete" checkbox? - if ($ldapserver->isMassDeleteEnabled()) - printf('',htmlspecialchars($base_dn)); - printf('',$expand_href,$expand_img,$expand_alt); printf('',$edit_href,$icon); - printf(''; + echo ''; echo ''; } @@ -336,9 +332,9 @@ function draw_tree_html($dn,$ldapserver,$level=0) { $child_count = number_format(count($tree['browser'][$dn]['children'])); if ((! $child_count) && (! $ldapserver->isShowCreateEnabled())) - echo ''; + echo ''; else - printf('',$collapse_href); + printf('',$collapse_href); } else { $size_limit = $config->GetValue('search','size_limit'); @@ -354,21 +350,21 @@ function draw_tree_html($dn,$ldapserver,$level=0) { } if ((! $child_count) && (! $ldapserver->isShowCreateEnabled())) - echo ''; + echo ''; else - printf('',$expand_href); + printf('',$expand_href); } printf('', $edit_href,$ldapserver->server_id,$encoded_dn,$img_src); - printf(''; + echo ''; if (isset($tree['browser'][$dn]['open']) && $tree['browser'][$dn]['open']) { /* Draw the "create new" link at the top of the tree list if there are more than 10 diff --git a/locale/ja_JP/LC_MESSAGES/messages.po b/locale/ja_JP/LC_MESSAGES/messages.po index 715ce35..984f4b8 100644 --- a/locale/ja_JP/LC_MESSAGES/messages.po +++ b/locale/ja_JP/LC_MESSAGES/messages.po @@ -1,4 +1,4 @@ -# : $Id: messages.po,v 1.1.2.2 2005/12/20 19:32:52 wurley Exp $ +# : $Id: messages.po,v 1.3 2006/01/03 20:39:59 wurley Exp $ # # Tadashi Jokagi , 2004. # Tadashi Jokagi , 2005. diff --git a/templates/creation/custom.php b/templates/creation/custom.php index 87bda76..f6c8d0e 100644 --- a/templates/creation/custom.php +++ b/templates/creation/custom.php @@ -1,5 +1,5 @@ %s', - _('Note'),htmlspecialchars($attr),_('is an alias for'), - htmlspecialchars($friendly_attrs[strtolower($attr)]), - htmlspecialchars($friendly_attrs[strtolower($attr)])); + $attr_display = sprintf('%s"', + htmlspecialchars($attr),htmlspecialchars($friendly_attrs[strtolower($attr)])); else $attr_display = htmlspecialchars($attr); diff --git a/templates/template_header.php b/templates/template_header.php index deb9638..2357d80 100644 --- a/templates/template_header.php +++ b/templates/template_header.php @@ -1,5 +1,5 @@ server_id,$encoded_dn); $export_href_base = sprintf('export_form.php?%s&scope=%s',$url_base,'base'); $export_href_sub = sprintf('export_form.php?%s&scope=%s',$url_base,'sub'); -$refresh_href = sprintf('template_engine.php?%s&random=%s',$url_base,random_junk()); +$refresh_href = sprintf('template_engine.php?%s&random=%s',$url_base,$random_junk); $copy_href = sprintf('copy_form.php?%s',$url_base); $intattr_href = sprintf('template_engine.php?%s&show_internal_attrs=true',$url_base); $delete_href = sprintf('delete_form.php?%s',$url_base); @@ -25,8 +27,8 @@ $addattr_href = sprintf('add_attr_form.php?%s',$url_base); echo ''; if ($dn) { - $actionlayout = ''; - $hintlayout = ''; + $actionlayout = ''; + $hintlayout = ''; printf('

    %s

    ',htmlspecialchars($rdn)); printf('

    %s: %s     %s: %s

    ', @@ -35,24 +37,24 @@ if ($dn) { echo "\n"; echo '
    ',$table_html_attrs); - $jpeg_data = $ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base'); - $jpeg_data = array_pop($jpeg_data); + $jpeg_data = array_pop($ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base')); if (! $jpeg_data) { printf(_('Could not fetch jpeg data from LDAP server for attribute %s.'),htmlspecialchars($attr_name)); return; @@ -1272,7 +1262,7 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu $img_height = $height; } - printf('Photo
    ', + printf('
    ', ($fixed_width ? '' : 'width="'.$img_width.'" '), ($fixed_height ? '' : 'height="'.$img_height.'"'), ($img_html_attrs ? $img_html_attrs : ''),basename($jpeg_filename)); @@ -1647,7 +1637,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('Find',$href,$title); + printf('',$href,$title); if ($include_choose_text) printf('%s',$href,$title,_('browse')); } @@ -1669,8 +1659,6 @@ function draw_chooser_link( $form_element, $include_choose_text=true, $rdn="none * */ function pla_explode_dn($dn,$with_attributes=0) { - if (DEBUG_ENABLED) - debug_log('pla_explode_dn(): Entered with (%s,%s)',1,$dn,$with_attributes); $dn = addcslashes(dn_escape($dn),'<>'); # split the dn @@ -1692,41 +1680,17 @@ function pla_explode_dn($dn,$with_attributes=0) { } /** - * Parse a DN and escape any special characters (rfc2253) + * Parse a DN and escape any special characters */ function dn_escape($dn) { - $olddn = $dn; - # - # http://rfc.net/rfc2253.html - # special = '"' / "," / "=" / "+" / "<" / ">" / "#" / ";" - # Check if the RDN has special chars escape them. - # - only simplest cases are dealt with - # TODO: '=' unhandled - # ';' may be used instead of ',' but its use is discouraged - while (preg_match('/([^\\\\])[;,](\s*[^=]*\s*)([;,]|$)/',$dn)) { - $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([;,]|$)/','$1\\\\2c$2$3',$dn); - $dn = preg_replace('/([^\\\\]);(\s*[^=]*\s*)([;,]|$)/','$1\\\\3b$2$3',$dn); - } - $dn = preg_replace('/([^\\\\])\+/','$1\\\\2b',$dn); - $dn = preg_replace('/([^\\\\])"/','$1\\\\22',$dn); - $dn = preg_replace('/([^\\\\])#([^0-9a-f]|$)/i','$1\\\\23$2',$dn); - $dn = preg_replace('/([^\\\\])>/','$1\\\\3e',$dn); - $dn = preg_replace('/([^\\\\]) $branch) { // pla_expode_dn returns the array with an extra count attribute, we can ignore that. @@ -2301,8 +2264,8 @@ function shadow_date( $attrs, $attr) { if (DEBUG_ENABLED) debug_log('shadow_date(): Entered with (%s,%s)',1,$attrs,$attr); - $shadowLastChange = isset($attrs['shadowLastChange']) ? $attrs['shadowLastChange'] : null; - $shadowMax = isset($attrs['shadowMax']) ? $attrs['shadowMax'] : null; + $shadowLastChange = isset($attrs['shadowLastChange']) ? $attrs['shadowLastChange'][0] : null; + $shadowMax = isset($attrs['shadowMax']) ? $attrs['shadowMax'][0] : null; if( 0 == strcasecmp( $attr, 'shadowLastChange' ) && $shadowLastChange) $shadow_date = $shadowLastChange; @@ -2538,20 +2501,6 @@ function binSIDtoText($binsid) { return $result; } -if (! function_exists('session_cache_expire')) { - - /** - * session_cache_expire is a php 4.2.0 function, we'll emulate it if we are using php <4.2.0 - */ - - function session_cache_expire() { - if (defined('DEBUG_ENABLED') && (DEBUG_ENABLED)) - debug_log('session_cache_expire(): Entered with ()',1); - - return 180; - } -} - /** * Sort a multi dimensional array. * @param array $data Multi demension array passed by reference @@ -2710,7 +2659,7 @@ function password_generate() { $leftover = array_merge($leftover,$llower,$lupper,$numbers,$punc); shuffle($leftover); - $outarray = array_merge($outarray, a_array_rand($leftover,$length-$num_spec)); + $outarray = array_merge($outarray, a_array_rand($leftover, $criteria['num'] - $num_spec)); } shuffle($outarray); @@ -2834,7 +2783,7 @@ function draw_date_selector_link( $attr ) { $href = "javascript:dateSelector('$attr');"; $title = _('Click to popup a dialog to select a date graphically'); - printf('Calendar',$href,$title,$attr); + printf('',$href,$title,$attr); } function no_expire_header() { @@ -2844,14 +2793,4 @@ function no_expire_header() { header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); } - -/** - * This is for Opera. By putting "random junk" in the query string, it thinks - * that it does not have a cached version of the page, and will thus - * fetch the page rather than display the cached version - */ -function random_junk() { - $time = gettimeofday(); - return md5(strtotime('now').$time['usec']); -} ?> diff --git a/lib/hooks.php b/lib/hooks.php index ae7b841..fad084a 100644 --- a/lib/hooks.php +++ b/lib/hooks.php @@ -1,5 +1,5 @@ read())) { - $filename = sprintf('%s/%s',HOOKSDIR,$entry); - if (is_file($filename) and eregi('php[0-9]?$',$entry)) - require_once "hooks/$entry"; + while (false !== ($entry = $dir -> read() ) ) { + if ( is_file ("hooks/$entry") and eregi ('php[0-9]?$', $entry) ) { + require_once "hooks/$entry"; + } } $dir -> close(); diff --git a/lib/ldif_functions.php b/lib/ldif_functions.php index 7442e2a..6132f96 100644 --- a/lib/ldif_functions.php +++ b/lib/ldif_functions.php @@ -1,5 +1,5 @@ GetValue('search','result_attributes')); ?>" />
    -

    %s',$ldapserver->server_id); - printf('%s ',htmlspecialchars($ldapserver->name)); + printf('%s ',htmlspecialchars($ldapserver->name)); if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') printf('timeout', sprintf(_('Inactivity will log you off at %s'),strftime('%H:%M',time()+($ldapserver->session_timeout*60)))); - echo '
    %simg%s',$edit_href,pretty_print_dn($base_dn)); + printf('%s',$edit_href,pretty_print_dn($base_dn)); if ($child_count) printf(' (%s)',$child_count); - echo '
    ------++img',97-$level); + printf('',97-$level); printf('%s',$edit_href,draw_formatted_dn($ldapserver,$dn)); if ($child_count) printf(' (%s)',$child_count); - echo '
    %s%sHint%s%s%s
    '; - printf($actionlayout,'refresh.png','Refresh',$refresh_href,_('Refresh this entry'),_('Refresh')); - printf($actionlayout,'save.png','Save',$export_href_base,_('Save a dump of this object'),_('Export')); + printf($actionlayout,'refresh.png',$refresh_href,_('Refresh this entry'),_('Refresh')); + printf($actionlayout,'save.png',$export_href_base,_('Save a dump of this object'),_('Export')); echo ''; - printf($actionlayout,'cut.png','Cut',$copy_href,_('Copy this object to another location, a new DN, or another server'),_('Copy or move this entry')); + printf($actionlayout,'cut.png',$copy_href,_('Copy this object to another location, a new DN, or another server'),_('Copy or move this entry')); if ($show_internal_attrs) - printf($actionlayout,'tools-no.png','Hide',$refresh_href,'',_('Hide internal attributes')); + printf($actionlayout,'tools-no.png',$refresh_href,'',_('Hide internal attributes')); else - printf($actionlayout,'tools.png','Show',$intattr_href,'',_('Show internal attributes')); + printf($actionlayout,'tools.png',$intattr_href,'',_('Show internal attributes')); echo ''; if (! $ldapserver->isReadOnly()) { echo ''; - printf($actionlayout,'trash.png','Trash',$delete_href,_('You will be prompted to confirm this decision'),_('Delete this entry')); - printf($actionlayout,'rename.png','Rename',$rename_href,'',_('Rename')); + printf($actionlayout,'trash.png',$delete_href,_('You will be prompted to confirm this decision'),_('Delete this entry')); + printf($actionlayout,'rename.png',$rename_href,'',_('Rename')); echo ''; if ($config->GetValue('appearance','show_hints')) { @@ -62,12 +64,12 @@ if ($dn) { } echo ''; - printf($actionlayout,'compare.png','Compare',$compare_href,'',_('Compare with another entry')); + printf($actionlayout,'compare.png',$compare_href,'',_('Compare with another entry')); echo ''; echo ''; - printf($actionlayout,'star.png','Create',$create_href,'',_('Create a child entry')); - printf($actionlayout,'add.png','Add',$addattr_href,'',_('Add new attribute')); + printf($actionlayout,'star.png',$create_href,'',_('Create a child entry')); + printf($actionlayout,'add.png',$addattr_href,'',_('Add new attribute')); echo ''; } @@ -82,8 +84,8 @@ if ($dn) { $ldapserver->server_id,rawurlencode('objectClass=*'),$encoded_dn); echo ''; - printf($actionlayout,'children.png','Children',$child_href,'',($children_count == 1) ? _('View 1 child') : sprintf(_('View %s children'),$children_count)); - printf($actionlayout,'save.png','Save',$export_href_sub,_('Save a dump of this object and all of its children'),_('Export subtree')); + printf($actionlayout,'children.png',$child_href,'',($children_count == 1) ? _('View 1 child') : sprintf(_('View %s children'),$children_count)); + printf($actionlayout,'save.png',$export_href_sub,_('Save a dump of this object and all of its children'),_('Export subtree')); echo ''; } @@ -114,7 +116,7 @@ if ($dn) { if (! $ldapserver->isReadOnly()) { echo ''; printf('',$ldapserver->server_id); - printf('',htmlspecialchars($dn)); + printf('',$dn); } echo '
    '."\n\n"; @@ -128,7 +130,7 @@ if ($dn) { $schema_href = sprintf('schema.php?server_id=%s&view=attributes&viewvalue=%s', $ldapserver->server_id,real_attr_name($attr)); - printf('', + printf('', $attr,$schema_href,htmlspecialchars($attr)); echo '
    %s
    %s
    '; diff --git a/tools/po/make_po_ca b/tools/po/make_po_ca index f4de496..9c6be16 100755 --- a/tools/po/make_po_ca +++ b/tools/po/make_po_ca @@ -6,4 +6,4 @@ # This script is run after make_po to merge the existing German translations to messages.po ./make_po -msgmerge -v ../../locale/ca_ES/LC_MESSAGES/messages.po messages.po -o messages.po +msgmerge -v ../locale/ca_ES/LC_MESSAGES/messages.po messages.po -o messages.po diff --git a/tools/po/make_po_de b/tools/po/make_po_de index 439c615..45b81b9 100755 --- a/tools/po/make_po_de +++ b/tools/po/make_po_de @@ -6,4 +6,4 @@ # This script is run after make_po to merge the existing German translations to messages.po ./make_po -msgmerge -v ../../locale/de_DE/LC_MESSAGES/messages.po messages.po -o messages.po +msgmerge -v ../locale/de_DE/LC_MESSAGES/messages.po messages.po -o messages.po diff --git a/tools/po/make_po_es b/tools/po/make_po_es index fe439c9..d64f403 100755 --- a/tools/po/make_po_es +++ b/tools/po/make_po_es @@ -6,4 +6,4 @@ # This script is run to update the existing Spanish translations in messages.po ./make_po -msgmerge -v ../../locale/es_ES/LC_MESSAGES/messages.po messages.po -o messages.po +msgmerge -v ../locale/es_ES/LC_MESSAGES/messages.po messages.po -o messages.po diff --git a/tools/po/make_po_fr b/tools/po/make_po_fr index c938788..b992a09 100755 --- a/tools/po/make_po_fr +++ b/tools/po/make_po_fr @@ -6,4 +6,4 @@ # This script is run after make_po to merge the existing German translations to messages.po ./make_po -msgmerge -v ../../locale/fr_FR/LC_MESSAGES/messages.po messages.po -o messages.po +msgmerge -v ../locale/fr_FR/LC_MESSAGES/messages.po messages.po -o messages.po diff --git a/tools/po/make_po_hu b/tools/po/make_po_hu index eb0c3e4..c2e3f97 100755 --- a/tools/po/make_po_hu +++ b/tools/po/make_po_hu @@ -6,4 +6,4 @@ # This script is run after make_po to merge the existing Hungarian translations to messages.po ./make_po -msgmerge -v ../../locale/hu_HU/LC_MESSAGES/messages.po messages.po -o messages.po +msgmerge -v ../locale/hu_HU/LC_MESSAGES/messages.po messages.po -o messages.po diff --git a/tools/po/make_po_it b/tools/po/make_po_it index 600cc2b..33b672e 100755 --- a/tools/po/make_po_it +++ b/tools/po/make_po_it @@ -6,4 +6,4 @@ # This script is run after make_po to merge the existing German translations to messages.po ./make_po -msgmerge -v ../../locale/it_IT/LC_MESSAGES/messages.po messages.po -o messages.po +msgmerge -v ../locale/it_IT/LC_MESSAGES/messages.po messages.po -o messages.po diff --git a/tools/po/make_po_ja b/tools/po/make_po_ja index b113c96..46efa42 100755 --- a/tools/po/make_po_ja +++ b/tools/po/make_po_ja @@ -6,4 +6,4 @@ # This script is run after make_po to merge the existing Japanese translations to messages.po ./make_po -msgmerge -v ../../locale/ja_JP/LC_MESSAGES/messages.po messages.po -o messages.po +msgmerge -v ../locale/ja_JP/LC_MESSAGES/messages.po messages.po -o messages.po diff --git a/tools/po/messages.header b/tools/po/messages.header index 96d14f7..be53cf1 100644 --- a/tools/po/messages.header +++ b/tools/po/messages.header @@ -3,7 +3,7 @@ msgid "" msgstr "" -"Project-Id-Version: phpldapadmin $Name: RELEASE-0_9_8_1 $\n" +"Project-Id-Version: phpldapadmin $Name: RELEASE-1_0_0 $\n" "Report-Msgid-Bugs-To: phpldapadmin-devel@lists.sf.net\n" "POT-Creation-Date: 2004-01-14 17:45+0200\n" "PO-Revision-Date: 2004-01-14 17:45+0200\n"