Ejemplo n.º 1
0
 /**
  * Redirects the browser to the page in $url
  * This function is based on PEAR HTTP class
  * @param string $url
  * @param bool $exit
  * @param bool $rfc2616
  * @license BSD
  * @access public static
  * @return bool
  * @version 1.0
  */
 public static function Redirect($url, $exit = true, $rfc2616 = true)
 {
     @ob_clean();
     if (isset($_SESSION) && count($_SESSION)) {
         session_write_close();
     }
     if (headers_sent()) {
         die('Headers are already sent, this should not have happened. Please inform Flyspray developers.');
     }
     $url = FlySpray::absoluteURI($url);
     header('Location: ' . $url);
     if ($rfc2616 && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
         $url = htmlspecialchars($url, ENT_QUOTES, 'utf-8');
         printf('%s to: <a href="%s">%s</a>.', eL('Redirect'), $url, $url);
     }
     if ($exit) {
         exit;
     }
     return true;
 }