r154: Fixed the circumstances under which we show changes... it now works right.
[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 echo 'alert: bad bug';
25 exit;
26 }
27
28 // ###################################################################
29
30 $logs_fetch = $db->query("
31 SELECT history.*, user.userid, user.email, user.displayname, user.showemail
32 FROM " . TABLE_PREFIX . "history AS history
33 LEFT JOIN " . TABLE_PREFIX . "user AS user
34 ON (user.userid = history.userid)
35 WHERE bugid = $bug[bugid]"
36 );
37 while ($log = $db->fetch_array($logs_fetch))
38 {
39 $log['formatted'] = call_user_func_array('phrase', array_merge(array($log['language']), unserialize($log['arguments'])));
40 $log['date'] = datelike('standard', $log['dateline']);
41 $log['user'] = construct_user_display($log);
42
43 $logs["$log[dateline]"]["$log[historyid]"] = $log;
44 ksort($logs["$log[dateline]"]);
45 }
46
47 ksort($logs);
48
49 foreach ($logs AS $dateline => $logitems)
50 {
51 $rowspan = 1;
52 $changes = '';
53 $show['changes'] = false;
54 foreach ($logitems AS $log)
55 {
56 $rowspan++;
57 $show['changes'] = ((empty($log['original']) AND empty($log['changed'])) ? $show['changes'] : true);
58 eval('$changes .= "' . $template->fetch('history_bit') . '";');
59 }
60 eval('$history .= "' . $template->fetch('history_group') . '";');
61 }
62
63 eval('$template->flush("' . $template->fetch('history') . '");');
64
65 /*=====================================================================*\
66 || ###################################################################
67 || # $HeadURL$
68 || # $Id$
69 || ###################################################################
70 \*=====================================================================*/
71 ?>