function fp_goto

7.x misc.inc fp_goto($path, $query = "")
6.x misc.inc fp_goto($path, $query = "")
4.x misc.inc fp_goto($path, $query = "")
5.x misc.inc fp_goto($path, $query = "")

Redirect the user's browser to the specified internal path + query.

We will automatically add the current_student_id variable, if it is not present in the query.

Example uses:

43 calls to fp_goto()
admin_edit_degree_form_submit in modules/admin/admin.degrees.inc
admin_edit_group_form_submit in modules/admin/admin.groups.inc
advise_display_history in modules/advise/advise.history.inc
Displays the history tab on screen.
advise_init_screen in modules/advise/advise.module
advise_perform_clear_advising_cache in modules/advise/advise.module
From menu hook. Clear just the advising cache.

... See full list

File

includes/misc.inc, line 2229
This file contains misc functions for FlightPath

Code

function fp_goto($path, $query = "") {
  global $current_student_id;


  // Were we sent an array instead of separate values?  That's OK if so, let's separate them back out.
  if (is_array($path)) {
    $path = @$path [0];
    $query = (string) @$path [1];

  }


  if ($current_student_id != "" && !strstr($query, "current_student_id=")) {
    // If the query doesn't contain the current_student_id, then add it in.
    $query .= "&current_student_id=$current_student_id";
  }

  // Close the seesion before we try to redirect.
  session_write_close();

  if ($path == "<front>") {
    $path = variable_get("front_page", "main");
  }

  $location = fp_url($path, $query);


  if (str_starts_with($path, "http://") || str_starts_with($path, "https://")) {
    // We are going to an external address.
    if (str_starts_with($query, "&")) {
      // Need to add ? to the query.
      $query = "?fprnd=" . mt_rand(9, 999999) . $query;
    }
    $location = $path . $query;
  }


  header('Location: ' . $location);
  exit();

}