Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php
  2. class suspendedUserFilter extends sfFilter{
  3.  
  4. /**
  5. * executes the filter. This filter will determine if a
  6. * request should be http or https and will redirect as such
  7. *
  8. * @param sfFilterChain $filterChain the current symfony filter chain
  9. * @return boolean redirect status
  10. */
  11. public function execute( $filterChain ){
  12. //only run once per request
  13. if( $this->isFirstCall() ){
  14. $request = $this->getContext()->getRequest();
  15. //only filter is the request is get or head
  16. if( $request->isMethod( 'get' ) || $request->isMethod( 'head' ) ){
  17. $controller = $this->getContext()->getController();
  18. $stackEntry = $controller->getActionStack()->getLastEntry();
  19. $module = $stackEntry->getModuleName();
  20. $action = $stackEntry->getActionName();
  21. if ($this->getContext()->getUser()->getGuardUser()->getStatus() == "suspended")
  22. {
  23. $this->getContext()->getUser()->setFlash('account_suspended', "blah");
  24. return $controller->forward('account', 'billing');
  25. }
  26. }
  27. }
  28. //no redirect necessary, continue the filter chain
  29. $filterChain->execute();
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement