r18: Fixed showreport.php to not query comments and the bug report in one (the joins...
[bugdar.git] / showreport.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # [#]app[#] [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 require_once('./global.php');
14
15 if (!($bugsys->userinfo['permissions'] & CANVIEWBUGS))
16 {
17 echo 'no permission';
18 exit;
19 }
20
21 // ###################################################################
22
23 if (empty($_REQUEST['do']))
24 {
25 $_REQUEST['do'] = 'modify';
26 }
27
28 // ###################################################################
29
30 if ($_REQUEST['do'] == 'modify')
31 {
32 sanitize(array('bugid' => INT));
33
34 if (!$vars['bugid'])
35 {
36 echo 'alert: bad bug';
37 exit;
38 }
39
40 $bug = $DB_sql->query_first("
41 SELECT bug.*, user.displayname, user.email, user.showemail
42 FROM " . TABLE_PREFIX . "bug AS bug
43 LEFT JOIN " . TABLE_PREFIX . "user AS user
44 ON (bug.userid = user.userid)
45 WHERE bug.bugid = $vars[bugid]"
46 );
47
48 if (!is_array($bug))
49 {
50 echo 'alert: bad bug';
51 exit;
52 }
53
54 echo "<div><strong>Bug ID:</strong> $bug[bugid]</div>";
55 echo "<div><strong>Reported by:</strong> $bug[displayname]" . iff($bug['showemail'], " &lt;$bug[email]&gt;") . " (userid: $bug[userid])</div>";
56 echo "<div><strong>Product:</strong> " . $bugsys->datastore['product']["$bug[productid]"]['title'] . iff($bug['componentid'], ' / <strong>Component:</strong>' . $bugsys->datastore['product']["$bug[componentid]"]['title'] . '</strong>') . ' / <strong>Version:</strong> ' . $bugsys->datastore['version']["$bug[versionid]"]['version'] . "</div>";
57 echo "<div><strong>Title / summary:</strong> $bug[summary]</div>";
58 echo "<div><strong>Status:</strong> " . $bugsys->datastore['status']["$bug[status]"]['status'] . " / <strong>Resolution:</strong> " . $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'] . "</div>";
59 echo "<div><strong>Severity:</strong> " . $bugsys->datastore['severity']["$bug[severity]"]['severity'] . "</div>";
60 echo "<div><strong>Priority:</strong> " . $bugsys->datastore['priority']["$bug[priority]"]['priority'] . "</div>";
61 $assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"];
62 echo iff(is_array($assigninfo), "<div><strong>Assigned to:</strong> " . $assigninfo['displayname'] . iff($assigninfo['showemail'], " &lt;$assigninfo[email]&gt;") . " (userid: $assigninfo[userid])</div>");
63
64 echo '<br />';
65
66 $comments = $DB_sql->query("
67 SELECT comment.*, user.email, user.showemail, user.displayname
68 FROM " . TABLE_PREFIX . "comment AS comment
69 LEFT JOIN " . TABLE_PREFIX . "user AS user
70 ON (comment.userid = user.userid)
71 WHERE comment.bugid = $vars[bugid]
72 ORDER BY comment.dateline ASC"
73 );
74 while ($comment = $DB_sql->fetch_array($comments))
75 {
76 echo '<table border="1" cellspacing="2" cellpadding="4" width="100%"><tr style="background-color:#EEEEEE"><td><span style="float:right">' . datelike('standard', $comment['dateline']) . '</span>' . $comment['displayname'] . iff($comment['showemail'], " &lt;$comment[email]&gt;") . " (userid: $comment[userid])</td></tr>";
77 echo "<tr><td>" . nl2br($comment['comment']) . "</td></tr></table>";
78 }
79
80 if ($bugsys->userinfo['permissions'] & CANPOSTCOMMENTS)
81 {
82 echo "<div>[<a href=\"newcomment.php?bugid=$bug[bugid]\">New Comment</a>]</div>";
83 }
84
85 /*print_r($bug);
86 print_r($comments);*/
87 }
88
89 /*=====================================================================*\
90 || ###################################################################
91 || # $HeadURL$
92 || # $Id$
93 || ###################################################################
94 \*=====================================================================*/
95 ?>