Changeset 2317
- Timestamp:
- 01/19/2016 01:51:49 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/wporg-sso/wp-plugin.php
r2316 r2317 43 43 add_filter( 'allowed_redirect_hosts', array( &$this, 'add_allowed_redirect_host' ) ); 44 44 45 if ( preg_match( ' /\/wp-signup\.php$/', $this->script ) ) {45 if ( preg_match( '!/wp-signup\.php$!', $this->script ) ) { 46 46 // If we're on any WP signup screen, redirect to the SSO host one,respecting the user's redirect_to request 47 47 $this->_safe_redirect( add_query_arg( 'redirect_to', urlencode( $redirect_req ), $this->sso_signup_url ) ); 48 48 49 } else if ( self::SSO_HOST !== $this->host ) {49 } elseif ( self::SSO_HOST !== $this->host ) { 50 50 // If we're not on the SSO host 51 if ( preg_match( ' /\/wp-login\.php$/', $this->script ) ) {51 if ( preg_match( '!/wp-login\.php$!', $this->script ) ) { 52 52 // If on a WP login screen... 53 53 $redirect_to_sso_login = $this->sso_login_url; … … 71 71 } else if ( self::SSO_HOST === $this->host ) { 72 72 // If on the SSO host 73 if ( ! preg_match( ' /\/wp-login\.php$/', $this->script ) ) {73 if ( ! preg_match( '!/wp-login\.php$!', $this->script ) ) { 74 74 // ... but not on its login screen. 75 if ( preg_match( ' /^\/(\?.*)?$/', $_SERVER['REQUEST_URI'] ) ) {75 if ( preg_match( '!^/(\?.*)?$!', $_SERVER['REQUEST_URI'] ) ) { 76 76 // If at host root (/) 77 77 if ( ! empty( $_GET['action'] ) ) { … … 94 94 } 95 95 return; 96 } 97 } else if ( preg_match( '/^\/oauth([\/\?]{1}.*)?$/', $_SERVER['REQUEST_URI'] ) ) {96 } 97 } elseif ( preg_match( '!^/oauth([/?]{1}.*)?$!', $_SERVER['REQUEST_URI'] ) ) { 98 98 // Let the theme render for oauth paths (/oauth, /oauth/, /oauth/*, but 99 99 // not /notoauth or /oauthnot), or redirect if logged in … … 102 102 } 103 103 return; 104 } else if ( is_user_logged_in() ) {104 } elseif ( is_user_logged_in() ) { 105 105 // Logged in catch all, before last fallback 106 106 $this->_redirect_to_profile(); … … 129 129 */ 130 130 public function login_network_site_url( $url, $path, $scheme ) { 131 if ( self::SSO_HOST === $this->host && preg_match( ' /\/wp-login\.php$/', $this->script ) ) {132 $url = preg_replace( ' /^(https?:\/\/)[^\/]+(\/.+)$/' , '\1'.self::SSO_HOST.'\2', $url );131 if ( self::SSO_HOST === $this->host && preg_match( '!/wp-login\.php$!', $this->script ) ) { 132 $url = preg_replace( '!^(https?://)[^/]+(/.+)$!' , '\1'.self::SSO_HOST.'\2', $url ); 133 133 } 134 134
Note: See TracChangeset
for help on using the changeset viewer.