forked from mantisbt/mantisbt
/
bugnote_edit_page.php
94 lines (80 loc) · 3.05 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
90
91
92
93
94
<?php
# Mantis - a php based bugtracking system
# Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
# Copyright (C) 2002 - 2004 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.49 2005-07-25 16:34:10 thraxisp 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' );
$t_core_path = config_get( 'core_path' );
require_once( $t_core_path.'bug_api.php' );
require_once( $t_core_path.'bugnote_api.php' );
require_once( $t_core_path.'string_api.php' );
require_once( $t_core_path.'current_user_api.php' );
?>
<?php
$f_bugnote_id = gpc_get_int( 'bugnote_id' );
$t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' );
$t_bug = bug_get( $t_bug_id, true );
if( $t_bug->project_id != helper_get_current_project() ) {
# in case the current project is not the same project of the bug we are viewing...
# ... override the current project. This to avoid problems with categories and handlers lists etc.
$g_project_override = $t_bug->project_id;
}
# Check if the current user is allowed to edit the bugnote
$t_user_id = auth_get_current_user_id();
$t_reporter_id = bugnote_get_field( $f_bugnote_id, 'reporter_id' );
if ( ( $t_user_id != $t_reporter_id ) ||
( OFF == config_get( 'bugnote_allow_user_edit_delete' ) ) ) {
access_ensure_bugnote_level( config_get( 'update_bugnote_threshold' ), $f_bugnote_id );
}
# Check if the bug is readonly
if ( bug_is_readonly( $t_bug_id ) ) {
error_parameters( $t_bug_id );
trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
}
$t_bugnote_text = string_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 html_page_top1( bug_format_summary( $t_bug_id, SUMMARY_CAPTION ) ) ?>
<?php html_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" class="button" value="<?php echo lang_get( 'update_information_button' ) ?>" />
</td>
</tr>
</table>
</form>
</div>
<?php html_page_bottom1( __FILE__ ) ?>