]>
src.bluestatic.org Git - bugdar.git/blob - includes/class_history.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]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 \*=====================================================================*/
25 var $attachmentid = 0;
34 * Allow diff's that have an empty result (no change)
37 var $allowempty = false;
40 * Logs a field change into the database
42 * @param array Diff data produced by diff()
44 function log($diffdata = null)
48 $this->bugid
= intval($this->bugid
);
49 $this->attachmentid
= intval($this->attachmentid
);
50 $this->commentid
= intval($this->commentid
);
63 INSERT INTO " . TABLE_PREFIX
. "history
64 (bugid, attachmentid, commentid, dateline, userid, field, original, changed)
66 (" . $this->bugid
. ", " . $this->attachmentid
. ", " . $this->commentid
. ", " . TIMENOW
. ",
67 " . $bugsys->userinfo
['userid'] . ", '" . $bugsys->escape($diffdata['field']) . "',
68 '" . $bugsys->escape($diffdata['initial']) . "', '" . $bugsys->escape($diffdata['final']) . "'
74 * Compares two values and creates a report of their differences
76 * @param string Name of the field
77 * @param mixed Initial value
78 * @param mixed Final value
80 * @return array Difference report
82 function diff($field, $initial, $final)
84 $field = trim($field);
85 $initial = trim($initial);
86 $final = trim($final);
93 if (empty($initial) AND empty($final))
95 if (!$this->allowempty
)
101 if (!$this->allowempty
)
103 if ($initial === $final)
109 return array('field' => $field, 'initial' => $initial, 'final' => $final);
113 /*=====================================================================*\
114 || ###################################################################
117 || ###################################################################
118 \*=====================================================================*/