]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-19037, use getremoteaddr to get remote ip address"
authordongsheng <dongsheng>
Fri, 1 May 2009 03:04:10 +0000 (03:04 +0000)
committerdongsheng <dongsheng>
Fri, 1 May 2009 03:04:10 +0000 (03:04 +0000)
auth/ldap/auth.php
lib/form/recaptcha.php
mod/hotpot/view.php
mod/resource/type/file/resource.class.php
mod/resource/type/repository/resource.class.php

index 83d45c24573b03900188afa1bd7081087490c512..cd36ea6bd1b57f4a3f995c43f600232201fe1d21 100644 (file)
@@ -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)) {
index a1ad0ae9cea69110512d767c4c496c20010e52e7..3b509f32660ea1872e053287880c63a4b7aa81f7 100644 (file)
@@ -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);
index 2136d272fde9ddf7e6667fc5bfc5a99d05f1266d..49033d6818d0a14f89a03ea0c2894b5e546a6533 100644 (file)
@@ -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)')) { 
index d2af53306bd970515a1ff6b154a262c5c1d7d931..30eb00554a2db404df1fadeb2ded465c5bdf268e 100644 (file)
@@ -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){
index 697f0993a06f7c2ece2dbc24b0e04725dfaad291..e23d80e52bf7ff69e2e64265e857f587bdabcb09 100644 (file)
@@ -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);
 }