X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FLdapCommon%2FLdapCommon.php;h=afc61abf7222633c7a5078c0b8555da256b5738f;hb=19b965d99188fde59cdd39b668df8951bc0f180c;hp=579fe4b64b474fe649198170037e9c1ba1a6ad33;hpb=bf20258f4b61dd8396db9a1980463c060dab292c;p=quix0rs-gnu-social.git diff --git a/plugins/LdapCommon/LdapCommon.php b/plugins/LdapCommon/LdapCommon.php index 579fe4b64b..afc61abf72 100644 --- a/plugins/LdapCommon/LdapCommon.php +++ b/plugins/LdapCommon/LdapCommon.php @@ -60,12 +60,15 @@ class LdapCommon $this->ldap_config = $this->get_ldap_config(); if(!isset($this->host)){ - throw new Exception(_m("A host must be specified.")); + // TRANS: Exception thrown when initialising the LDAP Common plugin fails because of an incorrect configuration. + throw new Exception(_m('A host must be specified.')); } if(!isset($this->basedn)){ + // TRANS: Exception thrown when initialising the LDAP Common plugin fails because of an incorrect configuration. throw new Exception(_m('"basedn" must be specified.')); } if(!isset($this->attributes['username'])){ + // TRANS: Exception thrown when initialising the LDAP Common plugin fails because of an incorrect configuration. throw new Exception(_m('The username attribute must be set.')); } } @@ -122,9 +125,13 @@ class LdapCommon // if we were called with a config, assume caller will handle // incorrect username/password (LDAP_INVALID_CREDENTIALS) if (isset($config) && $err->getCode() == 0x31) { - throw new LdapInvalidCredentialsException('Could not connect to LDAP server: '.$err->getMessage()); + // TRANS: Exception thrown in the LDAP Common plugin when LDAP server is not available. + // TRANS: %s is the error message. + throw new LdapInvalidCredentialsException(sprintf(_m('Could not connect to LDAP server: %s'),$err->getMessage())); } - throw new Exception('Could not connect to LDAP server: '.$err->getMessage()); + // TRANS: Exception thrown in the LDAP Common plugin when LDAP server is not available. + // TRANS: %s is the error message. + throw new Exception(sprintf(_m('Could not connect to LDAP server: %s.'),$err->getMessage())); } $c = Cache::instance(); if (!empty($c)) { @@ -140,7 +147,7 @@ class LdapCommon function checkPassword($username, $password) { - $entry = $this->get_user($username); + $entry = $this->get_user($username,array('dn' => 'dn')); if(!$entry){ return false; }else{ @@ -165,10 +172,10 @@ class LdapCommon function changePassword($username,$oldpassword,$newpassword) { if(! isset($this->attributes['password']) || !isset($this->password_encoding)){ - //throw new Exception(_('Sorry, changing LDAP passwords is not supported at this time')); + //throw new Exception(_m('Sorry, changing LDAP passwords is not supported at this time.')); return false; } - $entry = $this->get_user($username); + $entry = $this->get_user($username,array('dn' => 'dn')); if(!$entry){ return false; }else{