-
Notifications
You must be signed in to change notification settings - Fork 0
/
issue_create.php
174 lines (152 loc) · 7 KB
/
issue_create.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
require_once "global.php";
if (isset($_POST["create"])) {
if (empty($_POST["subject"])) {
die("you must enter a subject. please go back and enter one.");
};
$subject = (!empty($_POST["subject"])) ? "'".clean($_POST["subject"])."'" : 'DEFAULT';
$owner = (is_numeric($_POST["owner"])) ? $_POST["owner"] : 'DEFAULT';
$milestone = (is_numeric($_POST["milestone"])) ? $_POST["milestone"] : 'DEFAULT';
$status = (is_numeric($_POST["status"])) ? $_POST["status"] : 'DEFAULT';
$severity = (is_numeric($_POST["severity"])) ? $_POST["severity"] : 'DEFAULT';
$type = (is_numeric($_POST["type"])) ? $_POST["type"] : 'DEFAULT';
$message = (!empty($_POST["message"])) ? "'".clean($_POST["message"])."'" : 'DEFAULT';
$sql = "INSERT INTO {$table_prefix}issue ".
"SET owner_id = $owner , ".
" milestone_id = $milestone , ".
" status_id = $status , ".
" severity_id = $severity , ".
" type_id = $type , ".
" subject = $subject ";
if (!$result = mysql_query($sql)) print_error();
$issue_id = mysql_insert_id();
if (empty($issue_id)) {
die("something terrible happened. sorry.");
};
$sql = "INSERT INTO {$table_prefix}issue_revision ".
"SET issue_id = $issue_id , ".
" author_id = {$bussd["user_id"]}, ".
" date = UNIX_TIMESTAMP() , ".
" owner_id = $owner , ".
" milestone_id = $milestone , ".
" status_id = $status , ".
" severity_id = $severity , ".
" type_id = $type , ".
" subject = $subject , ".
" message = $message ";
if (!$result = mysql_query($sql)) print_error();
if (is_numeric($owner) && $owner != $bussd["user_id"]) bust_an_email($owner, $issue_id, 'created');
header("Location: issue.php?id=$issue_id");
}
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>create—issue—<?php echo $project_name; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.php" />
</head>
<body>
<div id="contain">
<h1><a href="index.php"><?php echo $project_name; ?></a></h1>
<h2><a href="index.php">issues</a> » create</h2>
<form action="issue_create.php" method="post">
<table id="create">
<tr>
<th>subject</th>
<td><input type="text" name="subject" class="required" /></td>
</tr>
<tr>
<th>owner</th>
<td>
<select name="owner">
<option value="0">undetermined</option>
<?php
$sql = "SELECT id, name FROM {$table_prefix}user ORDER BY id";
if (!$result = mysql_query($sql)) print_error();
while (list($owner_id, $owner_name) = mysql_fetch_row($result)) {
echo " <option value=\"$owner_id\">".output($owner_name)."</option>\n";
};
?>
</select>
</td>
</tr>
<tr>
<th>milestone</th>
<td>
<select name="milestone">
<option value="0">undetermined</option>
<?php
$sql = "SELECT id, name FROM {$table_prefix}milestone ORDER BY id";
if (!$result = mysql_query($sql)) print_error();
while (list($milestone_id, $milestone_name) = mysql_fetch_row($result)) {
echo " <option value=\"$milestone_id\">".output($milestone_name)."</option>\n";
};
?>
</select>
</td>
</tr>
<tr>
<th>status</th>
<td>
<select name="status">
<option value="0">undetermined</option>
<?php
$sql = "SELECT id, name FROM {$table_prefix}status ORDER BY id";
if (!$result = mysql_query($sql)) print_error();
while (list($status_id, $status_name) = mysql_fetch_row($result)) {
echo " <option value=\"$status_id\">".output($status_name)."</option>\n";
};
?>
</select>
</td>
</tr>
<tr>
<th>severity</th>
<td>
<select name="severity">
<option value="0">undetermined</option>
<?php
$sql = "SELECT id, name FROM {$table_prefix}severity ORDER BY id";
if (!$result = mysql_query($sql)) print_error();
while (list($severity_id, $severity_name) = mysql_fetch_row($result)) {
echo " <option value=\"$severity_id\">".output($severity_name)."</option>\n";
};
?>
</select>
</td>
</tr>
<tr>
<th>type</th>
<td>
<select name="type">
<option value="0">undetermined</option>
<?php
$sql = "SELECT id, name FROM {$table_prefix}type ORDER BY id";
if (!$result = mysql_query($sql)) print_error();
while (list($type_id, $type_name) = mysql_fetch_row($result)) {
echo " <option value=\"$type_id\">".output($type_name)."</option>\n";
};
?>
</select>
</td>
</tr>
<tr>
<th>message</th>
<td>
<textarea cols="72" rows="10" name="message"></textarea>
</td>
</tr>
<tr>
<th> </th>
<td>
<input type="hidden" name="create" />
<input type="submit" value="submit" class="submit" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>