34 lines
828 B
PHP
34 lines
828 B
PHP
<?php
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
namespace Icinga\Web;
|
|
|
|
use Zend_Controller_Response_Http;
|
|
use Icinga\Application\Icinga;
|
|
|
|
class Response extends Zend_Controller_Response_Http
|
|
{
|
|
public function redirectAndExit($url)
|
|
{
|
|
if (! $url instanceof Url) {
|
|
$url = Url::fromPath($url);
|
|
}
|
|
$url->getParams()->setSeparator('&');
|
|
|
|
if (Icinga::app()->getFrontController()->getRequest()->isXmlHttpRequest()) {
|
|
$this->setHeader('X-Icinga-Redirect', rawurlencode($url->getAbsoluteUrl()));
|
|
} else {
|
|
$this->setRedirect($url->getAbsoluteUrl());
|
|
}
|
|
|
|
$session = Session::getSession();
|
|
if ($session->hasChanged()) {
|
|
$session->write();
|
|
}
|
|
|
|
$this->sendHeaders();
|
|
exit;
|
|
}
|
|
}
|