2014-06-22 13:49:21 +02:00
|
|
|
<?php
|
2014-07-15 13:39:22 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2014-06-22 13:49:21 +02:00
|
|
|
|
|
|
|
namespace Icinga\Web;
|
|
|
|
|
|
|
|
use Zend_Controller_Response_Http;
|
2014-07-04 12:35:33 +02:00
|
|
|
use Icinga\Application\Icinga;
|
2014-06-22 13:49:21 +02:00
|
|
|
|
|
|
|
class Response extends Zend_Controller_Response_Http
|
|
|
|
{
|
2014-07-04 12:35:33 +02:00
|
|
|
public function redirectAndExit($url)
|
|
|
|
{
|
|
|
|
if (! $url instanceof Url) {
|
|
|
|
$url = Url::fromPath($url);
|
|
|
|
}
|
|
|
|
$url->getParams()->setSeparator('&');
|
|
|
|
|
|
|
|
if (Icinga::app()->getFrontController()->getRequest()->isXmlHttpRequest()) {
|
2014-09-12 09:14:13 +02:00
|
|
|
$this->setHeader('X-Icinga-Redirect', rawurlencode($url->getAbsoluteUrl()));
|
2014-07-04 12:35:33 +02:00
|
|
|
} else {
|
|
|
|
$this->setRedirect($url->getAbsoluteUrl());
|
|
|
|
}
|
|
|
|
$this->sendHeaders();
|
|
|
|
exit;
|
|
|
|
}
|
2014-06-22 13:49:21 +02:00
|
|
|
}
|