Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. /**
  2. *
  3. * @param array $errors : optional assign it to
  4. * @param string $target : url for redirect of the request
  5. */
  6. protected function forwardRequest(array $errors = null, $target = null) {
  7. //check for given target and try to fall back to previous page if needed
  8. if ($target == null) {
  9. if (!isset($_REQUEST[self::PAGE])) {
  10. throw new Exception('Missing target for forward.');
  11. }
  12. $target = $_REQUEST[self::PAGE];
  13. }
  14. //forward request to target
  15. // optional - add errors to redirect and process them in view
  16. if (count($errors) > 0)
  17. $target .= '&errors=' . urlencode(serialize($errors));
  18. header('location: ' . $target);
  19. exit();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement