'.get_lang('Back').'';
echo '
'.$msg1.'
';
} else {
$form = new FormValidator('lost_password');
$form->addElement('text', 'user', get_lang('LoginOrEmailAddress'), array('size'=>'40'));
//$form->applyFilter('email','strtolower');
$form->addElement('style_submit_button', 'submit', get_lang('Send'),'class="save"');
// setting the rules
$form->addRule('user', ''.get_lang('ThisFieldIsRequired').'
', 'required');
if ($form->validate()) {
$values = $form->exportValues();
if(strpos($values['user'],'@')){
$user = strtolower($values['user']);
$email = TRUE;
} else {
$user = strtolower($values['user']);
$email = FALSE;
}
$condition = '';
if ($email) {
$condition = "LOWER(email) = '".Database::escape_string($user)."' ";
} else {
$condition = "LOWER(username) = '".Database::escape_string($user)."'";
}
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$query = "SELECT user_id AS uid, lastname AS lastName, firstname AS firstName, ".
"username AS loginName, password, email, status AS status, ".
"official_code, phone, picture_uri, creator_id ".
"FROM ".$tbl_user." ".
"WHERE ( $condition ) ";
$result = Database::query($query);
$num_rows = Database::num_rows($result);
if ($result && $num_rows > 0) {
$by_username = true;
$users = Database::store_result($result);
foreach( $users as $user ) {
if ($userPasswordCrypted != 'none') {
Login::handle_encrypted_password($user, $by_username);
} else {
Login::send_password_to_user($user, $by_username);
}
}
} else {
Display::display_error_message(get_lang('NoUserAccountWithThisEmailAddress'));
}
//$msg .= ''.get_lang('Back').'';
//echo '
'.$msg.'
';
} else {
echo get_lang('EnterEmailUserAndWellSendYouPassword');
echo '
';
$form->display();
}
}
Display::display_footer();