2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 $fetchtemplates = array(
15 'showreport_attachment',
19 require_once('./global.php');
21 if (!can_perform('canviewbugs'))
27 // ###################################################################
29 // -------------------------------------------------------------------
31 $bug = $db->query_first("
32 SELECT bug.*, user.displayname, user.email, user.showemail
33 FROM " . TABLE_PREFIX
. "bug AS bug
34 LEFT JOIN " . TABLE_PREFIX
. "user AS user
35 ON (bug.userid = user.userid)
36 WHERE bug.bugid = " . intval($bugsys->in
['bugid'])
41 echo 'alert: bad bug';
45 // -------------------------------------------------------------------
47 $bug['userinfo'] = construct_user_display($bug);
48 $bug['product'] = $bugsys->datastore
['product']["$bug[productid]"]['title'];
49 $bug['component'] = (($bug['componentid']) ?
$bugsys->datastore
['product']["$bug[componentid]"]['title'] : '');
50 $bug['version'] = $bugsys->datastore
['version']["$bug[versionid]"]['version'];
51 $bug['status'] = $bugsys->datastore
['status']["$bug[status]"]['status'];
52 $bug['resolution'] = $bugsys->datastore
['resolution']["$bug[resolution]"]['resolution'];
53 $bug['severity'] = $bugsys->datastore
['severity']["$bug[severity]"]['severity'];
54 $bug['priority'] = $bugsys->datastore
['priority']["$bug[priority]"]['priority'];
56 $assigninfo = $bugsys->datastore
['assignto']["$bug[assignedto]"];
57 $bug['assigninfo'] = ((is_array($assigninfo)) ?
construct_user_display($assigninfo) : '');
59 if (((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo'))
61 $show['editreport'] = true
;
65 $show['editreport'] = false
;
68 // -------------------------------------------------------------------
70 $words = explode(' ', $bugsys->in
['hilight']);
71 foreach ($words AS $word)
75 $word = preg_quote($bugsys->unsanitize($word));
76 $hilight[] = $temp = trim(preg_replace('#[^0-9a-zA-Z_ ]#', '', $word));
80 // -------------------------------------------------------------------
82 $show['getattachments'] = ((can_perform('cangetattach') OR can_perform('caneditattach')) ? true
: false
);
83 $show['putattachments'] = ((can_perform('canputattach') OR can_perform('caneditattach')) ? true
: false
);
85 if ($show['getattachments'] OR $show['putattachments'])
87 $attachments_fetch = $db->query("
88 SELECT attachment.*, user.email, user.showemail,
90 FROM " . TABLE_PREFIX
. "attachment AS attachment
91 LEFT JOIN " . TABLE_PREFIX
. "user AS user
92 ON (attachment.userid = user.userid)
93 WHERE attachment.bugid = $bug[bugid]
94 ORDER BY attachment.dateline"
96 while ($attachment = $db->fetch_array($attachments_fetch))
98 $show['editattach'] = ((can_perform('caneditattach') OR ($attachment['userid'] == $bugsys->userinfo
['userid'] AND can_perform('canputattach'))) ? true
: false
);
99 $attachment['date'] = datelike('standard', $attachment['dateline']);
100 $attachment['user'] = construct_user_display($attachment, false
);
101 eval('$attachments .= "' . $template->fetch('showreport_attachment') . '";');
105 // -------------------------------------------------------------------
107 $comments_fetch = $db->query("
108 SELECT comment.*, user.email, user.showemail, user.displayname
109 FROM " . TABLE_PREFIX
. "comment AS comment
110 LEFT JOIN " . TABLE_PREFIX
. "user AS user
111 ON (comment.userid = user.userid)
112 WHERE comment.bugid = $bug[bugid]
113 ORDER BY comment.dateline ASC"
115 while ($comment = $db->fetch_array($comments_fetch))
117 $comment['posttime'] = datelike('standard', $comment['dateline']);
118 $comment['postby'] = construct_user_display($comment);
119 if ((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers'))
121 $show['editcomment'] = true
;
125 $show['editcomment'] = false
;
128 if (is_array($hilight))
130 foreach ($hilight AS $id => $find)
133 $replace = "<span style=\"background-color: yellow; font-weight: bold; color: red;\">\\1</span>";
134 $comment['comment_parsed'] = preg_replace($find, $replace, $comment['comment_parsed']);
138 eval('$comments .= "' . $template->fetch('showreport_comment') . '";');
141 if (can_perform('canpostcomments'))
143 $show['newreply'] = true
;
147 $show['newreply'] = false
;
150 if (is_array($hilight))
152 foreach ($hilight AS $id => $find)
155 $replace = "<span style=\"background-color: yellow; font-weight: bold; color: red;\">\\1</span>";
156 $bug['summary'] = preg_replace($find, $replace, $bug['summary']);
160 eval('$template->flush("' . $template->fetch('SHOWREPORT') . '");');
162 /*=====================================================================*\
163 || ###################################################################
166 || ###################################################################
167 \*=====================================================================*/