Commit b8aa76c1 authored by dongsheng's avatar dongsheng
Browse files

"MDL-19037, use getremoteaddr to get remote ip address"

parent 224eccbf
......@@ -1807,7 +1807,7 @@ class auth_plugin_ldap extends auth_plugin_base {
&& !empty($this->config->ntlmsso_subnet) // have a subnet to test for
&& empty($_GET['authldap_skipntlmsso']) // haven't failed it yet
&& (isguestuser() || !isloggedin()) // guestuser or not-logged-in users
&& address_in_subnet($_SERVER['REMOTE_ADDR'], $this->config->ntlmsso_subnet)) {
&& address_in_subnet(getremoteaddr(), $this->config->ntlmsso_subnet)) {
// First, let's remember where we were trying to get to before we got here
if (empty($SESSION->wantsurl)) {
......
......@@ -129,7 +129,7 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input {
global $CFG;
require_once $CFG->libdir . '/recaptchalib.php';
$response = recaptcha_check_answer($CFG->recaptchaprivatekey,
$_SERVER['REMOTE_ADDR'],
getremoteaddr(),
$challenge_field,
$response_field,
$this->_https);
......
......@@ -58,7 +58,7 @@
if (!hotpot_is_visible($cm)) {
$error = get_string("activityiscurrentlyhidden");
// check network address
} else if ($hotpot->subnet && !address_in_subnet($_SERVER['REMOTE_ADDR'], $hotpot->subnet)) {
} else if ($hotpot->subnet && !address_in_subnet(getremoteaddr(), $hotpot->subnet)) {
$error = get_string("subneterror", "quiz");
// check number of attempts
} else if ($hotpot->attempts && $hotpot->attempts <= $DB->count_records_select('hotpot_attempts', 'hotpot=? AND userid=?', array($hotpot->id, $USER->id), 'COUNT(DISTINCT clickreportid)')) {
......
......@@ -735,7 +735,7 @@ class resource_file extends resource_base {
return extern_server_file($this->resource->reference);
}
}
return md5($_SERVER['REMOTE_ADDR'].$CFG->resource_secretphrase);
return md5(getremoteaddr().$CFG->resource_secretphrase);
}
function setup_preprocessing(&$defaults){
......
......@@ -497,7 +497,7 @@ function set_encrypted_parameter() {
return extern_server_file($this->resource->reference);
}
}
return md5($_SERVER['REMOTE_ADDR'].$CFG->resource_secretphrase);
return md5(getremoteaddr().$CFG->resource_secretphrase);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment