|
|
@ -13,10 +13,10 @@
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This driver has been tested with o2switch hosting and seems to work fine.
|
|
|
|
* This driver has been tested with o2switch hosting and seems to work fine.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @version 3.0
|
|
|
|
* @version 3.1
|
|
|
|
* @author Christian Chech <christian@chech.fr>
|
|
|
|
* @author Christian Chech <christian@chech.fr>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005-2013, The Roundcube Dev Team
|
|
|
|
* Copyright (C) 2005-2016, The Roundcube Dev Team
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
@ -41,22 +41,27 @@ class rcube_cpanel_password
|
|
|
|
$rcmail = rcmail::get_instance();
|
|
|
|
$rcmail = rcmail::get_instance();
|
|
|
|
|
|
|
|
|
|
|
|
$this->cuser = $rcmail->config->get('password_cpanel_username');
|
|
|
|
$this->cuser = $rcmail->config->get('password_cpanel_username');
|
|
|
|
|
|
|
|
$cpanel_host = $rcmail->config->get('password_cpanel_host');
|
|
|
|
|
|
|
|
$cpanel_port = $rcmail->config->get('password_cpanel_port');
|
|
|
|
|
|
|
|
$cpanel_hash = $rcmail->config->get('password_cpanel_hash');
|
|
|
|
|
|
|
|
$cpanel_pass = $rcmail->config->get('password_cpanel_password');
|
|
|
|
|
|
|
|
|
|
|
|
// Setup the xmlapi connection
|
|
|
|
// Setup the xmlapi connection
|
|
|
|
$this->xmlapi = new xmlapi($rcmail->config->get('password_cpanel_host'));
|
|
|
|
$this->xmlapi = new xmlapi($cpanel_host);
|
|
|
|
$this->xmlapi->set_port($rcmail->config->get('password_cpanel_port'));
|
|
|
|
$this->xmlapi->set_port($cpanel_port);
|
|
|
|
|
|
|
|
|
|
|
|
// Hash auth
|
|
|
|
// Hash auth
|
|
|
|
if (!empty($cpanel_hash = $rcmail->config->get('password_cpanel_hash'))) {
|
|
|
|
if (!empty($cpanel_hash)) {
|
|
|
|
$this->xmlapi->hash_auth( $this->cuser, $cpanel_hash);
|
|
|
|
$this->xmlapi->hash_auth($this->cuser, $cpanel_hash);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Pass auth
|
|
|
|
// Pass auth
|
|
|
|
else if (!empty($cpanel_password = $rcmail->config->get('password_cpanel_password'))) {
|
|
|
|
else if (!empty($cpanel_pass)) {
|
|
|
|
$this->xmlapi->hash_auth( $this->cuser, $cpanel_password);
|
|
|
|
$this->xmlapi->password_auth($this->cuser, $cpanel_pass);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
return PASSWORD_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->xmlapi->set_output('json');
|
|
|
|
$this->xmlapi->set_output('json');
|
|
|
|
$this->xmlapi->set_debug(0);
|
|
|
|
$this->xmlapi->set_debug(0);
|
|
|
|
|
|
|
|
|
|
|
@ -81,16 +86,16 @@ class rcube_cpanel_password
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$data['password'] = $password;
|
|
|
|
$data['password'] = $password;
|
|
|
|
|
|
|
|
|
|
|
|
// Get the cPanel user
|
|
|
|
// Get the cPanel user
|
|
|
|
$query = $this->xmlapi->listaccts( 'domain', $data['domain'] );
|
|
|
|
$query = $this->xmlapi->listaccts('domain', $data['domain']);
|
|
|
|
$query = json_decode( $query, true );
|
|
|
|
$query = json_decode($query, true);
|
|
|
|
if ( $query['status'] != 1 ) {
|
|
|
|
if ( $query['status'] != 1) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$cpanel_user = $query['acct'][0]['user'];
|
|
|
|
$cpanel_user = $query['acct'][0]['user'];
|
|
|
|
|
|
|
|
|
|
|
|
$query = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data);
|
|
|
|
$query = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data);
|
|
|
|
$query = json_decode($query, true);
|
|
|
|
$query = json_decode($query, true);
|
|
|
|
$result = $query['cpanelresult']['data'][0];
|
|
|
|
$result = $query['cpanelresult']['data'][0];
|
|
|
|
|
|
|
|
|
|
|
|