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()) { if ($this->Event->delete()) {
if ($this->_isRest() || $this->response->type() === 'application/json') {
// delete the event from remote servers $this->set('message', 'Event deleted.');
//if ('true' == Configure::read('MISP.sync')) { // TODO test..(!$this->_isRest()) && $this->set('_serialize', array('message'));
// $this->__deleteEventFromServers($uuid); } else {
//} // delete the event from remote servers
$this->Session->setFlash(__('Event deleted')); //if ('true' == Configure::read('MISP.sync')) { // TODO test..(!$this->_isRest()) &&
// $this->__deleteEventFromServers($uuid);
// if coming from index, redirect to referer (to have the filter working) //}
// else redirect to index $this->Session->setFlash(__('Event deleted'));
if (strpos($this->referer(), '/view') !== FALSE)
// 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')); $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'); $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'); $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'); $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(); $finalSettings = $this->Server->serverSettingsRead();
$issues = array( $issues = array(

View File

@ -1552,6 +1552,10 @@ class Server extends AppModel {
} }
public function sessionDiagnostics(&$diagnostic_errors, &$sessionCount) { 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() . ';'; $sql = 'SELECT COUNT(id) FROM `cake_sessions` WHERE `expires` < ' . time() . ';';
$sessionCount = $this->query($sql)[0][0]['COUNT(id)']; $sessionCount = $this->query($sql)[0][0]['COUNT(id)'];
$sessionStatus = 0; $sessionStatus = 0;

View File

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