diff options
| -rw-r--r-- | plugins/password/README | 8 | ||||
| -rw-r--r-- | plugins/password/config.inc.php.dist | 5 | ||||
| -rw-r--r-- | plugins/password/drivers/directadmin.php | 36 | ||||
| -rw-r--r-- | roundcubemail/program/localization/pt_BR/messages.inc | 1 |
4 files changed, 31 insertions, 19 deletions
diff --git a/plugins/password/README b/plugins/password/README index 80421ce8f..d9280fb03 100644 --- a/plugins/password/README +++ b/plugins/password/README @@ -177,9 +177,11 @@ 2.5. DirectAdmin Control Panel (directadmin) -------------------------------------------- - You can specify which host to connect to via 'password_directadmin_host' - and what port via 'password_direactadmin_port'. See config.inc.php.dist file - for more info. + You can specify which host to connect to via 'password_directadmin_host' (don't + forget to use tcp:// or ssl://) and what port via 'password_direactadmin_port'. + The password enforcement with plenty customization can be done directly by + DirectAdmin, please see http://www.directadmin.com/features.php?id=910 + See config.inc.php.dist file for more info. 2.6. cPanel (cpanel) diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist index ddf881217..94af6d776 100644 --- a/plugins/password/config.inc.php.dist +++ b/plugins/password/config.inc.php.dist @@ -212,7 +212,10 @@ $rcmail_config['password_ldap_samba_lchattr'] = ''; // DirectAdmin Driver options // -------------------------- // The host which changes the password -// Use 'ssl://serverip' instead of 'tcp://serverip' when running DirectAdmin over SSL. +// Use 'ssl://host' instead of 'tcp://host' when running DirectAdmin over SSL. +// The host can contain the following macros that will be expanded as follows: +// %h is replaced with the imap host (from the session info) +// %d is replaced with the domain part of the username (if the username is an email) $rcmail_config['password_directadmin_host'] = 'tcp://localhost'; // TCP port used for DirectAdmin connections diff --git a/plugins/password/drivers/directadmin.php b/plugins/password/drivers/directadmin.php index 6ca3264c5..3b6ae9f03 100644 --- a/plugins/password/drivers/directadmin.php +++ b/plugins/password/drivers/directadmin.php @@ -5,7 +5,7 @@ * * Driver to change passwords via DirectAdmin Control Panel * - * @version 1.0 + * @version 1.2 * @author Victor Benincasa <vbenincasa@gmail.com> * */ @@ -22,6 +22,11 @@ function password_save($curpass, $passwd){ $da_host = $rcmail->config->get('password_directadmin_host'); $da_port = $rcmail->config->get('password_directadmin_port'); + if(strpos($da_user, '@') === false) return array('code' => PASSWORD_ERROR, 'message' => 'Change the SYSTEM user password through control panel!'); + + $da_host = str_replace('%h', $_SESSION['imap_host'], $da_host); + $da_host = str_replace('%d', $rcmail->user->get_username('domain'), $da_host); + $Socket->connect($da_host,$da_port); $Socket->set_method('POST'); $Socket->query('/CMD_CHANGE_EMAIL_PASSWORD', @@ -34,13 +39,14 @@ function password_save($curpass, $passwd){ )); $response = $Socket->fetch_parsed_body(); - //console("DA error response: $response[text] [$da_user]"); + //DEBUG + //console("Password Plugin: [USER: $da_user] [HOST: $da_host] - Response: [SOCKET: ".$Socket->result_status_code."] [DA ERROR: ".strip_tags($response['error'])."] [TEXT: ".$response[text]."]"); - if($Socket->result_status_code <> 200) - return PASSWORD_CONNECT_ERROR; - elseif($response['error'] == 1){ //Error description: $response[text] - return PASSWORD_ERROR; - }else + if($Socket->result_status_code != 200) + return array('code' => PASSWORD_CONNECT_ERROR, 'message' => $Socket->error[0]); + elseif($response['error'] == 1) + return array('code' => PASSWORD_ERROR, 'message' => strip_tags($response['text'])); + else return PASSWORD_SUCCESS; } @@ -57,11 +63,11 @@ function password_save($curpass, $passwd){ * * @author Phi1 'l0rdphi1' Stier <l0rdphi1@liquenox.net> * @package HTTPSocket - * @version 2.6 + * @version 2.7 (Updated by Victor Benincasa <vbenincasa@gmail.com>) */ class HTTPSocket { - var $version = '2.6'; + var $version = '2.7'; /* all vars are private except $error, $query_cache, and $doFollowLocationHeader */ @@ -316,8 +322,8 @@ class HTTPSocket { } } - - list($this->result_header, $this->result_body) = explode("\r\n\r\n", $this->result, 2); + + list($this->result_header,$this->result_body) = preg_split("/\r\n\r\n/",$this->result,2); if ($this->bind_host) { @@ -378,7 +384,7 @@ class HTTPSocket { { if ($asArray) { - return explode("\n", $this->fetch_body()); + return preg_split("/\n/",$this->fetch_body()); } return $this->fetch_body(); @@ -438,14 +444,14 @@ class HTTPSocket { */ function fetch_header( $header = '' ) { - $array_headers = explode("\r\n", $this->result_header); - + $array_headers = preg_split("/\r\n/",$this->result_header); + $array_return = array( 0 => $array_headers[0] ); unset($array_headers[0]); foreach ( $array_headers as $pair ) { - list($key,$value) = explode(": ", $pair, 2); + list($key,$value) = preg_split("/: /",$pair,2); $array_return[strtolower($key)] = $value; } diff --git a/roundcubemail/program/localization/pt_BR/messages.inc b/roundcubemail/program/localization/pt_BR/messages.inc index 4cba88f95..94975b3eb 100644 --- a/roundcubemail/program/localization/pt_BR/messages.inc +++ b/roundcubemail/program/localization/pt_BR/messages.inc @@ -38,6 +38,7 @@ $messages['loggedout'] = 'Sua sessão foi finalizada com sucesso. Até breve!'; $messages['mailboxempty'] = 'A caixa de mensagens está vazia'; $messages['loading'] = 'Carregando...'; $messages['uploading'] = 'Enviando anexo...'; +$messages['uploadingmany'] = 'Enviando anexos...'; $messages['loadingdata'] = 'Carregando informações...'; $messages['checkingmail'] = 'Verificando se há novas mensagens...'; $messages['sendingmessage'] = 'Enviando mensagem...'; |
