Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / bug_reminder.php
blob678c0f28033704c0c0dacc8339983f2367775ebb
1 <?php
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/>.
17 /**
18 * This page allows an authorized user to send a reminder by email to another user
20 * @package MantisBT
21 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
22 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
23 * @link http://www.mantisbt.org
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
42 require_once( 'core.php' );
43 require_api( 'access_api.php' );
44 require_api( 'bug_api.php' );
45 require_api( 'bugnote_api.php' );
46 require_api( 'config_api.php' );
47 require_api( 'constant_inc.php' );
48 require_api( 'email_api.php' );
49 require_api( 'error_api.php' );
50 require_api( 'form_api.php' );
51 require_api( 'gpc_api.php' );
52 require_api( 'helper_api.php' );
53 require_api( 'html_api.php' );
54 require_api( 'lang_api.php' );
55 require_api( 'print_api.php' );
56 require_api( 'string_api.php' );
58 form_security_validate( 'bug_reminder' );
60 $f_bug_id = gpc_get_int( 'bug_id' );
61 $f_to = gpc_get_int_array( 'to' );
62 $f_body = gpc_get_string( 'body' );
64 $t_bug = bug_get( $f_bug_id, true );
65 if( $t_bug->project_id != helper_get_current_project() ) {
66 # in case the current project is not the same project of the bug we are viewing...
67 # ... override the current project. This to avoid problems with categories and handlers lists etc.
68 $g_project_override = $t_bug->project_id;
71 if ( bug_is_readonly( $f_bug_id ) ) {
72 error_parameters( $f_bug_id );
73 trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
76 access_ensure_bug_level( config_get( 'bug_reminder_threshold' ), $f_bug_id );
78 # Automically add recipients to monitor list if they are above the monitor
79 # threshold, option is enabled, and not reporter or handler.
80 foreach ( $f_to as $t_recipient )
82 if ( ON == config_get( 'reminder_recipients_monitor_bug' ) &&
83 access_has_bug_level( config_get( 'monitor_bug_threshold' ), $f_bug_id ) &&
84 !bug_is_user_handler( $f_bug_id, $t_recipient ) &&
85 !bug_is_user_reporter( $f_bug_id, $t_recipient ) ) {
86 bug_monitor( $f_bug_id, $t_recipient );
90 $result = email_bug_reminder( $f_to, $f_bug_id, $f_body );
92 # Add reminder as bugnote if store reminders option is ON.
93 if ( ON == config_get( 'store_reminders' ) ) {
94 if ( count( $f_to ) > 50 ) { # too many recipients to log, truncate the list
95 $t_to = array();
96 for ( $i=0; $i<50; $i++ ) {
97 $t_to[] = $f_to[$i];
99 $f_to = $t_to;
101 $t_attr = '|' . implode( '|', $f_to ) . '|';
102 bugnote_add( $f_bug_id, $f_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE );
105 form_security_purge( 'bug_reminder' );
107 html_page_top( null, string_get_bug_view_url( $f_bug_id ) );
109 <br />
110 <div align="center">
111 <?php
112 echo lang_get( 'operation_successful' ).'<br />';
113 print_bracket_link( string_get_bug_view_url( $f_bug_id ), lang_get( 'proceed' ) );
115 </div>
116 <?php
117 html_page_bottom();