r145: - Added logging mechanism to files
[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_bit'
16 );
17
18 require_once('./global.php');
19
20 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']));
21 if (!$bug)
22 {
23 echo 'alert: bad bug';
24 exit;
25 }
26
27 // ###################################################################
28
29 $logs = $db->query("SELECT history.*, user.* FROM " . TABLE_PREFIX . "history LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = history.userid) WHERE bugid = $bug[bugid]");
30 while ($log = $db->fetch_array($logs))
31 {
32 $log['formatted'] = call_user_func_array('phrase', array_merge(array($log['language']), unserialize($log['arguments'])));
33 $log['date'] = datelike('standard', $log['dateline']);
34 $log['user'] = construct_user_display($log);
35
36 $log['initial'] = unserialize($log['original']);
37 $log['final'] = unserialize($log['changed']);
38
39 foreach ($log['initial'] AS $key => $value)
40 {
41 $log['changes'] .= "[$key] \"$value\" => \"{$log['final'][$key]}\"\n";
42 }
43
44 eval('$history .= "' . $template->fetch('history_bit') . '";');
45 }
46
47 eval('$template->flush("' . $template->fetch('history') . '");');
48
49 /*=====================================================================*\
50 || ###################################################################
51 || # $HeadURL$
52 || # $Id$
53 || ###################################################################
54 \*=====================================================================*/
55 ?>