2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2002-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2002 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
18 require_once('./global.php');
20 $bug = $db->query_first("
21 SELECT bug.*, user.email, user.displayname, user.showemail
22 FROM " . TABLE_PREFIX
. "bug AS bug
23 LEFT JOIN " . TABLE_PREFIX
. "user AS user
24 ON (bug.userid = user.userid)
25 WHERE bug.bugid = " . intval($bugsys->in
['bugid'])
30 echo 'alert: bad bug';
34 if (!(((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')))
40 // ###################################################################
42 if (empty($_REQUEST['do']))
44 $_REQUEST['do'] = 'edit';
47 // ###################################################################
49 #*# do these later once we have delete permissions figured out
50 if ($_REQUEST['do'] == 'kill')
52 // run code to remove item in database
55 // ###################################################################
57 if ($_REQUEST['do'] == 'delete')
59 // display delete confirmation message
62 // ###################################################################
64 if ($_POST['do'] == 'update')
66 $pcv = parse_pcv_select($bugsys->in
['pcv_select'], true
);
68 if (!$bugsys->in
['summary'])
70 echo 'you need to enter a summary';
75 echo 'invalid product/component/version';
80 UPDATE " . TABLE_PREFIX
. "bug
81 SET summary = '" . $bugsys->in
['summary'] . "',
82 priority = " . intval($bugsys->in
['priority']) . ",
83 status = " . intval($bugsys->in
['status']) . ",
84 resolution = " . intval($bugsys->in
['resolution']) . ",
85 assignedto = " . intval($bugsys->in
['assignedto']) . ",
86 productid = " . $pcv['product'] . ",
87 componentid = " . $pcv['component'] . ",
88 versionid = " . $pcv['version'] . "
89 WHERE bugid = $bug[bugid]"
92 if (!$bugsys->in
['firstcomment'])
94 echo 'you need to enter some text in the first comment';
98 $bugsys->in
['comment_parsed'] = $bugsys->in
['firstcomment'];
100 if (!$bugsys->options
['allowhtml'])
102 $bugsys->in
['comment_parsed'] = $bugsys->sanitize($bugsys->in
['comment_parsed']);
105 // we could pass this as a GET param, but that's unsafe
106 $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1");
109 UPDATE " . TABLE_PREFIX
. "comment
110 SET comment = '" . $bugsys->in
['firstcomment'] . "',
111 comment_parsed = '" . nl2br($bugsys->in
['comment_parsed']) . "'
112 WHERE commentid = $firstcomment[commentid]"
115 if ($bugsys->in
['changeproduct'])
117 $_REQUEST['do'] = 'editproduct';
121 echo "<a href=\"showreport.php?bugid=$bug[bugid]\">done with update bug</a>";
125 // ###################################################################
127 if ($_REQUEST['do'] == 'edit')
129 foreach ($bugsys->datastore
['severity'] AS $severity)
131 $value = $severity['severityid'];
132 $selected = (($severity['severityid'] == $bug['severity']) ? true
: false
);
133 $label = $severity['severity'];
134 eval('$select[severity] .= "' . $template->fetch('selectoption') . '";');
137 $show['changestatus'] = ((can_perform('canchangestatus')) ? true
: false
);
138 if (can_perform('canchangestatus'))
140 foreach ($bugsys->datastore
['priority'] AS $priority)
142 $value = $priority['priorityid'];
143 $selected = (($priority['priorityid'] == $bug['priority']) ? true
: false
);
144 $label = $priority['priority'];
145 eval('$select[priority] .= "' . $template->fetch('selectoption') . '";');
148 foreach ($bugsys->datastore
['status'] AS $status)
150 $value = $status['statusid'];
151 $selected = (($status['statusid'] == $bug['status']) ? true
: false
);
152 $label = $status['status'];
153 eval('$select[status] .= "' . $template->fetch('selectoption') . '";');
156 foreach ($bugsys->datastore
['resolution'] AS $resolution)
158 $value = $resolution['resolutionid'];
159 $selected = (($resolution['resolutionid'] == $bug['resolution']) ? true
: false
);
160 $label = $resolution['resolution'];
161 eval('$select[resolution] .= "' . $template->fetch('selectoption') . '";');
165 $show['assign'] = ((can_perform('canassign')) ? true
: false
);
166 if (can_perform('canassign'))
168 foreach ($bugsys->datastore
['assignto'] AS $dev)
170 $value = $dev['userid'];
171 $selected = (($dev['userid'] == $bug['assignedto']) ? true
: false
);
172 $label = construct_user_display($dev, false
);
173 eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
177 $pcv_select = construct_pcv_select("p$bug[productid]c$bug[componentid]v$bug[versionid]");
179 $firstcomment = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "comment WHERE bugid = $bug[bugid] ORDER BY dateline ASC LIMIT 1");
181 eval('$template->flush("' . $template->fetch('editreport') . '");');
184 /*=====================================================================*\
185 || ###################################################################
188 || ###################################################################
189 \*=====================================================================*/