MDL-11517 reserved word MOD used in table alias in questions backup code
[moodle-pu.git] / auth / mnet / land.php
blob905119adf5e9f4a0052d03a16ad1dcd9c05b020e
1 <?php
3 /**
4 * @author Martin Dougiamas
5 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
6 * @package moodle multiauth
8 * Authentication Plugin: Moodle Network Authentication
10 * Multiple host authentication support for Moodle Network.
12 * 2006-11-01 File created.
15 require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
16 require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
18 if (!$site = get_site()) {
19 print_error('mnet_session_prohibited', 'mnet', '', '');
22 if (!is_enabled_auth('mnet')) {
23 error('mnet is disabled');
25 // grab the GET params
26 $token = required_param('token', PARAM_BASE64);
27 $remotewwwroot = required_param('idp', PARAM_URL);
28 $wantsurl = required_param('wantsurl', PARAM_LOCALURL);
30 // confirm the MNET session
31 $mnetauth = get_auth_plugin('mnet');
32 $localuser = $mnetauth->confirm_mnet_session($token, $remotewwwroot);
34 // log in
35 $USER = get_complete_user_data('id', $localuser->id, $localuser->mnethostid);
36 load_all_capabilities();
38 if (!empty($localuser->mnet_foreign_host_array)) {
39 $USER->mnet_foreign_host_array = $localuser->mnet_foreign_host_array;
42 // redirect
43 redirect($CFG->wwwroot . $wantsurl);