2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Renapsus [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
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']);
90 // -------------------------------------------------------------------
92 if (!is_array($vars['pcv']))
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 // -------------------------------------------------------------------
110 $product = $bugsys->datastore
['product'][ $vars['pcv']['product'] ];
113 echo 'please select a valid product';
116 $version = $bugsys->datastore
['version'][ $vars['pcv']['version'] ];
119 echo 'please select a valid version';
123 if ($vars['pcv']['component'] == 0)
125 // not global version and version.productid != product.productid
126 if ($version['productid'] != 0 AND $version['productid'] != $product['productid'])
128 echo 'invalid version specified';
135 $component = $bugsys->datastore
['product'][ $vars['pcv']['component'] ];
136 // component has the right mother
137 if ($component['componentmother'] == $product['productid'])
139 // version.productid != {component.productid | product.productid}
140 if (($version['productid'] != $component['productid'] AND $version['productid'] != $product['productid']) AND $version['productid'] != 0)
142 echo 'invalid version specified';
148 echo 'invalid component specified';
153 // -------------------------------------------------------------------
154 // data clean and insert
155 $vars['comment_parsed'] = $vars['comment'];
157 if (!$bugsys->options
['allowhtml'])
159 $vars['comment_parsed'] = htmlspecialcharslike($vars['comment_parsed']);
162 // create the bug report
164 INSERT INTO " . TABLE_PREFIX
. "bug
165 (userid, productid, componentid, versionid, summary, severity, priority, status, assignedto, resolution)
167 (" . $bugsys->userinfo
['userid'] . ", " . $vars['pcv']['product'] . ", " . $vars['pcv']['component'] . ", " . $vars['pcv']['version'] . ",
168 '" . addslasheslike($vars['summary']) . "', $vars[severity], $vars[priority], $vars[status], $vars[assignedto], $vars[resolution]
172 $bugid = $DB_sql->insert_id();
176 // insert the comment to the database
178 INSERT INTO " . TABLE_PREFIX
. "comment
179 (bugid, userid, dateline, comment, comment_parsed)
181 ($bugid, " . $bugsys->userinfo
['userid'] . ",
182 $time, '" . addslasheslike($vars['comment']) . "',
183 '" . addslasheslike(nl2br($vars['comment_parsed'])) . "'
187 $initialreport = $DB_sql->insert_id();
189 $DB_sql->query("UPDATE " . TABLE_PREFIX
. "bug SET dateline = $time, initialreport = $initialreport, lastposttime = $time, lastpostby = " . $bugsys->userinfo
['userid'] . " WHERE bugid = $bugid");
191 echo "<a href=\"showreport.php?bugid=$bugid\">bug is done!</a>";
194 // ###################################################################
196 if ($_REQUEST['do'] == 'add')
198 foreach ($bugsys->datastore
['severity'] AS $severity)
200 $value = $severity['severityid'];
201 $label = $severity['severity'];
202 eval('$select[severity] .= "' . $tpl->fetch('selectoption') . '";');
205 $show['changestatus'] = iff(can_perform('canchangestatus'), true
, false
);
207 if (can_perform('canchangestatus'))
209 foreach ($bugsys->datastore
['priority'] AS $priority)
211 $value = $priority['priorityid'];
212 $label = $priority['priority'];
213 eval('$select[priority] .= "' . $tpl->fetch('selectoption') . '";');
216 foreach ($bugsys->datastore
['status'] AS $status)
218 $value = $status['statusid'];
219 $label = $status['status'];
220 eval('$select[status] .= "' . $tpl->fetch('selectoption') . '";');
223 foreach ($bugsys->datastore
['resolution'] AS $resolution)
225 $value = $resolution['resolutionid'];
226 $label = $resolution['resolution'];
227 eval('$select[resolution] .= "' . $tpl->fetch('selectoption') . '";');
231 $show['assign'] = iff(can_perform('canassign'), true
, false
);
233 if (can_perform('canassign'))
235 foreach ($bugsys->datastore
['assignto'] AS $dev)
237 $value = $dev['userid'];
238 $label = construct_user_display($dev, false
);
239 eval('$select[dev] .= "' . $tpl->fetch('selectoption') . '";');
243 $pcv_select = construct_pcv_select();
245 eval('$tpl->flush("' . $tpl->fetch('newreport') . '");');
248 /*=====================================================================*\
249 || ###################################################################
252 || ###################################################################
253 \*=====================================================================*/