r765: Say hello to the GPL
[bugdar.git] / showhistory.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 $fetchtemplates = array(
23 'history',
24 'history_bit'
25 );
26
27 define('SVN', '$Id$');
28
29 $focus['showreport'] = 'focus';
30
31 require_once('./global.php');
32
33 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']));
34 if (!$bug)
35 {
36 $message->error($lang->getlex('error_invalid_id'));
37 }
38
39 if (($bug['hidden'] AND !can_perform('canviewhidden', $bug['productid'])) OR !can_perform('canviewbugs', $bug['productid']))
40 {
41 $message->error_permission();
42 }
43
44 // ###################################################################
45
46 $customfields = $db->query("
47 SELECT bugfield.*
48 FROM " . TABLE_PREFIX . "bugfield AS bugfield
49 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
50 ON (bugfield.fieldid = permission.fieldid)
51 WHERE permission.mask <> 0
52 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
53 );
54
55 while ($field = $db->fetch_array($customfields))
56 {
57 $fieldlist["custom_field$field[fieldid]"] = 'custom_field' . $field['fieldid'] . " (\"$field[name]\")";
58 }
59
60 // ###################################################################
61
62 $logs_fetch = $db->query("
63 SELECT history.*, user.userid, user.email, user.displayname, user.showemail
64 FROM " . TABLE_PREFIX . "history AS history
65 LEFT JOIN " . TABLE_PREFIX . "user AS user
66 ON (user.userid = history.userid)
67 WHERE bugid = $bug[bugid]"
68 );
69 while ($log = $db->fetch_array($logs_fetch))
70 {
71 $log['date'] = $datef->format($bugsys->options['dateformat'], $log['dateline']);
72 $log['user'] = construct_user_display($log);
73
74 $logs["$log[dateline]"]["$log[historyid]"] = $log;
75 ksort($logs["$log[dateline]"]);
76 }
77
78 ksort($logs);
79
80 foreach ($logs AS $dateline => $logitems)
81 {
82 $show['group'] = true;
83
84 foreach ($logitems AS $log)
85 {
86 $funct->exec_swap_bg('', $stylevar['alt_colour']);
87 $bgcolour = $funct->bgcolour;
88
89 if ($newlog = $fieldlist["$log[field]"])
90 {
91 $log['field'] = $newlog;
92 }
93
94 eval('$history .= "' . $template->fetch('history_bit') . '";');
95 $show['group'] = false;
96 }
97 }
98
99 eval('$template->flush("' . $template->fetch('history') . '");');
100
101 /*=====================================================================*\
102 || ###################################################################
103 || # $HeadURL$
104 || # $Id$
105 || ###################################################################
106 \*=====================================================================*/
107 ?>