MDL-22631 Added some clean_param calls to clean the $_GET data and also added lots...
[moodle.git] / auth / cas / config.html
blobe1539692ff1ff308c79f62674cfa2595d2c02807
1 <?php
5 global $CFG;
7 require_once 'languages.php';
11 $createoptions[0] = get_string("no");
13 $createoptions[1] = get_string("yes");
17 // set to defaults if undefined (CAS)
19 if (!isset ($config->hostname))
21 $config->hostname = '';
23 if (!isset ($config->port))
25 $config->port = '';
27 if (!isset ($config->casversion))
29 $config->casversion = '';
31 if (!isset ($config->baseuri))
33 $config->baseuri = '';
35 if (!isset ($config->language))
37 $config->language = '';
39 if (!isset ($config->proxycas))
41 $config->proxycas = '';
43 if (!isset ($config->logoutcas))
45 $config->logoutcas = '';
47 if (!isset ($config->multiauth))
49 $config->multiauth = '';
51 // set to defaults if undefined (LDAP)
53 if (!isset($config->host_url))
55 { $config->host_url = ''; }
57 if (empty($config->ldapencoding))
59 { $config->ldapencoding = 'utf-8'; }
61 if (!isset($config->contexts))
63 { $config->contexts = ''; }
65 if (!isset($config->user_type))
67 { $config->user_type = 'default'; }
69 if (!isset($config->user_attribute))
71 { $config->user_attribute = ''; }
73 if (!isset($config->search_sub))
75 { $config->search_sub = ''; }
77 if (!isset($config->opt_deref))
79 { $config->opt_deref = LDAP_DEREF_NEVER; }
81 if (!isset($config->bind_dn))
83 {$config->bind_dn = ''; }
85 if (!isset($config->bind_pw))
87 {$config->bind_pw = ''; }
89 if (!isset($config->version))
91 {$config->version = '2'; }
93 if (!isset($config->objectclass))
95 {$config->objectclass = ''; }
97 if (!isset($config->memberattribute))
99 {$config->memberattribute = ''; }
101 if (!isset($config->memberattribute_isdn))
103 {$config->memberattribute_isdn = ''; }
105 if (!isset($config->groupecreators))
107 {$config->groupecreators = ''; }
109 if (!isset($config->attrcreators))
111 {$config->attrcreators = ''; }
113 if (!isset($config->removeuser))
115 {$config->removeuser = 0; }
119 $yesno = array( get_string('no'), get_string('yes') );
123 if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
125 notify(get_string('auth_ldap_noextension','auth'));
137 <table cellspacing="0" cellpadding="5" border="0">
141 <tr>
143 <td colspan="2">
145 <h4><?php print_string('auth_cas_server_settings', 'auth') ?> </h4>
147 </td>
149 </tr>
151 <tr valign="top" class="required">
153 <td align="right"><?php print_string('auth_cas_hostname_key', 'auth') ?>:</td>
155 <td>
157 <input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
159 <?php
163 if (isset($err['hostname'])) {
165 formerr($err['hostname']);
173 </td>
175 <td><?php print_string('auth_cas_hostname', 'auth') ?></td>
177 </tr>
181 <tr valign="top" class="required">
183 <td align="right"><?php print_string('auth_cas_baseuri_key', 'auth') ?>:</td>
185 <td>
187 <input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
189 <?php
193 if (isset($err['baseuri'])) {
195 formerr($err['baseuri']);
203 </td>
205 <td><?php print_string('auth_cas_baseuri', 'auth') ?></td>
207 </tr>
211 <tr valign="top" class="required">
213 <td align="right"><?php print_string('auth_cas_port_key', 'auth') ?>:</td>
215 <td>
217 <input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
219 <?php
223 if (isset($err['port'])) {
225 formerr($err['port']);
233 </td>
235 <td><?php print_string('auth_cas_port', 'auth') ?></td>
237 </tr>
241 <tr valign="top" class="required">
243 <td align="right"><?php print_string('auth_cas_casversion', 'auth') ?>:</td>
245 <td>
247 <input name="casversion" type="text" size="30" value="<?php echo $config->casversion ?>" />
249 <?php
253 if (isset($err['casversion'])) {
255 formerr($err['casversion']);
263 </td>
265 <td><?php print_string('auth_cas_version', 'auth') ?></td>
267 </tr>
271 <tr valign="top" class="required">
273 <td align="right"><?php print_string('auth_cas_language_key', 'auth') ?>:</td>
275 <td>
277 <?php
281 choose_from_menu($CASLANGUAGES, 'language', $config->language, '');
287 </td>
289 <td><?php print_string('auth_cas_language', 'auth') ?></td>
291 </tr>
295 <tr valign="top" class="required">
297 <td align="right"><?php print_string('auth_cas_proxycas_key', 'auth') ?>:</td>
299 <td>
301 <?php
303 unset($options);
305 $options[1] = get_string('yes');
307 choose_from_menu ($options, 'proxycas', $config->proxycas, get_string('no'), '', '');
311 </td>
313 <td><?php print_string('auth_cas_proxycas', 'auth') ?></td>
315 </tr>
319 <tr valign="top" class="required">
321 <td align="right"><?php print_string('auth_cas_logoutcas_key', 'auth') ?>:</td>
323 <td>
325 <?php
327 unset($options);
329 $options[1] = get_string('yes');
331 choose_from_menu ($options, 'logoutcas', $config->logoutcas, get_string('no'), '', '');
335 </td>
337 <td><?php print_string('auth_cas_logoutcas', 'auth') ?></td>
339 </tr>
343 <tr valign="top" class="required">
345 <td align="right"><?php print_string('auth_cas_multiauth_key', 'auth') ?>:</td>
347 <td>
349 <?php
351 unset($options);
353 $options[1] = get_string('yes');
355 choose_from_menu ($options, 'multiauth', $config->multiauth, get_string('no'), '', '');
359 </td>
361 <td><?php print_string('auth_cas_multiauth', 'auth') ?></td>
363 </tr>
367 <tr>
369 <td colspan="2">
371 <h4><?php print_string('auth_ldap_server_settings', 'auth') ?> </h4>
373 </td>
375 </tr>
379 <tr valign="top" class="required">
381 <td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth') ?></label></td>
383 <td>
385 <input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
387 <?php if (isset($err['host_url'])) formerr($err['host_url']); ?>
389 </td>
391 <td>
393 <?php print_string('auth_ldap_host_url','auth') ?>
395 </td>
397 </tr>
401 <tr valign="top" class="required">
403 <td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
405 <td>
407 <?php
409 $versions = array();
411 $versions[2] = '2';
413 $versions[3] = '3';
415 choose_from_menu($versions, 'version', $config->version, '');
417 if (isset($err['version'])) formerr($err['version']);
421 </td>
423 <td>
425 <?php print_string('auth_ldap_version','auth') ?>
427 </td>
429 </tr>
433 <tr valign="top" class="required">
435 <td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth") ?></label></td>
437 <td>
439 <input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
441 <?php
445 if (isset($err['ldapencoding'])) {
447 formerr($err['ldapencoding']);
455 </td>
457 <td><?php print_string('auth_ldap_ldap_encoding', 'auth') ?></td>
459 </tr>
463 <tr>
465 <td colspan="2">
467 <h4><?php print_string('auth_ldap_bind_settings', 'auth') ?> </h4>
469 </td>
471 </tr>
475 <tr valign="top" class="required">
477 <td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth') ?></label></td>
479 <td>
481 <input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
483 <?php if (isset($err['bind_dn'])) formerr($err['bind_dn']); ?>
485 </td><td>
487 <?php print_string('auth_ldap_bind_dn','auth') ?>
489 </td>
491 </tr>
495 <tr valign="top" class="required">
497 <td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth') ?></label></td>
499 <td>
501 <input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
503 <?php if (isset($err['bind_pw'])) formerr($err['bind_pw']); ?>
505 </td><td>
507 <?php print_string('auth_ldap_bind_pw','auth') ?>
509 </td>
511 </tr>
515 <tr>
517 <td colspan="2">
519 <h4><?php print_string('auth_ldap_user_settings', 'auth') ?> </h4>
521 </td>
523 </tr>
527 <tr valign="top" class="required">
529 <td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth') ?></label></td>
531 <td>
533 <?php choose_from_menu($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, ''); ?>
535 <?php if (isset($err['user_type'])) formerr($err['user_type']); ?>
537 </td>
539 <td>
541 <?php print_string('auth_ldap_user_type', 'auth') ?>
543 </td>
545 </tr>
549 <tr valign="top" class="required">
551 <td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth') ?></label></td>
553 <td>
555 <input name="contexts" id="contexts" type="text" size="30" value="<?php echo $config->contexts?>" />
557 <?php if (isset($err['contexts'])) formerr($err['contexts']); ?>
559 </td>
561 <td>
563 <?php print_string('auth_ldap_contexts', 'auth') ?>
565 </td>
567 </tr>
571 <tr valign="top" class="required">
573 <td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth') ?></label></td>
575 <td>
577 <?php choose_from_menu($yesno, 'search_sub', $config->search_sub, ''); ?>
579 </td>
581 <td>
583 <?php print_string('auth_ldap_search_sub','auth') ?>
585 </td>
587 </tr>
591 <tr valign="top" class="required">
593 <td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth') ?></label></td>
595 <td>
597 <?php
599 $opt_deref = array();
601 $opt_deref[LDAP_DEREF_NEVER] = get_string('no');
603 $opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
605 choose_from_menu($opt_deref, 'opt_deref', $config->opt_deref, '');
607 if (isset($err['opt_deref'])) formerr($err['opt_deref']);
611 </td>
613 <td>
615 <?php print_string('auth_ldap_opt_deref','auth') ?>
617 </td>
619 </tr>
627 <tr valign="top" class="required">
629 <td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth') ?></label></td>
631 <td>
633 <input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
635 <?php if (isset($err['user_attribute'])) formerr($err['user_attribute']); ?>
637 </td>
639 <td>
641 <?php print_string('auth_ldap_user_attribute','auth') ?>
643 </td>
645 </tr>
649 <tr valign="top" class="required">
651 <td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth') ?></label></td>
653 <td>
655 <input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
657 <?php if (isset($err['memberattribute'])) formerr($err['memberattribute']); ?>
659 </td><td>
661 <?php print_string('auth_ldap_memberattribute','auth') ?>
663 </td>
665 </tr>
669 <tr valign="top" class="required">
671 <td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth') ?></label></td>
673 <td>
675 <input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
677 <?php if (isset($err['memberattribute_isdn'])) formerr($err['memberattribute_isdn']); ?>
679 </td><td>
681 <?php print_string('auth_ldap_memberattribute_isdn','auth') ?>
683 </td>
685 </tr>
689 <tr valign="top" class="required">
691 <td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth') ?></label></td>
693 <td>
695 <input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
697 <?php if (isset($err['objectclass'])) formerr($err['objectclass']); ?>
699 </td>
701 <td>
703 <?php print_string('auth_ldap_objectclass','auth') ?>
705 </td>
707 </tr>
711 <tr>
713 <td colspan="2">
715 <h4><?php print_string('coursecreators') ?> </h4>
717 </td>
719 </tr>
723 <tr valign="top" class="required">
725 <td align="right"><label for="attrcreators"><?php print_string('auth_ldap_attrcreators_key','auth') ?></label></td>
727 <td>
729 <input name="attrcreators" id="attrcreators" type="text" size="30" value="<?php echo $config->attrcreators?>" />
731 <?php if (isset($err['attrcreators'])) formerr($err['attrcreators']); ?>
733 </td><td>
735 <?php print_string('auth_ldap_attrcreators','auth') ?>
737 </td>
739 </tr>
743 <tr valign="top" class="required">
745 <td align="right"><label for="groupecreators"><?php print_string('auth_ldap_groupecreators_key','auth') ?></label></td>
747 <td>
749 <input name="groupecreators" id="groupecreators" type="text" size="30" value="<?php echo $config->groupecreators?>" />
751 <?php if (isset($err['groupecreators'])) formerr($err['groupecreators']); ?>
753 </td><td>
755 <?php print_string('auth_ldap_groupecreators','auth') ?>
757 </td>
759 </tr>
763 <tr>
765 <td colspan="2">
767 <h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
769 </td>
771 </tr>
775 <tr valign="top">
777 <td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
779 <td>
781 <?php
783 $deleteopt = array();
785 $deleteopt['0'] = get_string('auth_remove_keep','auth');
787 $deleteopt['1'] = get_string('auth_remove_suspend','auth');
789 $deleteopt['2'] = get_string('auth_remove_delete','auth');
791 choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
795 </td>
797 <td>
799 <?php print_string('auth_remove_user','auth') ?>
801 </td>
803 </tr>
805 <?php
809 $help = get_string('auth_ldapextrafields','auth');
811 $help .= get_string('auth_updatelocal_expl','auth');
813 $help .= get_string('auth_fieldlock_expl','auth');
815 $help .= get_string('auth_updateremote_expl','auth');
817 $help .= '<hr />';
819 $help .= get_string('auth_updateremote_ldap','auth');
823 print_auth_lock_options('cas', $user_fields, $help, true, true);
828 </table>