Révision 32700c57
Ajouté par Assos Assos il y a environ 5 ans
drupal7/sites/all/modules/ldap/ldap_help/ldap_help.status.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* status file for ldaphelp module |
|
6 |
* |
|
5 |
* Status file for ldaphelp module. |
|
7 | 6 |
*/ |
8 | 7 |
|
8 |
/** |
|
9 |
* |
|
10 |
*/ |
|
9 | 11 |
function ldap_help_status($return = 'html') { |
10 | 12 |
|
11 | 13 |
drupal_add_css(drupal_get_path('module', 'system') . '/system.css', 'module', 'all', FALSE); |
12 |
include_once(drupal_get_path('module', 'system') . '/system.admin.inc');
|
|
14 |
include_once drupal_get_path('module', 'system') . '/system.admin.inc';
|
|
13 | 15 |
|
14 |
// server and LDAP Module Data
|
|
16 |
// Server and LDAP Module Data.
|
|
15 | 17 |
$heading = "Server and LDAP Module"; |
16 | 18 |
$key = 'server'; |
17 | 19 |
$phpinfo = ldap_help_parsePHPModules(); |
18 | 20 |
$status['server'] = ldap_help_get_server($phpinfo, $info); |
19 | 21 |
$reporting_text = _ldap_help_parse_status_to_text($status['server'], $heading); |
20 |
$content = "<h3>$heading</h3>" . theme('status_report', array('requirements' => $status['server'])); // . ldap_help_phpinfo();
|
|
22 |
$content = "<h3>$heading</h3>" . theme('status_report', ['requirements' => $status['server']]);
|
|
21 | 23 |
|
22 | 24 |
$status['user_settings'] = ldap_help_get_user_settings(); |
23 |
$content .= "<h3>User Settings</h3>" . theme('status_report', array('requirements' => $status['user_settings']));
|
|
25 |
$content .= "<h3>User Settings</h3>" . theme('status_report', ['requirements' => $status['user_settings']]);
|
|
24 | 26 |
|
25 | 27 |
if (module_exists('ldap_servers')) { |
26 | 28 |
list($status['ldap_servers'], $servers) = ldap_help_get_ldap_servers(); |
27 |
$content .= "<h3>General Settings</h3>" . theme('status_report', array('requirements' => $status['ldap_servers']));
|
|
29 |
$content .= "<h3>General Settings</h3>" . theme('status_report', ['requirements' => $status['ldap_servers']]);
|
|
28 | 30 |
|
29 | 31 |
foreach ($servers as $sid => $server) { |
30 |
$content .= "<h3>Server: " . $server[1]['value'] . "</h3>" . theme('status_report', array('requirements' => $server));
|
|
32 |
$content .= "<h3>Server: " . $server[1]['value'] . "</h3>" . theme('status_report', ['requirements' => $server]);
|
|
31 | 33 |
} |
32 | 34 |
} |
33 | 35 |
|
34 | 36 |
if (module_exists('ldap_authentication')) { |
35 | 37 |
$status['ldap_authentication'] = ldap_help_get_ldap_authentication(); |
36 |
$content .= "<h3>LDAP Authentication Settings</h3>" . theme('status_report', array('requirements' => $status['ldap_authentication']));
|
|
38 |
$content .= "<h3>LDAP Authentication Settings</h3>" . theme('status_report', ['requirements' => $status['ldap_authentication']]);
|
|
37 | 39 |
} |
38 | 40 |
if (module_exists('ldap_authorization')) { |
39 | 41 |
$status['ldap_authorizations'] = ldap_help_get_ldap_authorization(); |
40 | 42 |
if (count($status['ldap_authorizations'])) { |
41 | 43 |
foreach ($status['ldap_authorizations'] as $sid => $mapping) { |
42 |
$content .= "<h3>LDAP Authorization Mapping</h3>" . theme('status_report', array('requirements' => $mapping));
|
|
44 |
$content .= "<h3>LDAP Authorization Mapping</h3>" . theme('status_report', ['requirements' => $mapping]);
|
|
43 | 45 |
} |
44 | 46 |
} |
45 | 47 |
} |
... | ... | |
52 | 54 |
} |
53 | 55 |
|
54 | 56 |
} |
57 |
|
|
58 |
/** |
|
59 |
* |
|
60 |
*/ |
|
55 | 61 |
function ldap_help_get_server($phpinfo, &$info) { |
56 | 62 |
|
57 | 63 |
$info['phpversion'] = phpversion(); |
... | ... | |
71 | 77 |
$info['ldap']['text'] = $text; |
72 | 78 |
|
73 | 79 |
$modules = system_rebuild_module_data(); |
74 |
$ldapmodules = array('ldap_servers', 'ldap_authentication', 'ldap_authorization', |
|
80 |
$ldapmodules = [ |
|
81 |
'ldap_servers', 'ldap_authentication', 'ldap_authorization', |
|
75 | 82 |
'ldap_authorization_drupal_role', 'ldap_authorization_og', 'ldap_feeds', |
76 |
'ldap_query', 'ldap_sso', 'ldap_views'); |
|
83 |
'ldap_query', 'ldap_sso', 'ldap_views', |
|
84 |
]; |
|
77 | 85 |
|
78 | 86 |
foreach ($ldapmodules as $ldapmodule) { |
79 | 87 |
$data['status'] = $modules[$ldapmodule]->status; |
... | ... | |
86 | 94 |
$info[$ldapmodule] = $data; |
87 | 95 |
} |
88 | 96 |
|
89 |
// set status array to be converted into html table.
|
|
97 |
// Set status array to be converted into html table.
|
|
90 | 98 |
if (isset($phpinfo['Apache Environment'])) { |
91 |
$status[] = array(
|
|
99 |
$status[] = [
|
|
92 | 100 |
'title' => 'Apache', |
93 |
'value' => $phpinfo['Apache Environment']['SERVER_SOFTWARE'] |
|
94 |
);
|
|
101 |
'value' => $phpinfo['Apache Environment']['SERVER_SOFTWARE'],
|
|
102 |
];
|
|
95 | 103 |
} |
96 | 104 |
elseif (isset($_SERVER["SERVER_SOFTWARE"])) { |
97 |
$status[] = array(
|
|
105 |
$status[] = [
|
|
98 | 106 |
'title' => 'SERVER_SOFTWARE', |
99 |
'value' => $_SERVER["SERVER_SOFTWARE"] |
|
100 |
);
|
|
107 |
'value' => $_SERVER["SERVER_SOFTWARE"],
|
|
108 |
];
|
|
101 | 109 |
|
102 | 110 |
} |
103 | 111 |
|
104 |
|
|
105 |
$status[] = array( |
|
112 |
$status[] = [ |
|
106 | 113 |
'title' => 'PHP version', |
107 |
'value' => phpversion() |
|
108 |
); |
|
109 |
|
|
110 |
|
|
111 |
|
|
114 |
'value' => phpversion(), |
|
115 |
]; |
|
112 | 116 |
|
113 |
if (! $info['ldaploaded']) { |
|
114 |
$status[] = array( 'title' => 'PHP ldap extension not loaded', |
|
115 |
'value' => l(t('PHP LDAP extension'), 'http://us2.php.net/ldap') . ' must be loaded for LDAP Integration to work. |
|
117 |
if (!$info['ldaploaded']) { |
|
118 |
$status[] = [ |
|
119 |
'title' => 'PHP ldap extension not loaded', |
|
120 |
'value' => l(t('PHP LDAP extension'), 'http://us2.php.net/ldap') . ' must be loaded for LDAP Integration to work. |
|
116 | 121 |
It comes compiled with most versions of PHP.' , |
117 |
'severity' => REQUIREMENT_ERROR); |
|
122 |
'severity' => REQUIREMENT_ERROR, |
|
123 |
]; |
|
118 | 124 |
} |
119 | 125 |
else { |
120 |
$status[] = array( 'title' => 'PHP ldap extension data', |
|
121 |
'value' => $info['ldap']['text'] , |
|
122 |
'severity' => 0); |
|
126 |
$status[] = [ |
|
127 |
'title' => 'PHP ldap extension data', |
|
128 |
'value' => $info['ldap']['text'] , |
|
129 |
'severity' => 0, |
|
130 |
]; |
|
123 | 131 |
} |
124 | 132 |
|
125 |
$status[] = array( |
|
126 |
'title' => 'mcrypt extension loaded', |
|
127 |
'value' => (extension_loaded('mcrypt')) ? "yes" : "no", |
|
128 |
); |
|
129 |
|
|
130 |
$status[] = array( |
|
133 |
$status[] = [ |
|
131 | 134 |
'title' => 'open ssl extension loaded', |
132 | 135 |
'value' => extension_loaded('openssl') ? "yes" : "no", |
133 |
);
|
|
136 |
];
|
|
134 | 137 |
|
135 |
$status[] = array('title' => 'Drupal', 'value' => VERSION , 'severity' => "0");
|
|
138 |
$status[] = ['title' => 'Drupal', 'value' => VERSION , 'severity' => "0"];
|
|
136 | 139 |
|
137 |
foreach ( $ldapmodules as $ldapmodule) {
|
|
138 |
$status[] = array('title' => $ldapmodule, 'value' => $info[$ldapmodule]['text'], 'severity' => "0");
|
|
140 |
foreach ($ldapmodules as $ldapmodule) { |
|
141 |
$status[] = ['title' => $ldapmodule, 'value' => $info[$ldapmodule]['text'], 'severity' => "0"];
|
|
139 | 142 |
} |
140 | 143 |
return $status; |
141 | 144 |
} |
142 | 145 |
|
146 |
/** |
|
147 |
* |
|
148 |
*/ |
|
143 | 149 |
function ldap_help_get_ldapauth(&$info) { |
144 | 150 |
|
145 |
$status[] = array(
|
|
151 |
$status[] = [
|
|
146 | 152 |
'title' => 'Authentication mode', |
147 | 153 |
value => $info['ldapauth']['login_process_text'] , |
148 |
'severity' => "0"); |
|
154 |
'severity' => "0", |
|
155 |
]; |
|
149 | 156 |
|
150 |
$status[] = array(
|
|
157 |
$status[] = [
|
|
151 | 158 |
'title' => 'Conflict Resolve Feature', |
152 | 159 |
value => $info['ldapauth']['login_conflict_text'], |
153 |
'severity' => "0"); |
|
160 |
'severity' => "0", |
|
161 |
]; |
|
154 | 162 |
|
155 | 163 |
$info['ldapauth']['ldapauth_disable_pass_change_text'] = (LDAPAUTH_FORGET_PASSWORDS == TRUE) ? "Do not " : "Do"; |
156 | 164 |
$info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'store users\' passwords during sessions.'; |
157 | 165 |
|
158 |
$status[] = array('title' => 'Security Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'], 'severity' => "0");
|
|
166 |
$status[] = ['title' => 'Security Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'], 'severity' => "0"];
|
|
159 | 167 |
|
160 | 168 |
$info['ldapauth']['ldapauth_disable_pass_change_text'] = (LDAPAUTH_DISABLE_PASS_CHANGE == TRUE) ? "R" : "Do not R"; |
161 | 169 |
$info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'emove password change fields from user edit form'; |
162 |
$info['ldapauth']['ldapauth_alter_email_field_text'] = 'ldapauth_alter_email_field: ' . LDAPAUTH_ALTER_EMAIL_FIELD ;
|
|
170 |
$info['ldapauth']['ldapauth_alter_email_field_text'] = 'ldapauth_alter_email_field: ' . LDAPAUTH_ALTER_EMAIL_FIELD; |
|
163 | 171 |
|
164 |
$status[] = array('title' => 'LDAP UI Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'] . "<br/>" . $info['ldapauth']['ldapauth_alter_email_field_text'], 'severity' => "0");
|
|
172 |
$status[] = ['title' => 'LDAP UI Options', value => $info['ldapauth']['ldapauth_disable_pass_change_text'] . "<br/>" . $info['ldapauth']['ldapauth_alter_email_field_text'], 'severity' => "0"];
|
|
165 | 173 |
|
166 | 174 |
return $status; |
167 | 175 |
} |
168 | 176 |
|
169 |
function _ldap_help_parse_status_to_text($status, $heading, $replacements = array()) { |
|
177 |
/** |
|
178 |
* |
|
179 |
*/ |
|
180 |
function _ldap_help_parse_status_to_text($status, $heading, $replacements = []) { |
|
170 | 181 |
|
171 | 182 |
$var_del = "\r\n------------------------------------------------\r\n"; |
172 | 183 |
$section_del = "\r\n\r\n================================================\r\n"; |
173 | 184 |
$name_val_del = ":\r\n"; |
174 | 185 |
$lr = "\r\n"; |
175 | 186 |
|
176 |
$replacements = array_merge($replacements, array( |
|
177 |
'<br/>' => $lr, |
|
178 |
'<ul>' => $lr, |
|
179 |
'</ul>' => $lr, |
|
180 |
'<li>' => $lr, |
|
181 |
'</li>' => "", |
|
182 |
"<code>" => "", |
|
183 |
"</code>" => "", |
|
184 |
"<strong>" => "", |
|
185 |
"</strong>" => "" |
|
186 |
)); |
|
187 |
|
|
188 |
|
|
189 |
$content = drupal_strtoupper($heading) . $lr ; |
|
187 |
$replacements = array_merge($replacements, [ |
|
188 |
'<br/>' => $lr, |
|
189 |
'<ul>' => $lr, |
|
190 |
'</ul>' => $lr, |
|
191 |
'<li>' => $lr, |
|
192 |
'</li>' => "", |
|
193 |
"<code>" => "", |
|
194 |
"</code>" => "", |
|
195 |
"<strong>" => "", |
|
196 |
"</strong>" => "", |
|
197 |
]); |
|
198 |
|
|
199 |
$content = drupal_strtoupper($heading) . $lr; |
|
190 | 200 |
foreach ($status as $item) { |
191 |
// $item['value'] = str_replace(array('<br/>','<ul>','</ul>','<li>','</li>',"<code>","</code>"), |
|
192 |
// array("\r\n","\r\n","\r\n","\r\n","\r\n"),$item['value'] ); |
|
193 |
$item['value'] = str_replace(array_keys($replacements), array_values($replacements), $item['value'] ); |
|
194 |
$item['title'] = str_replace(array_keys($replacements), array_values($replacements), $item['title'] ); |
|
201 |
$item['value'] = str_replace(array_keys($replacements), array_values($replacements), $item['value']); |
|
202 |
$item['title'] = str_replace(array_keys($replacements), array_values($replacements), $item['title']); |
|
195 | 203 |
$content .= $item['title'] . $name_val_del . $item['value'] . $var_del; |
196 | 204 |
} |
197 | 205 |
return $content; |
198 | 206 |
} |
199 | 207 |
|
208 |
/** |
|
209 |
* |
|
210 |
*/ |
|
200 | 211 |
function ldap_help_phpinfo() { |
201 | 212 |
ob_start(); |
202 | 213 |
phpinfo(); |
... | ... | |
204 | 215 |
ob_end_clean(); |
205 | 216 |
return $s; |
206 | 217 |
} |
207 |
/** parse php modules from phpinfo */ |
|
218 |
|
|
219 |
/** |
|
220 |
* Parse php modules from phpinfo .*/ |
|
208 | 221 |
function ldap_help_parsePHPModules() { |
209 | 222 |
ob_start(); |
210 | 223 |
phpinfo(); |
... | ... | |
215 | 228 |
$s = preg_replace('/<th[^>]*>([^<]+)<\/th>/', "<info>\\1</info>", $s); |
216 | 229 |
$s = preg_replace('/<td[^>]*>([^<]+)<\/td>/', "<info>\\1</info>", $s); |
217 | 230 |
$vtmp = preg_split('/(<h2>[^<]+<\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE); |
218 |
$vmodules = array();
|
|
231 |
$vmodules = [];
|
|
219 | 232 |
for ($i = 1; $i < count($vtmp); $i++) { |
220 | 233 |
if (preg_match('/<h2>([^<]+)<\/h2>/', $vtmp[$i], $vmat)) { |
221 | 234 |
$vname = trim($vmat[1]); |
222 | 235 |
$vtmp2 = explode("\n", $vtmp[$i + 1]); |
223 |
foreach ($vtmp2 AS $vone) {
|
|
236 |
foreach ($vtmp2 as $vone) {
|
|
224 | 237 |
$vpat = '<info>([^<]+)<\/info>'; |
225 | 238 |
$vpat3 = "/$vpat\s*$vpat\s*$vpat/"; |
226 | 239 |
$vpat2 = "/$vpat\s*$vpat/"; |
227 |
if (preg_match($vpat3, $vone, $vmat)) { // 3cols |
|
228 |
$vmodules[$vname][trim($vmat[1])] = array(trim($vmat[2]), trim($vmat[3])); |
|
240 |
// 3cols. |
|
241 |
if (preg_match($vpat3, $vone, $vmat)) { |
|
242 |
$vmodules[$vname][trim($vmat[1])] = [trim($vmat[2]), trim($vmat[3])]; |
|
229 | 243 |
} |
230 |
elseif (preg_match($vpat2, $vone, $vmat)) { // 2cols |
|
244 |
// 2cols. |
|
245 |
elseif (preg_match($vpat2, $vone, $vmat)) { |
|
231 | 246 |
$vmodules[$vname][trim($vmat[1])] = trim($vmat[2]); |
232 | 247 |
} |
233 | 248 |
} |
... | ... | |
236 | 251 |
return $vmodules; |
237 | 252 |
} |
238 | 253 |
|
254 |
/** |
|
255 |
* |
|
256 |
*/ |
|
239 | 257 |
function ldap_help_get_user_settings() { |
240 | 258 |
|
241 | 259 |
$user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL); |
242 |
$options = array(
|
|
260 |
$options = [
|
|
243 | 261 |
USER_REGISTER_ADMINISTRATORS_ONLY => t('Administrators only'), |
244 | 262 |
USER_REGISTER_VISITORS => t('Visitors'), |
245 | 263 |
USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL => t('Visitors, but administrator approval is required'), |
246 |
);
|
|
264 |
];
|
|
247 | 265 |
|
266 |
$status[] = [ |
|
267 |
'title' => 'Who can register accounts?', |
|
268 |
'value' => $options[$user_register], |
|
269 |
]; |
|
248 | 270 |
|
249 |
$status[] = array( |
|
250 |
'title' => 'Who can register accounts?', |
|
251 |
'value' => $options[$user_register], |
|
252 |
); |
|
253 |
|
|
254 |
return $status; |
|
271 |
return $status; |
|
255 | 272 |
|
256 | 273 |
} |
257 | 274 |
|
275 |
/** |
|
276 |
* |
|
277 |
*/ |
|
258 | 278 |
function ldap_help_get_ldap_servers() { |
259 | 279 |
if (!module_exists('ldap_servers')) { |
260 | 280 |
return FALSE; |
... | ... | |
266 | 286 |
$conf_form = ldap_servers_settings(); |
267 | 287 |
|
268 | 288 |
$selected = @$conf_form['encryption']['ldap_servers_encryption']['#default_value']; |
269 |
$status[] = array(
|
|
270 |
'title' => 'encryption',
|
|
271 |
'value' => @$conf_form['encryption']['ldap_servers_encryption']['#options'][$selected],
|
|
272 |
);
|
|
289 |
$status[] = [
|
|
290 |
'title' => 'encryption', |
|
291 |
'value' => @$conf_form['encryption']['ldap_servers_encryption']['#options'][$selected], |
|
292 |
];
|
|
273 | 293 |
|
274 | 294 |
$servers_objects = ldap_servers_get_servers(NULL, 'all'); |
275 |
$servers = array();
|
|
295 |
$servers = [];
|
|
276 | 296 |
$field_to_properties = LdapServer::field_to_properties_map(); |
277 |
$props = array_values($field_to_properties); // array('sid', 'name', 'status', 'ldap_type', 'port', 'tls', 'user_attr', 'mail_attr', 'user_dn_expression', 'ldap_to_drupal_user'); |
|
297 |
// Format: ['sid', 'name', 'status', 'ldap_type', 'port', 'tls', 'user_attr', 'mail_attr', 'user_dn_expression', 'ldap_to_drupal_user']. |
|
298 |
$props = array_values($field_to_properties); |
|
278 | 299 |
foreach ($servers_objects as $sid => $server_object) { |
279 | 300 |
$server_admin = new LdapServerAdmin($sid); |
280 | 301 |
$form = $server_admin->drupalForm('update'); |
... | ... | |
286 | 307 |
$value = $form['bind_method']['bind_method']['#options'][$value]; |
287 | 308 |
} |
288 | 309 |
|
289 |
$servers[$sid][] = array(
|
|
290 |
'title' => $property,
|
|
291 |
'value' => $value,
|
|
292 |
);
|
|
310 |
$servers[$sid][] = [
|
|
311 |
'title' => $property, |
|
312 |
'value' => $value, |
|
313 |
];
|
|
293 | 314 |
} |
294 | 315 |
|
295 |
$ldaps = (strpos(drupal_strtolower($server_object->address), 'ldaps') !== FALSE) ? 'y' : 'n'; |
|
296 |
$servers[$sid][] = array(
|
|
297 |
'title' => 'ldaps in address', |
|
298 |
'value' => $ldaps, |
|
299 |
);
|
|
316 |
$ldaps = (strpos(drupal_strtolower($server_object->address), 'ldaps') !== FALSE) ? 'y' : 'n';
|
|
317 |
$servers[$sid][] = [
|
|
318 |
'title' => 'ldaps in address',
|
|
319 |
'value' => $ldaps,
|
|
320 |
];
|
|
300 | 321 |
|
301 |
$binddn = trim($server_object->binddn) ? 'yes' : 'no'; |
|
302 |
$servers[$sid][] = array(
|
|
303 |
'title' => 'binddn present', |
|
304 |
'value' => $binddn, |
|
305 |
);
|
|
322 |
$binddn = trim($server_object->binddn) ? 'yes' : 'no';
|
|
323 |
$servers[$sid][] = [
|
|
324 |
'title' => 'binddn present',
|
|
325 |
'value' => $binddn,
|
|
326 |
];
|
|
306 | 327 |
|
307 |
$basedn = count($server_object->basedn); |
|
308 |
$servers[$sid][] = array(
|
|
309 |
'title' => 'basedn count', |
|
310 |
'value' => $basedn, |
|
311 |
);
|
|
328 |
$basedn = count($server_object->basedn);
|
|
329 |
$servers[$sid][] = [
|
|
330 |
'title' => 'basedn count',
|
|
331 |
'value' => $basedn,
|
|
332 |
];
|
|
312 | 333 |
|
313 | 334 |
} |
314 | 335 |
|
315 |
return array($status, $servers);
|
|
336 |
return [$status, $servers];
|
|
316 | 337 |
} |
317 | 338 |
|
339 |
/** |
|
340 |
* |
|
341 |
*/ |
|
318 | 342 |
function ldap_help_get_ldap_authentication() { |
319 | 343 |
|
320 | 344 |
ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class'); |
... | ... | |
341 | 365 |
return $status; |
342 | 366 |
} |
343 | 367 |
|
368 |
/** |
|
369 |
* |
|
370 |
*/ |
|
344 | 371 |
function ldap_help_get_ldap_user() { |
345 | 372 |
ldap_servers_module_load_include('php', 'ldap_user', 'LdapUserConfAdmin.class'); |
346 | 373 |
$conf = new LdapUserConfAdmin(); |
... | ... | |
354 | 381 |
return $status; |
355 | 382 |
} |
356 | 383 |
|
357 |
|
|
358 |
|
|
359 |
|
|
384 |
/** |
|
385 |
* |
|
386 |
*/ |
|
360 | 387 |
function ldap_help_get_ldap_authorization() { |
361 |
$status = array();
|
|
388 |
$status = [];
|
|
362 | 389 |
ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class'); |
363 | 390 |
ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.settings'); |
364 | 391 |
ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.admin'); |
... | ... | |
367 | 394 |
$consumers = ldap_authorization_get_consumers(); |
368 | 395 |
|
369 | 396 |
if (count($servers) == 0) { |
370 |
return array();
|
|
397 |
return [];
|
|
371 | 398 |
} |
372 | 399 |
|
373 | 400 |
foreach ($servers as $sid => $server) { |
374 | 401 |
$server_options[$sid] = $server->name; |
375 | 402 |
} |
376 | 403 |
|
377 |
|
|
378 | 404 |
$items['status']['mapping_id'] = 'string'; |
379 | 405 |
$items['status']['consumer_type'] = 'string'; |
380 | 406 |
$items['status']['status'] = 'string'; |
381 | 407 |
$items['status']['only_ldap_authenticated'] = 'string'; |
382 | 408 |
|
383 |
// $items['filter_and_mappings']['mappings'] = 'string'; |
|
384 | 409 |
$items['use_filter']['mappings'] = 'string'; |
385 | 410 |
|
386 | 411 |
$items['misc_settings']['allow_synch_both_directions'] = 'string'; |
... | ... | |
397 | 422 |
if ($map_content == 'data present') { |
398 | 423 |
$map_content .= ($maps == drupal_strtolower($maps)) ? ', lower case' : ', mixed case'; |
399 | 424 |
} |
400 |
$status[$consumer_type][] = array(
|
|
425 |
$status[$consumer_type][] = [
|
|
401 | 426 |
'title' => 'mappings', |
402 | 427 |
'value' => $map_content, |
403 |
);
|
|
428 |
];
|
|
404 | 429 |
|
405 | 430 |
} |
406 | 431 |
return $status; |
407 | 432 |
|
408 | 433 |
} |
409 | 434 |
|
410 |
|
|
435 |
/** |
|
436 |
* |
|
437 |
*/ |
|
411 | 438 |
function ldap_help_parse_form($form, $items) { |
412 | 439 |
|
413 |
$status = array();
|
|
440 |
$status = [];
|
|
414 | 441 |
foreach ($form as $fieldset_name => $field) { |
415 | 442 |
foreach ($field as $field_name => $field_data) { |
416 | 443 |
if (isset($items[$fieldset_name][$field_name])) { |
... | ... | |
426 | 453 |
case 'radios': |
427 | 454 |
$value = $field_data['#options'][$default_value]; |
428 | 455 |
break; |
456 |
|
|
429 | 457 |
case 'select': |
430 | 458 |
case 'checkboxes': |
431 | 459 |
$value = $default_value; |
432 | 460 |
break; |
461 |
|
|
433 | 462 |
case 'checkbox': |
434 |
$value = (boolean)($field_data['#default_value']) ? 'y' : 'n'; |
|
463 |
$value = (boolean) ($field_data['#default_value']) ? 'y' : 'n';
|
|
435 | 464 |
break; |
465 |
|
|
436 | 466 |
case 'hidden': |
437 | 467 |
$value = $field_data['#value']; |
438 | 468 |
break; |
469 |
|
|
439 | 470 |
case 'textarea': |
440 | 471 |
case 'textfield': |
441 | 472 |
|
... | ... | |
443 | 474 |
break; |
444 | 475 |
} |
445 | 476 |
if ($items[$fieldset_name][$field_name] == 'empty') { |
446 |
$value = ((boolean)trim($value)) ? 'populated' : 'empty'; |
|
477 |
$value = ((boolean) trim($value)) ? 'populated' : 'empty';
|
|
447 | 478 |
} |
448 |
$status[] = array(
|
|
479 |
$status[] = [
|
|
449 | 480 |
'title' => $field_name, |
450 | 481 |
'value' => $value, |
451 |
);
|
|
482 |
];
|
|
452 | 483 |
|
453 | 484 |
} |
454 | 485 |
|
... | ... | |
458 | 489 |
|
459 | 490 |
return $status; |
460 | 491 |
|
461 |
|
|
462 | 492 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules