[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/auth/mnet/ -> land.php (source)

   1  <?php
   2  
   3  /**
   4   * @author Martin Dougiamas
   5   * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
   6   * @package moodle multiauth
   7   *
   8   * Authentication Plugin: Moodle Network Authentication
   9   *
  10   * Multiple host authentication support for Moodle Network.
  11   *
  12   * 2006-11-01  File created.
  13   */
  14  
  15  require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
  16  require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
  17  
  18  if (!$site = get_site()) {
  19      print_error('mnet_session_prohibited', 'mnet', '', '');
  20  }
  21  
  22  if (!is_enabled_auth('mnet')) {
  23      error('mnet is disabled');
  24  }
  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);
  29  
  30  // confirm the MNET session
  31  $mnetauth = get_auth_plugin('mnet');
  32  $localuser = $mnetauth->confirm_mnet_session($token, $remotewwwroot);
  33  
  34  // log in
  35  $USER = get_complete_user_data('id', $localuser->id, $localuser->mnethostid);
  36  complete_user_login($USER);
  37  
  38  if (!empty($localuser->mnet_foreign_host_array)) {
  39      $USER->mnet_foreign_host_array = $localuser->mnet_foreign_host_array;
  40  }
  41  
  42  // redirect
  43  redirect($CFG->wwwroot . $wantsurl);
  44  
  45  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7