applications/dashboard/controllers/class.entrycontroller.php
public function Target($Target = FALSE) {
      if ($Target === FALSE) {
         $Target = $this->Form->GetFormValue('Target', FALSE);
         if (!$Target)
            $Target = $this->Request->Get('Target', '/');
      }
      
      // Make sure that the target is a valid url.
      if (!preg_match('`(^https?://)`', $Target)) {
         $Target = '/'.ltrim($Target, '/');
         
         // Never redirect back to signin.
         if (preg_match('`^/entry/signin`i', $Target))
            $Target = '/';
      } else {
         $MyHostname = parse_url(Gdn::Request()->Domain(),PHP_URL_HOST);
         $TargetHostname = parse_url($Target, PHP_URL_HOST);
         
         // Only allow external redirects to trusted domains.
         $TrustedDomains = C('Garden.TrustedDomains', TRUE);
         
         if (is_array($TrustedDomains)) {
            // Add this domain to the trusted hosts.
            $TrustedDomains[] = $MyHostname;
            $Sender->EventArguments['TrustedDomains'] = &$TrustedDomains;
            $this->FireEvent('BeforeTargetReturn');
         }
			
         if ($TrustedDomains === TRUE) {
            return $Target;
			} elseif (count($TrustedDomains) == 0) {
				// Only allow http redirects if they are to the same host name.
				if ($MyHostname != $TargetHostname)
					$Target = '';
			} else {
				// Loop the trusted domains looking for a match
				$Match = FALSE;
				foreach ($TrustedDomains as $TrustedDomain) {
					if (StringEndsWith($TargetHostname, $TrustedDomain, TRUE))
						$Match = TRUE;
				}
				if (!$Match)
					$Target = '';
			}
      }
      return $Target;
   }
public function Target($Target = FALSE) {
      if ($Target === FALSE) {
         $Target = $this->Form->GetFormValue('Target', FALSE);
         if (!$Target)
            $Target = $this->Request->Get('Target', '/');
      }
      
      // Make sure that the target is a valid url.
      if (!preg_match('`(^https?://)`', $Target)) {
         $Target = '/'.ltrim($Target, '/');
         
         // Never redirect back to signin.
         if (preg_match('`^/entry/signin`i', $Target))
            $Target = '/';
      } else {
         $MyHostname = parse_url(Gdn::Request()->Domain(),PHP_URL_HOST);
         $TargetHostname = parse_url($Target, PHP_URL_HOST);
         
         // Only allow external redirects to trusted domains.
         $TrustedDomains = C('Garden.TrustedDomains', TRUE);
         
         if (is_array($TrustedDomains)) {
            // Add this domain to the trusted hosts.
            $TrustedDomains[] = $MyHostname;
            $Sender->EventArguments['TrustedDomains'] = &$TrustedDomains;
            $this->FireEvent('BeforeTargetReturn');
         }
			
         if ($TrustedDomains === TRUE) {
            return $Target;
			} elseif (count($TrustedDomains) == 0) {
				// Only allow http redirects if they are to the same host name.
				if ($MyHostname != $TargetHostname)
					$Target = '';
			} else {
				// Loop the trusted domains looking for a match
				$Match = FALSE;
				foreach ($TrustedDomains as $TrustedDomain) {
					if (StringEndsWith($TargetHostname, $TrustedDomain, TRUE))
						$Match = TRUE;
				}
				if (!$Match)
					$Target = '';
			}
      }
      return $Target;
   }
public function Target ( $ Target = FALSE ) { if ( $ Target === FALSE ) { $ Target = $ this -> Form -> GetFormValue ( 'Target' , FALSE ) ; if ( ! $ Target ) $ Target = $ this -> Request -> Get ( 'Target' , '/' ) ; } // Make sure that the target is a valid url. if ( ! preg_match ( '`(^https?://)`' , $ Target ) ) { $ Target = '/' . ltrim ( $ Target , '/' ) ; // Never redirect back to signin. if ( preg_match ( '`^/entry/signin`i' , $ Target ) ) $ Target = '/' ; } else { $ MyHostname = parse_url ( Gdn :: Request ( ) -> Domain ( ) , PHP_URL_HOST ) ; $ TargetHostname = parse_url ( $ Target , PHP_URL_HOST ) ; // Only allow external redirects to trusted domains. $ TrustedDomains = C ( 'Garden.TrustedDomains' , TRUE ) ; if ( is_array ( $ TrustedDomains ) ) { // Add this domain to the trusted hosts. $ TrustedDomains [ ] = $ MyHostname ; $ Sender -> EventArguments [ 'TrustedDomains' ] = & $ TrustedDomains ; $ this -> FireEvent ( 'BeforeTargetReturn' ) ; } if ( $ TrustedDomains === TRUE ) { return $ Target ; } elseif ( count ( $ TrustedDomains ) == 0 ) { // Only allow http redirects if they are to the same host name. if ( $ MyHostname != $ TargetHostname ) $ Target = '' ; } else { // Loop the trusted domains looking for a match $ Match = FALSE ; foreach ( $ TrustedDomains as $ TrustedDomain ) { if ( StringEndsWith ( $ TargetHostname , $ TrustedDomain , TRUE ) ) $ Match = TRUE ; } if ( ! $ Match ) $ Target = '' ; } } return $ Target ; }
Set where to go after signin.

@access public
@since 2.0.0

@param string $Target Where we're requested to go to.
@return string URL to actually go to (validated & safe).
Set where to go after signin .