質問編集履歴

3

追記

2015/08/25 09:40

投稿

amakusa
amakusa

スコア176

test CHANGED
File without changes
test CHANGED
@@ -121,3 +121,119 @@
121
121
  </form>
122
122
 
123
123
  ```
124
+
125
+
126
+
127
+
128
+
129
+ ※追記
130
+
131
+ あと、sanitize.phpのcleanではこのように記述されています。
132
+
133
+ ここ変えればよかったりもしないですよね、、、
134
+
135
+ ```php
136
+
137
+ public static function clean($data, $options = array()) {
138
+
139
+ if (empty($data)) {
140
+
141
+ return $data;
142
+
143
+ }
144
+
145
+
146
+
147
+ if (!is_array($options)) {
148
+
149
+ $options = array('connection' => $options);
150
+
151
+ }
152
+
153
+
154
+
155
+ $options += array(
156
+
157
+ 'connection' => 'default',
158
+
159
+ 'odd_spaces' => true,
160
+
161
+ 'remove_html' => false,
162
+
163
+ 'encode' => true,
164
+
165
+ 'dollar' => true,
166
+
167
+ 'carriage' => true,
168
+
169
+ 'unicode' => true,
170
+
171
+ 'escape' => true,
172
+
173
+ 'backslash' => true
174
+
175
+ );
176
+
177
+
178
+
179
+ if (is_array($data)) {
180
+
181
+ foreach ($data as $key => $val) {
182
+
183
+ $data[$key] = Sanitize::clean($val, $options);
184
+
185
+ }
186
+
187
+ return $data;
188
+
189
+ }
190
+
191
+
192
+
193
+ if ($options['odd_spaces']) {
194
+
195
+ $data = str_replace(chr(0xCA), '', $data);
196
+
197
+ }
198
+
199
+ if ($options['encode']) {
200
+
201
+ $data = Sanitize::html($data, array('remove' => $options['remove_html']));
202
+
203
+ }
204
+
205
+ if ($options['dollar']) {
206
+
207
+ $data = str_replace("\\\$", "$", $data);
208
+
209
+ }
210
+
211
+ if ($options['carriage']) {
212
+
213
+ $data = str_replace("\r", "", $data);
214
+
215
+ }
216
+
217
+ if ($options['unicode']) {
218
+
219
+ $data = preg_replace("/&amp;#([0-9]+);/s", "&#\\1;", $data);
220
+
221
+ }
222
+
223
+ if ($options['escape']) {
224
+
225
+ $data = Sanitize::escape($data, $options['connection']);
226
+
227
+ }
228
+
229
+ if ($options['backslash']) {
230
+
231
+ $data = preg_replace("/\\\(?!&amp;#|\?#)/", "\\", $data);
232
+
233
+ }
234
+
235
+ return $data;
236
+
237
+ }
238
+
239
+ ```

2

追記

2015/08/25 09:39

投稿

amakusa
amakusa

スコア176

test CHANGED
File without changes
test CHANGED
@@ -81,3 +81,43 @@
81
81
  }
82
82
 
83
83
  ```
84
+
85
+
86
+
87
+ View/Details/index.ctp
88
+
89
+ ```php
90
+
91
+ <div id="comment">
92
+
93
+ <?php echo "●管理側コメント" ?><br />
94
+
95
+ <?php
96
+
97
+ if (isset($comment)) {
98
+
99
+ echo "$comment";
100
+
101
+ } else {
102
+
103
+ echo "";
104
+
105
+ }
106
+
107
+ ?>
108
+
109
+ </div>
110
+
111
+
112
+
113
+ <form action="/details/update" method="post">
114
+
115
+ <textarea name="report_comment" cols=40 rows=4 maxlength=66></textarea>
116
+
117
+ <input type="hidden" name="report_id" value=<?php echo $reportId ?>>
118
+
119
+ <input id="reportcomment_submit" type="submit" value="更新"><input id="reportcomment_reset" type="reset" value="リセット">
120
+
121
+ </form>
122
+
123
+ ```

1

追記

2015/08/25 08:09

投稿

amakusa
amakusa

スコア176

test CHANGED
File without changes
test CHANGED
@@ -12,9 +12,9 @@
12
12
 
13
13
 
14
14
 
15
- おそらくはsanitizeしたところで文字化けしてしまっていると思うのですが、どうすれば解決できますでしょうか。
15
+ おそらくはsanitizeしたところで文字化けしてしまっていると思うのですが、どうすれば解決できますでしょうか。
16
16
 
17
- mb_convert_encodingは、これがないとかな入力による文字列の表示ができなかったので書き加えております。
17
+ mb_convert_encodingは、これがないとかな入力による文字列の表示ができなかったので書き加えております。
18
18
 
19
19
 
20
20
 
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
 
25
-
25
+ Controller/DetailsController.php
26
26
 
27
27
  ```php
28
28