}
$matches = self::getPathInfo( 'title' );
- foreach( $matches as $key => $val) {
+ foreach( $matches as $key => $val ) {
$this->data[$key] = $_GET[$key] = $_REQUEST[$key] = $val;
}
}
* @return Boolean
*/
public function checkSessionCookie() {
- return isset( $_COOKIE[ session_name() ] );
+ return isset( $_COOKIE[session_name()] );
}
/**
if( $hash !== false ) {
$base = substr( $base, 0, $hash );
}
+
if( $base[0] == '/' ) {
- return $base;
+ // More than one slash will look like it is protocol relative
+ return preg_replace( '!^/+!', '/', $base );
} else {
// We may get paths with a host prepended; strip it.
- return preg_replace( '!^[^:]+://[^/]+/!', '/', $base );
+ return preg_replace( '!^[^:]+://[^/]+/+!', '/', $base );
}
}
if ( function_exists( 'apache_request_headers' ) ) {
foreach ( apache_request_headers() as $tempName => $tempValue ) {
- $this->headers[ strtoupper( $tempName ) ] = $tempValue;
+ $this->headers[strtoupper( $tempName )] = $tempValue;
}
} else {
foreach ( $_SERVER as $name => $value ) {
$curIP = IP::canonicalize( $curIP );
if ( wfIsTrustedProxy( $curIP ) ) {
if ( isset( $ipchain[$i + 1] ) ) {
- if ( $wgUsePrivateIPs || IP::isPublic( $ipchain[$i + 1 ] ) ) {
+ if ( $wgUsePrivateIPs || IP::isPublic( $ipchain[$i + 1] ) ) {
$ip = $ipchain[$i + 1];
}
}
public function setIP( $ip ) {
$this->ip = $ip;
}
-
- /**
- * Export the resolved user IP, HTTP headers, and session ID.
- * The result will be reasonably sized to allow for serialization.
- *
- * @return Array
- * @since 1.21
- */
- public function exportUserSession() {
- return array(
- 'ip' => $this->getIP(),
- 'headers' => $this->getAllHeaders(),
- 'sessionId' => session_id()
- );
- }
}
/**