diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index 4f93fd633..b88e8c9ee 100644 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -83,7 +83,8 @@ class EventsController extends AppController { // force check userid and orgname to be from yourself $this->request->data['Event']['user_id'] = $this->Auth->user('id'); $this->request->data['Event']['org'] = $this->Auth->user('org'); - $this->Event->create(); + $this->request->data['Event']['uuid'] = String::uuid(); + $this->Event->create(); if ($this->Event->save($this->request->data)) { $this->Session->setFlash(__('The event has been saved')); $this->redirect(array('action' => 'view', $this->Event->getId())); @@ -126,7 +127,7 @@ class EventsController extends AppController { $this->request->data['Event']['alerted'] = 0; // say what fields are to be updated - $fieldList=array('user_id', 'org', 'date', 'risk', 'info', 'alerted'); + $fieldList=array('user_id', 'org', 'date', 'risk', 'info', 'alerted', 'private'); if ($this->Event->save($this->request->data, true, $fieldList)) { $this->Session->setFlash(__('The event has been saved')); $this->redirect(array('action' => 'view', $id)); diff --git a/app/Controller/SignaturesController.php b/app/Controller/SignaturesController.php index 53facdb91..7ad543981 100644 --- a/app/Controller/SignaturesController.php +++ b/app/Controller/SignaturesController.php @@ -61,7 +61,7 @@ class SignaturesController extends AppController { $this->Signature->create(); $this->request->data['Signature']['value'] = $signature; // set the value as the content of the single line - + $this->request->data['Signature']['uuid'] = String::uuid(); if ($this->Signature->save($this->request->data)) { $successes .= " ".($key+1); } else { @@ -89,6 +89,8 @@ class SignaturesController extends AppController { // // create the signature $this->Signature->create(); + $this->request->data['Signature']['uuid'] = String::uuid(); + if ($this->Signature->save($this->request->data)) { // inform the user and redirect $this->Session->setFlash(__('The signature has been saved')); @@ -128,7 +130,7 @@ class SignaturesController extends AppController { if ($this->Signature->save($this->request->data)) { $this->Session->setFlash(__('The signature has been saved')); - $this->redirect(array('action' => 'index')); + $this->redirect($this->referer()); } else { $this->Session->setFlash(__('The signature could not be saved. Please, try again.')); } @@ -136,6 +138,11 @@ class SignaturesController extends AppController { $this->request->data = $this->Signature->read(null, $id); } + + // combobox for types + $types = $this->Signature->validate['type']['rule'][1]; + $types = $this->_arrayToValuesIndexArray($types); + $this->set('types',compact('types')); } /** diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php index e811aaa2f..6190405e6 100644 --- a/app/Controller/UsersController.php +++ b/app/Controller/UsersController.php @@ -271,7 +271,7 @@ class UsersController extends AppController { // What org posted what type of signature - // LATER beautify types_histogram + // LATER beautify types_histogram http://dev.sencha.com/deploy/ext-4.0.0/examples/charts/StackedBar.html $this->loadModel('Signature'); $fields = array('Event.org', 'Signature.type', 'count(Signature.type) as `num_types`'); $params = array('recursive' => 0, diff --git a/app/Model/Event.php b/app/Model/Event.php index b3f87aeb0..030ca23fd 100644 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -87,6 +87,16 @@ class Event extends AppModel { //'on' => 'create', // Limit validation to 'create' or 'update' operations ), ), + 'private' => array( + 'boolean' => array( + 'rule' => array('boolean'), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + 'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), ); //The Associations below have been created with all possible keys, those that are not needed can be removed diff --git a/app/Model/Signature.php b/app/Model/Signature.php index f6dea8c0d..6ef0582fe 100644 --- a/app/Model/Signature.php +++ b/app/Model/Signature.php @@ -92,6 +92,26 @@ class Signature extends AppModel { //'on' => 'create', // Limit validation to 'create' or 'update' operations ), ), + 'revision' => array( + 'numeric' => array( + 'rule' => array('numeric'), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), + 'private' => array( + 'boolean' => array( + 'rule' => array('boolean'), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + 'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), ); //The Associations below have been created with all possible keys, those that are not needed can be removed @@ -111,6 +131,16 @@ class Signature extends AppModel { ) ); + + function beforeSave() { + // increment the revision number + if (empty($this->data['Signature']['revision'])) $this->data['Signature']['revision'] = 0; + $this->data['Signature']['revision'] = 1 + $this->data['Signature']['revision'] ; + + // always return true after a beforeSave() + return true; + } + function validateSignatureValue ($fields) { $value = $fields['value']; $event_id = $this->data['Signature']['event_id']; diff --git a/app/View/Events/add.ctp b/app/View/Events/add.ctp index 61b3e9566..4019bdd5b 100755 --- a/app/View/Events/add.ctp +++ b/app/View/Events/add.ctp @@ -6,7 +6,7 @@ echo $this->Form->input('date'); echo $this->Form->input('risk'); echo $this->Form->input('info'); - + ?> Form->end(__('Submit', true));?> diff --git a/app/View/Events/index.ctp b/app/View/Events/index.ctp index 5d6ec714a..65bfe1bc9 100755 --- a/app/View/Events/index.ctp +++ b/app/View/Events/index.ctp @@ -13,9 +13,7 @@ - Html->link($event['Event']['id'], array('controller' => 'events', 'action' => 'view', $event['Event']['id'])); ?> @@ -64,6 +62,5 @@
diff --git a/app/View/Events/view.ctp b/app/View/Events/view.ctp index 04aeef7a2..7ead06dd7 100755 --- a/app/View/Events/view.ctp +++ b/app/View/Events/view.ctp @@ -40,6 +40,11 @@   +
Info
diff --git a/app/View/Layouts/default.ctp b/app/View/Layouts/default.ctp index d6128d5e0..6ded5ea98 100644 --- a/app/View/Layouts/default.ctp +++ b/app/View/Layouts/default.ctp @@ -16,14 +16,13 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework'); ?> Html->charset(); ?> - <?php echo $cakeDescription ?>: + CyDefSIG: <?php echo $title_for_layout; ?> Form->input('id'); - echo $this->Form->input('event_id'); echo $this->Form->input('type'); echo $this->Form->input('value'); echo $this->Form->input('to_ids'); - echo $this->Form->input('uuid'); ?> Form->end(__('Submit'));?>
+ diff --git a/app/View/Users/memberslist.ctp b/app/View/Users/memberslist.ctp index 3135dfb7b..ec4496618 100644 --- a/app/View/Users/memberslist.ctp +++ b/app/View/Users/memberslist.ctp @@ -46,3 +46,6 @@ +
+ +
diff --git a/app/View/Users/news.ctp b/app/View/Users/news.ctp index 8c4769781..aab6041b5 100644 --- a/app/View/Users/news.ctp +++ b/app/View/Users/news.ctp @@ -4,7 +4,7 @@

Backend rewrite + security
Complete rewrite of the backend code to migrate to CakePHP 2.x (from CakePHP 1.3).
During this rewrite the code was cleaned up, CSRF protection should now be present on all the important actions.
-Password strength validation, anti-bruteforce has been implemented.
+Password strength validation has been implemented.
Some intermittent bugs might have slipped in during the (manual) conversion. Please contact me user1088@qet.be to report any issues.

Terms and News