/** * Carry out a redirect * * @access public * @param redirectURL string the URL to redirect to */ static function Redirect($url) { $redirectURL = urldecode($url); // this is safe if called multiple times. if (headers_sent() == true) { return false; } // Remove & entities to prevent redirect breakage $redirectURL = str_replace('&', '&', $redirectURL); if (substr($redirectURL, 0, 4) != 'http') { // Removing leading slashes from redirect url $redirectURL = preg_replace('!^/*!', '', $redirectURL); // Get base URL $baseurl = wbServer::getBaseURL(); $redirectURL = $baseurl . $redirectURL; } if (preg_match('/IIS/', wbServer::getVar('SERVER_SOFTWARE')) && preg_match('/CGI/', wbServer::getVar('GATEWAY_INTERFACE'))) { $header = "Refresh: 0; URL={$redirectURL}"; } else { $header = "Location: {$redirectURL}"; } // if // Start all over again header($header); // NOTE: we *could* return for pure '1 exit point' but then we'd have to keep track of more, // so for now, we exit here explicitly. Besides the end of index.php this should be the only // exit point. exit; }