query("$sql_query"); if ($DB->affected_rows()) { $_SESSION['password'] = encrypt_passwd($newpasswd); } return($DB->affected_rows()); } function rcmail_passwd_form($attrib){ global $CONFIG, $OUTPUT; list($form_start, $form_end) = get_form_tags($attrib, 'save-passwd'); unset($attrib['form']); if (!$attrib['id']) $attrib['id'] = 'rcmSavepassword'; // allow the following attributes to be added to the tag $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary')); // return the complete edit form as table $out = "$form_start\n\n"; $a_show_cols = array('curpasswd' => array('type' => 'text'), 'newpasswd' => array('type' => 'text'), 'confpasswd' => array('type' => 'text')); // show current password field $field_id = 'curpasswd'; $input_curpasswd = new passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 30)); $out .= sprintf("\n", $field_id, rep_specialchars_output(rcube_label('curpasswd')), $input_curpasswd->show($CONFIG['curpasswd'])); // show new password selection $field_id = 'newpasswd'; $input_newpasswd = new passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 30)); $out .= sprintf("\n", $field_id, rep_specialchars_output(rcube_label('newpasswd')), $input_newpasswd->show($CONFIG['newpasswd'])); // show confirm password selection $field_id = 'confpasswd'; $input_confpasswd = new passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 30)); $out .= sprintf("\n", $field_id, rep_specialchars_output(rcube_label('confpasswd')), $input_confpasswd->show($CONFIG['confpasswd'])); $out .= "\n
%s
%s
%s
$form_end"; return $out; } // Handle user request if ($_action=='save-passwd'){ if (!isset($_POST['_newpasswd']) or !isset($_POST['_curpasswd'])) $OUTPUT->show_message('errorsaving', 'error'); else if (rcmail_save_passwd(get_input_value('_curpasswd', RCUBE_INPUT_POST), get_input_value('_newpasswd', RCUBE_INPUT_POST))) $OUTPUT->show_message('successfullysaved', 'confirmation'); else $OUTPUT->show_message('errorsaving', 'error'); // overwrite action variable rcmail_overwrite_action('passwd'); } // add some labels to client rcube_add_label('nopassword'); rcube_add_label('passwordinconsistency'); parse_template('passwd'); ?>