]>
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' ,
21 define ( 'SVN' , ' $Id $' );
23 $focus [' showreport
'] = ' focus
';
25 require_once(' ./ global . php
');
27 if (!can_perform(' canviewbugs
'))
29 $message- >error_permission();
32 $show [' edit
'] = (((can_perform(' caneditown
') AND $bugsys- >userinfo[' userid
'] == $bug [' userid
']) OR can_perform(' caneditothers
')) AND can_perform(' caneditinfo
')) ? true : false;
34 $bugid = intval( $bugsys- >in[' bugid
']);
36 // ###################################################################
38 if (empty( $bugid ) OR $_REQUEST [' do '] == ' quicksearch
')
42 if ( $db- >query_first("SELECT bugid FROM " . TABLE_PREFIX . "bug WHERE bugid = $bugid" ))
44 header("Location: showreport.php?bugid= $bugid" );
49 $error = lang::p(' error_invalid_id
');
53 eval(' $template- > flush ( "' . $template- >fetch('quicksearch') . '" ); ');
57 // ###################################################################
59 // -------------------------------------------------------------------
61 $bug = $db- >query_first("
62 SELECT bugvaluefill.*, bug.*, user.email, user.displayname, user.showemail
63 FROM " . TABLE_PREFIX . "bug AS bug
64 LEFT JOIN " . TABLE_PREFIX . "user AS user
65 ON (bug.userid = user.userid)
66 LEFT JOIN " . TABLE_PREFIX . "bugvaluefill AS bugvaluefill
67 ON (bug.bugid = bugvaluefill.bugid)
68 WHERE bug.bugid = " . intval( $bugsys- >in[' bugid
'])
73 $message- >error(lang::p(' error_invalid_id
'));
76 if ( $bug [' hidden
'] AND !can_perform(' canviewhidden
'))
78 $message- >error_permission();
81 // ###################################################################
82 // global display items
84 $favourite = (bool) $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "favourite WHERE bugid = $bug [bugid] AND userid = " . $bugsys- >userinfo[' userid
']);
85 $favouritetext = (( $favourite ) ? ' Remove from Favourites
' : ' Add to Favourites
');
87 $bug [' userinfo
'] = construct_user_display( $bug );
88 $bug [' datetime
'] = $datef- >format( $bugsys- >options[' dateformat
'], $bug [' dateline
']);
90 // ###################################################################
94 $select [' severity
'] = construct_datastore_select(' severity
', ' severity
', ' severityid
', $bug [' severity
']);
96 $show [' changestatus
'] = ((can_perform(' canchangestatus
')) ? true : false);
97 if (can_perform(' canchangestatus
'))
99 $select [' priority
'] = construct_datastore_select(' priority
', ' priority
', ' priorityid
', $bug [' priority
']);
100 $select [' status
'] = construct_datastore_select(' status
', ' status
', ' statusid
', $bug [' status
']);
101 $select [' resolution
'] = construct_datastore_select(' resolution
', ' resolution
', ' resolutionid
', $bug [' resolution
']);
104 $show [' assign
'] = ((can_perform(' canassign
')) ? true : false);
105 if (can_perform(' canassign
'))
107 foreach ( $bugsys- >datastore[' assignto
'] AS $dev )
109 $value = $dev [' userid
'];
110 $selected = (( $dev [' userid
'] == $bug [' assignedto
']) ? true : false);
111 $label = construct_user_display( $dev , false);
112 eval(' $select [ dev
] .= "' . $template- >fetch('selectoption') . '" ; ');
116 $pcv_select = construct_pcv_select("p $bug [productid]c $bug [componentid]v $bug [versionid]");
118 $firstcomment = $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "comment WHERE bugid = $bug [bugid] ORDER BY dateline ASC LIMIT 1");
120 if ( $bug [' duplicateof
'])
122 $duplicate = $db- >query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug [duplicateof]");
125 if ( $bug [' dependency
'])
127 $dependencies = $db- >query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ( $bug [dependency])");
128 while ( $dependency = $db- >fetch_array( $dependencies ))
130 $depends [] = "<a href= \" showreport.php?bugid= $dependency [bugid] \" title= \" $dependency [summary] \" > $dependency [bugid]</a>";
132 $dependencies = implode(' ', $depends );
135 $actions = $db- >query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC");
136 $select [' autoactions
'] = ' ';
137 $show [' autoactions
'] = false;
138 while ( $action = $db- >fetch_array( $actions ))
140 $label = $action [' name
'];
141 $value = $action [' actionid
'];
143 eval(' $select [ autoaction
] .= "' . $template- >fetch('selectoption') . '" ; ');
144 $show [' autoactions
'] = true;
146 if ( $show [' autoactions
'])
151 eval(' $select [ autoaction
] = "' . $template- >fetch('selectoption') . '" . $select [ autoaction
]; ');
155 // ###################################################################
159 // -------------------------------------------------------------------
161 $bug [' product
'] = $bugsys- >datastore[' product
'][" $bug [productid]"][' title
'];
162 $bug [' component
'] = (( $bug [' componentid
']) ? $bugsys- >datastore[' product
'][" $bug [componentid]"][' title
'] : ' ');
163 $bug [' version
'] = $bugsys- >datastore[' version
'][" $bug [versionid]"][' version
'];
164 $bug [' status
'] = $bugsys- >datastore[' status
'][" $bug [status]"][' status
'];
165 $bug [' resolution
'] = $bugsys- >datastore[' resolution
'][" $bug [resolution]"][' resolution
'];
166 $bug [' severity
'] = $bugsys- >datastore[' severity
'][" $bug [severity]"][' severity
'];
167 $bug [' priority
'] = $bugsys- >datastore[' priority
'][" $bug [priority]"][' priority
'];
169 $assigninfo = $bugsys- >datastore[' assignto
'][" $bug [assignedto]"];
170 $bug [' assigninfo
'] = ((is_array( $assigninfo )) ? construct_user_display( $assigninfo ) : ' ');
172 $duplicateof = $db- >query_first("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid = $bug [duplicateof]");
174 $duplicates = $db- >query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE duplicateof = $bug [bugid]");
175 while ( $duplicate = $db- >fetch_array( $duplicates ))
177 $dupelist [] = "<a href= \" showreport.php?bugid= $duplicate [bugid] \" target= \" _blank \" > $duplicate [summary]</a>";
179 $dupelist = implode(' , ', $dupelist );
181 if ( $bug [' dependency
'])
183 $dependencies = $db- >query("SELECT bugid, summary FROM " . TABLE_PREFIX . "bug WHERE bugid IN ( $bug [dependency])");
184 while ( $dependency = $db- >fetch_array( $dependencies ))
186 $depends [] = "<a href= \" showreport.php?bugid= $dependency [bugid] \" title= \" $dependency [summary] \" target= \" _blank \" > $dependency [bugid]</a>";
188 $dependencies = implode(' ', $depends );
192 // ###################################################################
193 // custom field output
195 $fields = construct_custom_fields( $bug );
197 $bugsys- >debug(count( $fields ) % 2);
199 foreach ( $fields AS $field )
201 $bugsys- >debug("i = $i" );
209 eval(' $customfields .= "' . $template- >fetch('customfield_bit') . '" ; ');
215 if ((count( $fields ) % 2) != 0)
217 $bugsys- >debug(' no modulo
for you
');
219 eval(' $customfields .= "' . $template- >fetch('customfield_bit') . '" ; ');
222 // ###################################################################
225 // -------------------------------------------------------------------
227 $words = explode(' ', $bugsys- >in[' hilight
']);
228 foreach ( $words AS $word )
232 $word = preg_quote( $bugsys- >unsanitize( $word ));
233 $hilight [] = $temp = trim(preg_replace(' #[ ^
0 - 9 a
- zA
- Z_
] #', '', $word));
237 // -------------------------------------------------------------------
239 $show [ 'getattachments' ] = (( can_perform ( 'cangetattach' ) OR can_perform ( 'caneditattach' )) ? true : false );
240 $show [ 'putattachments' ] = (( can_perform ( 'canputattach' ) OR can_perform ( 'caneditattach' )) ? true : false );
242 if ( $show [ 'getattachments' ] OR $show [ 'putattachments' ])
244 $attachments_fetch = $db- > query ( "
245 SELECT attachment.*, user.email, user.showemail,
247 FROM " . TABLE_PREFIX
. "attachment AS attachment
248 LEFT JOIN " . TABLE_PREFIX
. "user AS user
249 ON (attachment.userid = user.userid)
250 WHERE attachment.bugid = $bug [bugid]
251 ORDER BY attachment.dateline"
253 while ( $attachment = $db- > fetch_array ( $attachments_fetch ))
255 $show [ 'editattach' ] = (( can_perform ( 'caneditattach' ) OR ( $attachment [ 'userid' ] == $bugsys- > userinfo
[ 'userid' ] AND can_perform ( 'canputattach' ))) ? true : false );
256 $attachment [ 'date' ] = $datef- > format ( $bugsys- > options
[ 'dateformat' ], $attachment [ 'dateline' ]);
257 $attachment [ 'user' ] = construct_user_display ( $attachment , false );
258 eval ( ' $attachments .= "' . $template- > fetch ( 'showreport_attachment' ) . '";' );
262 // -------------------------------------------------------------------
265 $vote = $db- > query_first ( "SELECT *, FIND_IN_SET(" . $bugsys- > userinfo
[ 'userid' ] . ", userids) AS uservote FROM " . TABLE_PREFIX
. "vote WHERE bugid = $bug [bugid]" );
267 $vote [ 'total' ] = $vote [ 'votefor' ] +
$vote [ 'voteagainst' ];
268 $vote [ 'forpercent' ] = round ( $vote [ 'votefor' ] / $vote [ 'total' ], 3 ) * 100 ;
269 $vote [ 'againstpercent' ] = round ( $vote [ 'voteagainst' ] / $vote [ 'total' ], 3 ) * 100 ;
271 $show [ 'vote' ] = (( can_perform ( 'canvote' ) AND ! $vote [ 'uservote' ]) ? true : false );
273 // -------------------------------------------------------------------
275 $comments_fetch = $db- > query ( "
276 SELECT comment.*, user.email, user.showemail, user.displayname
277 FROM " . TABLE_PREFIX
. "comment AS comment
278 LEFT JOIN " . TABLE_PREFIX
. "user AS user
279 ON (comment.userid = user.userid)
280 WHERE comment.bugid = $bug [bugid]" . ((! can_perform ( 'canviewhidden' )) ? "
281 AND !hidden" : '' ) . "
282 ORDER BY comment.dateline ASC"
284 while ( $comment = $db- > fetch_array ( $comments_fetch ))
286 $comment [ 'posttime' ] = $datef- > format ( $bugsys- > options
[ 'dateformat' ], $comment [ 'dateline' ]);
287 $comment [ 'postby' ] = construct_user_display ( $comment );
288 $show [ 'editcomment' ] = ((( can_perform ( 'caneditown' ) AND $bugsys- > userinfo
[ 'userid' ] == $comment [ 'userid' ]) OR can_perform ( 'caneditothers' )) ? true : false );
290 if ( is_array ( $hilight ))
292 foreach ( $hilight AS $id => $find )
295 $replace = "<span style= \" background-color: yellow; font-weight: bold; color: red; \" > \\ 1</span>" ;
296 $comment [ 'comment_parsed' ] = preg_replace ( $find , $replace , $comment [ 'comment_parsed' ]);
300 eval ( ' $comments .= "' . $template- > fetch ( 'showreport_comment' ) . '";' );
303 $show [ 'newreply' ] = (( can_perform ( 'canpostcomments' )) ? true : false );
305 if ( is_array ( $hilight ))
307 foreach ( $hilight AS $id => $find )
310 $replace = "<span style= \" background-color: yellow; font-weight: bold; color: red; \" > \\ 1</span>" ;
311 $bug [ 'summary' ] = preg_replace ( $find , $replace , $bug [ 'summary' ]);
315 eval ( ' $template- >flush("' . $template- > fetch ( 'showreport' ) . '");' );
317 /*=====================================================================*\
318 || ###################################################################
321 || ###################################################################
322 \*=====================================================================*/