mirror of https://github.com/MISP/MISP
Strict messages fixes #99 and user edit requiring to change password
fixes #67 - Plugins and the user model were throwing strict messages in php 5.4+ or with E_STRICT on php 5.3 and lower. Should be fixed. - New cakePHP added automatic HTML5 validation to form fields, which breaks fields that can alternatively be left empty to not be edited (such as the password field in user edits) - removed the html5 form validation from user edits.pull/64/merge
parent
e67e199c96
commit
a707df1b31
|
@ -240,7 +240,7 @@ class User extends AppModel {
|
|||
//'RemoveNewline' => array('fields' => array('gpgkey')),
|
||||
);
|
||||
|
||||
public function beforeSave() {
|
||||
public function beforeSave($options = array()) {
|
||||
if (isset($this->data[$this->alias]['password'])) {
|
||||
$this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class OrphansProtectableBehavior extends ModelBehavior {
|
|||
* @param $model Model
|
||||
* @param $settings array
|
||||
*/
|
||||
function setup(&$Model, $settings) {
|
||||
function setup(Model $Model, $settings = array()) {
|
||||
$Model->_deletionError = null; // Stores the deletion error message
|
||||
$Model->orphansProtectableOptions = array_merge(array(
|
||||
'listPossibleOrphans' => true,
|
||||
|
@ -34,7 +34,7 @@ class OrphansProtectableBehavior extends ModelBehavior {
|
|||
* @param $cascade boolean
|
||||
* @return boolean
|
||||
*/
|
||||
function beforeDelete(&$Model, $cascade) {
|
||||
function beforeDelete(Model $model, $cascade = true) {
|
||||
if($cascade) return true;
|
||||
return !$Model->wouldLeaveOrphanedRecordsBehind();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ App::import('Controller', 'ServersController');
|
|||
|
||||
class SysLogLogableBehavior extends LogableBehavior {
|
||||
|
||||
function afterSave(&$Model, $created) {
|
||||
function afterSave(Model $Model, $created) {
|
||||
|
||||
if (!$this->settings[$Model->alias]['enabled']) {
|
||||
return true;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="users form">
|
||||
<?php echo $this->Form->create('User');?>
|
||||
<?php echo $this->Form->create('User', array('novalidate'=>true));?>
|
||||
<fieldset>
|
||||
<legend><?php echo __('Admin Edit User'); ?></legend>
|
||||
<?php
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="users form">
|
||||
<?php echo $this->Form->create('User');?>
|
||||
<?php echo $this->Form->create('User', array('novalidate' => true));?>
|
||||
<fieldset>
|
||||
<legend><?php echo __('Edit User'); ?></legend>
|
||||
<?php
|
||||
|
|
|
@ -96,7 +96,7 @@ class LogableBehavior extends ModelBehavior {
|
|||
* @param Object $Model
|
||||
* @param array $config
|
||||
*/
|
||||
function setup(&$Model, $config = array()) {
|
||||
function setup(Model $Model, $config = array()) {
|
||||
|
||||
if (!is_array($config)) {
|
||||
$config = array();
|
||||
|
@ -104,9 +104,9 @@ class LogableBehavior extends ModelBehavior {
|
|||
$this->settings[$Model->alias] = array_merge($this->defaults, $config);
|
||||
$this->settings[$Model->alias]['ignore'][] = $Model->primaryKey;
|
||||
|
||||
$this->Log = & ClassRegistry::init('Log');
|
||||
$this->Log = ClassRegistry::init('Log');
|
||||
if ($this->settings[$Model->alias]['userModel'] != $Model->alias) {
|
||||
$this->UserModel = & ClassRegistry::init($this->settings[$Model->alias]['userModel']);
|
||||
$this->UserModel = ClassRegistry::init($this->settings[$Model->alias]['userModel']);
|
||||
} else {
|
||||
$this->UserModel = $Model;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ class LogableBehavior extends ModelBehavior {
|
|||
* @param int $id id of the logged item (ie model_id in logs table)
|
||||
* @param array $values optional other values for your logs table
|
||||
*/
|
||||
function customLog(&$Model, $action, $id, $values = array()) {
|
||||
function customLog(Model $Model, $action, $id, $values = array()) {
|
||||
|
||||
$logData['Log'] = $values;
|
||||
/** @todo clean up $logData */
|
||||
|
@ -318,7 +318,7 @@ class LogableBehavior extends ModelBehavior {
|
|||
$this->_saveLog($Model, $logData, $title);
|
||||
}
|
||||
|
||||
function clearUserData(&$Model) {
|
||||
function clearUserData(Model $Model) {
|
||||
|
||||
$this->user = NULL;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ class LogableBehavior extends ModelBehavior {
|
|||
$this->userIP = $userIP;
|
||||
}
|
||||
|
||||
function beforeDelete(&$Model) {
|
||||
function beforeDelete(Model $Model, $cascade = true) {
|
||||
|
||||
if (!$this->settings[$Model->alias]['enabled']) {
|
||||
return true;
|
||||
|
@ -341,7 +341,7 @@ class LogableBehavior extends ModelBehavior {
|
|||
return true;
|
||||
}
|
||||
|
||||
function afterDelete(&$Model) {
|
||||
function afterDelete(Model $Model) {
|
||||
|
||||
if (!$this->settings[$Model->alias]['enabled']) {
|
||||
return true;
|
||||
|
@ -364,7 +364,7 @@ class LogableBehavior extends ModelBehavior {
|
|||
$this->_saveLog($Model, $logData);
|
||||
}
|
||||
|
||||
function beforeSave(&$Model) {
|
||||
function beforeSave(Model $Model) {
|
||||
|
||||
if (isset($this->schema['change']) && $Model->id) {
|
||||
$this->old = $Model->find('first', array(
|
||||
|
@ -375,7 +375,7 @@ class LogableBehavior extends ModelBehavior {
|
|||
return true;
|
||||
}
|
||||
|
||||
function afterSave(&$Model, $created) {
|
||||
function afterSave(Model $Model, $created) {
|
||||
|
||||
if (!$this->settings[$Model->alias]['enabled']) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue