/
set_project.php
69 lines (59 loc) · 2.16 KB
/
set_project.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2003 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
?>
<?php
require_once( 'core.php' );
$t_core_path = config_get( 'core_path' );
require_once( $t_core_path . 'current_user_api.php' );
?>
<?php #login_cookie_check() ?>
<?php
$f_project_id = gpc_get_int( 'project_id' );
$f_make_default = gpc_get_bool( 'make_default' );
$f_ref = gpc_get_string( 'ref', '' );
# Set default project
if ( $f_make_default ) {
current_user_set_default_project( $f_project_id );
}
helper_set_current_project( $f_project_id );
#@@@ we really need to make this more general... it is never intuitive
# to redirect to the main page as far as I can see. Is there a reason
# we can't just redirect back to the referrer in all cases? See
# issue #2686 about this... -jf
# redirect to 'same page' when switching projects.
# view_all_* pages, and summary
# for proxies that clear out HTTP_REFERER
if ( !is_blank( $f_ref ) ) {
$t_redirect_url = $f_ref;
} else if ( !isset( $_SERVER['HTTP_REFERER'] ) || is_blank( $_SERVER['HTTP_REFERER'] ) ) {
$t_redirect_url = 'main_page.php';
} else if ( eregi( 'view_all_bug_page.php', $_SERVER['HTTP_REFERER'] ) ){
$t_redirect_url = 'view_all_set.php?type=0';
} else if ( eregi( 'summary_page.php', $_SERVER['HTTP_REFERER'] ) ){
$t_redirect_url = 'summary_page.php';
} else if ( eregi( 'proj_user_menu_page.php', $_SERVER['HTTP_REFERER'] ) ){
$t_redirect_url = 'proj_user_menu_page.php';
} else if ( eregi( 'manage_page.php', $_SERVER['HTTP_REFERER'] ) ){
$t_redirect_url = 'manage_page.php';
} else {
$t_redirect_url = 'main_page.php';
}
print_header_redirect( $t_redirect_url );
?>
<?php print_page_top1() ?>
<?php
print_meta_redirect( $t_redirect_url );
?>
<?php print_page_top1() ?>
<br />
<div align="center">
<?php
echo lang_get( 'operation_successful' ).'<br />';
print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
?>
</div>
<?php print_page_bot1( __FILE__ ) ?>