2 # MantisBT - A PHP based bugtracking system
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.
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.
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/>.
18 * This page allows an authorized user to send a reminder by email to another user
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
26 * @uses access_api.php
28 * @uses bugnote_api.php
29 * @uses config_api.php
30 * @uses constant_inc.php
35 * @uses helper_api.php
39 * @uses string_api.php
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' );
61 form_security_validate( 'bug_reminder' );
63 $f_bug_id = gpc_get_int( 'bug_id' );
64 $f_to = gpc_get_int_array( 'to' );
65 $f_body = gpc_get_string( 'body' );
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
;
74 if ( bug_is_readonly( $f_bug_id ) ) {
75 error_parameters( $f_bug_id );
76 trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED
, ERROR
);
79 access_ensure_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id );
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 )
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 );
93 $result = email_bug_reminder( $f_to, $f_bug_id, $f_body );
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
99 for ( $i=0; $i<50; $i++
) {
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 );
108 form_security_purge( 'bug_reminder' );
110 html_page_top( null, string_get_bug_view_url( $f_bug_id ) );
115 echo lang_get( 'operation_successful' ).'<br />';
116 print_bracket_link( string_get_bug_view_url( $f_bug_id ), lang_get( 'proceed' ) );