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 if ($bug['hidden'] AND !can_perform('canviewhidden'))
45 $message->error_permission();
48 // -------------------------------------------------------------------
50 $bug['userinfo'] = construct_user_display($bug);
51 $bug['product'] = $bugsys->datastore
['product']["$bug[productid]"]['title'];
52 $bug['component'] = (($bug['componentid']) ?
$bugsys->datastore
['product']["$bug[componentid]"]['title'] : '');
53 $bug['version'] = $bugsys->datastore
['version']["$bug[versionid]"]['version'];
54 $bug['status'] = $bugsys->datastore
['status']["$bug[status]"]['status'];
55 $bug['resolution'] = $bugsys->datastore
['resolution']["$bug[resolution]"]['resolution'];
56 $bug['severity'] = $bugsys->datastore
['severity']["$bug[severity]"]['severity'];
57 $bug['priority'] = $bugsys->datastore
['priority']["$bug[priority]"]['priority'];
59 $assigninfo = $bugsys->datastore
['assignto']["$bug[assignedto]"];
60 $bug['assigninfo'] = ((is_array($assigninfo)) ?
construct_user_display($assigninfo) : '');
62 $show['editreport'] = ((((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) AND can_perform('caneditinfo')) ? true
: false
);
64 $duplicateof = $db->query_first("SELECT bugid, summary FROM " . TABLE_PREFIX
. "bug WHERE bugid = $bug[duplicateof]");
66 $duplicates = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX
. "bug WHERE duplicateof = $bug[bugid]");
67 while ($duplicate = $db->fetch_array($duplicates))
69 $dupelist[] = "<a href=\"showreport.php?bugid=$duplicate[bugid]\" target=\"_blank\">$duplicate[summary]</a>";
71 $dupelist = implode(', ', $dupelist);
73 if ($bug['dependency'])
75 $dependencies = $db->query("SELECT bugid, summary FROM " . TABLE_PREFIX
. "bug WHERE bugid IN ($bug[dependency])");
76 while ($dependency = $db->fetch_array($dependencies))
78 $depends[] = "<a href=\"showreport.php?bugid=$dependency[bugid]\" title=\"$dependency[summary]\" target=\"_blank\">$dependency[bugid]</a>";
80 $dependencies = implode(' ', $depends);
83 // -------------------------------------------------------------------
87 $allfields = $db->query("
89 FROM " . TABLE_PREFIX
. "bugfield AS bugfield
90 LEFT JOIN " . TABLE_PREFIX
. "bugfieldpermission AS permission
91 ON (bugfield.fieldid = permission.fieldid)
92 WHERE permission.mask <> 0
93 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
95 while ($field = $db->fetch_array($allfields))
97 $fieldlist["$field[shortname]"] = $field;
100 $fieldvalues = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bugvaluefill WHERE bugid = $bug[bugid]");
102 foreach ($fieldlist AS $shortname => $field)
104 $customfields .= "<div><strong>$field[name]:</strong> ";
106 if (is_null($fieldvalues["$shortname"]))
108 $value = $field['defaultvalue'];
112 $value = $fieldvalues["$shortname"];
115 if ($field['type'] == 'input_text' OR $field['type'] == 'select_single')
117 $customfields .= $value;
119 else if ($field['type'] == 'input_checkbox')
121 $customfields .= (($value) ?
'True' : 'False');
123 $customfeilds .= "</div>\n\n";
126 // -------------------------------------------------------------------
128 $words = explode(' ', $bugsys->in
['hilight']);
129 foreach ($words AS $word)
133 $word = preg_quote($bugsys->unsanitize($word));
134 $hilight[] = $temp = trim(preg_replace('#[^0-9a-zA-Z_ ]#', '', $word));
138 // -------------------------------------------------------------------
140 $show['getattachments'] = ((can_perform('cangetattach') OR can_perform('caneditattach')) ? true
: false
);
141 $show['putattachments'] = ((can_perform('canputattach') OR can_perform('caneditattach')) ? true
: false
);
143 if ($show['getattachments'] OR $show['putattachments'])
145 $attachments_fetch = $db->query("
146 SELECT attachment.*, user.email, user.showemail,
148 FROM " . TABLE_PREFIX
. "attachment AS attachment
149 LEFT JOIN " . TABLE_PREFIX
. "user AS user
150 ON (attachment.userid = user.userid)
151 WHERE attachment.bugid = $bug[bugid]
152 ORDER BY attachment.dateline"
154 while ($attachment = $db->fetch_array($attachments_fetch))
156 $show['editattach'] = ((can_perform('caneditattach') OR ($attachment['userid'] == $bugsys->userinfo
['userid'] AND can_perform('canputattach'))) ? true
: false
);
157 $attachment['date'] = datelike('standard', $attachment['dateline']);
158 $attachment['user'] = construct_user_display($attachment, false
);
159 eval('$attachments .= "' . $template->fetch('showreport_attachment') . '";');
163 // -------------------------------------------------------------------
165 $comments_fetch = $db->query("
166 SELECT comment.*, user.email, user.showemail, user.displayname
167 FROM " . TABLE_PREFIX
. "comment AS comment
168 LEFT JOIN " . TABLE_PREFIX
. "user AS user
169 ON (comment.userid = user.userid)
170 WHERE comment.bugid = $bug[bugid]" . ((!can_perform('canviewhidden')) ?
"
171 AND !hidden" : '') . "
172 ORDER BY comment.dateline ASC"
174 while ($comment = $db->fetch_array($comments_fetch))
176 $comment['posttime'] = datelike('standard', $comment['dateline']);
177 $comment['postby'] = construct_user_display($comment);
178 $show['editcomment'] = (((can_perform('caneditown') AND $bugsys->userinfo
['userid'] == $comment['userid']) OR can_perform('caneditothers')) ? true
: false
);
180 if (is_array($hilight))
182 foreach ($hilight AS $id => $find)
185 $replace = "<span style=\"background-color: yellow; font-weight: bold; color: red;\">\\1</span>";
186 $comment['comment_parsed'] = preg_replace($find, $replace, $comment['comment_parsed']);
190 eval('$comments .= "' . $template->fetch('showreport_comment') . '";');
193 $show['newreply'] = ((can_perform('canpostcomments')) ? true
: false
);
195 if (is_array($hilight))
197 foreach ($hilight AS $id => $find)
200 $replace = "<span style=\"background-color: yellow; font-weight: bold; color: red;\">\\1</span>";
201 $bug['summary'] = preg_replace($find, $replace, $bug['summary']);
205 eval('$template->flush("' . $template->fetch('SHOWREPORT') . '");');
207 /*=====================================================================*\
208 || ###################################################################
211 || ###################################################################
212 \*=====================================================================*/