Skip to content

Commit

Permalink
Fixed poential problems with proxies and HTTP_REFERER not being prope…
Browse files Browse the repository at this point in the history
…rly sent.

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@591 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Dec 31, 2001
1 parent ae6f718 commit 75216cf
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 41 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -2,6 +2,7 @@ Mantis

01.01.2001 - 0.17.0

* Fixed poential problems with proxies and HTTP_REFERER not being properly sent.
* Modified many files for extensive use of CSS.
* Modified BLOB field to LONGBLOB.
* Added view by page feature.
Expand Down
7 changes: 5 additions & 2 deletions bug_assign.php3
Expand Up @@ -30,14 +30,17 @@

### send assigned to email
email_assign( $f_id );

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id );
?>
<? print_html_top() ?>
<? print_head_top() ?>
<? print_title( $g_window_title ) ?>
<? print_css( $g_css_include_file ) ?>
<?
if ( $result ) {
print_meta_redirect( $HTTP_REFERER, $g_wait_time );
print_meta_redirect( $t_redirect_url, $g_wait_time );
}
?>
<? include( $g_meta_include_file ) ?>
Expand All @@ -56,7 +59,7 @@
print_sql_error( $query );
}

print_bracket_link( $HTTP_REFERER, $s_proceed );
print_bracket_link( $t_redirect_url, $s_proceed );
?>
</div>

Expand Down
7 changes: 5 additions & 2 deletions bug_file_add.php3
Expand Up @@ -42,6 +42,9 @@
}
$result = db_query( $query );
}

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id );
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand All @@ -50,7 +53,7 @@
<? include( $g_meta_include_file ) ?>
<?
if ( $result ) {
print_meta_redirect( $HTTP_REFERER, $g_wait_time );
print_meta_redirect( $t_redirect_url, $g_wait_time );
}
?>
<? print_head_bottom() ?>
Expand All @@ -68,7 +71,7 @@
print_sql_error( $query );
}

print_bracket_link( $HTTP_REFERER, $s_proceed );
print_bracket_link( $t_redirect_url, $s_proceed );
?>
</div>

Expand Down
15 changes: 2 additions & 13 deletions bug_update.php3
Expand Up @@ -88,19 +88,8 @@
break;
}

switch ( $g_show_view ) {
case 0: if ( get_current_user_pref_field( "advanced_view" )==1 ) {
$t_redirect_url = $g_view_bug_page;
} else {
$t_redirect_url = $g_view_bug_advanced_page;
}
break;
case 1: $t_redirect_url = $g_view_bug_page;
break;
case 2: $t_redirect_url = $g_view_bug_advanced_page;
break;
}
$t_redirect_url = $t_redirect_url."?f_id=".$f_id;
# Determine which view page to redirect back to.
$t_redirect_url = get_update_redirect_url( $f_id );

if (( $g_quick_proceed == 1 )&&( $result )) {
print_header_redirect( $t_redirect_url );
Expand Down
7 changes: 5 additions & 2 deletions bugnote_delete.php3
Expand Up @@ -35,14 +35,17 @@
FROM $g_mantis_bugnote_text_table
WHERE id='$t_bugnote_text_id'";
$result = db_query($query);

# Determine which view page to redirect back to.
$t_redirect_url = get_view_redirect_url( $f_id );
?>
<? print_html_top() ?>
<? print_head_top() ?>
<? print_title( $g_window_title ) ?>
<? print_css( $g_css_include_file ) ?>
<?
if ( $result ) {
print_meta_redirect( $HTTP_REFERER, $g_wait_time );
print_meta_redirect( $t_redirect_url, $g_wait_time );
}
?>
<? include( $g_meta_include_file ) ?>
Expand All @@ -61,7 +64,7 @@
print_sql_error( $query );
}

print_bracket_link( $HTTP_REFERER, $s_proceed );
print_bracket_link( $t_redirect_url, $s_proceed );
?>
</div>

Expand Down
69 changes: 65 additions & 4 deletions core_helper_API.php
Expand Up @@ -286,6 +286,7 @@ function get_bugnote_count( $p_id ) {
return db_result( $result, 0 );
}
### --------------------
# Returns the name of the project
function get_project_name( $p_project_id ) {
global $g_mantis_project_table;

Expand All @@ -295,8 +296,68 @@ function get_project_name( $p_project_id ) {
$result = db_query( $query );
return db_result( $result, 0, 0 );
}
### --------------------
###########################################################################
### END ###
###########################################################################
# --------------------
# Some proxies strip out HTTP_REFERER.
# This function helps determine which pages to redirect to
# based on site and user preference.
function get_view_redirect_url( $p_bug_id ) {
global $HTTP_REFERER, $g_show_view, $g_view_bug_page, $g_view_bug_advanced_page;

if ( ( !isset( $HTTP_REFERER ) ) || ( empty( $HTTP_REFERER )) ) {
switch ( $g_show_view ) {
case 0: if ( 1 == get_current_user_pref_field( "advanced_view" ) ) {
return $g_view_bug_page."?f_id=".$p_bug_id;
} else {
return $g_view_bug_advanced_page."?f_id=".$p_bug_id;
}
case 1: return $g_view_bug_page."?f_id=".$p_bug_id;
case 2: return $g_view_bug_advanced_page."?f_id=".$p_bug_id;
default:return $g_view_bug_page."?f_id=".$p_bug_id;
}
} else {
return $HTTP_REFERER;
}
}
# --------------------
# Some proxies strip out HTTP_REFERER.
# This function helps determine which pages to redirect to
# based on site and user preference.
function get_update_redirect_url( $p_bug_id ) {
global $g_show_view, $g_view_bug_page, $g_view_bug_advanced_page;

switch ( $g_show_view ) {
case 0: if ( 1 == get_current_user_pref_field( "advanced_view" ) ) {
return $g_view_bug_page."?f_id=".$p_bug_id;
} else {
return $g_view_bug_advanced_page."?f_id=".$p_bug_id;
}
case 1: return $g_view_bug_page."?f_id=".$p_bug_id;
case 2: return $g_view_bug_advanced_page."?f_id=".$p_bug_id;
default:return $g_view_bug_page."?f_id=".$p_bug_id;
}
}
# --------------------
# Some proxies strip out HTTP_REFERER.
# This function helps determine which pages to redirect to
# based on site and user preference.
function get_report_redirect_url() {
global $HTTP_REFERER, $g_show_report, $g_report_bug_page, $g_report_bug_advanced_page;

if ( ( !isset( $HTTP_REFERER ) ) || ( empty( $HTTP_REFERER )) ) {
switch( $g_show_report ) {
case 0: if ( 1 == get_current_user_pref_field( "advanced_report" ) ) {
return $g_report_bug_advanced_page;
} else {
return $g_report_bug_page;
}
case 1: return $g_report_bug_page;
case 2: return $g_report_bug_advanced_page;
default:return $g_report_bug_page;
}
} else {
return $HTTP_REFERER;
}
}
# --------------------
# END
?>
19 changes: 2 additions & 17 deletions report_add.php3
Expand Up @@ -156,23 +156,8 @@
}
}

# for proxies that clear out HTTP_REFERER
if ( ( !isset( $HTTP_REFERER ) ) OR ( empty( $HTTP_REFERER )) ) {
switch( $g_show_report ) {
case 0: if ( get_current_user_pref_field( "advanced_report" )==1 ) {
$t_redirect_url = $g_report_bug_advanced_page;
} else {
$t_redirect_url = $g_report_bug_page;
}
break;
case 1: $t_redirect_url = $g_report_bug_page;
break;
case 2: $t_redirect_url = $g_report_bug_advanced_page;
break;
}
} else {
$t_redirect_url = $HTTP_REFERER;
}
# Determine which report page to redirect back to.
$t_redirect_url = get_report_redirect_url();
?>
<? print_html_top() ?>
<? print_head_top() ?>
Expand Down
3 changes: 2 additions & 1 deletion set_project.php3
Expand Up @@ -29,8 +29,9 @@

# redirect to 'same page' when switching projects.
# view_all_* pages, and summary
# for proxies that clear out HTTP_REFERER
if ( $valid_project==1 ) {
if ( !isset( $HTTP_REFERER ) ) {
if ( !isset( $HTTP_REFERER ) || empty( $HTTP_REFERER ) ) {
$t_redirect_url = $g_main_page;
} else if ( eregi( $g_view_all_bug_page,$HTTP_REFERER ) ){
$t_redirect_url = $g_view_all_bug_page;
Expand Down

0 comments on commit 75216cf

Please sign in to comment.