r173: Renaming the error reporting stuff so it can also handle non-error messages...
[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 require_once('./global.php');
20
21 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']));
22 if (!$bug)
23 {
24 $message->error('alert: bad bug');
25 }
26
27 // ###################################################################
28
29 $logs_fetch = $db->query("
30 SELECT history.*, user.userid, user.email, user.displayname, user.showemail
31 FROM " . TABLE_PREFIX . "history AS history
32 LEFT JOIN " . TABLE_PREFIX . "user AS user
33 ON (user.userid = history.userid)
34 WHERE bugid = $bug[bugid]"
35 );
36 while ($log = $db->fetch_array($logs_fetch))
37 {
38 $log['formatted'] = call_user_func_array('phrase', array_merge(array($log['language']), unserialize($log['arguments'])));
39 $log['date'] = datelike('standard', $log['dateline']);
40 $log['user'] = construct_user_display($log);
41
42 $logs["$log[dateline]"]["$log[historyid]"] = $log;
43 ksort($logs["$log[dateline]"]);
44 }
45
46 ksort($logs);
47
48 foreach ($logs AS $dateline => $logitems)
49 {
50 $rowspan = 1;
51 $changes = '';
52 $show['changes'] = false;
53 $messages = array();
54 foreach ($logitems AS $log)
55 {
56 $hasvalues = ((empty($log['original']) AND empty($log['changed'])) ? false : true);
57 $show['changes'] = (($hasvalues) ? true : $show['changes']);
58
59 if ($hasvalues)
60 {
61 $rowspan++;
62 eval('$changes .= "' . $template->fetch('history_bit') . '";');
63 }
64
65 if (!in_array($log['formatted'], $messages))
66 {
67 $messages[] = $log['formatted'];
68 }
69 }
70
71 $log['messages'] = implode("</div>\n<div>", $messages);
72
73 eval('$history .= "' . $template->fetch('history_group') . '";');
74 }
75
76 eval('$template->flush("' . $template->fetch('history') . '");');
77
78 /*=====================================================================*\
79 || ###################################################################
80 || # $HeadURL$
81 || # $Id$
82 || ###################################################################
83 \*=====================================================================*/
84 ?>