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')
39 'summary' => STR_NOHTML
,
48 // -------------------------------------------------------------------
49 // check permissions on various input values
50 if (!can_perform('canchangestatus'))
52 $vars['priority'] = $bugsys->options
['defaultpriority'];
53 $vars['status'] = $bugsys->options
['defaultstatus'];
54 $vars['resolution'] = $bugsys->options
['defaultresolve'];
58 if (!$bugsys->datastore
['priority']["$vars[priority]"])
60 $vars['priority'] = $bugsys->options
['defaultpriority'];
62 if (!$bugsys->datastore
['status']["$vars[status]"])
64 $vars['status'] = $bugsys->options
['defaultstatus'];
66 if (!$bugsys->datastore
['resolution']["$vars[resolution]"])
68 $vars['resolution'] = $bugsys->options
['defaultresolve'];
71 if (!can_perform('canassign'))
73 $vars['assignedto'] = $bugsys->options
['defaultassign'];
77 // assigned person is not a dev or a valid user
78 if (!$bugsys->datastore
['assignto']["$vars[assignedto]"]['userid'])
80 $vars['assignedto'] = $bugsys->options
['defaultassign'];
84 // -------------------------------------------------------------------
85 // product/component/version stuff
86 $vars['pcv'] = parse_pcv_select($vars['pcv_select'], true
);
90 // -------------------------------------------------------------------
94 echo 'there was a problem selecting the product, component, or version';
97 if (!$vars['summary'])
99 echo 'please enter a bug title';
102 if (!$vars['comment'])
104 echo 'please enter a bug description';
108 // -------------------------------------------------------------------
109 // data clean and insert
110 $vars['comment_parsed'] = $vars['comment'];
112 if (!$bugsys->options
['allowhtml'])
114 $vars['comment_parsed'] = htmlspecialcharslike($vars['comment_parsed']);
117 // create the bug report
119 INSERT INTO " . TABLE_PREFIX
. "bug
120 (userid, productid, componentid, versionid, summary, severity, priority, status, assignedto, resolution)
122 (" . $bugsys->userinfo
['userid'] . ", " . $vars['pcv']['product'] . ", " . $vars['pcv']['component'] . ", " . $vars['pcv']['version'] . ",
123 '" . addslasheslike($vars['summary']) . "', $vars[severity], $vars[priority], $vars[status], $vars[assignedto], $vars[resolution]
127 $bugid = $db->insert_id();
131 // insert the comment to the database
133 INSERT INTO " . TABLE_PREFIX
. "comment
134 (bugid, userid, dateline, comment, comment_parsed)
136 ($bugid, " . $bugsys->userinfo
['userid'] . ",
137 $time, '" . addslasheslike($vars['comment']) . "',
138 '" . addslasheslike(nl2br($vars['comment_parsed'])) . "'
142 $initialreport = $db->insert_id();
144 $db->query("UPDATE " . TABLE_PREFIX
. "bug SET dateline = $time, initialreport = $initialreport, lastposttime = $time, lastpostby = " . $bugsys->userinfo
['userid'] . " WHERE bugid = $bugid");
146 echo "<a href=\"showreport.php?bugid=$bugid\">bug is done!</a>";
149 // ###################################################################
151 if ($_REQUEST['do'] == 'add')
153 foreach ($bugsys->datastore
['severity'] AS $severity)
155 $value = $severity['severityid'];
156 $label = $severity['severity'];
157 eval('$select[severity] .= "' . $template->fetch('selectoption') . '";');
160 $show['changestatus'] = ((can_perform('canchangestatus')) ? true
: false
);
162 if (can_perform('canchangestatus'))
164 foreach ($bugsys->datastore
['priority'] AS $priority)
166 $value = $priority['priorityid'];
167 $label = $priority['priority'];
168 eval('$select[priority] .= "' . $template->fetch('selectoption') . '";');
171 foreach ($bugsys->datastore
['status'] AS $status)
173 $value = $status['statusid'];
174 $label = $status['status'];
175 eval('$select[status] .= "' . $template->fetch('selectoption') . '";');
178 foreach ($bugsys->datastore
['resolution'] AS $resolution)
180 $value = $resolution['resolutionid'];
181 $label = $resolution['resolution'];
182 eval('$select[resolution] .= "' . $template->fetch('selectoption') . '";');
186 $show['assign'] = ((can_perform('canassign')) ? true
: false
);
188 if (can_perform('canassign'))
190 foreach ($bugsys->datastore
['assignto'] AS $dev)
192 $value = $dev['userid'];
193 $label = construct_user_display($dev, false
);
194 eval('$select[dev] .= "' . $template->fetch('selectoption') . '";');
198 $pcv_select = construct_pcv_select();
200 eval('$template->flush("' . $template->fetch('newreport') . '");');
203 /*=====================================================================*\
204 || ###################################################################
207 || ###################################################################
208 \*=====================================================================*/