From: <jfi...@us...> - 2002-09-05 23:44:38
|
Update of /cvsroot/mantisbt/mantisbt In directory usw-pr-cvs1:/tmp/cvs-serv12159 Modified Files: set_project.php Log Message: clean up set_project.php Index: set_project.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/set_project.php,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- set_project.php 3 Sep 2002 02:41:50 -0000 1.23 +++ set_project.php 5 Sep 2002 23:44:34 -0000 1.24 @@ -8,22 +8,13 @@ <?php require_once( 'core.php' ) ?> <?php #login_cookie_check() ?> <?php - $valid_project = 1; - # Check for invalid project_id selection - $c_project_id = (integer)$f_project_id; - if ( empty( $f_project_id ) ) { - $valid_project = 0; - } - - check_varset( $f_ref, '' ); + $f_project_id = gpc_get_int( 'f_project_id' ); + $f_make_default = gpc_get_bool( 'f_make_default' ); + $f_ref = gpc_get_string( 'f_ref', '' ); # Set default project - if ( isset( $f_make_default ) ) { - $t_user_id = current_user_get_field( 'id' ); - $query = "UPDATE $g_mantis_user_pref_table - SET default_project='$c_project_id' - WHERE user_id='$t_user_id'"; - $result = db_query( $query ); + if ( $f_make_default ) { + current_user_set_default_project( $f_project_id ); } # Add item @@ -32,29 +23,24 @@ # redirect to 'same page' when switching projects. # view_all_* pages, and summary # for proxies that clear out HTTP_REFERER - if ( 1 == $valid_project ) { - if ( !isset( $HTTP_REFERER ) || empty( $HTTP_REFERER ) ) { - $t_redirect_url = 'main_page.php'; - } else if ( eregi( 'view_all_bug_page.php', $HTTP_REFERER ) ){ - $t_redirect_url = 'view_all_set.php?f_type=0'; - } else if ( eregi( 'summary_page.php', $HTTP_REFERER ) ){ - $t_redirect_url = 'summary_page.php'; - } else if ( eregi( 'proj_user_menu_page.php', $HTTP_REFERER ) ){ - $t_redirect_url = 'proj_user_menu_page.php'; - } else { - $t_redirect_url = 'main_page.php'; - } - } - if ( !empty( $f_ref ) ) { $t_redirect_url = $f_ref; + } else if ( !isset( $_SERVER['HTTP_REFERER'] ) || empty( $_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?f_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 { + $t_redirect_url = 'main_page.php'; } # clear view filter between projects setcookie( $g_view_all_cookie, '', -1, $g_cookie_path ); - if ( $result ) { - print_header_redirect( $t_redirect_url ); - } + + print_header_redirect( $t_redirect_url ); ?> <?php print_page_top1() ?> <?php @@ -65,13 +51,9 @@ <br /> <div align="center"> <?php - if ( 1 == $valid_project ) { # SUCCESS - PRINT $s_operation_successful.'<br />'; - } else { # FAILURE - echo $s_valid_project_msg; - } + echo lang_get( 'operation_successful' ).'<br />'; - print_bracket_link( $t_redirect_url, $s_proceed ); + print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) ); ?> </div> |