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'))
23 $message->error_permission();
26 // ###################################################################
28 // -------------------------------------------------------------------
30 $bug = $db->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 = " . intval($bugsys->in
['bugid'])
40 $message->error('alert: bad bug');
43 // -------------------------------------------------------------------
45 $bug['userinfo'] = construct_user_display($bug);
46 $bug['product'] = $bugsys->datastore
['product']["$bug[productid]"]['title'];
47 $bug['component'] = (($bug['componentid']) ?
$bugsys->datastore
['product']["$bug[componentid]"]['title'] : '');
48 $bug['version'] = $bugsys->datastore
['version']["$bug[versionid]"]['version'];
49 $bug['status'] = $bugsys->datastore
['status']["$bug[status]"]['status'];
50 $bug['resolution'] = $bugsys->datastore
['resolution']["$bug[resolution]"]['resolution'];
51 $bug['severity'] = $bugsys->datastore
['severity']["$bug[severity]"]['severity'];
52 $bug['priority'] = $bugsys->datastore
['priority']["$bug[priority]"]['priority'];
54 $assigninfo = $bugsys->datastore
['assignto']["$bug[assignedto]"];
55 $bug['assigninfo'] = ((is_array($assigninfo)) ?
construct_user_display($assigninfo) : '');
57 $show['editreport'] = ((((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true
: false
);
59 // -------------------------------------------------------------------
61 $words = explode(' ', $bugsys->in
['hilight']);
62 foreach ($words AS $word)
66 $word = preg_quote($bugsys->unsanitize($word));
67 $hilight[] = $temp = trim(preg_replace('#[^0-9a-zA-Z_ ]#', '', $word));
71 // -------------------------------------------------------------------
73 $show['getattachments'] = ((can_perform('cangetattach') OR can_perform('caneditattach')) ? true
: false
);
74 $show['putattachments'] = ((can_perform('canputattach') OR can_perform('caneditattach')) ? true
: false
);
76 if ($show['getattachments'] OR $show['putattachments'])
78 $attachments_fetch = $db->query("
79 SELECT attachment.*, user.email, user.showemail,
81 FROM " . TABLE_PREFIX
. "attachment AS attachment
82 LEFT JOIN " . TABLE_PREFIX
. "user AS user
83 ON (attachment.userid = user.userid)
84 WHERE attachment.bugid = $bug[bugid]
85 ORDER BY attachment.dateline"
87 while ($attachment = $db->fetch_array($attachments_fetch))
89 $show['editattach'] = ((can_perform('caneditattach') OR ($attachment['userid'] == $bugsys->userinfo
['userid'] AND can_perform('canputattach'))) ? true
: false
);
90 $attachment['date'] = datelike('standard', $attachment['dateline']);
91 $attachment['user'] = construct_user_display($attachment, false
);
92 eval('$attachments .= "' . $template->fetch('showreport_attachment') . '";');
96 // -------------------------------------------------------------------
98 $comments_fetch = $db->query("
99 SELECT comment.*, user.email, user.showemail, user.displayname
100 FROM " . TABLE_PREFIX
. "comment AS comment
101 LEFT JOIN " . TABLE_PREFIX
. "user AS user
102 ON (comment.userid = user.userid)
103 WHERE comment.bugid = $bug[bugid]
104 ORDER BY comment.dateline ASC"
106 while ($comment = $db->fetch_array($comments_fetch))
108 $comment['posttime'] = datelike('standard', $comment['dateline']);
109 $comment['postby'] = construct_user_display($comment);
110 $show['editcomment'] = (((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) ? true
: false
);
112 if (is_array($hilight))
114 foreach ($hilight AS $id => $find)
117 $replace = "<span style=\"background-color: yellow; font-weight: bold; color: red;\">\\1</span>";
118 $comment['comment_parsed'] = preg_replace($find, $replace, $comment['comment_parsed']);
122 eval('$comments .= "' . $template->fetch('showreport_comment') . '";');
125 $show['newreply'] = ((can_perform('canpostcomments')) ? true
: false
);
127 if (is_array($hilight))
129 foreach ($hilight AS $id => $find)
132 $replace = "<span style=\"background-color: yellow; font-weight: bold; color: red;\">\\1</span>";
133 $bug['summary'] = preg_replace($find, $replace, $bug['summary']);
137 eval('$template->flush("' . $template->fetch('SHOWREPORT') . '");');
139 /*=====================================================================*\
140 || ###################################################################
143 || ###################################################################
144 \*=====================================================================*/