示例#1
0
文件: land.php 项目: Br3nda/mahara
define('PUBLIC', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
// If networking is turned off, it's safer to die immediately
if (!get_config('enablenetworking')) {
    throw new AccessTotallyDeniedException(get_string('networkingdisabledonthissite', 'auth.xmlrpc'));
}
require_once get_config('docroot') . 'api/xmlrpc/client.php';
require_once get_config('docroot') . 'auth/xmlrpc/lib.php';
require_once get_config('libroot') . 'institution.php';
$token = param_variable('token');
$remotewwwroot = param_variable('idp');
$wantsurl = param_variable('wantsurl', '/');
$remoteurl = param_boolean('remoteurl');
$institution = new Institution();
try {
    $institution->findByWwwroot($remotewwwroot);
} catch (ParamOutOfRangeException $e) {
    throw new ParameterException(get_string('errnoxmlrpcwwwroot', 'auth', $remotewwwroot));
}
$instances = auth_get_auth_instances_for_wwwroot($remotewwwroot);
if (empty($instances)) {
    throw new ParameterException(get_string('errnoauthinstances', 'auth', $remotewwwroot));
}
// If the user is already logged in as someone, log them out. That way, if
// XMLRPC authentication fails, the system isn't left looking stupid as it
// reports that the user couldn't log in while they actually are.
if ($USER->is_logged_in()) {
    $USER->logout();
}
$SESSION->set('messages', array());
$rpcconfigured = false;