-
Notifications
You must be signed in to change notification settings - Fork 6
/
bug_window.php
executable file
·102 lines (102 loc) · 4.5 KB
/
bug_window.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
<?php
session_start();
if(!isset($_SESSION['logged_on'])){ ?> <script type="text/javascript"> parent.reload(); </script> <?php } else { $user = $_SESSION['user']; }
require_once 'constants.php';
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
?>
<html lang="en">
<head>
<style type="text/css">
body {font-family: arial;}
</style>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Ymap | Bug Report or Feature Request</title>
<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script>
function submitBug(project){
submitter = $('#submitter').val();
description = $('#description').val();
$.ajax({
url : 'addBug_server.php',
type : 'post',
data : {
submitter: submitter,
description: description
},
success : function(answer){
window.location.href=window.location.href;
}
});
}
</script>
</head>
<body>
<div id="bugSubmit">
<input type="hidden" id="submitter" name="submitter" value="<?php echo $user?>">
Describe your bug or feature request below.<br>
If you are having a problem with a specific project, make sure to include the project name in your comment.<br>
If you are responding to a previous comment, make sure to include the comment number from the first collumn.<br>
Once an admin has responded, the comment entries will be colored <font style='background-color: #AAFFAA'>green to
indicate a resolved issue</font>, <font style='background-color: #FFFFAA'>yellow to indicate an ongoing issue</font>,
or <font style='background-color: #FFAAAA'>red to indicate the need for more information/discussion</font>.<br>
Your comments will only be visible to you and site administrators.<br>
<textarea id="description" rows="5" cols="150">Comment here.</textarea><br />
<button type="button" onclick="submitBug()">Submit Bug or Feature!</button><br /><br />
</div>
<div id="bugList">
<table id="bugTable" border="1">
<tr bgcolor="#DDDDDD">
<th>#</th>
<th>Submitter</th>
<th colspan=80>Description</th>
<th>Type</th>
<th colspan=80>Admin Notes</th>
</tr>
<?php
$bugtrackFile = "bugtracker/bugs.txt";
if (file_exists($bugtrackFile)) {
$bugFileHandle = fopen($bugtrackFile, 'r');
$comment_count = 0;
while (($buffer = fgets($bugFileHandle, 4096)) !== false) {
if (strcmp($buffer,"") <> 1) { $comment_count = $comment_count + 1; }
list ($submitter, $description, $type, $notes, $status) = explode("|", $buffer);
$super_user_flag_file = "users/".$user."/super.txt";
if (file_exists($super_user_flag_file)) { // Super-user privilidges.
if ($status == 1) { echo "<tr bgcolor='FFAAAA'>";
} else if ($status == 2) { echo "<tr bgcolor='FFFFAA'>";
} else if ($status == 3) { echo "<tr bgcolor='AAFFAA'>";
} else { echo "<tr>";
}
if (strcmp($buffer,"") == 1) { echo "<td align='center'></td>";
} else { echo "<td align='center'>".$comment_count."</td>";
}
echo "<td align='center'>".$submitter."</td>\n<td colspan=80>".$description."</td>\n<td align='center'>".$type."</td>\n<td colspan=80>".$notes."</td>\n";
echo "</tr>";
} else {
if (($submitter == $user) || ($submitter == 'admin')) {
if ($status == 1) { echo "<tr bgcolor='FFAAAA'>";
} else if ($status == 2) { echo "<tr bgcolor='FFFFAA'>";
} else if ($status == 3) { echo "<tr bgcolor='AAFFAA'>";
} else { echo "<tr>";
}
if (strcmp($buffer,"") == 1) { echo "<td align='center'></td>";
} else { echo "<td align='center'>".$comment_count."</td>";
}
echo "<td align='center'>".$submitter."</td>\n<td colspan=80>".$description."</td>\n<td align='center'>".$type."</td>\n<td colspan=80>".$notes."</td>\n";
echo "</tr>";
}
}
}
fclose($bugFileHandle);
} else {
$bugsOutput = fopen($bugtrackFile, 'w');
chmod($bugsOutput, 0777);
fwrite($bugtrackFile, "test|test|test|test|0");
fclose($bugsOutput);
}
?>
</table>
</div>
</body>
</html>