From 0fe493b007e4a5669d3ed151b29e159963eccf19 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 8 Mar 2014 12:07:03 +0100 Subject: [PATCH] Allow us to have responses with no output not rendered in JS --- library/Icinga/Web/Controller/ActionController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 973086c18..f57cb413e 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -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