Replace deprecated print_error calls
This commit is contained in:
parent
b07d17fbee
commit
0341b05f99
4 changed files with 9 additions and 9 deletions
4
auth.php
4
auth.php
|
@ -157,7 +157,7 @@ class auth_plugin_userkey extends auth_plugin_base {
|
||||||
if (isloggedin()) {
|
if (isloggedin()) {
|
||||||
require_logout();
|
require_logout();
|
||||||
}
|
}
|
||||||
print_error($exception->errorcode);
|
throw $exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isloggedin()) {
|
if (isloggedin()) {
|
||||||
|
@ -653,7 +653,7 @@ class auth_plugin_userkey extends auth_plugin_base {
|
||||||
$this->redirect($redirect);
|
$this->redirect($redirect);
|
||||||
} else {
|
} else {
|
||||||
// If logged in with different auth type, then display an error.
|
// If logged in with different auth type, then display an error.
|
||||||
print_error('incorrectlogout', 'auth_userkey', $CFG->wwwroot);
|
throw new moodle_exception('incorrectlogout', 'auth_userkey', $CFG->wwwroot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,17 +115,17 @@ class core_userkey_manager implements userkey_manager_interface {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$key = $DB->get_record('user_private_key', $options)) {
|
if (!$key = $DB->get_record('user_private_key', $options)) {
|
||||||
print_error('invalidkey');
|
throw new \moodle_exception('invalidkey');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($key->validuntil) and $key->validuntil < time()) {
|
if (!empty($key->validuntil) and $key->validuntil < time()) {
|
||||||
print_error('expiredkey');
|
throw new \moodle_exception('expiredkey');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->validate_ip_address($key);
|
$this->validate_ip_address($key);
|
||||||
|
|
||||||
if (!$user = $DB->get_record('user', array('id' => $key->userid))) {
|
if (!$user = $DB->get_record('user', array('id' => $key->userid))) {
|
||||||
print_error('invaliduserid');
|
throw new \moodle_exception('invaliduserid');
|
||||||
}
|
}
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class core_userkey_manager implements userkey_manager_interface {
|
||||||
$remoteaddr = getremoteaddr(null);
|
$remoteaddr = getremoteaddr(null);
|
||||||
|
|
||||||
if (empty($remoteaddr)) {
|
if (empty($remoteaddr)) {
|
||||||
print_error('noip', 'auth_userkey');
|
throw new \moodle_exception('noip', 'auth_userkey');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (address_in_subnet($remoteaddr, $key->iprestriction)) {
|
if (address_in_subnet($remoteaddr, $key->iprestriction)) {
|
||||||
|
@ -161,6 +161,6 @@ class core_userkey_manager implements userkey_manager_interface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print_error('ipmismatch', 'error', '', null, "Remote address: $remoteaddr\nKey IP: $key->iprestriction");
|
throw new \moodle_exception('ipmismatch', 'error', '', null, "Remote address: $remoteaddr\nKey IP: $key->iprestriction");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
require_once(dirname(__FILE__) . '/../../config.php');
|
require_once(dirname(__FILE__) . '/../../config.php');
|
||||||
|
|
||||||
if (!is_enabled_auth('userkey')) {
|
if (!is_enabled_auth('userkey')) {
|
||||||
print_error(get_string('pluginisdisabled', 'auth_userkey'));
|
throw new moodle_exception(get_string('pluginisdisabled', 'auth_userkey'));
|
||||||
}
|
}
|
||||||
|
|
||||||
get_auth_plugin('userkey')->user_login_userkey();
|
get_auth_plugin('userkey')->user_login_userkey();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
require_once(dirname(__FILE__) . '/../../config.php');
|
require_once(dirname(__FILE__) . '/../../config.php');
|
||||||
|
|
||||||
if (!is_enabled_auth('userkey')) {
|
if (!is_enabled_auth('userkey')) {
|
||||||
print_error(get_string('pluginisdisabled', 'auth_userkey'));
|
throw new moodle_exception(get_string('pluginisdisabled', 'auth_userkey'));
|
||||||
}
|
}
|
||||||
|
|
||||||
get_auth_plugin('userkey')->user_logout_userkey();
|
get_auth_plugin('userkey')->user_logout_userkey();
|
||||||
|
|
Loading…
Reference in a new issue