|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); 00004 00005 //HTTPS is required in this page when $CFG->loginhttps enabled 00006 $PAGE->https_required(); 00007 00008 $PAGE->set_url('/auth/ldap/ntlmsso_finish.php'); 00009 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); 00010 00011 // Define variables used in page 00012 $site = get_site(); 00013 00014 $authsequence = get_enabled_auth_plugins(true); // auths, in sequence 00015 if (!in_array('ldap', $authsequence, true)) { 00016 print_error('ldap_isdisabled', 'auth'); 00017 } 00018 00019 $authplugin = get_auth_plugin('ldap'); 00020 if (empty($authplugin->config->ntlmsso_enabled)) { 00021 print_error('ntlmsso_isdisabled', 'auth_ldap'); 00022 } 00023 00024 // If ntlmsso_finish() succeeds, then the code never returns, 00025 // so we only worry about failure. 00026 if (!$authplugin->ntlmsso_finish()) { 00027 // Redirect to login, saying "don't try again!" 00028 // Display the page header. This makes redirect respect the timeout we specify 00029 // here (and not add 3 more secs). 00030 $loginsite = get_string("loginsite"); 00031 $PAGE->navbar->add($loginsite); 00032 $PAGE->set_title("$site->fullname: $loginsite"); 00033 $PAGE->set_heading($site->fullname); 00034 echo $OUTPUT->header(); 00035 redirect($CFG->httpswwwroot . '/login/index.php?authldap_skipntlmsso=1', 00036 get_string('ntlmsso_failed','auth_ldap'), 3); 00037 }