1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* The ldaphelp module is a module to help admins debug ldap_integration modules.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Implements hook_menu().
|
10 |
|
|
*/
|
11 |
|
|
function ldap_help_menu() {
|
12 |
32700c57
|
Assos Assos
|
$items = [];
|
13 |
|
|
$items['admin/config/people/ldap/help'] = [
|
14 |
85ad3d82
|
Assos Assos
|
'title' => 'Help',
|
15 |
|
|
'type' => MENU_LOCAL_TASK,
|
16 |
|
|
'weight' => 9,
|
17 |
|
|
'description' => 'Debugging and Configuration Help with LDAP',
|
18 |
|
|
'file' => 'ldap_help.resources.inc',
|
19 |
|
|
'page callback' => 'ldap_help_main',
|
20 |
32700c57
|
Assos Assos
|
'access arguments' => ['administer site configuration'],
|
21 |
|
|
];
|
22 |
85ad3d82
|
Assos Assos
|
|
23 |
32700c57
|
Assos Assos
|
$items['admin/config/people/ldap/help/intro'] = [
|
24 |
85ad3d82
|
Assos Assos
|
'title' => 'Resources',
|
25 |
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
26 |
32700c57
|
Assos Assos
|
];
|
27 |
85ad3d82
|
Assos Assos
|
|
28 |
32700c57
|
Assos Assos
|
$items['admin/config/people/ldap/help/status'] = [
|
29 |
85ad3d82
|
Assos Assos
|
'title' => 'Status',
|
30 |
|
|
'description' => 'LDAP status page',
|
31 |
|
|
'page callback' => 'ldap_help_status',
|
32 |
32700c57
|
Assos Assos
|
'access arguments' => ['administer site configuration'],
|
33 |
85ad3d82
|
Assos Assos
|
'file' => 'ldap_help.status.inc',
|
34 |
|
|
'type' => MENU_LOCAL_TASK,
|
35 |
|
|
'weight' => 4,
|
36 |
32700c57
|
Assos Assos
|
];
|
37 |
85ad3d82
|
Assos Assos
|
|
38 |
32700c57
|
Assos Assos
|
$items['admin/config/people/ldap/help/watchdog'] = [
|
39 |
85ad3d82
|
Assos Assos
|
'title' => 'Watchdog',
|
40 |
|
|
'description' => 'LDAP watchdog logs',
|
41 |
|
|
'page callback' => 'ldap_help_watchdog',
|
42 |
32700c57
|
Assos Assos
|
'access arguments' => ['administer site configuration'],
|
43 |
85ad3d82
|
Assos Assos
|
'file' => 'ldap_help.watchdog.inc',
|
44 |
|
|
'type' => MENU_LOCAL_TASK,
|
45 |
|
|
'weight' => 5,
|
46 |
32700c57
|
Assos Assos
|
];
|
47 |
85ad3d82
|
Assos Assos
|
|
48 |
32700c57
|
Assos Assos
|
$items['admin/config/people/ldap/help/issues'] = [
|
49 |
85ad3d82
|
Assos Assos
|
'title' => 'Issue Reporting',
|
50 |
|
|
'description' => 'Creating LDAP Issue Queue Items',
|
51 |
|
|
'page callback' => 'ldap_help_issues',
|
52 |
32700c57
|
Assos Assos
|
'access arguments' => ['administer site configuration'],
|
53 |
85ad3d82
|
Assos Assos
|
'file' => 'ldap_help.issues.inc',
|
54 |
|
|
'type' => MENU_LOCAL_TASK,
|
55 |
|
|
'weight' => 7,
|
56 |
32700c57
|
Assos Assos
|
];
|
57 |
85ad3d82
|
Assos Assos
|
|
58 |
32700c57
|
Assos Assos
|
$items['admin/config/people/ldap/help/examples'] = [
|
59 |
85ad3d82
|
Assos Assos
|
'title' => 'Sample LDAPs',
|
60 |
|
|
'description' => 'Sample LDAPs from Documentation',
|
61 |
|
|
'page callback' => 'ldap_help_examples',
|
62 |
32700c57
|
Assos Assos
|
'access arguments' => ['administer site configuration'],
|
63 |
85ad3d82
|
Assos Assos
|
'file' => 'ldap_help.examples.inc',
|
64 |
|
|
'type' => MENU_LOCAL_TASK,
|
65 |
|
|
'weight' => 7,
|
66 |
32700c57
|
Assos Assos
|
];
|
67 |
85ad3d82
|
Assos Assos
|
|
68 |
|
|
return $items;
|
69 |
|
|
}
|
70 |
|
|
|
71 |
32700c57
|
Assos Assos
|
/**
|
72 |
|
|
*
|
73 |
|
|
*/
|
74 |
85ad3d82
|
Assos Assos
|
function ldap_help_form_ldap_servers_settings_alter(&$form, &$form_state) {
|
75 |
32700c57
|
Assos Assos
|
$form['watchdog_detail'] = ['#type' => 'fieldset', '#title' => t('Development')];
|
76 |
|
|
$form['watchdog_detail']['watchdog_detail'] = [
|
77 |
85ad3d82
|
Assos Assos
|
'#type' => 'checkbox',
|
78 |
|
|
'#title' => t('Enabled Detailed LDAP Watchdog logging. This is generally for
|
79 |
|
|
debugging and reporting issues with the ldap modules and should not be left
|
80 |
|
|
on.'),
|
81 |
|
|
'#default_value' => variable_get('ldap_help_watchdog_detail', 0),
|
82 |
32700c57
|
Assos Assos
|
];
|
83 |
|
|
$date = variable_get('ldap_help_user_data_clear_set_date', time());
|
84 |
|
|
$form['watchdog_detail']['user_data_clear'] = [
|
85 |
85ad3d82
|
Assos Assos
|
'#type' => 'checkbox',
|
86 |
|
|
'#title' => t('Discard and ignore user authorization data stored by ldap module in user records data before %date.
|
87 |
|
|
This is useful for implementers of development versions of the module
|
88 |
32700c57
|
Assos Assos
|
that may have corrupt user data from the past.', ['%date' => date('Y-m-d H:i:s', $date)]),
|
89 |
85ad3d82
|
Assos Assos
|
'#default_value' => variable_get('ldap_help_user_data_clear', 0),
|
90 |
32700c57
|
Assos Assos
|
// array('%date' => date('Y-m-d H:i:s', $date))
|
91 |
|
|
];
|
92 |
|
|
$form['watchdog_detail']['user_data_clear_date'] = [
|
93 |
85ad3d82
|
Assos Assos
|
'#type' => 'checkbox',
|
94 |
32700c57
|
Assos Assos
|
'#title' => t('Reset the clear date to the current date %date', ['%date' => date('Y-m-d H:i:s')]),
|
95 |
85ad3d82
|
Assos Assos
|
'#default_value' => variable_get('ldap_help_user_data_clear_set_date', 0),
|
96 |
32700c57
|
Assos Assos
|
];
|
97 |
85ad3d82
|
Assos Assos
|
$form['#submit'][] = 'ldap_help_watchdog_detail_submit';
|
98 |
|
|
}
|
99 |
|
|
|
100 |
32700c57
|
Assos Assos
|
/**
|
101 |
|
|
*
|
102 |
|
|
*/
|
103 |
85ad3d82
|
Assos Assos
|
function ldap_help_watchdog_detail_submit($form, &$form_state) {
|
104 |
|
|
if ($form_state['submitted']) {
|
105 |
|
|
$watchdog_detail = $form_state['values']['watchdog_detail'];
|
106 |
|
|
if ($watchdog_detail != variable_get('ldap_help_watchdog_detail', 0)) {
|
107 |
|
|
variable_set('ldap_help_watchdog_detail', $watchdog_detail);
|
108 |
|
|
}
|
109 |
|
|
if ($form_state['values']['user_data_clear'] != variable_get('ldap_help_user_data_clear', 0)) {
|
110 |
|
|
variable_set('ldap_help_user_data_clear', $form_state['values']['user_data_clear']);
|
111 |
|
|
}
|
112 |
|
|
if ($form_state['values']['user_data_clear_date'] != 0) {
|
113 |
|
|
variable_set('ldap_help_user_data_clear_set_date', time());
|
114 |
|
|
}
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
|
118 |
32700c57
|
Assos Assos
|
/**
|
119 |
|
|
*
|
120 |
|
|
*/
|
121 |
85ad3d82
|
Assos Assos
|
function ldap_help_help($path, $arg) {
|
122 |
|
|
|
123 |
|
|
$help = '<h3>' . t('LDAP Help Module') . '</h3><p>' .
|
124 |
|
|
t('This module assists Drupal admins in configuring, debugging, sharing, and submitting
|
125 |
|
|
support and bug request related to LDAP modules.') . '<strong><em> ' .
|
126 |
|
|
t('LDAP Help Module should be disabled unless you are debugging or configuring
|
127 |
|
|
LDAP problems.') . ' </em></strong>' .
|
128 |
|
|
t('It adds no functionality to the LDAP modules.') . '</p>';
|
129 |
|
|
|
130 |
|
|
switch ($path) {
|
131 |
|
|
case 'admin/config/people/ldap/help':
|
132 |
|
|
$output = '<p>' . $help . '</p>';
|
133 |
|
|
return $output;
|
134 |
|
|
|
135 |
|
|
case 'admin/help#ldap_help':
|
136 |
|
|
$output = '<p>' . $help . '</p>';
|
137 |
|
|
return $output;
|
138 |
|
|
}
|
139 |
|
|
|
140 |
|
|
} |