Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class suspendedUserFilter extends sfFilter{
- /**
- * executes the filter. This filter will determine if a
- * request should be http or https and will redirect as such
- *
- * @param sfFilterChain $filterChain the current symfony filter chain
- * @return boolean redirect status
- */
- public function execute( $filterChain ){
- //only run once per request
- if( $this->isFirstCall() ){
- $request = $this->getContext()->getRequest();
- //only filter is the request is get or head
- if( $request->isMethod( 'get' ) || $request->isMethod( 'head' ) ){
- $controller = $this->getContext()->getController();
- $stackEntry = $controller->getActionStack()->getLastEntry();
- $module = $stackEntry->getModuleName();
- $action = $stackEntry->getActionName();
- if ($this->getContext()->getUser()->getGuardUser()->getStatus() == "suspended")
- {
- $this->getContext()->getUser()->setFlash('account_suspended', "blah");
- return $controller->forward('account', 'billing');
- }
- }
- }
- //no redirect necessary, continue the filter chain
- $filterChain->execute();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement