Changeset 2150
- Timestamp:
- 12/03/2015 03:14:47 PM (9 years ago)
- Location:
- sites/trunk/common/includes/wporg-sso
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/wporg-sso/bb-plugin.php
r2135 r2150 18 18 parent::__construct(); 19 19 20 add_action( 'bb_init', array( &$this, 'redirect_all_login_or_signup_to_sso' ) ); 20 if ( $this->has_host() ) { 21 add_action( 'bb_init', array( &$this, 'redirect_all_login_or_signup_to_sso' ) ); 22 } 21 23 } 22 24 -
sites/trunk/common/includes/wporg-sso/class-wporg-sso.php
r2098 r2150 24 24 $this->sso_signup_url = 'https://wordpress.org/support/register.php'; // For now 25 25 26 $this->host = $_SERVER['HTTP_HOST']; 27 $this->script = $_SERVER['SCRIPT_NAME']; 26 if ( ! empty( $_SERVER['HTTP_HOST'] ) ) { 27 $this->host = $_SERVER['HTTP_HOST']; 28 $this->script = $_SERVER['SCRIPT_NAME']; 29 } 28 30 } 29 31 … … 78 80 } 79 81 82 83 /** 84 * Tests if the current process has $_SERVER['HTTP_HOST'] or not (EG: cron'd processes do not). 85 * 86 * @return boolean 87 */ 88 public function has_host() { 89 return ( ! empty( $this->host ) ); 90 } 91 80 92 /** 81 93 * Get a safe redirect URL (ie: a wordpress.org-based one) from $_REQUEST['redirect_to'] or a safe alternative. … … 93 105 $redirect_to = $redirect_to_requested; 94 106 } 95 } else { 107 } else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { 108 // We didn't get a redirect_to, but we got a referrer, use that if a valid target. 109 $redirect_to_referrer = $_SERVER['HTTP_REFERER']; 110 if ( $this->_is_valid_targeted_domain( $redirect_to_referrer ) ) { 111 $redirect_to = $redirect_to_referrer; 112 } 113 } else{ 96 114 // Otherwise, attempt to guess the parent dir of where they came from and validate that. 97 115 $redirect_to_source_parent = preg_replace( '/\/[^\/]+\.php\??.*$/', '/', "https://{$this->host}{$_SERVER['REQUEST_URI']}" ); -
sites/trunk/common/includes/wporg-sso/gp-plugin.php
r2098 r2150 12 12 function __construct() { 13 13 parent::__construct(); 14 14 15 // Load SSO lib 15 16 $this->instantiate_sso(); 16 // Actions 17 $this->add_action( 'init' ); 18 // Filters 19 $this->add_filter( 'gp_url', array( 'args' => 3 ) ); 17 18 if ( $this->sso_obj->has_host() ) { 19 // Actions 20 $this->add_action( 'init' ); 21 // Filters 22 $this->add_filter( 'gp_url', array( 'args' => 3 ) ); 23 } 20 24 } 21 25 -
sites/trunk/common/includes/wporg-sso/wp-plugin.php
r2135 r2150 18 18 parent::__construct(); 19 19 20 add_action( 'init', array( &$this, 'redirect_all_login_or_signup_to_sso' ) ); 20 if ( $this->has_host() ) { 21 add_action( 'init', array( &$this, 'redirect_all_login_or_signup_to_sso' ) ); 22 } 21 23 } 22 24
Note: See TracChangeset
for help on using the changeset viewer.