function redirect($uri = '', $method = 'location', $http_response_code = 302) { switch($method) { case 'refresh' : header("Refresh:0;url=".site_url($uri)); break; default : if(substr($uri, 0, 7) != 'http://') { $uri = site_url($uri); } //@todo make this be set off with the debug switch. and if debugging is on it should show a link to the page it would have forwarded to. header("Location: " . $uri, TRUE, $http_response_code); break; } /* @todo you should call an app end event here.*/ SweetFramework::end(); //exit; }
function redirect($uri = '', $http_response_code = 302) { if(substr($uri, 0, 7) != 'http://') { //@todo fix this so it works with https /* $this->callRoute($uri); exit; */ if($uri == '/') { $uri = SITE_URL; } else { $uri = SITE_URL . $uri; } } //@todo make this be set off with the debug switch. and if debugging is on it should show a link to the page it would have forwarded to. if(headers_sent()) { D::show('Headers already sent.', B::a(array('href' => $uri), $uri)); } else { header('Location: ' . $uri, TRUE, $http_response_code); /* @todo you should call an app end event here.*/ SweetFramework::end(true); } }