- Timestamp:
- 12/03/2015 03:14:47 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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']}" );
Note: See TracChangeset
for help on using the changeset viewer.