how to perfom a task before the current action is called?

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

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.

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

Thank you for your replies.

I extended CHttpRequest and it works like a charm.

Thanks a lot.

me23