-
Notifications
You must be signed in to change notification settings - Fork 1
/
bug-callback.php
121 lines (88 loc) · 2.8 KB
/
bug-callback.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
<?php
/*
* License: GPLv3
* Author: Paul Tagliamonte <paultag@whube.com>
* Description:
* Where you post a bug against
*/
session_start();
include( "conf/site.php" );
include( "libs/php/globals.php" );
requireLogin();
include( "model/bug.php" );
include( "model/user.php" );
include( "model/project.php" );
$b = new bug();
/*
--> get shiz via $_POST all like:
Array (
[bID] => 1
[project] => whube_docs
[title] => Whube is not done yet
[status] => 1
[severity] => 1
[owner] => raidsong
)
*/
// print_r( $_POST ); // data sent to us
if ( isset ( $_POST['bID'] ) && $_POST['bID'] != "" ) {
$bugid = clean($_POST['bID'] ); /* Bug ID. This should NEVER be fucked with */
$project = clean($_POST['project']); /* New project of the bug ( perhaps ) */
$title = clean($_POST['title']); /* New title of the bug ( perhaps ) */
$status = clean($_POST['status']); /* New status of the bug ( perhaps ) */
$sever = clean($_POST['severity']); /* New severity of the bug ( perhaps ) */
$owner = clean($_POST['owner']); /* New owner of the bug ( perhaps ) */
$descr = clean($_POST['descr']); /* New descr of the bug ( perhaps ) */
$priv = false;
if ( isset( $_POST['private'] ) ) {
$priv = true;
} else {
$priv = false;
}
$o = new user();
$p = new project();
$o->getByCol( "username", $owner );
$p->getByCol( "project_name", $project );
$own = $o->getNext();
$pkg = $p->getNext();
$projectID = $pkg['pID'];
$ownerID = $own['uID'];
$posted_data = array(
"bug_severity" => $sever,
"bug_status" => $status,
"package" => $projectID,
"owner" => $ownerID,
"title" => $title,
"private" => $priv,
"descr" => $descr
);
// print_r( $posted_data );
$b->getAllByPK( $bugid );
$row = $b->getNext();
// print_r( $row ); // searched bug
/*
--> $row should look like:
** NOTE: IGNORE THE [n] ETC! THEY ARE STUPID IF YOU DON'T QUERY FUR THEM **
Array (
[bID] => 1 <-- PK, bug ID
[bug_status] => 1 <-- FK, status table by ID
[bug_severity] => 1 <-- FK, severity table by ID
[package] => 1 <-- FK, project table by pID
[reporter] => 1 <-- FK, user table by uID
[owner] => 0 <-- FK, user table by uID
[title] => Whube is not done yet <-- Title
[descr] => Whube is not done yet, of course! <-- Description
)
*/
$b->updateByPK( $bugid, $posted_data );
// /*
$_SESSION['msg'] = "Bug #$bugid updated!";
header( "Location: " . $SITE_PREFIX . "t/bug/" . $bugid );
exit(0);
// */
} else {
$_SESSION['msg'] = "Wtf, really";
header( "Location: " . $SITE_PREFIX . "t/bug-list/" . $bugid );
exit(0);
}
?>