OSDN Git Service

\nのunescape対応
authorCake <cake_67@users.sourceforge.jp>
Mon, 11 Jan 2010 14:43:21 +0000 (23:43 +0900)
committerCake <cake_67@users.sourceforge.jp>
Mon, 11 Jan 2010 14:43:21 +0000 (23:43 +0900)
app/controllers/app_controller.php
app/models/app_model.php
app/models/user.php

index f1f9507..ca1be58 100644 (file)
@@ -30,6 +30,7 @@ class AppController extends Controller
                'AuthPlus',
                'Acl',
                'DebugKit.Toolbar',
+               'Cakeplus.HtmlEscape',
                'Token'
        );
 
index 958bf57..51d45d1 100644 (file)
@@ -53,6 +53,10 @@ class AppModel extends Model {
 
        function beforeSave($options = array())
        {
+               // $fieldsの設定でSanitize
+               foreach($this->data[$this->name] as $field => $value) {
+                       $this->data[$this->name][$field]  = $this->escapeByFields($field, $value);
+               }
                // Sanitize(不正コード、SQL Injection)
                $this->data = Sanitize::clean(
                        $this->data,
index 94ea677..1367e6a 100644 (file)
@@ -4,6 +4,9 @@ class User extends AppModel {
        var $name = 'User';
        var $belongsTo = array('Group');
        var $actsAs = array(
+               'Cakeplus.ValidationErrorI18n',
+               'Cakeplus.AddValidationRule',
+               'SanitizePlus',
                'Acl' => 'requester', // ARO自動登録用
                'Containable',
        );
@@ -116,12 +119,6 @@ class User extends AppModel {
        }
        function beforeSave($options = array())
        {
-
-               // $fieldsの設定でSanitize
-               foreach($this->data['User'] as $field => $value) {
-                       $this->data['User'][$field]  = $this->escapeByFields($field, $value);
-               }
-
                return parent::beforeSave($options);
        }