/** * @param IDS_Report $report * @param int $impact * @param string $level * @return bool */ public function run(IDS_Report $report, $impact, $level, Monitor $monitor = null) { $service = Module::getServiceManager(); $application = $service->get('Application'); $response = $application->getResponse(); $response->getHeaders()->addHeaderLine('Location', $this->config['url']); $response->setStatusCode(302); return true; }
/** * React to a potential threat by analyzing the generated report object * @param IDS_Report $result * @return boolean */ protected function react(IDS_Report $report) { $impact = $this->aggregateImpactInSession($report); $exit = false; foreach ($this->config['levels'] as $level => $options) { if ($options['max_impact'] >= $impact || $options['max_impact'] === null) { if (isset($options['actions'])) { foreach ($options['actions'] as $name) { if ($action = $this->getAction($name)) { $exit = $exit || $action->run($report, $impact, $level, $this); } } } break; } } //if an action needs to stop execution then return the response and exit if ($exit) { Module::getServiceManager()->get('Application')->getResponse()->send(); exit; } return false; }