/
bugnote_edit_page.php
89 lines (76 loc) · 2.79 KB
/
bugnote_edit_page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2003 Mantis Team - mantisbt-dev@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
# --------------------------------------------------------
# $Id: bugnote_edit_page.php,v 1.33 2003-01-24 14:59:23 jlatour Exp $
# --------------------------------------------------------
# CALLERS
# This page is submitted to by the following pages:
# - bugnote_inc.php
# EXPECTED BEHAVIOUR
# Allow the user to modify the text of a bugnote, then submit to
# bugnote_update.php with the new text
# RESTRICTIONS & PERMISSIONS
# - none beyond API restrictions
?>
<?php
require_once( 'core.php' );
require_once( $g_core_path . 'bug_api.php' );
require_once( $g_core_path . 'project_api.php' );
require_once( $g_core_path . 'bugnote_api.php' );
require_once( $g_core_path . 'string_api.php' );
?>
<?php login_cookie_check() ?>
<?php
$f_bugnote_id = gpc_get_int( 'bugnote_id' );
bugnote_ensure_exists( $f_bugnote_id );
$t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' );
project_access_check( $t_bug_id );
bug_ensure_exists( $t_bug_id );
# Check if the bug has been resolved
if ( bug_get_field( $t_bug_id, 'status' ) >= config_get( 'bug_resolved_status_threshold' ) ) {
# @@@ The error should be more generic.
trigger_error( ERROR_BUG_RESOLVED_ACTION_DENIED, ERROR );
}
# make sure the user accessing the note is valid and has proper access
$t_bugnote_user_id = bugnote_get_field( $f_bugnote_id, 'reporter_id' );
if ( ( ! access_level_check_greater_or_equal( config_get( 'update_bugnote_threshold' ) ) ) &&
( $t_bugnote_user_id != auth_get_current_user_id() ) ) {
access_denied();
}
$t_bugnote_text = string_edit_textarea( bugnote_get_text( $f_bugnote_id ) );
# Determine which view page to redirect back to.
$t_redirect_url = string_get_bug_view_url( $t_bug_id );
?>
<?php print_page_top1() ?>
<?php print_page_top2() ?>
<br />
<div align="center">
<form method="post" action="bugnote_update.php">
<table class="width75" cellspacing="1">
<tr>
<td class="form-title">
<input type="hidden" name="bugnote_id" value="<?php echo $f_bugnote_id ?>" />
<?php echo lang_get( 'edit_bugnote_title' ) ?>
</td>
<td class="right">
<?php print_bracket_link( $t_redirect_url, lang_get( 'go_back' ) ) ?>
</td>
</tr>
<tr class="row-1">
<td class="center" colspan="2">
<textarea cols="80" rows="10" name="bugnote_text" wrap="virtual"><?php echo $t_bugnote_text ?></textarea>
</td>
</tr>
<tr>
<td class="center" colspan="2">
<input type="submit" value="<?php echo lang_get( 'update_information_button' ) ?>" />
</td>
</tr>
</table>
</form>
</div>
<?php print_page_bot1( __FILE__ ) ?>