STR, 'summary' => STR_NOHTML, 'severity' => INT, 'priority' => INT, 'status' => INT, 'resolution' => INT, 'assignedto' => INT, 'comment' => STR) ); // ------------------------------------------------------------------- // check permissions on various input values if (!can_perform('canchangestatus')) { $vars['priority'] = $bugsys->options['defaultpriority']; $vars['status'] = $bugsys->options['defaultstatus']; $vars['resolution'] = $bugsys->options['defaultresolve']; } else { if (!$bugsys->datastore['priority']["$vars[priority]"]) { $vars['priority'] = $bugsys->options['defaultpriority']; } if (!$bugsys->datastore['status']["$vars[status]"]) { $vars['status'] = $bugsys->options['defaultstatus']; } if (!$bugsys->datastore['resolution']["$vars[resolution]"]) { $vars['resolution'] = $bugsys->options['defaultresolve']; } } if (!can_perform('canassign')) { $vars['assignedto'] = $bugsys->options['defaultassign']; } else { // assigned person is not a dev or a valid user if (!$bugsys->datastore['assignto']["$vars[assignedto]"]['userid']) { $vars['assignedto'] = $bugsys->options['defaultassign']; } } // ------------------------------------------------------------------- // product/component/version stuff $vars['pcv'] = parse_pcv_select($vars['pcv_select'], true); print_r($vars); // ------------------------------------------------------------------- // sanity checks if (!$vars['pcv']) { echo 'there was a problem selecting the product, component, or version'; exit; } if (!$vars['summary']) { echo 'please enter a bug title'; exit; } if (!$vars['comment']) { echo 'please enter a bug description'; exit; } // ------------------------------------------------------------------- // data clean and insert $vars['comment_parsed'] = $vars['comment']; if (!$bugsys->options['allowhtml']) { $vars['comment_parsed'] = htmlspecialcharslike($vars['comment_parsed']); } // create the bug report $db->query(" INSERT INTO " . TABLE_PREFIX . "bug (userid, productid, componentid, versionid, summary, severity, priority, status, assignedto, resolution) VALUES (" . $bugsys->userinfo['userid'] . ", " . $vars['pcv']['product'] . ", " . $vars['pcv']['component'] . ", " . $vars['pcv']['version'] . ", '" . addslasheslike($vars['summary']) . "', $vars[severity], $vars[priority], $vars[status], $vars[assignedto], $vars[resolution] )" ); $bugid = $db->insert_id(); $time = time(); // insert the comment to the database $db->query(" INSERT INTO " . TABLE_PREFIX . "comment (bugid, userid, dateline, comment, comment_parsed) VALUES ($bugid, " . $bugsys->userinfo['userid'] . ", $time, '" . addslasheslike($vars['comment']) . "', '" . addslasheslike(nl2br($vars['comment_parsed'])) . "' )" ); $initialreport = $db->insert_id(); $db->query("UPDATE " . TABLE_PREFIX . "bug SET dateline = $time, initialreport = $initialreport, lastposttime = $time, lastpostby = " . $bugsys->userinfo['userid'] . " WHERE bugid = $bugid"); echo "bug is done!"; } // ################################################################### if ($_REQUEST['do'] == 'add') { foreach ($bugsys->datastore['severity'] AS $severity) { $value = $severity['severityid']; $label = $severity['severity']; eval('$select[severity] .= "' . $tpl->fetch('selectoption') . '";'); } $show['changestatus'] = iff(can_perform('canchangestatus'), true, false); if (can_perform('canchangestatus')) { foreach ($bugsys->datastore['priority'] AS $priority) { $value = $priority['priorityid']; $label = $priority['priority']; eval('$select[priority] .= "' . $tpl->fetch('selectoption') . '";'); } foreach ($bugsys->datastore['status'] AS $status) { $value = $status['statusid']; $label = $status['status']; eval('$select[status] .= "' . $tpl->fetch('selectoption') . '";'); } foreach ($bugsys->datastore['resolution'] AS $resolution) { $value = $resolution['resolutionid']; $label = $resolution['resolution']; eval('$select[resolution] .= "' . $tpl->fetch('selectoption') . '";'); } } $show['assign'] = iff(can_perform('canassign'), true, false); if (can_perform('canassign')) { foreach ($bugsys->datastore['assignto'] AS $dev) { $value = $dev['userid']; $label = construct_user_display($dev, false); eval('$select[dev] .= "' . $tpl->fetch('selectoption') . '";'); } } $pcv_select = construct_pcv_select(); eval('$tpl->flush("' . $tpl->fetch('newreport') . '");'); } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>