X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FWebRequest.php;h=0065135ae01087690e28f5729102b7bb3434136f;hb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;hp=8f7816457492ea18844bda947121d3397b1ada98;hpb=196db3429307c04e5c92f6c06a965a394d4a8a87;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 8f78164574..0065135ae0 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -23,6 +23,7 @@ * @file */ +use MediaWiki\MediaWikiServices; use MediaWiki\Session\Session; use MediaWiki\Session\SessionId; use MediaWiki\Session\SessionManager; @@ -520,7 +521,7 @@ class WebRequest { * @return int */ public function getInt( $name, $default = 0 ) { - return intval( $this->getVal( $name, $default ) ); + return intval( $this->getRawVal( $name, $default ) ); } /** @@ -532,7 +533,7 @@ class WebRequest { * @return int|null */ public function getIntOrNull( $name ) { - $val = $this->getVal( $name ); + $val = $this->getRawVal( $name ); return is_numeric( $val ) ? intval( $val ) : null; @@ -549,7 +550,7 @@ class WebRequest { * @return float */ public function getFloat( $name, $default = 0.0 ) { - return floatval( $this->getVal( $name, $default ) ); + return floatval( $this->getRawVal( $name, $default ) ); } /** @@ -562,7 +563,7 @@ class WebRequest { * @return bool */ public function getBool( $name, $default = false ) { - return (bool)$this->getVal( $name, $default ); + return (bool)$this->getRawVal( $name, $default ); } /** @@ -575,7 +576,8 @@ class WebRequest { * @return bool */ public function getFuzzyBool( $name, $default = false ) { - return $this->getBool( $name, $default ) && strcasecmp( $this->getVal( $name ), 'false' ) !== 0; + return $this->getBool( $name, $default ) + && strcasecmp( $this->getRawVal( $name ), 'false' ) !== 0; } /** @@ -589,7 +591,7 @@ class WebRequest { public function getCheck( $name ) { # Checkboxes and buttons are only present when clicked # Presence connotes truth, absence false - return $this->getVal( $name, null ) !== null; + return $this->getRawVal( $name, null ) !== null; } /** @@ -1221,7 +1223,8 @@ HTML; # Append XFF $forwardedFor = $this->getHeader( 'X-Forwarded-For' ); if ( $forwardedFor !== false ) { - $isConfigured = IP::isConfiguredProxy( $ip ); + $proxyLookup = MediaWikiServices::getInstance()->getProxyLookup(); + $isConfigured = $proxyLookup->isConfiguredProxy( $ip ); $ipchain = array_map( 'trim', explode( ',', $forwardedFor ) ); $ipchain = array_reverse( $ipchain ); array_unshift( $ipchain, $ip ); @@ -1234,14 +1237,14 @@ HTML; foreach ( $ipchain as $i => $curIP ) { $curIP = IP::sanitizeIP( IP::canonicalize( $curIP ) ); if ( !$curIP || !isset( $ipchain[$i + 1] ) || $ipchain[$i + 1] === 'unknown' - || !IP::isTrustedProxy( $curIP ) + || !$proxyLookup->isTrustedProxy( $curIP ) ) { break; // IP is not valid/trusted or does not point to anything } if ( IP::isPublic( $ipchain[$i + 1] ) || $wgUsePrivateIPs || - IP::isConfiguredProxy( $curIP ) // bug 48919; treat IP as sane + $proxyLookup->isConfiguredProxy( $curIP ) // bug 48919; treat IP as sane ) { // Follow the next IP according to the proxy $nextIP = IP::canonicalize( $ipchain[$i + 1] );