]>
src.bluestatic.org Git - bugdar.git/blob - newreport.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
18 require_once('./global.php');
20 if (!can_perform('cansubmitbugs'))
26 // ###################################################################
28 if (empty($_REQUEST['do']))
30 $_REQUEST['do'] = 'add';
33 // ###################################################################
35 if ($_POST['do'] == 'insert')
37 // -------------------------------------------------------------------
38 // check permissions on various input values
39 if (!can_perform('canchangestatus'))
41 $bugsys->in
['priority'] = $bugsys->options
['defaultpriority'];
42 $bugsys->in
['status'] = $bugsys->options
['defaultstatus'];
43 $bugsys->in
['resolution'] = $bugsys->options
['defaultresolve'];
47 if (!$bugsys->datastore
['priority'][ $bugsys->in
['priority'] ])
49 $bugsys->in
['priority'] = $bugsys->options
['defaultpriority'];
51 if (!$bugsys->datastore
['status'][ $bugsys->in
['status'] ])
53 $bugsys->in
['status'] = $bugsys->options
['defaultstatus'];
55 if (!$bugsys->datastore
['resolution'][ $bugsys->in
['resolution'] ])
57 $bugsys->in
['resolution'] = $bugsys->options
['defaultresolve'];
60 if (!can_perform('canassign'))
62 $bugsys->in
['assignedto'] = $bugsys->options
['defaultassign'];
66 // assigned person is not a dev or a valid user
67 if (!$bugsys->datastore
['assignto'][ $bugsys->in
['assignedto'] ]['userid'])
69 $bugsys->in
['assignedto'] = $bugsys->options
['defaultassign'];
73 // -------------------------------------------------------------------
74 // product/component/version stuff
75 $pcv = parse_pcv_select($bugsys->in
['pcv_select'], true);
79 // -------------------------------------------------------------------
83 echo 'there was a problem selecting the product, component, or version';
86 if (!$bugsys->in
['summary'])
88 echo 'please enter a bug title';
91 if (!$bugsys->in
['comment'])
93 echo 'please enter a bug description';
97 // -------------------------------------------------------------------
98 // data clean and insert
99 $bugsys->in
['comment_parsed'] = $bugsys->in
['comment'];
101 if (!$bugsys->options
['allowhtml'])
103 $bugsys->in
['comment_parsed'] = $bugsys->sanitize($bugsys->in
['comment_parsed']);
106 // create the bug report
108 INSERT INTO " . TABLE_PREFIX
. "bug
109 (userid, productid, componentid, versionid, summary, severity, priority, status, assignedto, resolution)
111 (" . $bugsys->userinfo
['userid'] . ", " . $pcv['product'] . ", " . $pcv['component'] . ", " . $pcv['version'] . ",
112 '" . $bugsys->in
['summary'] . "', " . intval($bugsys->in
['severity']) . ", " . intval($bugsys->in
['priority']) . ",
113 " . intval($bugsys->in
['status']) . ", " . intval($bugsys->in
['assignedto']) . ", " . intval($bugsys->in
['resolution']) . "
117 $bugid = $db->insert_id();
121 // insert the comment to the database
123 INSERT INTO " . TABLE_PREFIX
. "comment
124 (bugid, userid, dateline, comment, comment_parsed)
126 ($bugid, " . $bugsys->userinfo
['userid'] . ",
127 $time, '" . $bugsys->in
['comment'] . "',
128 '" . nl2br($bugsys->in
['comment_parsed']) . "'
132 $initialreport = $db->insert_id();
134 $db->query("UPDATE " . TABLE_PREFIX
. "bug SET dateline = $time, initialreport = $initialreport, lastposttime = $time, lastpostby = " . $bugsys->userinfo
['userid'] . " WHERE bugid = $bugid");
136 echo "<a href
=\"showreport
.php
?bugid
=$bugid\">bug is done
!</a
>";
139 // ###################################################################
141 if ($_REQUEST['do'] == 'add')
143 foreach ($bugsys->datastore['severity'] AS $severity)
145 $value = $severity['severityid'];
146 $label = $severity['severity'];
147 eval('$select[severity] .= "' . $template->fetch('selectoption
') . '";');
150 $show['changestatus'] = ((can_perform('canchangestatus')) ? true : false);
152 if (can_perform('canchangestatus'))
154 foreach ($bugsys->datastore['priority'] AS $priority)
156 $value = $priority['priorityid'];
157 $label = $priority['priority'];
158 eval('$select[priority] .= "' . $template->fetch('selectoption
') . '";');
161 foreach ($bugsys->datastore['status'] AS $status)
163 $value = $status['statusid'];
164 $label = $status['status'];
165 eval('$select[status] .= "' . $template->fetch('selectoption
') . '";');
168 foreach ($bugsys->datastore['resolution'] AS $resolution)
170 $value = $resolution['resolutionid'];
171 $label = $resolution['resolution'];
172 eval('$select[resolution] .= "' . $template->fetch('selectoption
') . '";');
176 $show['assign'] = ((can_perform('canassign')) ? true : false);
178 if (can_perform('canassign'))
180 foreach ($bugsys->datastore['assignto'] AS $dev)
182 $value = $dev['userid'];
183 $label = construct_user_display($dev, false);
184 eval('$select[dev] .= "' . $template->fetch('selectoption
') . '";');
188 $pcv_select = construct_pcv_select();
190 eval('$template->flush("' . $template->fetch('newreport
') . '");');
193 /*=====================================================================*\
194 || ###################################################################
197 || ###################################################################
198 \*=====================================================================*/