roundcubemail/plugins/password/drivers/cpanel.php
function setPassword($address, $password)
    {
        if (strpos($address, '@')) {
            list($data['email'], $data['domain']) = explode('@', $address);
        }
        else {
            list($data['email'], $data['domain']) = array($address, '');
        }

        $data['password'] = $password;

        // Get the cPanel user
        $query = $this->xmlapi->listaccts('domain', $data['domain']);
        $query = json_decode($query, true);
        if ( $query['status'] != 1) {
            return false;
        }
        $cpanel_user = $query['acct'][0]['user'];

        $query  = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data);
        $query  = json_decode($query, true);
        $result = $query['cpanelresult']['data'][0];

        if ($result['result'] == 1) {
            return PASSWORD_SUCCESS;
        }

        if ($result['reason']) {
            return array(
                'code'    => PASSWORD_ERROR,
                'message' => $result['reason'],
            );
        }

        return PASSWORD_ERROR;
    }
function setPassword($address, $password)
    {
        if (strpos($address, '@')) {
            list($data['email'], $data['domain']) = explode('@', $address);
        }
        else {
            list($data['email'], $data['domain']) = array($address, '');
        }

        $data['password'] = $password;

        // Get the cPanel user
        $query = $this->xmlapi->listaccts('domain', $data['domain']);
        $query = json_decode($query, true);
        if ( $query['status'] != 1) {
            return false;
        }
        $cpanel_user = $query['acct'][0]['user'];

        $query  = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data);
        $query  = json_decode($query, true);
        $result = $query['cpanelresult']['data'][0];

        if ($result['result'] == 1) {
            return PASSWORD_SUCCESS;
        }

        if ($result['reason']) {
            return array(
                'code'    => PASSWORD_ERROR,
                'message' => $result['reason'],
            );
        }

        return PASSWORD_ERROR;
    }
function setPassword ( $ address , $ password ) { if ( strpos ( $ address , '@' ) ) { list ( $ data [ 'email' ] , $ data [ 'domain' ] ) = explode ( '@' , $ address ) ; } else { list ( $ data [ 'email' ] , $ data [ 'domain' ] ) = array ( $ address , '' ) ; } $ data [ 'password' ] = $ password ; // Get the cPanel user $ query = $ this -> xmlapi -> listaccts ( 'domain' , $ data [ 'domain' ] ) ; $ query = json_decode ( $ query , true ) ; if ( $ query [ 'status' ] != 1 ) { return false ; } $ cpanel_user = $ query [ 'acct' ] [ 0 ] [ 'user' ] ; $ query = $ this -> xmlapi -> api2_query ( $ cpanel_user , 'Email' , 'passwdpop' , $ data ) ; $ query = json_decode ( $ query , true ) ; $ result = $ query [ 'cpanelresult' ] [ 'data' ] [ 0 ] ; if ( $ result [ 'result' ] == 1 ) { return PASSWORD_SUCCESS ; } if ( $ result [ 'reason' ] ) { return array ( 'code' => PASSWORD_ERROR , 'message' => $ result [ 'reason' ] , ) ; } return PASSWORD_ERROR ; }
Change email account password

@param string $address  Email address/username
@param string $password Email account password

@return int|array Operation status
Change email account password