r35: Presentation code moved out of PHP files and into templates. Error and stop...
[bugdar.git] / showreport.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Renapsus [#]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 $fetchtemplates = array(
14 'SHOWREPORT',
15 'showreport_comment'
16 );
17
18 require_once('./global.php');
19
20 if (!can_perform('canviewbugs'))
21 {
22 echo 'no permission';
23 exit;
24 }
25
26 // ###################################################################
27
28 sanitize(array('bugid' => INT));
29
30 $bug = $DB_sql->query_first("
31 SELECT bug.*, user.displayname, user.email, user.showemail
32 FROM " . TABLE_PREFIX . "bug AS bug
33 LEFT JOIN " . TABLE_PREFIX . "user AS user
34 ON (bug.userid = user.userid)
35 WHERE bug.bugid = $vars[bugid]"
36 );
37
38 if (!is_array($bug))
39 {
40 echo 'alert: bad bug';
41 exit;
42 }
43
44 $bug['userinfo'] = construct_user_display($bug);
45 $bug['product'] = $bugsys->datastore['product']["$bug[productid]"]['title'];
46 $bug['component'] = iff($bug['componentid'], $bugsys->datastore['product']["$bug[componentid]"]['title']);
47 $bug['version'] = $bugsys->datastore['version']["$bug[versionid]"]['version'];
48 $bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status'];
49 $bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'];
50 $bug['severity'] = $bugsys->datastore['severity']["$bug[severity]"]['severity'];
51 $bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority'];
52
53 $assigninfo = $bugsys->datastore['assignto']["$bug[assignedto]"];
54 $bug['assigninfo'] = iff(is_array($assigninfo), construct_user_display($assigninfo));
55
56 if (((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo'))
57 {
58 $show['editreport'] = true;
59 }
60 else
61 {
62 $show['editreport'] = false;
63 }
64
65 $comments_fetch = $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_fetch))
74 {
75 $comment['posttime'] = datelike('standard', $comment['dateline']);
76 $comment['postby'] = construct_user_display($comment);
77 if ((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['userid']) OR can_perform('caneditothers'))
78 {
79 $show['editcomment'] = true;
80 }
81 else
82 {
83 $show['editcomment'] = false;
84 }
85 eval('$comments .= "' . $tpl->fetch('showreport_comment') . '";');
86 }
87
88 if (can_perform('canpostcomments'))
89 {
90 $show['newreply'] = true;
91 }
92 else
93 {
94 $show['newreply'] = false;
95 }
96
97 eval('$tpl->flush("' . $tpl->fetch('SHOWREPORT') . '");');
98
99 /*=====================================================================*\
100 || ###################################################################
101 || # $HeadURL$
102 || # $Id$
103 || ###################################################################
104 \*=====================================================================*/
105 ?>