[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> set_project.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: set_project.php,v 1.57.2.1 2007-10-13 22:34:30 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      require_once ( 'core.php' );
  26  
  27      $t_core_path = config_get( 'core_path' );
  28  
  29      require_once( $t_core_path.'current_user_api.php' );
  30  ?>
  31  <?php
  32      $f_project_id    = gpc_get_string( 'project_id' );
  33      $f_make_default    = gpc_get_bool  ( 'make_default' );
  34      $f_ref            = gpc_get_string( 'ref', '' );
  35      
  36      $c_ref = string_prepare_header( $f_ref );
  37  
  38      $t_project = split( ';', $f_project_id );
  39      $t_top     = $t_project[0];
  40      $t_bottom  = $t_project[ count( $t_project ) - 1 ];
  41  
  42      if ( ALL_PROJECTS != $t_bottom ) {
  43          project_ensure_exists( $t_bottom );
  44      }
  45  
  46      # Set default project
  47      if ( $f_make_default ) {
  48          current_user_set_default_project( $t_top );
  49      }
  50  
  51      helper_set_current_project( $f_project_id );
  52  
  53      # redirect to 'same page' when switching projects.
  54  
  55      # for proxies that clear out HTTP_REFERER
  56      if ( !is_blank( $c_ref ) ) {
  57          $t_redirect_url = $c_ref;
  58      } else if ( !isset( $_SERVER['HTTP_REFERER'] ) || is_blank( $_SERVER['HTTP_REFERER'] ) ) {
  59          $t_redirect_url = config_get( 'default_home_page' );
  60      } else {
  61          $t_home_page = config_get( 'default_home_page' );
  62  
  63          # Check that referrer matches our address after squashing case (case insensitive compare)
  64          $t_path = config_get( 'path' );
  65          if ( strtolower( $t_path ) == strtolower( substr( $_SERVER['HTTP_REFERER'], 0, strlen( $t_path ) ) ) ) {
  66              $t_referrer_page = substr( $_SERVER['HTTP_REFERER'], strlen( $t_path ) );
  67              # if view_all_bug_page, pass on filter    
  68              if ( eregi( 'view_all_bug_page.php', $t_referrer_page ) ) {
  69                  $t_source_filter_id = filter_db_get_project_current( $f_project_id );
  70                  $t_redirect_url = 'view_all_set.php?type=4';
  71  
  72                  if ( $t_source_filter_id !== null ) {
  73                      $t_redirect_url = 'view_all_set.php?type=3&amp;source_query_id=' . $t_source_filter_id;
  74                  }
  75              } else if ( eregi( '_page.php', $t_referrer_page ) ) {
  76                  # get just the page component
  77                  if ( strpos( $t_referrer_page, '?' ) !== FALSE ) {
  78                      list( $t_path, $t_param ) = split( '\?', $t_referrer_page, 2 );
  79                  } else {
  80                      $t_path = $t_referrer_page;
  81                      $t_param = '';
  82                  } 
  83                          
  84                  switch ($t_path ) {
  85                      case 'bug_view_advanced_page.php':
  86                      case 'bug_update_page.php':
  87                      case 'bug_update_advanced_page.php':
  88                      case 'bug_change_status_page.php':
  89                          $t_path = $t_home_page;
  90                          break;
  91                      default:                    
  92                          break;
  93                  }
  94                  $t_redirect_url = $t_path;
  95              } else {
  96                  $t_redirect_url = $t_home_page;
  97              }
  98          } else {
  99              $t_redirect_url = $t_home_page;
 100          }
 101      }
 102  
 103      print_header_redirect( $t_redirect_url, true, true );
 104  ?>
 105  <?php html_page_top1() ?>
 106  <?php
 107      html_meta_redirect( $t_redirect_url );
 108  ?>
 109  <?php html_page_top1() ?>
 110  
 111  <br />
 112  <div align="center">
 113  <?php
 114      echo lang_get( 'operation_successful' ).'<br />';
 115  
 116      print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
 117  ?>
 118  </div>
 119  
 120  <?php html_page_bottom1( __FILE__ ) ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics