r21: Changed all bitwise operations to use can_perform() (new: includes/functions...
[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 (!can_perform('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 $bug = $DB_sql->query_first("
35 SELECT bug.*, user.displayname, user.email, user.showemail
36 FROM " . TABLE_PREFIX . "bug AS bug
37 LEFT JOIN " . TABLE_PREFIX . "user AS user
38 ON (bug.userid = user.userid)
39 WHERE bug.bugid = $vars[bugid]"
40 );
41
42 if (!is_array($bug))
43 {
44 echo 'alert: bad bug';
45 exit;
46 }
47
48 echo "<div><strong>Bug ID:</strong> $bug[bugid]</div>";
49 echo "<div><strong>Reported by:</strong> " . construct_user_display($bug) . "</div>";
50 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>";
51 echo "<div><strong>Title / summary:</strong> $bug[summary]</div>";
52 echo "<div><strong>Status:</strong> " . $bugsys->datastore['status']["$bug[status]"]['status'] . " / <strong>Resolution:</strong> " . $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'] . "</div>";
53 echo "<div><strong>Severity:</strong> " . $bugsys->datastore['severity']["$bug[severity]"]['severity'] . "</div>";
54 echo "<div><strong>Priority:</strong> " . $bugsys->datastore['priority']["$bug[priority]"]['priority'] . "</div>";
55 $assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"];
56 echo iff(is_array($assigninfo), "<div><strong>Assigned to:</strong> " . construct_user_display($assigninfo) . "</div>");
57
58 if (((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo'))
59 {
60 echo '<div>[<a href="editreport.php?bugid=' . $bug['bugid'] . '">Edit Bug Report</a>]</div>';
61 }
62
63 echo '<br />';
64
65 $comments = $DB_sql->query("
66 SELECT comment.*, user.email, user.showemail, user.displayname
67 FROM " . TABLE_PREFIX . "comment AS comment
68 LEFT JOIN " . TABLE_PREFIX . "user AS user
69 ON (comment.userid = user.userid)
70 WHERE comment.bugid = $vars[bugid]
71 ORDER BY comment.dateline ASC"
72 );
73 while ($comment = $DB_sql->fetch_array($comments))
74 {
75 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>' . construct_user_display($comment) . "</td></tr>";
76 echo "<tr><td>" . $comment['comment_parsed'] . "</td></tr>";
77 if ((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers'))
78 {
79 echo "<tr style=\"background-color:#999999\"><td>[<a href=\"editcomment.php?commentid=$comment[commentid]\">Edit Comment</a>]</td></tr>";
80 }
81 echo "</table>";
82 }
83
84 if (can_perform('canpostcomments'))
85 {
86 echo "<div>[<a href=\"newcomment.php?bugid=$bug[bugid]\">New Comment</a>]</div>";
87 }
88
89 /*print_r($bug);
90 print_r($comments);*/
91 }
92
93 /*=====================================================================*\
94 || ###################################################################
95 || # $HeadURL$
96 || # $Id$
97 || ###################################################################
98 \*=====================================================================*/
99 ?>