diff --git a/INSTALL b/INSTALL index 78ea6f7..7618b9a 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ For install instructions in non-English languages, see the wiki: - http://wiki.pldapadmin.com + http://wiki.phpldapadmin.info * Requirements @@ -17,7 +17,7 @@ For install instructions in non-English languages, see the wiki: * For additional help See the wiki: - http://wiki.pldapadmin.com + http://wiki.phpldapadmin.info Join our mailing list: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel diff --git a/config/config.php.example b/config/config.php.example index e13bd47..11a5b2f 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -1,4 +1,9 @@ default->appearance['lang'] = array( - * 'desc'=>'Language', - * 'default'=>'auto'); + * 'desc'=>'Language', + * 'default'=>'auto'); * * to override this, use $config->custom->appearance['lang'] = 'en'; * @@ -141,7 +146,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',''); +// $ldapservers->SetValue($i,'login','class',null); /* Specify true If you want phpLDAPadmin to not display or permit any modification to the LDAP server. */ @@ -164,50 +169,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',''); +// $ldapservers->SetValue($i,'auto_number','dn',null); /* The password for the dn above. */ -// $ldapservers->SetValue($i,'auto_number','pass',''); +// $ldapservers->SetValue($i,'auto_number','pass',null); /* 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',''); +// $ldapservers->SetValue($i,'unique_attrs','dn',null); /* The password for the dn above */ -// $ldapservers->SetValue($i,'unique_attrs','pass',''); +// $ldapservers->SetValue($i,'unique_attrs','pass',null); /* If you set this, then only these DNs are allowed to log in. This array can 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); @@ -240,20 +245,20 @@ $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',''); -$ldapservers->SetValue($i,'login','class',''); +$ldapservers->SetValue($i,'login','string',null); +$ldapservers->SetValue($i,'login','class',null); $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',''); +$ldapservers->SetValue($i,'auto_number','search_base',null); $ldapservers->SetValue($i,'auto_number','min','1000'); -$ldapservers->SetValue($i,'auto_number','dn',''); -$ldapservers->SetValue($i,'auto_number','pass',''); +$ldapservers->SetValue($i,'auto_number','dn',null); +$ldapservers->SetValue($i,'auto_number','pass',null); $ldapservers->SetValue($i,'login','anon_bind',true); $ldapservers->SetValue($i,'custom','pages_prefix','custom_'); -$ldapservers->SetValue($i,'unique_attrs','dn',''); -$ldapservers->SetValue($i,'unique_attrs','pass',''); +$ldapservers->SetValue($i,'unique_attrs','dn',null); +$ldapservers->SetValue($i,'unique_attrs','pass',null); */ /*********************************************/ @@ -265,7 +270,7 @@ $ldapservers->SetValue($i,'unique_attrs','pass',''); $friendly_attrs = array(); $friendly_attrs['facsimileTelephoneNumber'] = 'Fax'; -$friendly_attrs['telephoneNumber'] = 'Phone'; +$friendly_attrs['telephoneNumber'] = 'Phone'; /*********************************************/ /* Support for attrs display order */ @@ -277,16 +282,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' # ); /*********************************************/ @@ -305,8 +310,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 **/ @@ -357,7 +362,7 @@ $queries[$q]['scope'] = 'sub'; $queries[$q]['filter'] = '(&(objectClass=posixAccount)(uid=*))'; /* The attributes to return */ -$queries[$q]['attributes'] = 'cn, uid, homeDirectory'; +$queries[$q]['attributes'] = 'cn, uid, homeDirectory, telephonenumber, jpegphoto'; /* If you want to configure more pre-defined queries, copy and paste the above (including the "$q++;") */ $q++; diff --git a/doc/README-translation.txt b/doc/README-translation.txt index fa1141a..8c4cc33 100644 --- a/doc/README-translation.txt +++ b/doc/README-translation.txt @@ -1,2 +1,2 @@ -Please see http://wiki.pldapadmin.com/Translating now for information on +Please see http://wiki.phpldapadmin.info/Translating now for information on translating PLA. diff --git a/htdocs/add_value_form.php b/htdocs/add_value_form.php index 725796b..2cb4b44 100644 --- a/htdocs/add_value_form.php +++ b/htdocs/add_value_form.php @@ -1,5 +1,5 @@ getDNAttr($dn,$attr); -if ($current_values) - $num_current_values = (is_array($current_values) ? count($current_values) : 1); -else +if ($current_values) { + if (! is_array($current_values)) + $current_values = array($current_values); + + $num_current_values = count($current_values); + +} else { + $current_values = array(); $num_current_values = 0; +} $is_object_class = (strcasecmp($attr, 'objectClass') == 0) ? true : false; @@ -107,18 +113,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 9a76d4d..70f0259 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 ff3e9bd..0831f6e 100644 --- a/htdocs/compare.php +++ b/htdocs/compare.php @@ -1,5 +1,5 @@ - + diff --git a/htdocs/copy.php b/htdocs/copy.php index 94ac0f1..0786c73 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,6 +172,7 @@ 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/expand.php b/htdocs/expand.php index 46669eb..8526114 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_form.php b/htdocs/export_form.php index 8b90250..df147e8 100755 --- a/htdocs/export_form.php +++ b/htdocs/export_form.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/login.php b/htdocs/login.php index c969155..aa6d196 100644 --- a/htdocs/login.php +++ b/htdocs/login.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,14 +78,15 @@ 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 = array_pop($ldapserver->search(null,$base_dn,$filter,array('dn'))); + $result = $ldapserver->search(null,$base_dn,$filter,array('dn')); + $result = array_pop($result); $dn = $result['dn']; 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/rdelete.php b/htdocs/rdelete.php index 8a37677..52cef28 100644 --- a/htdocs/rdelete.php +++ b/htdocs/rdelete.php @@ -1,5 +1,5 @@ getContainerContents($dn); if (! is_array($children) || count($children) == 0) { - printf(''._('Deleting %s').'...',htmlspecialchars($dn)); + printf('%s %s...',_('Deleting'),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(''._('Deleting %s').'...',htmlspecialchars($dn)); + printf('%s %s...',_('Deleting'),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/schema.php b/htdocs/schema.php index 837e8ff..373a672 100644 --- a/htdocs/schema.php +++ b/htdocs/schema.php @@ -1,5 +1,5 @@ search(null,dn_escape($base_dn),$filter,$search_result_attributes,$scope,true,$config->GetValue('deref','search')); + $results = $ldapserver->search(null,dn_escape($base_dn),$filter, + $search_result_attributes,$scope,$orderby,$config->GetValue('deref','search')); if ((! $results) && $ldapserver->errno()) pla_error(_('Encountered an error while performing search.'),$ldapserver->error(),$ldapserver->errno()); diff --git a/htdocs/server_info.php b/htdocs/server_info.php index 1e6cd60..5da5882 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 = array_pop($ldapserver->search(null,'','objectClass=*',array('+','*'),'base')); +$attrs = $ldapserver->search(null,'','objectClass=*',array('+','*'),'base'); +$attrs = array_pop($attrs); /* After fetching the "basic" attributes from the RootDSE, try fetching the 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 = array_pop($ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base')); +$attrs2 = $ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base'); +$attrs2 = array_pop($attrs2); if (is_array($attrs2)) foreach ($attrs2 as $attr => $values) @@ -83,7 +85,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 5721461..05226f6 100644 --- a/htdocs/template_engine.php +++ b/htdocs/template_engine.php @@ -1,5 +1,5 @@ ',$value); printf('%s%s',$attr,htmlspecialchars($display)); @@ -742,7 +744,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 ''; @@ -968,10 +970,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]); @@ -1005,7 +1007,7 @@ foreach ($template['attrs'] as $attr => $vals) { if (! strcasecmp($attr,'objectClass')) { printf('Info ', - _('View the schema description for this objectClass'),$ldapserver->server_id,htmlspecialchars($val)); + _('View the schema description for this objectClass'),$ldapserver->server_id,strtolower(htmlspecialchars($val))); $schema_object = $ldapserver->getSchemaObjectClass($val); @@ -1022,10 +1024,10 @@ foreach ($template['attrs'] as $attr => $vals) { if (is_dn_string($val) || $ldapserver->isDNAttr($attr)) if ($ldapserver->dnExists($val)) { - printf(' ', + printf('Go ', htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val)); } else { - printf(' ', + printf('N/E ', htmlspecialchars($val),$ldapserver->server_id,rawurlencode($val)); } diff --git a/htdocs/tree.php b/htdocs/tree.php index 0e738d8..8488954 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_confirm.php b/htdocs/update_confirm.php index a7c4777..c50b5ff 100644 --- a/htdocs/update_confirm.php +++ b/htdocs/update_confirm.php @@ -1,5 +1,5 @@ 0) { printf('',$counter%2 ? 'even' : 'odd'); printf('%s',htmlspecialchars($attr)); - echo ''; + echo ''; if (strcasecmp($attr,'userPassword') == 0) { foreach ($old_values[$attr] as $key => $value) { @@ -161,8 +161,8 @@ if (count($update_array) > 0) { else echo nl2br(htmlspecialchars($old_values[$attr])).'
    '; - echo '
    '; - echo ''; + echo ''; + echo ''; # Is this a multi-valued attribute? if (is_array($new_val)) { @@ -201,7 +201,7 @@ if (count($update_array) > 0) { } elseif ($new_val != '') printf('%s',_('[attribute deleted]')); - echo ''; + echo ''; printf('',htmlspecialchars($attr)); echo ''."\n\n"; diff --git a/lib/common.php b/lib/common.php index de747f1..a284f85 100644 --- a/lib/common.php +++ b/lib/common.php @@ -1,5 +1,5 @@ default->appearance['obfuscate_password_display'] = array( 'desc'=>'Obfuscate the display of passwords', - 'default'=>false); + 'default'=>true); $this->default->appearance['show_clear_password'] = array( 'desc'=>'Whether to show clear passwords if we dont obfuscate them', diff --git a/lib/export_functions.php b/lib/export_functions.php index 0e5f045..9053dad 100755 --- a/lib/export_functions.php +++ b/lib/export_functions.php @@ -1,5 +1,5 @@ %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(); @@ -500,8 +501,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) ); } } @@ -1088,15 +1089,16 @@ 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( 0 == ini_get( 'error_reporting' ) || 0 == error_reporting() ) + /* 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) return; $file = basename( $file ); @@ -1216,7 +1218,8 @@ function draw_jpeg_photos($ldapserver,$dn,$attr_name='jpegPhoto',$draw_delete_bu if (isset($table_html_attrs) && trim($table_html_attrs) ) printf(' + + + + + diff --git a/lib/server_functions.php b/lib/server_functions.php index 289fd9d..49868d3 100644 --- a/lib/server_functions.php +++ b/lib/server_functions.php @@ -1,5 +1,5 @@ _connect($connect_id); - if ($resource && ! $reconnect) + if (is_resource($resource) && ! $reconnect) return $resource; if (DEBUG_ENABLED) @@ -219,7 +219,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 ($resource && ! $reconnect) + if (is_resource($resource) && ! $reconnect) return $resource; run_hook('pre_connect',array('server_id'=>$this->server_id,'connect_id'=>$connect_id)); @@ -335,7 +335,8 @@ class LDAPserver { debug_log('%s::getBaseDN(): Connect to LDAP to find BaseDN',80,get_class($this)); if ($this->connect()) { - $r = array_pop($this->search(null,'','objectClass=*',array('namingContexts'),'base')); + $r = $this->search(null,'','objectClass=*',array('namingContexts'),'base'); + $r = array_pop($r); if (is_array($r)) $r = array_change_key_case($r); @@ -1670,13 +1671,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=true,$deref=LDAP_DEREF_NEVER,$size_limit=0) { + function search($resource=null,$base_dn=null,$filter,$attrs=array(),$scope='sub',$sort_results=false,$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); @@ -1719,6 +1720,10 @@ 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)) @@ -1758,8 +1763,6 @@ 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); @@ -2440,7 +2443,8 @@ class LDAPserver { debug_log('%s:getDNAttrs(): Entered with (%s,%s,%s)',17, get_class($this),$dn,$lower_case_attr_names,$deref); - $attrs = array_pop($this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref)); + $attrs = $this->search(null,dn_escape($dn),'(objectClass=*)',array(),'base',false,$deref); + $attrs = array_pop($attrs); if (is_array($attrs)) { if ($lower_case_attr_names) diff --git a/lib/template_functions.php b/lib/template_functions.php index 1cdfb3f..ba52860 100644 --- a/lib/template_functions.php +++ b/lib/template_functions.php @@ -1,5 +1,5 @@ ',$id); + $html = sprintf('',$id); } else { if (is_array($helper)) { diff --git a/lib/tree_functions.php b/lib/tree_functions.php index 9af5a84..ab4ed70 100644 --- a/lib/tree_functions.php +++ b/lib/tree_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; @@ -206,12 +206,12 @@ function draw_server_tree() { printf('',$expand_href,$expand_img,$expand_alt); printf('',$edit_href,$icon); - printf(''; + echo ''; echo ''; } @@ -336,9 +336,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 +354,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/templates/template_header.php b/templates/template_header.php index f228bc4..bde3ab4 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); @@ -130,7 +128,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 '
    ',$table_html_attrs); - $jpeg_data = array_pop($ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base')); + $jpeg_data = $ldapserver->search(null,$dn,'objectClass=*',array($attr_name),'base'); + $jpeg_data = array_pop($jpeg_data); if (! $jpeg_data) { printf(_('Could not fetch jpeg data from LDAP server for attribute %s.'),htmlspecialchars($attr_name)); return; @@ -1719,7 +1722,7 @@ function dn_unescape($dn) { */ function get_href($type,$extra_info='') { $sf = 'https://sourceforge.net'; - $pla = 'http://wiki.pldapadmin.com'; + $pla = 'http://wiki.phpldapadmin.info'; $group_id = '61828'; $bug_atid = '498546'; $rfe_atid = '498549'; @@ -2680,7 +2683,7 @@ function password_generate() { $leftover = array_merge($leftover,$llower,$lupper,$numbers,$punc); shuffle($leftover); - $outarray = array_merge($outarray, a_array_rand($leftover, $criteria['num'] - $num_spec)); + $outarray = array_merge($outarray, a_array_rand($leftover,$length-$num_spec)); } shuffle($outarray); @@ -2814,4 +2817,14 @@ 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 30520e1..ae7b841 100644 --- a/lib/hooks.php +++ b/lib/hooks.php @@ -1,5 +1,5 @@ read() ) ) { - if ( is_file ("hooks/$entry") and eregi ('php[0-9]?$', $entry) ) { - require_once "hooks/$entry"; - } + while (false !== ($entry = $dir->read())) { + $filename = sprintf('%s/%s',HOOKSDIR,$entry); + if (is_file($filename) and eregi('php[0-9]?$',$entry)) + require_once "hooks/$entry"; } $dir -> close(); diff --git a/lib/search_form_advanced.php b/lib/search_form_advanced.php index d68b049..b54b118 100644 --- a/lib/search_form_advanced.php +++ b/lib/search_form_advanced.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
    %s
    '; diff --git a/tools/po/make_po_ca b/tools/po/make_po_ca index 9c6be16..f4de496 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 45b81b9..439c615 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 d64f403..fe439c9 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 b992a09..c938788 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 c2e3f97..eb0c3e4 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 33b672e..600cc2b 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 46efa42..b113c96 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