r532: - Removing NULL 2nd parameter from can_perform()
[bugdar.git] / showhistory.php
1 <?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 \*=====================================================================*/
12
13 $fetchtemplates = array(
14 'history',
15 'history_group',
16 'history_bit'
17 );
18
19 define('SVN', '$Id$');
20
21 $focus['showreport'] = 'focus';
22
23 require_once('./global.php');
24
25 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']));
26 if (!$bug)
27 {
28 $message->error($lang->getlex('error_invalid_id'));
29 }
30
31 if ($bug['hidden'] AND !can_perform('canviewhidden', $bug['productid']))
32 {
33 $message->error_permission();
34 }
35
36 // ###################################################################
37
38 $customfields = $db->query("
39 SELECT bugfield.*
40 FROM " . TABLE_PREFIX . "bugfield AS bugfield
41 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
42 ON (bugfield.fieldid = permission.fieldid)
43 WHERE permission.mask <> 0
44 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
45 );
46
47 while ($field = $db->fetch_array($customfields))
48 {
49 $fieldlist["custom_field$field[fieldid]"] = 'custom_field' . $field['fieldid'] . " (\"$field[name]\")";
50 }
51
52 // ###################################################################
53
54 $logs_fetch = $db->query("
55 SELECT history.*, user.userid, user.email, user.displayname, user.showemail
56 FROM " . TABLE_PREFIX . "history AS history
57 LEFT JOIN " . TABLE_PREFIX . "user AS user
58 ON (user.userid = history.userid)
59 WHERE bugid = $bug[bugid]"
60 );
61 while ($log = $db->fetch_array($logs_fetch))
62 {
63 $log['date'] = $datef->format($bugsys->options['dateformat'], $log['dateline']);
64 $log['user'] = construct_user_display($log);
65
66 $logs["$log[dateline]"]["$log[historyid]"] = $log;
67 ksort($logs["$log[dateline]"]);
68 }
69
70 ksort($logs);
71
72 foreach ($logs AS $dateline => $logitems)
73 {
74 $rowspan = 1;
75 $changes = '';
76 $show['changes'] = false;
77 $messages = array();
78 foreach ($logitems AS $log)
79 {
80 $hasvalues = ((empty($log['original']) AND (empty($log['changed']) AND $log['changed'] != '0')) ? false : true);
81
82 if ($newlog = $fieldlist["$log[field]"])
83 {
84 $log['field'] = $newlog;
85 }
86
87 $show['changes'] = (($hasvalues) ? true : $show['changes']);
88
89 if ($hasvalues)
90 {
91 $rowspan++;
92 eval('$changes .= "' . $template->fetch('history_bit') . '";');
93 }
94 }
95
96 $log['messages'] = implode("<br />\n", $messages);
97
98 eval('$history .= "' . $template->fetch('history_group') . '";');
99 }
100
101 eval('$template->flush("' . $template->fetch('history') . '");');
102
103 /*=====================================================================*\
104 || ###################################################################
105 || # $HeadURL$
106 || # $Id$
107 || ###################################################################
108 \*=====================================================================*/
109 ?>