-
Notifications
You must be signed in to change notification settings - Fork 1
/
submit-bug.php
60 lines (50 loc) · 1.36 KB
/
submit-bug.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
<?php
/*
* License: GPLv3
* Author: Paul Tagliamonte <paultag@whube.com>
* Description:
* You POST against this file
*/
session_start();
include( "conf/site.php" );
include( "libs/php/globals.php" );
requireLogin();
if (
isset ( $_POST['project'] ) &&
isset ( $_POST['title'] ) &&
isset ( $_POST['descr'] )
) {
include( "model/user.php" );
include( "model/project.php" );
include( "model/bug.php" );
$b = new bug();
$u = new user();
$p = new project();
// let's first verify the project.
$pname = htmlentities( $_POST['project'], ENT_QUOTES);
$title = htmlentities( $_POST['title'], ENT_QUOTES);
$descr = htmlentities( $_POST['descr'], ENT_QUOTES);
$p->getByCol( "project_name", $pname );
$project = $p->getNext();
if ( $project != NULL && $project['pID'] > 0 ) {
$fields = array(
"package" => $project['pID'],
"reporter" => $_SESSION['id'],
"title" => $title,
"descr" => $descr
);
$id = $b->createNew( $fields );
$_SESSION['msg'] = "New bug created!";
header("Location: $SITE_PREFIX" . "t/bug/$id");
exit(0);
} else {
$_SESSION['err'] = "Please enter a real project!";
header("Location: $SITE_PREFIX" . "t/new-bug");
exit(0);
}
} else {
$_SESSION['err'] = "Please fill in all the forms!";
header("Location: $SITE_PREFIX" . "t/new-bug");
exit(0);
}
?>