3 // Set to defaults if undefined
4 if (!isset($config->host_url
)) {
5 $config->host_url
= '';
7 if (!isset($config->start_tls
)) {
8 $config->start_tls
= false;
10 if (empty($config->ldapencoding
)) {
11 $config->ldapencoding
= 'utf-8';
13 if (!isset($config->pagesize
)) {
14 $config->pagesize
= LDAP_DEFAULT_PAGESIZE
;
16 if (!isset($config->contexts
)) {
17 $config->contexts
= '';
19 if (!isset($config->user_type
)) {
20 $config->user_type
= 'default';
22 if (!isset($config->user_attribute
)) {
23 $config->user_attribute
= '';
25 if (!isset($config->search_sub
)) {
26 $config->search_sub
= '';
28 if (!isset($config->opt_deref
)) {
29 $config->opt_deref
= LDAP_DEREF_NEVER
;
31 if (!isset($config->preventpassindb
)) {
32 $config->preventpassindb
= 0;
34 if (!isset($config->bind_dn
)) {
35 $config->bind_dn
= '';
37 if (!isset($config->bind_pw
)) {
38 $config->bind_pw
= '';
40 if (!isset($config->ldap_version
)) {
41 $config->ldap_version
= '3';
43 if (!isset($config->objectclass
)) {
44 $config->objectclass
= '';
46 if (!isset($config->memberattribute
)) {
47 $config->memberattribute
= '';
49 if (!isset($config->memberattribute_isdn
)) {
50 $config->memberattribute_isdn
= '';
52 if (!isset($config->creators
)) {
53 $config->creators
= '';
55 if (!isset($config->create_context
)) {
56 $config->create_context
= '';
58 if (!isset($config->expiration
)) {
59 $config->expiration
= '';
61 if (!isset($config->expiration_warning
)) {
62 $config->expiration_warning
= '10';
64 if (!isset($config->expireattr
)) {
65 $config->expireattr
= '';
67 if (!isset($config->gracelogins
)) {
68 $config->gracelogins
= '';
70 if (!isset($config->graceattr
)) {
71 $config->graceattr
= '';
73 if (!isset($config->auth_user_create
)) {
74 $config->auth_user_create
= '';
76 if (!isset($config->forcechangepassword
)) {
77 $config->forcechangepassword
= 0;
79 if (!isset($config->stdchangepassword
)) {
80 $config->stdchangepassword
= 0;
82 if (!isset($config->passtype
)) {
83 $config->passtype
= 'plaintext';
85 if (!isset($config->changepasswordurl
)) {
86 $config->changepasswordurl
= '';
88 if (!isset($config->removeuser
)) {
89 $config->removeuser
= AUTH_REMOVEUSER_KEEP
;
91 if (!isset($config->ntlmsso_enabled
)) {
92 $config->ntlmsso_enabled
= 0;
94 if (!isset($config->ntlmsso_subnet
)) {
95 $config->ntlmsso_subnet
= '';
97 if (!isset($config->ntlmsso_ie_fastpath
)) {
98 $config->ntlmsso_ie_fastpath
= 0;
100 if (!isset($config->ntlmsso_type
)) {
101 $config->ntlmsso_type
= 'ntlm';
103 if (!isset($config->ntlmsso_remoteuserformat
)) {
104 $config->ntlmsso_remoteuserformat
= '';
107 $yesno = array(get_string('no'), get_string('yes'));
109 $fastpathoptions = array(AUTH_NTLM_FASTPATH_YESFORM
=> get_string('auth_ntlmsso_ie_fastpath_yesform', 'auth_ldap'),
110 AUTH_NTLM_FASTPATH_YESATTEMPT
=> get_string('auth_ntlmsso_ie_fastpath_yesattempt', 'auth_ldap'),
111 AUTH_NTLM_FASTPATH_ATTEMPT
=> get_string('auth_ntlmsso_ie_fastpath_attempt', 'auth_ldap'));
114 if (!ldap_paged_results_supported($config->ldap_version
)) {
115 $disabled = ' disabled="disabled"';
116 echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
120 <table cellspacing=
"0" cellpadding=
"5" border=
"0">
123 <h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?></h4>
126 <tr valign=
"top" class=
"required">
128 <label for=
"host_url"><?php print_string('auth_ldap_host_url_key', 'auth_ldap') ?></label>
131 <input name=
"host_url" id=
"host_url" type=
"text" size=
"30" value=
"<?php echo $config->host_url?>" />
132 <?php
if (isset($err['host_url'])) { echo $OUTPUT->error_text($err['host_url']); } ?>
135 <?php print_string('auth_ldap_host_url', 'auth_ldap') ?>
138 <tr valign=
"top" class=
"required">
140 <label for=
"ldap_version"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label>
147 echo html_writer
::select($versions, 'ldap_version', $config->ldap_version
, false);
148 if (isset($err['ldap_version'])) { echo $OUTPUT->error_text($err['ldap_version']); }
152 <?php print_string('auth_ldap_version', 'auth_ldap') ?>
157 <label for=
"start_tls"><?php print_string('start_tls_key', 'auth_ldap') ?></label>
160 <?php echo html_writer
::select($yesno, 'start_tls', $config->start_tls
, false); ?>
163 <?php print_string('start_tls', 'auth_ldap') ?>
166 <tr valign=
"top" class=
"required">
168 <label for=
"ldapencoding"><?php print_string('auth_ldap_ldap_encoding_key', 'auth_ldap') ?></label>
171 <input id=
"ldapencoding" name=
"ldapencoding" type=
"text" value=
"<?php echo $config->ldapencoding ?>" />
172 <?php
if (isset($err['ldapencoding'])) { echo $OUTPUT->error_text($err['ldapencoding']); } ?>
175 <?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?>
180 <label for=
"pagesize"><?php print_string('pagesize_key', 'auth_ldap') ?></label>
183 <input id=
"pagesize" name=
"pagesize" type=
"text" value=
"<?php echo $config->pagesize ?>" <?php
echo $disabled ?>/>
185 if (isset($err['pagesize'])) { echo $OUTPUT->error_text($err['pagesize']); }
187 // Don't loose the page size value (disabled fields are not submitted!)
189 <input id=
"pagesize" name=
"pagesize" type=
"hidden" value=
"<?php echo $config->pagesize ?>" />
194 <?php print_string('pagesize', 'auth_ldap') ?>
199 <h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?></h4>
202 <tr valign=
"top" class=
"required">
204 <label for=
"menupreventpassindb"><?php print_string('auth_ldap_preventpassindb_key', 'auth_ldap') ?></label>
207 <?php echo html_writer
::select($yesno, 'preventpassindb', $config->preventpassindb
, false); ?>
210 <?php print_string('auth_ldap_preventpassindb', 'auth_ldap') ?>
213 <tr valign=
"top" class=
"required">
215 <label for=
"bind_dn"><?php print_string('auth_ldap_bind_dn_key', 'auth_ldap') ?></label>
218 <input name=
"bind_dn" id=
"bind_dn" type=
"text" size=
"30" value=
"<?php echo $config->bind_dn?>" />
219 <?php
if (isset($err['bind_dn'])) { echo $OUTPUT->error_text($err['bind_dn']); } ?>
222 <?php print_string('auth_ldap_bind_dn', 'auth_ldap') ?>
225 <tr valign=
"top" class=
"required">
227 <label for=
"bind_pw"><?php print_string('auth_ldap_bind_pw_key', 'auth_ldap') ?></label>
230 <input name=
"bind_pw" id=
"bind_pw" type=
"password" size=
"30" value=
"<?php echo $config->bind_pw?>" autocomplete
="off"/>
231 <?php
if (isset($err['bind_pw'])) { echo $OUTPUT->error_text($err['bind_pw']); } ?>
234 <?php print_string('auth_ldap_bind_pw', 'auth_ldap') ?>
239 <h4><?php print_string('auth_ldap_user_settings', 'auth_ldap') ?></h4>
242 <tr valign=
"top" class=
"required">
244 <label for=
"menuuser_type"><?php print_string('auth_ldap_user_type_key', 'auth_ldap') ?></label>
248 echo html_writer
::select(ldap_supported_usertypes(), 'user_type', $config->user_type
, false);
249 if (isset($err['user_type'])) { echo $OUTPUT->error_text($err['user_type']); }
253 <?php print_string('auth_ldap_user_type', 'auth_ldap') ?>
256 <tr valign=
"top" class=
"required">
258 <label for=
"contexts"><?php print_string('auth_ldap_contexts_key', 'auth_ldap') ?></label>
261 <input name=
"contexts" id=
"contexts" type=
"text" size=
"30" value=
"<?php echo $config->contexts?>" />
262 <?php
if (isset($err['contexts'])) { echo $OUTPUT->error_text($err['contexts']); } ?>
265 <?php print_string('auth_ldap_contexts', 'auth_ldap') ?>
268 <tr valign=
"top" class=
"required">
270 <label for=
"menusearch_sub"><?php print_string('auth_ldap_search_sub_key', 'auth_ldap') ?></label>
273 <?php echo html_writer
::select($yesno, 'search_sub', $config->search_sub
, false); ?>
276 <?php print_string('auth_ldap_search_sub', 'auth_ldap') ?>
279 <tr valign=
"top" class=
"required">
281 <label for=
"menuopt_deref"><?php print_string('auth_ldap_opt_deref_key', 'auth_ldap') ?></label>
285 $opt_deref = array();
286 $opt_deref[LDAP_DEREF_NEVER
] = get_string('no');
287 $opt_deref[LDAP_DEREF_ALWAYS
] = get_string('yes');
288 echo html_writer
::select($opt_deref, 'opt_deref', $config->opt_deref
, false);
289 if (isset($err['opt_deref'])) { echo $OUTPUT->error_text($err['opt_deref']); }
293 <?php print_string('auth_ldap_opt_deref', 'auth_ldap') ?>
296 <tr valign=
"top" class=
"required">
298 <label for=
"user_attribute"><?php print_string('auth_ldap_user_attribute_key', 'auth_ldap') ?></label>
301 <input name=
"user_attribute" id=
"user_attribute" type=
"text" size=
"30" value=
"<?php echo $config->user_attribute?>" />
302 <?php
if (isset($err['user_attribute'])) { echo $OUTPUT->error_text($err['user_attribute']); } ?>
305 <?php print_string('auth_ldap_user_attribute', 'auth_ldap') ?>
308 <tr valign=
"top" class=
"required">
310 <label for=
"memberattribute"><?php print_string('auth_ldap_memberattribute_key', 'auth_ldap') ?></label>
313 <input name=
"memberattribute" id=
"memberattribute" type=
"text" size=
"30" value=
"<?php echo $config->memberattribute?>" />
314 <?php
if (isset($err['memberattribute'])) { echo $OUTPUT->error_text($err['memberattribute']); } ?>
317 <?php print_string('auth_ldap_memberattribute', 'auth_ldap') ?>
320 <tr valign=
"top" class=
"required">
322 <label for=
"memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key', 'auth_ldap') ?></label>
325 <input name=
"memberattribute_isdn" id=
"memberattribute_isdn" type=
"text" size=
"30" value=
"<?php echo $config->memberattribute_isdn?>" />
326 <?php
if (isset($err['memberattribute_isdn'])) { echo $OUTPUT->error_text($err['memberattribute_isdn']); } ?>
329 <?php print_string('auth_ldap_memberattribute_isdn', 'auth_ldap') ?>
332 <tr valign=
"top" class=
"required">
334 <label for=
"objectclass"><?php print_string('auth_ldap_objectclass_key', 'auth_ldap') ?></label>
337 <input name=
"objectclass" id=
"objectclass" type=
"text" size=
"30" value=
"<?php echo $config->objectclass?>" />
338 <?php
if (isset($err['objectclass'])) { echo $OUTPUT->error_text($err['objectclass']); } ?>
341 <?php print_string('auth_ldap_objectclass', 'auth_ldap') ?>
346 <h4><?php print_string('forcechangepassword', 'auth') ?></h4>
349 <tr valign=
"top" class=
"required">
350 <td align=
"right" valign=
"top">
351 <label for=
"menuforcechangepassword"><?php print_string('forcechangepassword', 'auth') ?></label>
354 <?php echo html_writer
::select($yesno, 'forcechangepassword', $config->forcechangepassword
, false); ?>
356 <td align=
"left" valign=
"top">
357 <p><?php print_string('forcechangepasswordfirst_help', 'auth') ?></p>
360 <tr valign=
"top" class=
"required">
361 <td align=
"right" valign=
"top">
362 <label for=
"menustdchangepassword"><?php print_string('stdchangepassword', 'auth') ?></label>
365 <?php echo html_writer
::select($yesno, 'stdchangepassword', $config->stdchangepassword
, false); ?>
367 <td align=
"left" valign=
"top">
368 <p><?php print_string('stdchangepassword_expl', 'auth') ?></p>
369 <p><?php print_string('stdchangepassword_explldap', 'auth') ?></p>
372 <tr valign=
"top" class=
"required">
374 <label for=
"menupasstype"><?php print_string('auth_ldap_passtype_key', 'auth_ldap') ?></label>
379 $passtype['plaintext'] = get_string('plaintext', 'auth');
380 $passtype['md5'] = get_string('md5', 'auth');
381 $passtype['sha1'] = get_string('sha1', 'auth');
382 echo html_writer
::select($passtype, 'passtype', $config->passtype
, false);
386 <?php print_string('auth_ldap_passtype', 'auth_ldap') ?>
391 <label for=
"changepasswordurl"><?php print_string('auth_ldap_changepasswordurl_key', 'auth_ldap') ?></label>
394 <input name=
"changepasswordurl" id=
"changepasswordurl" type=
"text" value=
"<?php echo $config->changepasswordurl ?>" />
395 <?php
if (isset($err['changepasswordurl'])) { echo $OUTPUT->error_text($err['changepasswordurl']); } ?>
398 <?php print_string('changepasswordhelp', 'auth') ?>
403 <h4><?php print_string('auth_ldap_passwdexpire_settings', 'auth_ldap') ?></h4>
406 <tr valign=
"top" class=
"required">
408 <label for=
"menuexpiration"><?php print_string('auth_ldap_expiration_key', 'auth_ldap') ?></label>
412 $expiration = array();
413 $expiration['0'] = 'no';
414 $expiration['1'] = 'LDAP';
415 echo html_writer
::select($expiration, 'expiration', $config->expiration
, false);
416 if (isset($err['expiration'])) { echo $OUTPUT->error_text($err['expiration']); }
420 <?php print_string('auth_ldap_expiration_desc', 'auth_ldap') ?>
423 <tr valign=
"top" class=
"required">
425 <label for=
"expiration_warning"><?php print_string('auth_ldap_expiration_warning_key', 'auth_ldap') ?></label>
428 <input name=
"expiration_warning" id=
"expiration_warning" type=
"text" size=
"2" value=
"<?php echo $config->expiration_warning?>" />
429 <?php
if (isset($err['expiration_warning'])) { echo $OUTPUT->error_text($err['expiration_warning']); } ?>
432 <?php print_string('auth_ldap_expiration_warning_desc', 'auth_ldap') ?>
435 <tr valign=
"top" class=
"required">
437 <label for=
"expireattr"><?php print_string('auth_ldap_expireattr_key', 'auth_ldap') ?></label>
440 <input name=
"expireattr" id=
"expireattr" type=
"text" size=
"30" value=
"<?php echo $config->expireattr?>" />
441 <?php
if (isset($err['expireattr'])) { echo $OUTPUT->error_text($err['expireattr']); } ?>
444 <?php print_string('auth_ldap_expireattr_desc', 'auth_ldap') ?>
447 <tr valign=
"top" class=
"required">
449 <label for=
"menugracelogins"><?php print_string('auth_ldap_gracelogins_key', 'auth_ldap') ?></label>
452 <?php echo html_writer
::select($yesno, 'gracelogins', $config->gracelogins
, false); ?>
455 <?php print_string('auth_ldap_gracelogins_desc', 'auth_ldap') ?>
458 <tr valign=
"top" class=
"required">
460 <label for=
"graceattr"><?php print_string('auth_ldap_gracelogin_key', 'auth_ldap') ?></label>
463 <input name=
"graceattr" id=
"graceattr" type=
"text" size=
"30" value=
"<?php echo $config->graceattr?>" />
464 <?php
if (isset($err['graceattr'])) { echo $OUTPUT->error_text($err['graceattr']); } ?>
467 <?php print_string('auth_ldap_graceattr_desc', 'auth_ldap') ?>
472 <h4><?php print_string('auth_user_create', 'auth') ?></h4>
477 <label for=
"menuauth_user_create"><?php print_string('auth_ldap_auth_user_create_key', 'auth_ldap') ?></label>
480 <?php echo html_writer
::select($yesno, 'auth_user_create', $config->auth_user_create
, false); ?>
483 <?php print_string('auth_user_creation', 'auth'); ?>
486 <tr valign=
"top" class=
"required">
488 <label for=
"create_context"><?php print_string('auth_ldap_create_context_key', 'auth_ldap') ?></label>
491 <input name=
"create_context" id=
"create_context" type=
"text" size=
"30" value=
"<?php echo $config->create_context?>" />
492 <?php
if (isset($err['create_context'])) { echo $OUTPUT->error_text($err['create_context']); } ?>
495 <?php print_string('auth_ldap_create_context', 'auth_ldap') ?>
500 <h4><?php print_string('coursecreators') ?></h4>
503 <tr valign=
"top" class=
"required">
505 <label for=
"creators"><?php print_string('auth_ldap_creators_key', 'auth_ldap') ?></label>
508 <input name=
"creators" id=
"creators" type=
"text" size=
"30" value=
"<?php echo $config->creators?>" />
509 <?php
if (isset($err['creators'])) { echo $OUTPUT->error_text($err['creators']); } ?>
512 <?php print_string('auth_ldap_creators', 'auth_ldap') ?>
517 <h4><?php print_string('auth_sync_script', 'auth') ?></h4>
522 <label for=
"menuremoveuser"><?php print_string('auth_remove_user_key', 'auth') ?></label>
526 $deleteopt = array();
527 $deleteopt[AUTH_REMOVEUSER_KEEP
] = get_string('auth_remove_keep', 'auth');
528 $deleteopt[AUTH_REMOVEUSER_SUSPEND
] = get_string('auth_remove_suspend', 'auth');
529 $deleteopt[AUTH_REMOVEUSER_FULLDELETE
] = get_string('auth_remove_delete', 'auth');
530 echo html_writer
::select($deleteopt, 'removeuser', $config->removeuser
, false);
534 <?php print_string('auth_remove_user', 'auth') ?>
539 <h4><?php print_string('auth_ntlmsso', 'auth_ldap') ?></h4>
544 <label for=
"menuntlmsso_enabled"><?php print_string('auth_ntlmsso_enabled_key', 'auth_ldap') ?></label>
547 <?php echo html_writer
::select($yesno, 'ntlmsso_enabled', $config->ntlmsso_enabled
, false); ?>
550 <?php print_string('auth_ntlmsso_enabled', 'auth_ldap') ?>
555 <label for=
"ntlmsso_subnet"><?php print_string('auth_ntlmsso_subnet_key', 'auth_ldap') ?></label>
558 <input name=
"ntlmsso_subnet" id=
"ntlmsso_subnet" type=
"text" size=
"30" value=
"<?php p($config->ntlmsso_subnet) ?>" />
561 <?php
print_string('auth_ntlmsso_subnet', 'auth_ldap') ?>
566 <label for=
"menuntlmsso_ie_fastpath"><?php print_string('auth_ntlmsso_ie_fastpath_key', 'auth_ldap') ?></label>
569 <?php echo html_writer
::select($fastpathoptions, 'ntlmsso_ie_fastpath', $config->ntlmsso_ie_fastpath
, false); ?>
572 <?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
577 <label for=
"menuntlmsso_type"><?php print_string('auth_ntlmsso_type_key', 'auth_ldap')?></label>
582 $types['ntlm'] = 'NTLM';
583 $types['kerberos'] = 'Kerberos';
584 echo html_writer
::select($types, 'ntlmsso_type', $config->ntlmsso_type
, false);
588 <?php print_string('auth_ntlmsso_type','auth_ldap') ?>
593 <label for=
"ntlmsso_remoteuserformat"><?php print_string('auth_ntlmsso_remoteuserformat_key', 'auth_ldap') ?></label>
596 <input name=
"ntlmsso_remoteuserformat" id=
"ntlmsso_remoteuserformat" type=
"text" size=
"30" value=
"<?php echo $config->ntlmsso_remoteuserformat?>" />
597 <?php
if (isset($err['ntlmsso_remoteuserformat'])) { echo $OUTPUT->error_text($err['ntlmsso_remoteuserformat']); } ?>
600 <?php print_string('auth_ntlmsso_remoteuserformat', 'auth_ldap') ?>
604 $help = get_string('auth_ldapextrafields', 'auth_ldap');
605 $help .= get_string('auth_updatelocal_expl', 'auth');
606 $help .= get_string('auth_fieldlock_expl', 'auth');
607 $help .= get_string('auth_updateremote_expl', 'auth');
609 $help .= get_string('auth_updateremote_ldap', 'auth');
611 print_auth_lock_options($this->authtype
, $user_fields, $help, true, true, $this->get_custom_user_profile_fields());