mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-05-24 00:20:11 +02:00
There should not be any necessity to write the session once changes are being made to it. We now track whether changes were made and write the session when responding to the user's request if so.
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;
|
|
}
|
|
}
|