function save()
 {
     $confirm = $this->rcmail_inst->config->get('password_confirm_current');
     if ($confirm && !isset($_POST['_curpasswd']) || !isset($_POST['_newpasswd'])) {
         $this->rcmail_inst->output->command('display_message', $this->gettext('nopassword'), 'error');
     } else {
         $curpwd = rcube_utils::get_input_value('_curpasswd', RCUBE_INPUT_POST);
         $newpwd = rcube_utils::get_input_value('_newpasswd', RCUBE_INPUT_POST);
         $pwl = $this->rcmail_inst->config->get('password_min_length');
         $checkUpper = $this->rcmail_inst->config->get('password_check_upper');
         $checkLower = $this->rcmail_inst->config->get('password_check_lower');
         $checkSymbol = $this->rcmail_inst->config->get('password_check_symbol');
         $checkNumber = $this->rcmail_inst->config->get('password_check_number');
         $error = false;
         if (!empty($pwl)) {
             $pwl = max(6, $pwl);
         } else {
             $pwl = 6;
         }
         if ($confirm && $this->rcmail_inst->decrypt($_SESSION['password']) != $curpwd) {
             $this->rcmail_inst->output->command('display_message', $this->gettext('passwordincorrect'), 'error');
         } else {
             if (strlen($newpwd) < $pwl) {
                 $error = true;
                 $this->rcmail_inst->output->command('display_message', str_replace("%d", $pwl, $this->gettext('passwordminlength')), 'error');
             }
             if (!$error && $checkNumber && !preg_match("#[0-9]+#", $newpwd)) {
                 $error = true;
                 $this->rcmail_inst->output->command('display_message', $this->gettext('passwordchecknumber'), 'error');
             }
             if (!$error && $checkLower && !preg_match("#[a-z]+#", $newpwd)) {
                 $error = true;
                 $this->rcmail_inst->output->command('display_message', $this->gettext('passwordchecklower'), 'error');
             }
             if (!$error && $checkUpper && !preg_match("#[A-Z]+#", $newpwd)) {
                 $error = true;
                 $this->rcmail_inst->output->command('display_message', $this->gettext('passwordcheckupper'), 'error');
             }
             if (!$error && $checkSymbol && !preg_match("#\\W+#", $newpwd)) {
                 $error = true;
                 $this->rcmail_inst->output->command('display_message', $this->gettext('passwordchecksymbol'), 'error');
             }
             if (!$error) {
                 try {
                     $soap = new SoapClient(null, array('location' => $this->rcmail_inst->config->get('soap_url') . 'index.php', 'uri' => $this->rcmail_inst->config->get('soap_url')));
                     $session_id = $soap->login($this->rcmail_inst->config->get('remote_soap_user'), $this->rcmail_inst->config->get('remote_soap_pass'));
                     $mail_user = $soap->mail_user_get($session_id, array('login' => $this->rcmail_inst->user->data['username']));
                     $params = $mail_user[0];
                     $startdate = array('year' => substr($params['autoresponder_start_date'], 0, 4), 'month' => substr($params['autoresponder_start_date'], 5, 2), 'day' => substr($params['autoresponder_start_date'], 8, 2), 'hour' => substr($params['autoresponder_start_date'], 11, 2), 'minute' => substr($params['autoresponder_start_date'], 14, 2));
                     $enddate = array('year' => substr($params['autoresponder_end_date'], 0, 4), 'month' => substr($params['autoresponder_end_date'], 5, 2), 'day' => substr($params['autoresponder_end_date'], 8, 2), 'hour' => substr($params['autoresponder_end_date'], 11, 2), 'minute' => substr($params['autoresponder_end_date'], 14, 2));
                     $params['password'] = $newpwd;
                     $params['autoresponder_end_date'] = $enddate;
                     $params['autoresponder_start_date'] = $startdate;
                     $uid = $soap->client_get_id($session_id, $mail_user[0]['sys_userid']);
                     $update = $soap->mail_user_update($session_id, $uid, $mail_user[0]['mailuser_id'], $params);
                     $soap->logout($session_id);
                     $this->rcmail_inst->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation');
                     $_SESSION['password'] = $this->rcmail_inst->encrypt($newpwd);
                     $this->rcmail_inst->user->data['password'] = $_SESSION['password'];
                 } catch (SoapFault $e) {
                     $this->rcmail_inst->output->command('display_message', 'Soap Error: ' . $e->getMessage(), 'error');
                 }
             }
         }
     }
     $this->init_html();
 }
Example #2
0
<?php

require 'soap_config.php';
$client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1));
try {
    if ($session_id = $client->login($username, $password)) {
        echo 'Logged successfull. Session ID:' . $session_id . '<br />';
    }
    //* Set the function parameters.
    $sys_userid = 5;
    $client_record = $client->client_get_id($session_id, $sys_userid);
    print_r($client_record);
    if ($client->logout($session_id)) {
        echo 'Logged out.<br />';
    }
} catch (SoapFault $e) {
    echo $client->__getLastResponse();
    die('SOAP Error: ' . $e->getMessage());
}