Allow us to have responses with no output not rendered in JS

This commit is contained in:
Thomas Gelf 2014-03-08 12:07:03 +01:00
parent cff89e3f9a
commit 0fe493b007
1 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,8 @@ class ActionController extends Zend_Controller_Action
private $autorefreshInterval;
private $noXhrBody = false;
// TODO: This would look better if we had a ModuleActionController
public function Config($file = null)
{
@ -203,6 +205,11 @@ class ActionController extends Zend_Controller_Action
return Translator::translate($text, $domain);
}
protected function ignoreXhrBody()
{
$this->noXhrBody = true;
}
public function setAutorefreshInterval($interval)
{
if (! is_int($interval) || $interval < 1) {
@ -308,6 +315,11 @@ class ActionController extends Zend_Controller_Action
}
}
if ($this->_request->isXmlHttpRequest() && $this->noXhrBody) {
header('X-Icinga-Container: ignore');
return;
}
if ($this->view->title) {
if (preg_match('~[\r\n]~', $this->view->title)) {
// TODO: Innocent exception and error log for hack attempts