Fixing bug when sending an image to the user profile see #4577

skala
Julio Montoya 14 years ago
parent a503454e67
commit f040ed290b
  1. 44
      main/auth/profile.php

@ -195,12 +195,13 @@ $form->addElement('email', 'email', get_lang('Email'), array('size' => 40));
if (api_get_setting('profile', 'email') !== 'true') { if (api_get_setting('profile', 'email') !== 'true') {
$form->freeze('email'); $form->freeze('email');
} }
$form->applyFilter('email', 'stripslashes');
$form->applyFilter('email', 'trim'); if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
if (api_get_setting('registration', 'email') == 'true') { $form->applyFilter('email', 'stripslashes');
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required'); $form->applyFilter('email', 'trim');
$form->addRule('email', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('email', get_lang('EmailWrong'), 'email');
} }
$form->addRule('email', get_lang('EmailWrong'), 'email');
// OPENID URL // OPENID URL
if (is_profile_editable() && api_get_setting('openid_authentication') == 'true') { if (is_profile_editable() && api_get_setting('openid_authentication') == 'true') {
@ -446,7 +447,6 @@ $(document).ready(function(){
}); });
</script>'; </script>';
if (api_get_setting('profile', 'apikeys') == 'true') { if (api_get_setting('profile', 'apikeys') == 'true') {
$form->addElement('html', '<div id="div_api_key">'); $form->addElement('html', '<div id="div_api_key">');
$form->addElement('text', 'api_key_generate', get_lang('MyApiKey'), array('size' => 40, 'id' => 'id_api_key_generate')); $form->addElement('text', 'api_key_generate', get_lang('MyApiKey'), array('size' => 40, 'id' => 'id_api_key_generate'));
@ -589,21 +589,24 @@ if ($form->validate()) {
$changeemail = ''; $changeemail = '';
if ($allow_users_to_change_email_with_no_password) { //If user is sending the email to be changed (input is available and is not freeze )
$changeemail = ''; if (api_get_setting('registration', 'email') == 'true' && api_get_setting('profile', 'email') == 'true') {
if (!check_user_email($user_data['email'])) {
$changeemail = $user_data['email']; if ($allow_users_to_change_email_with_no_password) {
//$_SESSION['change_email'] = 'success'; if (!check_user_email($user_data['email'])) {
} $changeemail = $user_data['email'];
} else { //$_SESSION['change_email'] = 'success';
//Normal behaviour }
if (!check_user_email($user_data['email']) && !empty($user_data['password0']) && !$wrong_current_password) { } else {
$changeemail = $user_data['email']; //Normal behaviour
if (!check_user_email($user_data['email']) && !empty($user_data['password0']) && !$wrong_current_password) {
$changeemail = $user_data['email'];
}
if (!check_user_email($user_data['email']) && empty($user_data['password0'])){
$_SESSION['change_email'] = 'success';
}
} }
if (!check_user_email($user_data['email']) && empty($user_data['password0'])){
$_SESSION['change_email'] = 'success';
}
} }
@ -733,7 +736,6 @@ if ($form->validate()) {
if (!empty($changeemail) && !isset($password) && in_array('email', $available_values_to_modify)) { if (!empty($changeemail) && !isset($password) && in_array('email', $available_values_to_modify)) {
$sql .= " email = '".Database::escape_string($changeemail)."'"; $sql .= " email = '".Database::escape_string($changeemail)."'";
} elseif (isset($password) && isset($changeemail) && in_array('email', $available_values_to_modify) && in_array('password', $available_values_to_modify)) { } elseif (isset($password) && isset($changeemail) && in_array('email', $available_values_to_modify) && in_array('password', $available_values_to_modify)) {
$sql .= " email = '".Database::escape_string($changeemail)."',"; $sql .= " email = '".Database::escape_string($changeemail)."',";
$password = api_get_encrypted_password($password); $password = api_get_encrypted_password($password);
$sql .= " password = '".Database::escape_string($password)."'"; $sql .= " password = '".Database::escape_string($password)."'";

Loading…
Cancel
Save