Merge branch 'hotfix-2.3.132'

pull/679/head v2.3.132
Iglocska 2015-09-23 12:16:13 +02:00
commit b998394943
4 changed files with 36 additions and 18 deletions

View File

@ -1418,22 +1418,31 @@ class EventsController extends AppController {
}
}
if ($this->Event->delete()) {
// delete the event from remote servers
//if ('true' == Configure::read('MISP.sync')) { // TODO test..(!$this->_isRest()) &&
// $this->__deleteEventFromServers($uuid);
//}
$this->Session->setFlash(__('Event deleted'));
// if coming from index, redirect to referer (to have the filter working)
// else redirect to index
if (strpos($this->referer(), '/view') !== FALSE)
if ($this->_isRest() || $this->response->type() === 'application/json') {
$this->set('message', 'Event deleted.');
$this->set('_serialize', array('message'));
} else {
// delete the event from remote servers
//if ('true' == Configure::read('MISP.sync')) { // TODO test..(!$this->_isRest()) &&
// $this->__deleteEventFromServers($uuid);
//}
$this->Session->setFlash(__('Event deleted'));
// if coming from index, redirect to referer (to have the filter working)
// else redirect to index
if (strpos($this->referer(), '/view') !== FALSE)
$this->redirect(array('action' => 'index'));
else
$this->redirect($this->referer(array('action' => 'index')));
}
} else {
if ($this->_isRest() || $this->response->type() === 'application/json') {
throw new Exception('Event was not deleted');
} else {
$this->Session->setFlash(__('Event was not deleted'));
$this->redirect(array('action' => 'index'));
else
$this->redirect($this->referer(array('action' => 'index')));
}
}
$this->Session->setFlash(__('Event was not deleted'));
$this->redirect(array('action' => 'index'));
}
/**

View File

@ -319,7 +319,7 @@ class ServersController extends AppController {
$stixOperational = array(0 => 'STIX or CyBox library not installed correctly', 1 => 'OK');
$stixVersion = array(0 => 'Incorrect STIX version installed, found $current, expecting $expected', 1 => 'OK');
$cyboxVersion = array(0 => 'Incorrect CyBox version installed, found $current, expecting $expected', 1 => 'OK');
$sessionErrors = array(0 => 'OK', 1 => 'High');
$sessionErrors = array(0 => 'OK', 1 => 'High', 2 => 'Alternative setting used');
$finalSettings = $this->Server->serverSettingsRead();
$issues = array(

View File

@ -1552,6 +1552,10 @@ class Server extends AppModel {
}
public function sessionDiagnostics(&$diagnostic_errors, &$sessionCount) {
if (Configure::read('Session.defaults') !== 'database') {
$sessionCount = 'N/A';
return 2;
}
$sql = 'SELECT COUNT(id) FROM `cake_sessions` WHERE `expires` < ' . time() . ';';
$sessionCount = $this->query($sql)[0][0]['COUNT(id)'];
$sessionStatus = 0;

View File

@ -133,11 +133,16 @@
<?php
$colour = 'green';
$message = $sessionErrors[$sessionStatus];
if ($sessionStatus > 0) {
$colour = 'red';
}
$sessionColours = array(0 => 'green', 1 => 'red', 2 => 'orange');
$colour = $sessionColours[$sessionStatus];
echo 'Expired sessions....<span style="color:' . $colour . ';">' . $sessionCount . ' (' . $message . ')' . '</span>';
?>
</div>
<?php
if ($sessionStatus < 2):
?>
<a href ="/servers/purgeSessions"><span class="btn btn-inverse" style="padding-top:1px;padding-bottom:1px;">Purge sessions</span></a>
<?php
endif;
?>
</div>