Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/auth/ldap/ntlmsso_magic.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // Don't let lib/setup.php set any cookies
00004 // as we will be executing under the OS security
00005 // context of the user we are trying to login, rather than
00006 // of the webserver.
00007 define('NO_MOODLE_COOKIES', true);
00008 
00009 require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
00010 
00011 //HTTPS is required in this page when $CFG->loginhttps enabled
00012 $PAGE->https_required();
00013 
00014 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
00015 
00016 $authsequence = get_enabled_auth_plugins(true); // auths, in sequence
00017 if (!in_array('ldap', $authsequence, true)) {
00018     print_error('ldap_isdisabled', 'auth');
00019 }
00020 
00021 $authplugin = get_auth_plugin('ldap');
00022 if (empty($authplugin->config->ntlmsso_enabled)) {
00023     print_error('ntlmsso_isdisabled', 'auth_ldap');
00024 }
00025 
00026 $sesskey = required_param('sesskey', PARAM_RAW);
00027 $file = $CFG->dirroot.'/pix/spacer.gif';
00028 
00029 if ($authplugin->ntlmsso_magic($sesskey) && file_exists($file)) {
00030     if (!empty($authplugin->config->ntlmsso_ie_fastpath)) {
00031         if (check_browser_version('MSIE')) {
00032             redirect($CFG->wwwroot.'/auth/ldap/ntlmsso_finish.php');
00033         }
00034     }
00035 
00036     // Serve GIF
00037     // Type
00038     header('Content-Type: image/gif');
00039     header('Content-Length: '.filesize($file));
00040 
00041     // Output file
00042     $handle = fopen($file, 'r');
00043     fpassthru($handle);
00044     fclose($handle);
00045     exit;
00046 } else {
00047     print_error('ntlmsso_iwamagicnotenabled', 'auth_ldap');
00048 }
00049 
00050 
 All Data Structures Namespaces Files Functions Variables Enumerations