Projet

Général

Profil

Révision 32700c57

Ajouté par Assos Assos il y a environ 5 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_authentication/ldap_authentication.pages.inc
1 1
<?php
2

  
2 3
/**
3 4
 * @file
4 5
 * User-facing page callbacks for the LDAP Authentication module.
......
6 7

  
7 8
/**
8 9
 * Form constructor for updating the profile.
9
 * 
10
 * @see ldap_authentication_profile_update_form_validate().
11
 * @see ldap_authentication_profile_update_form_submit().
10
 *
11
 * @see ldap_authentication_profile_update_form_validate()
12
 * @see ldap_authentication_profile_update_form_submit()
12 13
 */
13 14
function ldap_authentication_profile_update_form($form, &$form_state) {
14
  $form['mail'] = array(
15
  $form['mail'] = [
15 16
    '#type' => 'textfield',
16 17
    '#required' => TRUE,
17 18
    '#title' => t('Email Address'),
18
  );
19
  $form['submit'] = array(
19
  ];
20
  $form['submit'] = [
20 21
    '#type' => 'submit',
21 22
    '#value' => t('Update Profile'),
22
  );
23
  ];
23 24
  return $form;
24 25
}
25 26

  
26 27
/**
27 28
 * Form validator for updating the profile.
28
 * 
29
 * @see ldap_authentication_profile_update_form().
29
 *
30
 * @see ldap_authentication_profile_update_form()
30 31
 */
31 32
function ldap_authentication_profile_update_form_validate($form, &$form_state) {
32 33
  if (!filter_var($form_state['values']['mail'], FILTER_VALIDATE_EMAIL)) {
......
45 46

  
46 47
/**
47 48
 * Form submit handler for updating the profile.
48
 * 
49
 * @see ldap_authentication_profile_update_form().
49
 *
50
 * @see ldap_authentication_profile_update_form()
50 51
 */
51 52
function ldap_authentication_profile_update_form_submit($form, &$form_state) {
52 53
  global $user;
53
  if (user_save($user, array(
54
  if (user_save($user, [
54 55
    'mail' => $form_state['values']['mail'],
55
  ))) {
56
    // prevents the cached setting from being used again.
56
  ])) {
57
    // Prevents the cached setting from being used again.
57 58
    unset($_SESSION['ldap_authentication_template']);
58 59
    $form_state['redirect'] = isset($_GET['next']) ? $_GET['next'] : '<front>';
59 60
    drupal_set_message(t('Your profile has been updated.'));

Formats disponibles : Unified diff