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_help/ldap_help.module
3 3
/**
4 4
 * @file
5 5
 * The ldaphelp module is a module to help admins debug ldap_integration modules.
6
 *
7 6
 */
8 7

  
9 8
/**
10 9
 * Implements hook_menu().
11 10
 */
12 11
function ldap_help_menu() {
13
  $items = array();
14
  $items['admin/config/people/ldap/help'] = array(
12
  $items = [];
13
  $items['admin/config/people/ldap/help'] = [
15 14
    'title' => 'Help',
16 15
    'type' => MENU_LOCAL_TASK,
17 16
    'weight' => 9,
18 17
    'description' => 'Debugging and Configuration Help with LDAP',
19 18
    'file' => 'ldap_help.resources.inc',
20 19
    'page callback' => 'ldap_help_main',
21
    'access arguments' => array('administer site configuration'),
22
  );
20
    'access arguments' => ['administer site configuration'],
21
  ];
23 22

  
24
  $items['admin/config/people/ldap/help/intro'] = array(
23
  $items['admin/config/people/ldap/help/intro'] = [
25 24
    'title' => 'Resources',
26 25
    'type' => MENU_DEFAULT_LOCAL_TASK,
27
  );
26
  ];
28 27

  
29
  $items['admin/config/people/ldap/help/status'] = array(
28
  $items['admin/config/people/ldap/help/status'] = [
30 29
    'title' => 'Status',
31 30
    'description' => 'LDAP status page',
32 31
    'page callback' => 'ldap_help_status',
33
    'access arguments' => array('administer site configuration'),
32
    'access arguments' => ['administer site configuration'],
34 33
    'file' => 'ldap_help.status.inc',
35 34
    'type' => MENU_LOCAL_TASK,
36 35
    'weight' => 4,
37
  );
36
  ];
38 37

  
39
  $items['admin/config/people/ldap/help/watchdog'] = array(
38
  $items['admin/config/people/ldap/help/watchdog'] = [
40 39
    'title' => 'Watchdog',
41 40
    'description' => 'LDAP watchdog logs',
42 41
    'page callback' => 'ldap_help_watchdog',
43
    'access arguments' => array('administer site configuration'),
42
    'access arguments' => ['administer site configuration'],
44 43
    'file' => 'ldap_help.watchdog.inc',
45 44
    'type' => MENU_LOCAL_TASK,
46 45
    'weight' => 5,
47
  );
46
  ];
48 47

  
49
  $items['admin/config/people/ldap/help/issues'] = array(
48
  $items['admin/config/people/ldap/help/issues'] = [
50 49
    'title' => 'Issue Reporting',
51 50
    'description' => 'Creating LDAP Issue Queue Items',
52 51
    'page callback' => 'ldap_help_issues',
53
    'access arguments' => array('administer site configuration'),
52
    'access arguments' => ['administer site configuration'],
54 53
    'file' => 'ldap_help.issues.inc',
55 54
    'type' => MENU_LOCAL_TASK,
56 55
    'weight' => 7,
57
  );
58

  
56
  ];
59 57

  
60
  $items['admin/config/people/ldap/help/examples'] = array(
58
  $items['admin/config/people/ldap/help/examples'] = [
61 59
    'title' => 'Sample LDAPs',
62 60
    'description' => 'Sample LDAPs from Documentation',
63 61
    'page callback' => 'ldap_help_examples',
64
    'access arguments' => array('administer site configuration'),
62
    'access arguments' => ['administer site configuration'],
65 63
    'file' => 'ldap_help.examples.inc',
66 64
    'type' => MENU_LOCAL_TASK,
67 65
    'weight' => 7,
68
  );
69

  
66
  ];
70 67

  
71 68
  return $items;
72 69
}
73 70

  
71
/**
72
 *
73
 */
74 74
function ldap_help_form_ldap_servers_settings_alter(&$form, &$form_state) {
75
  $form['watchdog_detail'] = array('#type' => 'fieldset', '#title' => t('Development'));
76
  $form['watchdog_detail']['watchdog_detail'] = array(
75
  $form['watchdog_detail'] = ['#type' => 'fieldset', '#title' => t('Development')];
76
  $form['watchdog_detail']['watchdog_detail'] = [
77 77
    '#type' => 'checkbox',
78 78
    '#title' => t('Enabled Detailed LDAP Watchdog logging.  This is generally for
79 79
       debugging and reporting issues with the ldap modules and should not be left
80 80
       on.'),
81 81
    '#default_value' => variable_get('ldap_help_watchdog_detail', 0),
82
  );
83
 $date = variable_get('ldap_help_user_data_clear_set_date', time());
84
 $form['watchdog_detail']['user_data_clear'] = array(
82
  ];
83
  $date = variable_get('ldap_help_user_data_clear_set_date', time());
84
  $form['watchdog_detail']['user_data_clear'] = [
85 85
    '#type' => 'checkbox',
86 86
    '#title' => t('Discard and ignore user authorization data stored by ldap module in user records data before %date.
87 87
      This is useful for implementers of development versions of the module
88
      that may have corrupt user data from the past.', array('%date' => date('Y-m-d H:i:s', $date))),
88
      that may have corrupt user data from the past.', ['%date' => date('Y-m-d H:i:s', $date)]),
89 89
    '#default_value' => variable_get('ldap_help_user_data_clear', 0),
90
  );  //array('%date' => date('Y-m-d H:i:s', $date))
91
 $form['watchdog_detail']['user_data_clear_date'] = array(
90
  // array('%date' => date('Y-m-d H:i:s', $date))
91
  ];
92
  $form['watchdog_detail']['user_data_clear_date'] = [
92 93
    '#type' => 'checkbox',
93
    '#title' => t('Reset the clear date to the current date %date', array('%date' => date('Y-m-d H:i:s'))),
94
    '#title' => t('Reset the clear date to the current date %date', ['%date' => date('Y-m-d H:i:s')]),
94 95
    '#default_value' => variable_get('ldap_help_user_data_clear_set_date', 0),
95
  );
96
  ];
96 97
  $form['#submit'][] = 'ldap_help_watchdog_detail_submit';
97 98
}
98 99

  
99

  
100
/**
101
 *
102
 */
100 103
function ldap_help_watchdog_detail_submit($form, &$form_state) {
101 104
  if ($form_state['submitted']) {
102 105
    $watchdog_detail = $form_state['values']['watchdog_detail'];
......
112 115
  }
113 116
}
114 117

  
118
/**
119
 *
120
 */
115 121
function ldap_help_help($path, $arg) {
116 122

  
117 123
  $help = '<h3>' . t('LDAP Help Module') . '</h3><p>' .

Formats disponibles : Unified diff