diff --git a/app/Model/Attribute.php b/app/Model/Attribute.php index a85f076ab..208e9e3c6 100644 --- a/app/Model/Attribute.php +++ b/app/Model/Attribute.php @@ -19,7 +19,7 @@ class Attribute extends AppModel { 'userModel' => 'User', 'userKey' => 'user_id', 'change' => 'full' - ),// 'Trim' => array('fields' => array('value')) + ), 'Trim' // => array('fields' => array('value')) ); /** diff --git a/app/Model/Behavior/TrimBehavior.php b/app/Model/Behavior/TrimBehavior.php index c222576ed..dd13399f5 100644 --- a/app/Model/Behavior/TrimBehavior.php +++ b/app/Model/Behavior/TrimBehavior.php @@ -23,6 +23,19 @@ class TrimBehavior extends ModelBehavior { $this->settings[$Model->alias], (array)$settings); } +/** + * + * @param $options + */ + public function beforeValidate(Model $Model, $options = array()) { + //parent::beforeValidate(); + + // process some.. + $this->trimStringFields($Model); + + return true; + } + /** * Trim String Fields * diff --git a/app/Model/Event.php b/app/Model/Event.php index f8f73521c..4164536c0 100644 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -14,7 +14,7 @@ class Event extends AppModel { 'userModel' => 'User', 'userKey' => 'user_id', 'change' => 'full' - )); + ), 'Trim'); /** * Display field diff --git a/app/Model/Group.php b/app/Model/Group.php index 8a2923b1b..5cef8fb9e 100755 --- a/app/Model/Group.php +++ b/app/Model/Group.php @@ -51,7 +51,7 @@ class Group extends AppModel { * * @var unknown_type */ - public $actsAs = array('Acl' => array('type' => 'requester'), 'MagicTools.OrphansProtectable'); + public $actsAs = array('Acl' => array('type' => 'requester'), 'MagicTools.OrphansProtectable', 'Trim'); /** * TODO ACL: 2: hook Group into CakePHP ACL system (so link to aros) diff --git a/app/Model/Server.php b/app/Model/Server.php index 8f27b5fa5..cf15f7e9f 100755 --- a/app/Model/Server.php +++ b/app/Model/Server.php @@ -104,19 +104,6 @@ class Server extends AppModel { ), ); -/** - * - * @param $options - */ - public function beforeValidate($options = array()) { - parent::beforeValidate(); - - // process some.. - $this->trimStringFields(); - - return true; - } - public function isOwnedByOrg($serverid, $org) { return $this->field('id', array('id' => $serverid, 'org' => $org)) === $serverid; } diff --git a/app/Model/User.php b/app/Model/User.php index acdb211d5..425bdc4de 100755 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -228,7 +228,7 @@ class User extends AppModel { 'userModel' => 'User', 'userKey' => 'user_id', 'change' => 'full' - ) + ), 'Trim' ); /** diff --git a/app/Model/Whitelist.php b/app/Model/Whitelist.php index 9ab23b968..2795b0cf9 100644 --- a/app/Model/Whitelist.php +++ b/app/Model/Whitelist.php @@ -20,6 +20,8 @@ class Whitelist extends AppModel { */ public $displayField = 'name'; + public $actsAs = array('Trim'); + /** * Validation rules *