]>
src.bluestatic.org Git - bugdar.git/blob - showreport.php
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' ,
20 'bugfield_static_text'
23 define ( 'SVN' , ' $Id $' );
25 $focus [' showreport
'] = ' focus
';
27 require_once(' ./ global . php
');
29 if (!can_perform(' canviewbugs
'))
31 $message- >error_permission();
34 $show [' edit
'] = (((can_perform(' caneditown
') AND $bugsys- >userinfo[' userid
'] == $bug [' userid
']) OR can_perform(' caneditothers
')) AND can_perform(' caneditinfo
')) ? true : false;
36 $bugid = intval( $bugsys- >in[' bugid
']);
38 // ###################################################################
40 if (empty( $bugid ) OR $_REQUEST [' do '] == ' quicksearch
')
44 if ( $db- >query_first("SELECT bugid FROM " . TABLE_PREFIX . "bug WHERE bugid = $bugid" ))
46 header("Location: showreport.php?bugid= $bugid" );
51 $error = lang::p(' error_invalid_id
');
55 eval(' $template- > flush ( "' . $template- >fetch('quicksearch') . '" ); ');
59 // ###################################################################
61 // -------------------------------------------------------------------
63 $bug = $db- >query_first("
64 SELECT bugvaluefill.*, bug.*, user.email, user.displayname, user.showemail
65 FROM " . TABLE_PREFIX . "bug AS bug
66 LEFT JOIN " . TABLE_PREFIX . "user AS user
67 ON (bug.userid = user.userid)
68 LEFT JOIN " . TABLE_PREFIX . "bugvaluefill AS bugvaluefill
69 ON (bug.bugid = bugvaluefill.bugid)
70 WHERE bug.bugid = " . intval( $bugsys- >in[' bugid
'])
75 $message- >error(lang::p(' error_invalid_id
'));
78 if ( $bug [' hidden
'] AND !can_perform(' canviewhidden
'))
80 $message- >error_permission();
83 // ###################################################################
84 // global display items
86 $favourite = (bool) $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "favourite WHERE bugid = $bug [bugid] AND userid = " . $bugsys- >userinfo[' userid
']);
87 $favouritetext = (( $favourite ) ? ' Remove from Favourites
' : ' Add to Favourites
');
89 $bug [' userinfo
'] = construct_user_display( $bug );
90 $bug [' datetime
'] = $datef- >format( $bugsys- >options[' dateformat
'], $bug [' dateline
']);
92 // ###################################################################
96 $select [' severity
'] = construct_datastore_select(' severity
', ' severity
', ' severityid
', $bug [' severity
']);
98 $show [' changestatus
'] = ((can_perform(' canchangestatus
')) ? true : false);
99 if (can_perform(' canchangestatus
'))
101 $select [' priority
'] = construct_datastore_select(' priority
', ' priority
', ' priorityid
', $bug [' priority
']);
102 $select [' status
'] = construct_datastore_select(' status
', ' status
', ' statusid
', $bug [' status
']);
103 $select [' resolution
'] = construct_datastore_select(' resolution
', ' resolution
', ' resolutionid
', $bug [' resolution
']);
106 $show [' assign
'] = ((can_perform(' canassign
')) ? true : false);
107 if (can_perform(' canassign
'))
109 foreach ( $bugsys- >datastore[' assignto
'] AS $dev )
111 $value = $dev [' userid
'];
112 $selected = (( $dev [' userid
'] == $bug [' assignedto
']) ? true : false);
113 $label = construct_user_display( $dev , false);
114 eval(' $select [ dev
] .= "' . $template- >fetch('selectoption') . '" ; ');
118 $pcv_select = construct_pcv_select("p $bug [productid]c $bug [componentid]v $bug [versionid]");
120 $firstcomment = $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug [bugid] ORDER BY dateline ASC LIMIT 1");
122 if ( $bug [' duplicateof
'])
124 $duplicate = $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug [duplicateof]");
127 if ( $bug [' dependency
'])
129 $dependencies = $db- >query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ( $bug [dependency])");
130 while ( $dependency = $db- >fetch_array( $dependencies ))
132 $depends [] = "<a href= \" showreport.php?bugid= $dependency [bugid] \" title= \" $dependency [summary] \" > $dependency [bugid]</a>";
134 $dependencies = implode(' ', $depends );
137 $actions = $db- >query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC");
138 $select [' autoactions
'] = ' ';
139 $show [' autoactions
'] = false;
140 while ( $action = $db- >fetch_array( $actions ))
142 $label = $action [' name
'];
143 $value = $action [' actionid
'];
145 eval(' $select [ autoaction
] .= "' . $template- >fetch('selectoption') . '" ; ');
146 $show [' autoactions
'] = true;
148 if ( $show [' autoactions
'])
153 eval(' $select [ autoaction
] = "' . $template- >fetch('selectoption') . '" . $select [ autoaction
]; ');
157 // ###################################################################
161 // -------------------------------------------------------------------
163 $bug [' product
'] = $bugsys- >datastore[' product
'][" $bug [productid]"][' title
'];
164 $bug [' component
'] = (( $bug [' componentid
']) ? $bugsys- >datastore[' product
'][" $bug [componentid]"][' title
'] : ' ');
165 $bug [' version
'] = $bugsys- >datastore[' version
'][" $bug [versionid]"][' version
'];
166 $bug [' status
'] = $bugsys- >datastore[' status
'][" $bug [status]"][' status
'];
167 $bug [' resolution
'] = $bugsys- >datastore[' resolution
'][" $bug [resolution]"][' resolution
'];
168 $bug [' severity
'] = $bugsys- >datastore[' severity
'][" $bug [severity]"][' severity
'];
169 $bug [' priority
'] = $bugsys- >datastore[' priority
'][" $bug [priority]"][' priority
'];
171 $assigninfo = $bugsys- >datastore[' assignto
'][" $bug [assignedto]"];
172 $bug [' assigninfo
'] = ((is_array( $assigninfo )) ? construct_user_display( $assigninfo ) : ' ');
174 $duplicateof = $db- >query_first("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug [duplicateof]");
176 $duplicates = $db- >query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug [bugid]");
177 while ( $duplicate = $db- >fetch_array( $duplicates ))
179 $dupelist [] = "<a href= \" showreport.php?bugid= $duplicate [bugid] \" target= \" _blank \" > $duplicate [summary]</a>";
181 $dupelist = implode(' , ', $dupelist );
183 if ( $bug [' dependency
'])
185 $dependencies = $db- >query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid IN ( $bug [dependency])");
186 while ( $dependency = $db- >fetch_array( $dependencies ))
188 $depends [] = "<a href= \" showreport.php?bugid= $dependency [bugid] \" title= \" $dependency [summary] \" target= \" _blank \" > $dependency [bugid]</a>";
190 $dependencies = implode(' ', $depends );
194 // ###################################################################
195 // custom field output
197 $fields = construct_custom_fields( $bug );
199 $bugsys- >debug(count( $fields ) % 2);
201 foreach ( $fields AS $field )
203 $bugsys- >debug("i = $i" );
211 eval(' $customfields .= "' . $template- >fetch('customfield_bit') . '" ; ');
217 if ((count( $fields ) % 2) != 0)
219 $bugsys- >debug(' no modulo
for you
');
221 eval(' $customfields .= "' . $template- >fetch('customfield_bit') . '" ; ');
224 // ###################################################################
227 // -------------------------------------------------------------------
229 $words = explode(' ', $bugsys- >in[' hilight
']);
230 foreach ( $words AS $word )
234 $word = preg_quote( $bugsys- >unsanitize( $word ));
235 $hilight [] = $temp = trim(preg_replace(' #[ ^
0 - 9 a
- zA
- Z_
] #', '', $word));
239 // -------------------------------------------------------------------
241 $show [ 'getattachments' ] = (( can_perform ( 'cangetattach' ) OR can_perform ( 'caneditattach' )) ? true : false );
242 $show [ 'putattachments' ] = (( can_perform ( 'canputattach' ) OR can_perform ( 'caneditattach' )) ? true : false );
243 $show [ 'attachments' ] = ( $show [ 'getattachments' ] OR $show [ 'putattachments' ]) ? true : false ;
245 if ( $show [ 'getattachments' ] OR $show [ 'putattachments' ])
247 $attachments_fetch = $db- > query ( "
248 SELECT attachment.*, user.email, user.showemail,
250 FROM " . TABLE_PREFIX
. "attachment AS attachment
251 LEFT JOIN " . TABLE_PREFIX
. "user AS user
252 ON (attachment.userid = user.userid)
253 WHERE attachment.bugid = $bug [bugid]
254 ORDER BY attachment.dateline"
256 while ( $attachment = $db- > fetch_array ( $attachments_fetch ))
258 $show [ 'editattach' ] = (( can_perform ( 'caneditattach' ) OR ( $attachment [ 'userid' ] == $bugsys- > userinfo
[ 'userid' ] AND can_perform ( 'canputattach' ))) ? true : false );
259 $attachment [ 'date' ] = $datef- > format ( $bugsys- > options
[ 'dateformat' ], $attachment [ 'dateline' ]);
260 $attachment [ 'user' ] = construct_user_display ( $attachment , false );
261 eval ( ' $attachments .= "' . $template- > fetch ( 'showreport_attachment' ) . '";' );
265 // -------------------------------------------------------------------
268 $vote = $db- > query_first ( "SELECT *, FIND_IN_SET(" . $bugsys- > userinfo
[ 'userid' ] . ", userids) AS uservote FROM " . TABLE_PREFIX
. "vote WHERE bugid = $bug [bugid]" );
270 $vote [ 'total' ] = $vote [ 'votefor' ] +
$vote [ 'voteagainst' ];
271 $vote [ 'forpercent' ] = round ( $vote [ 'votefor' ] / $vote [ 'total' ], 3 ) * 100 ;
272 $vote [ 'againstpercent' ] = round ( $vote [ 'voteagainst' ] / $vote [ 'total' ], 3 ) * 100 ;
274 $show [ 'vote' ] = (( can_perform ( 'canvote' ) AND ! $vote [ 'uservote' ]) ? true : false );
276 // -------------------------------------------------------------------
278 $comments_fetch = $db- > query ( "
279 SELECT comment.*, user.email, user.showemail, user.displayname
280 FROM " . TABLE_PREFIX
. "comment AS comment
281 LEFT JOIN " . TABLE_PREFIX
. "user AS user
282 ON (comment.userid = user.userid)
283 WHERE comment.bugid = $bug [bugid]" . ((! can_perform ( 'canviewhidden' )) ? "
284 AND !hidden" : '' ) . "
285 ORDER BY comment.dateline ASC"
287 while ( $comment = $db- > fetch_array ( $comments_fetch ))
289 $comment [ 'posttime' ] = $datef- > format ( $bugsys- > options
[ 'dateformat' ], $comment [ 'dateline' ]);
290 $comment [ 'postby' ] = construct_user_display ( $comment );
291 $show [ 'editcomment' ] = ((( can_perform ( 'caneditown' ) AND $bugsys- > userinfo
[ 'userid' ] == $comment [ 'userid' ]) OR can_perform ( 'caneditothers' )) ? true : false );
293 if ( is_array ( $hilight ))
295 foreach ( $hilight AS $id => $find )
298 $replace = "<span style= \" background-color: yellow; font-weight: bold; color: red; \" > \\ 1</span>" ;
299 $comment [ 'comment_parsed' ] = preg_replace ( $find , $replace , $comment [ 'comment_parsed' ]);
303 eval ( ' $comments .= "' . $template- > fetch ( 'showreport_comment' ) . '";' );
306 $show [ 'newreply' ] = (( can_perform ( 'canpostcomments' )) ? true : false );
308 if ( is_array ( $hilight ))
310 foreach ( $hilight AS $id => $find )
313 $replace = "<span style= \" background-color: yellow; font-weight: bold; color: red; \" > \\ 1</span>" ;
314 $bug [ 'summary' ] = preg_replace ( $find , $replace , $bug [ 'summary' ]);
318 eval ( ' $template- >flush("' . $template- > fetch ( 'showreport' ) . '");' );
320 /*=====================================================================*\
321 || ###################################################################
324 || ###################################################################
325 \*=====================================================================*/