[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> bug_actiongroup_ext.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: bug_actiongroup_ext.php,v 1.1.2.1 2007-10-13 22:32:32 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      require_once ( 'core.php' );
  25  
  26      $t_core_path = config_get( 'core_path' );
  27  
  28      require_once ( $t_core_path . 'bug_api.php' );
  29      require_once( $t_core_path . 'bug_group_action_api.php' );
  30  
  31      auth_ensure_user_authenticated();
  32  
  33      helper_begin_long_process();
  34  
  35      $f_action = gpc_get_string( 'action' );
  36      $f_bug_arr    = gpc_get_int_array( 'bug_arr', array() );
  37  
  38      $t_action_include_file = 'bug_actiongroup_' . $f_action . '_inc.php';
  39  
  40      require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . $t_action_include_file );
  41      
  42      # group bugs by project
  43      $t_projects_bugs = array();
  44      foreach( $f_bug_arr as $t_bug_id ) {
  45          bug_ensure_exists( $t_bug_id );
  46          $t_bug = bug_get( $t_bug_id, true );
  47          
  48          if ( isset( $t_projects_bugs[$t_bug->project_id] ) ) {
  49            $t_projects_bugs[$t_bug->project_id][] = $t_bug_id;
  50          } else {
  51            $t_projects_bugs[$t_bug->project_id] = array( $t_bug_id );
  52          }
  53      }
  54    
  55      $t_failed_ids = array();
  56      
  57      # validate all bugs before we start the processing, we may fail the whole action
  58      # group, or some of the bugs.
  59      foreach( $t_projects_bugs as $t_project_id => $t_bug_ids ) {
  60          if ( $t_bug->project_id != helper_get_current_project() ) {
  61              # in case the current project is not the same project of the bug we are viewing...
  62              # ... override the current project. This to avoid problems with categories and handlers lists etc.
  63              $g_project_override = $t_bug->project_id;
  64              # @@@ (thraxisp) the next line goes away if the cache was smarter and used project
  65              config_flush_cache(); # flush the config cache so that configs are refetched
  66          }
  67  
  68          foreach( $t_bug_ids as $t_bug_id ) {
  69              $t_result = bug_group_action_validate( $f_action, $t_bug_id );
  70              if ( $t_result !== true ) {
  71                  foreach( $t_result as $t_key => $t_value ) {
  72                      $t_failed_ids[$t_key] = $t_value;
  73                  }
  74              }
  75          }
  76      }
  77  
  78      # process bugs that are not already failed by validation.
  79      foreach( $t_projects_bugs as $t_project_id => $t_bug_ids ) {
  80          if ( $t_bug->project_id != helper_get_current_project() ) {
  81              # in case the current project is not the same project of the bug we are viewing...
  82              # ... override the current project. This to avoid problems with categories and handlers lists etc.
  83              $g_project_override = $t_bug->project_id;
  84              # @@@ (thraxisp) the next line goes away if the cache was smarter and used project
  85              config_flush_cache(); # flush the config cache so that configs are refetched
  86          }
  87  
  88          foreach( $t_bug_ids as $t_bug_id ) {
  89              # do not process this bug if validation failed for it.
  90              if ( !isset( $t_failed_ids[$t_bug_id] ) ) {
  91                  $t_result = bug_group_action_process( $f_action, $t_bug_id );
  92                  if ( $t_result !== true ) {
  93                      $t_failed_ids[] = $t_result;
  94                  }
  95              }
  96          }
  97      }
  98  
  99      $t_redirect_url = 'view_all_bug_page.php';
 100  
 101      if ( count( $t_failed_ids ) > 0 ) {
 102          html_page_top1();
 103          html_page_top2();
 104  
 105          echo '<div align="center">';
 106          foreach( $t_failed_ids as $t_id => $t_reason ) {
 107              printf("<p>%s: %s</p>\n", string_get_bug_view_link( $t_id ), $t_reason );
 108          }
 109  
 110          print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
 111          echo '</div>';
 112  
 113          html_page_bottom1( __FILE__ );
 114      } else {
 115          print_header_redirect( $t_redirect_url );
 116      }
 117  ?>


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