function print_header_redirect($p_url, $p_die = true, $p_sanitize = false, $p_absolute = false) { $t_use_iis = config_get('use_iis'); if (ON == config_get_global('stop_on_errors') && error_handled()) { return false; } # validate the url as part of this site before continuing if ($p_absolute) { if ($p_sanitize) { $t_url = string_sanitize_url($p_url); } else { $t_url = $p_url; } } else { if ($p_sanitize) { $t_url = string_sanitize_url($p_url, true); } else { $t_url = config_get('path') . $p_url; } } $t_url = string_prepare_header($t_url); # don't send more headers if they have already been sent (guideweb) if (!headers_sent()) { header('Content-Type: text/html; charset=utf-8'); if (ON == $t_use_iis) { header("Refresh: 0;url={$t_url}"); } else { header("Location: {$t_url}"); } } else { trigger_error(ERROR_PAGE_REDIRECTION, ERROR); return false; } if ($p_die) { die; # additional output can cause problems so let's just stop output here } return true; }
require_api('config_api.php'); require_api('constant_inc.php'); require_api('current_user_api.php'); require_api('filter_api.php'); require_api('gpc_api.php'); require_api('helper_api.php'); require_api('html_api.php'); require_api('lang_api.php'); require_api('print_api.php'); require_api('project_api.php'); require_api('string_api.php'); require_api('utility_api.php'); $f_project_id = gpc_get_string('project_id'); $f_make_default = gpc_get_bool('make_default'); $f_ref = gpc_get_string('ref', ''); $c_ref = string_prepare_header($f_ref); $t_project = explode(';', $f_project_id); $t_top = $t_project[0]; $t_bottom = $t_project[count($t_project) - 1]; if (ALL_PROJECTS != $t_bottom) { project_ensure_exists($t_bottom); } # Set default project if ($f_make_default) { current_user_set_default_project($t_top); } helper_set_current_project($f_project_id); # redirect to 'same page' when switching projects. # for proxies that clear out HTTP_REFERER if (!is_blank($c_ref)) { $t_redirect_url = $c_ref;
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with MantisBT. If not, see <http://www.gnu.org/licenses/>. /** * Check to see if cookies are working * * @package MantisBT * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org * @copyright Copyright (C) 2002 - 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net * @link http://www.mantisbt.org */ /** * MantisBT Core API's */ require_once 'core.php'; if (auth_is_user_authenticated()) { $f_return = gpc_get_string('return'); $c_return = string_prepare_header($f_return); # If this is the first login for an instance, then redirect to create project page. # Use lack of projects as a hint for such scenario. if (is_blank($f_return) || $f_return == 'index.php') { if (current_user_is_administrator() && project_table_empty()) { $c_return = 'manage_proj_create_page.php'; } } $t_redirect_url = $c_return; } else { $t_redirect_url = 'login_page.php?cookie_error=1'; } print_header_redirect($t_redirect_url, true, true);