me23
(Yii)
November 28, 2008, 9:59am
1
Hello,
how do i perfom some tasks before the current action is called?
For example i like to purify all User-Inputs from $_POST and $_GET through
CHtmlPurifier right after the Application has started and before the current
action is processed.
Or are there better approaches to achieve this?
Thank you
me23
qiang
(Qiang Xue)
November 28, 2008, 11:57am
2
You can write a filter for this purpose. Or if you want to do it even earlier, you can extend CHttpRequest and override its normalizeRequest() method.
notzippy
(Notzippy)
November 28, 2008, 2:21pm
3
There is also a beforeAction() method you can override, it is called after the filter but before the target action (there is also an afterAction but I doubt you will need that
nz
me23
(Yii)
November 28, 2008, 4:46pm
4
Thank you for your replies.
I extended CHttpRequest and it works like a charm.
Thanks a lot.
me23