r303: Added SVN constant to user files; now ISSO debug information shows SVN details.
[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 require_once('./global.php');
22
23 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']));
24 if (!$bug)
25 {
26 $message->error('alert: bad bug');
27 }
28
29 if ($bug['hidden'] AND !can_perform('canviewhidden'))
30 {
31 $message->error_permission();
32 }
33
34 // ###################################################################
35
36 $customfields = $db->query("
37 SELECT bugfield.*
38 FROM " . TABLE_PREFIX . "bugfield AS bugfield
39 LEFT JOIN " . TABLE_PREFIX . "bugfieldpermission AS permission
40 ON (bugfield.fieldid = permission.fieldid)
41 WHERE permission.mask <> 0
42 AND permission.usergroupid = {$bugsys->userinfo['usergroupid']}"
43 );
44
45 while ($field = $db->fetch_array($customfields))
46 {
47 $fieldlist["custom_field$field[fieldid]"] = 'custom_field' . $field['fieldid'] . " (\"$field[name]\")";
48 }
49
50 // ###################################################################
51
52 $logs_fetch = $db->query("
53 SELECT history.*, user.userid, user.email, user.displayname, user.showemail
54 FROM " . TABLE_PREFIX . "history AS history
55 LEFT JOIN " . TABLE_PREFIX . "user AS user
56 ON (user.userid = history.userid)
57 WHERE bugid = $bug[bugid]"
58 );
59 while ($log = $db->fetch_array($logs_fetch))
60 {
61 $log['formatted'] = call_user_func_array(array(lang, 'p'), array_merge(array($log['language']), unserialize($log['arguments'])));
62 $log['date'] = $datef->format($bugsys->options['dateformat'], $log['dateline']);
63 $log['user'] = construct_user_display($log);
64
65 $logs["$log[dateline]"]["$log[historyid]"] = $log;
66 ksort($logs["$log[dateline]"]);
67 }
68
69 ksort($logs);
70
71 foreach ($logs AS $dateline => $logitems)
72 {
73 $rowspan = 1;
74 $changes = '';
75 $show['changes'] = false;
76 $messages = array();
77 foreach ($logitems AS $log)
78 {
79 $hasvalues = ((empty($log['original']) AND (empty($log['changed']) AND $log['changed'] != '0')) ? false : true);
80
81 if ($newlog = $fieldlist["$log[field]"])
82 {
83 $log['field'] = $newlog;
84 }
85
86 $show['changes'] = (($hasvalues) ? true : $show['changes']);
87
88 if ($hasvalues)
89 {
90 $rowspan++;
91 eval('$changes .= "' . $template->fetch('history_bit') . '";');
92 }
93
94 if (!in_array($log['formatted'], $messages))
95 {
96 $messages[] = $log['formatted'];
97 }
98 }
99
100 $log['messages'] = implode("</div>\n<div>", $messages);
101
102 eval('$history .= "' . $template->fetch('history_group') . '";');
103 }
104
105 eval('$template->flush("' . $template->fetch('history') . '");');
106
107 /*=====================================================================*\
108 || ###################################################################
109 || # $HeadURL$
110 || # $Id$
111 || ###################################################################
112 \*=====================================================================*/
113 ?>