[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> bug_reminder.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   * This page allows an authorized user to send a reminder by email to another user
  19   *
  20   * @package MantisBT
  21   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  22   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  23   * @link http://www.mantisbt.org
  24   *
  25   * @uses core.php
  26   * @uses access_api.php
  27   * @uses bug_api.php
  28   * @uses bugnote_api.php
  29   * @uses config_api.php
  30   * @uses constant_inc.php
  31   * @uses email_api.php
  32   * @uses error_api.php
  33   * @uses form_api.php
  34   * @uses gpc_api.php
  35   * @uses helper_api.php
  36   * @uses html_api.php
  37   * @uses lang_api.php
  38   * @uses print_api.php
  39   * @uses string_api.php
  40   */
  41  
  42  /**
  43   * MantisBT Core API's
  44   */
  45  require_once ( 'core.php' );
  46  require_api( 'access_api.php' );
  47  require_api( 'bug_api.php' );
  48  require_api( 'bugnote_api.php' );
  49  require_api( 'config_api.php' );
  50  require_api( 'constant_inc.php' );
  51  require_api( 'email_api.php' );
  52  require_api( 'error_api.php' );
  53  require_api( 'form_api.php' );
  54  require_api( 'gpc_api.php' );
  55  require_api( 'helper_api.php' );
  56  require_api( 'html_api.php' );
  57  require_api( 'lang_api.php' );
  58  require_api( 'print_api.php' );
  59  require_api( 'string_api.php' );
  60  
  61  form_security_validate( 'bug_reminder' );
  62  
  63  $f_bug_id        = gpc_get_int( 'bug_id' );
  64  $f_to            = gpc_get_int_array( 'to' );
  65  $f_body            = gpc_get_string( 'body' );
  66  
  67  $t_bug = bug_get( $f_bug_id, true );
  68  if( $t_bug->project_id != helper_get_current_project() ) {
  69      # in case the current project is not the same project of the bug we are viewing...
  70      # ... override the current project. This to avoid problems with categories and handlers lists etc.
  71      $g_project_override = $t_bug->project_id;
  72  }
  73  
  74  if ( bug_is_readonly( $f_bug_id ) ) {
  75      error_parameters( $f_bug_id );
  76      trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
  77  }
  78  
  79  access_ensure_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id );
  80  
  81  # Automically add recipients to monitor list if they are above the monitor
  82  # threshold, option is enabled, and not reporter or handler.
  83  foreach ( $f_to as $t_recipient )
  84  {
  85      if ( ON == config_get( 'reminder_recipients_monitor_bug' ) &&
  86          access_has_bug_level( config_get( 'monitor_bug_threshold' ), $f_bug_id ) &&
  87          !bug_is_user_handler( $f_bug_id, $t_recipient ) &&
  88          !bug_is_user_reporter( $f_bug_id, $t_recipient ) ) {
  89          bug_monitor( $f_bug_id, $t_recipient );
  90      }
  91  }
  92  
  93  $result = email_bug_reminder( $f_to, $f_bug_id, $f_body );
  94  
  95  # Add reminder as bugnote if store reminders option is ON.
  96  if ( ON == config_get( 'store_reminders' ) ) {
  97      if ( count( $f_to ) > 50 ) {        # too many recipients to log, truncate the list
  98          $t_to = array();
  99          for ( $i=0; $i<50; $i++ ) {
 100              $t_to[] = $f_to[$i];
 101          }
 102          $f_to = $t_to;
 103      }
 104      $t_attr = '|' . implode( '|', $f_to ) . '|';
 105      bugnote_add( $f_bug_id, $f_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE );
 106  }
 107  
 108  form_security_purge( 'bug_reminder' );
 109  
 110  html_page_top( null, string_get_bug_view_url( $f_bug_id ) );
 111  ?>
 112  <br />
 113  <div>
 114  <?php
 115  echo lang_get( 'operation_successful' ).'<br />';
 116  print_bracket_link( string_get_bug_view_url( $f_bug_id ), lang_get( 'proceed' ) );
 117  ?>
 118  </div>
 119  <?php
 120  html_page_bottom();


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