Guest

John Reese

By: a guest on Jun 21st, 2010  |  syntax: Diff  |  size: 5.53 KB  |  hits: 264  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. From 924bbbb0506a6877f21b764d9c27d4bd3a77b905 Mon Sep 17 00:00:00 2001
  2. From: John Reese <JohnMichael.Reese@ge.com>
  3. Date: Mon, 21 Jun 2010 13:43:58 -0400
  4. Subject: [PATCH 2/3] Migrate from existing usages to form_action_self()
  5.  
  6. ---
  7.  billing_inc.php                       |    2 +-
  8.  bugnote_stats_inc.php                 |    2 +-
  9.  core/authentication_api.php           |    2 +-
  10.  core/helper_api.php                   |    2 +-
  11.  manage_config_email_page.php          |    2 +-
  12.  manage_config_work_threshold_page.php |    2 +-
  13.  manage_config_workflow_page.php       |    2 +-
  14.  7 files changed, 7 insertions(+), 7 deletions(-)
  15.  
  16. diff --git a/billing_inc.php b/billing_inc.php
  17. index 9a10ada..a4d13f8 100644
  18. --- a/billing_inc.php
  19. +++ b/billing_inc.php
  20. @@ -72,7 +72,7 @@ if ( !config_get('time_tracking_enabled') )
  21.         }
  22.  
  23.  ?>
  24. -<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
  25. +<form method="post" action="<?php echo form_action_self() ?>">
  26.  <?php # CSRF protection not required here - form does not result in modifications ?>
  27.  <input type="hidden" name="id" value="<?php echo isset( $f_bug_id ) ? $f_bug_id : 0 ?>" />
  28.  <table border="0" class="width100" cellspacing="0">
  29. diff --git a/bugnote_stats_inc.php b/bugnote_stats_inc.php
  30. index 6e8e666..4e51b7e 100644
  31. --- a/bugnote_stats_inc.php
  32. +++ b/bugnote_stats_inc.php
  33. @@ -61,7 +61,7 @@ if ( ON != config_get('time_tracking_enabled') ) {
  34.  
  35.         $f_get_bugnote_stats_button = gpc_get_string( 'get_bugnote_stats_button', '' );
  36.  ?>
  37. -<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME'] ?>">
  38. +<form method="post" action="<?php echo form_action_self() ?>">
  39.  <?php # CSRF protection not required here - form does not result in modifications ?>
  40.  <input type="hidden" name="id" value="<?php echo $f_bug_id ?>" />
  41.  <table border=0 class="width100" cellspacing="0">
  42. diff --git a/core/authentication_api.php b/core/authentication_api.php
  43. index 957e265..32961f1 100644
  44. --- a/core/authentication_api.php
  45. +++ b/core/authentication_api.php
  46. @@ -674,7 +674,7 @@ function auth_reauthenticate_page( $p_user_id, $p_username ) {
  47.         }
  48.         ?>
  49.  </p>
  50. -<form name="reauth_form" method="post" action="<?php echo string_sanitize_url( $_SERVER['SCRIPT_NAME'] );?>">
  51. +<form name="reauth_form" method="post" action="<?php echo form_action_self();?>">
  52.  <?php
  53.         # CSRF protection not required here - user needs to enter password
  54.         # (confirmation step) before the form is accepted.
  55. diff --git a/core/helper_api.php b/core/helper_api.php
  56. index 21131cd..5731e63 100644
  57. --- a/core/helper_api.php
  58. +++ b/core/helper_api.php
  59. @@ -289,7 +289,7 @@ function helper_ensure_confirmed( $p_message, $p_button_label ) {
  60.         print_hr();
  61.         echo "\n$p_message\n";
  62.  
  63. -       echo '<form method="post" action="' . $_SERVER['SCRIPT_NAME'] . "\">\n";
  64. +       echo '<form method="post" action="' . form_action_self() . "\">\n";
  65.         # CSRF protection not required here - user needs to confirm action
  66.         # before the form is accepted.
  67.         print_hidden_inputs( gpc_strip_slashes( $_POST ) );
  68. diff --git a/manage_config_email_page.php b/manage_config_email_page.php
  69. index 918e2e8..b5b4295 100644
  70. --- a/manage_config_email_page.php
  71. +++ b/manage_config_email_page.php
  72. @@ -286,7 +286,7 @@
  73.                         echo form_security_field( 'manage_config_revert' );
  74.                         echo "<input name=\"revert\" type=\"hidden\" value=\"notify_flags,default_notify_flags\"></input>";
  75.                         echo "<input name=\"project\" type=\"hidden\" value=\"$t_project\"></input>";
  76. -                       echo "<input name=\"return\" type=\"hidden\" value=\"" . string_sanitize_url( $_SERVER['SCRIPT_NAME'] ) ."\"></input>";
  77. +                       echo "<input name=\"return\" type=\"hidden\" value=\"" . form_action_self() ."\"></input>";
  78.                         echo "<input type=\"submit\" class=\"button\" value=\"";
  79.                         if ( ALL_PROJECTS == $t_project ) {
  80.                  echo lang_get( 'revert_to_system' );
  81. diff --git a/manage_config_work_threshold_page.php b/manage_config_work_threshold_page.php
  82. index 42bdcb8..a91d220 100644
  83. --- a/manage_config_work_threshold_page.php
  84. +++ b/manage_config_work_threshold_page.php
  85. @@ -326,7 +326,7 @@
  86.                 echo form_security_field( 'manage_config_revert' );
  87.          echo "<input name=\"revert\" type=\"hidden\" value=\"" . implode( ',', $t_overrides ) . "\"></input>";
  88.          echo "<input name=\"project\" type=\"hidden\" value=\"$t_project_id\"></input>";
  89. -        echo "<input name=\"return\" type=\"hidden\" value=\"" . string_sanitize_url( $_SERVER['SCRIPT_NAME'] ) ."\"></input>";
  90. +        echo "<input name=\"return\" type=\"hidden\" value=\"" . form_action_self() ."\"></input>";
  91.          echo "<input type=\"submit\" class=\"button\" value=\"";
  92.          if ( ALL_PROJECTS == $t_project_id ) {
  93.              echo lang_get( 'revert_to_system' );
  94. diff --git a/manage_config_workflow_page.php b/manage_config_workflow_page.php
  95. index 5f1b191..53c426a 100644
  96. --- a/manage_config_workflow_page.php
  97. +++ b/manage_config_workflow_page.php
  98. @@ -477,7 +477,7 @@
  99.                         echo form_security_field( 'manage_config_revert' );
  100.              echo "<input name=\"revert\" type=\"hidden\" value=\"" . implode( ',', $t_overrides ) . "\"></input>";
  101.              echo "<input name=\"project\" type=\"hidden\" value=\"$t_project\"></input>";
  102. -            echo "<input name=\"return\" type=\"hidden\" value=\"" . string_sanitize_url( $_SERVER['SCRIPT_NAME'] ) ."\"></input>";
  103. +            echo "<input name=\"return\" type=\"hidden\" value=\"" . form_action_self() ."\"></input>";
  104.              echo "<input type=\"submit\" class=\"button\" value=\"";
  105.              if ( ALL_PROJECTS == $t_project ) {
  106.                  echo lang_get( 'revert_to_system' );
  107. --
  108. 1.7.0.4