[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> bug_actiongroup_ext.php (source)

   1  <?php
   2  # MantisBT - A PHP based bugtracking system
   3  
   4  # MantisBT is free software: you can redistribute it and/or modify
   5  # it under the terms of the GNU General Public License as published by
   6  # the Free Software Foundation, either version 2 of the License, or
   7  # (at your option) any later version.
   8  #
   9  # MantisBT is distributed in the hope that it will be useful,
  10  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  # GNU General Public License for more details.
  13  #
  14  # You should have received a copy of the GNU General Public License
  15  # along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * @package MantisBT
  19   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   *
  23   * @uses core.php
  24   * @uses authentication_api.php
  25   * @uses bug_api.php
  26   * @uses bug_group_action_api.php
  27   * @uses config_api.php
  28   * @uses form_api.php
  29   * @uses gpc_api.php
  30   * @uses helper_api.php
  31   * @uses html_api.php
  32   * @uses lang_api.php
  33   * @uses print_api.php
  34   * @uses string_api.php
  35   */
  36  
  37  /**
  38   * MantisBT Core API's
  39   */
  40  require_once ( 'core.php' );
  41  require_api( 'authentication_api.php' );
  42  require_api( 'bug_api.php' );
  43  require_api( 'bug_group_action_api.php' );
  44  require_api( 'config_api.php' );
  45  require_api( 'form_api.php' );
  46  require_api( 'gpc_api.php' );
  47  require_api( 'helper_api.php' );
  48  require_api( 'html_api.php' );
  49  require_api( 'lang_api.php' );
  50  require_api( 'print_api.php' );
  51  require_api( 'string_api.php' );
  52  
  53  auth_ensure_user_authenticated();
  54  
  55  helper_begin_long_process();
  56  
  57  $f_action = gpc_get_string( 'action' );
  58  $f_bug_arr    = gpc_get_int_array( 'bug_arr', array() );
  59  
  60  $t_action_include_file = 'bug_actiongroup_' . $f_action . '_inc.php';
  61  $t_form_name = 'bug_actiongroup_' . $f_action;
  62  
  63  form_security_validate( $t_form_name );
  64  
  65  require_once( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . $t_action_include_file );
  66  
  67  # group bugs by project
  68  $t_projects_bugs = array();
  69  foreach( $f_bug_arr as $t_bug_id ) {
  70      bug_ensure_exists( $t_bug_id );
  71      $t_bug = bug_get( $t_bug_id, true );
  72  
  73      if ( isset( $t_projects_bugs[$t_bug->project_id] ) ) {
  74        $t_projects_bugs[$t_bug->project_id][] = $t_bug_id;
  75      } else {
  76        $t_projects_bugs[$t_bug->project_id] = array( $t_bug_id );
  77      }
  78  }
  79  
  80  $t_failed_ids = array();
  81  
  82  foreach( $t_projects_bugs as $t_project_id => $t_bugs ) {
  83      $g_project_override = $t_project_id;
  84      foreach( $t_bugs as $t_bug_id ) {
  85          $t_fail_reason = bug_group_action_validate( $f_action, $t_bug_id );
  86          if( $t_fail_reason !== null ) {
  87              $t_failed_ids[$t_bug_id] = $t_fail_reason;
  88          }
  89          if( !isset( $t_failed_ids[$t_bug_id] ) ) {
  90              $t_fail_reason = bug_group_action_process( $f_action, $t_bug_id );
  91              if( $t_fail_reason !== null ) {
  92                  $t_failed_ids[$t_bug_id] = $t_fail_reason;
  93              }
  94          }
  95      }
  96  }
  97  
  98  $g_project_override = null;
  99  
 100  form_security_purge( $t_form_name );
 101  
 102  if ( count( $t_failed_ids ) > 0 ) {
 103      html_page_top();
 104  
 105      echo '<div>';
 106  
 107      $t_word_separator = lang_get( 'word_separator' );
 108      foreach( $t_failed_ids as $t_id => $t_reason ) {
 109          $label = sprintf( lang_get( 'label' ), string_get_bug_view_link( $t_id ) ) . $t_word_separator;
 110          printf("<p>%s%s</p>\n", $label, $t_reason );
 111      }
 112  
 113      print_bracket_link( 'view_all_bug_page.php', lang_get( 'proceed' ) );
 114      echo '</div>';
 115  
 116      html_page_bottom();
 117  } else {
 118      print_header_redirect( 'view_all_bug_page.php' );
 119  }


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7