readEntry($R_entry['entry_id'], $R_entry['rev_num']); } // Checking if you have read the entry $Q_read = mysql_query("select read_id from `entry_read` where user_id = '" . $login['user_id'] . "' and entry_id = '" . $R_entry['entry_id'] . "' and rev_num = '" . $R_entry['rev_num'] . "'"); if (mysql_num_rows($Q_read)) { $color = 'black'; $color2 = 'white'; } elseif (count($log) && $log['log_action'] == 'edit') { $color = 'white'; $color2 = 'blue'; } else { $color = 'white'; $color2 = 'red'; } echo ' <tr>' . chr(10); echo ' <td bgcolor="' . $color2 . '"><center><a href="./entry.php?entry_id=' . $R_entry['entry_id'] . '">' . $R_entry['entry_id'] . '</a></center></td>' . chr(10); echo ' <td bgcolor="' . $color2 . '"><font color="' . $color . '">' . $R_entry['entry_name'] . '</font></td>' . chr(10); echo ' <td bgcolor="' . $color2 . '"><font color="' . $color . '">' . date('H:i:s d-m-Y', $R_entry['time_last_edit']) . '</font></td>' . chr(10); echo ' <td bgcolor="' . $color2 . '"><font color="' . $color . '">' . $user['user_name'] . '</font></td>' . chr(10); if (count($log)) { echo ' <td bgcolor="' . $color2 . '"><font color="' . $color . '">'; printEntryLog($log); echo '</font></td>' . chr(10); } else { echo ' <td bgcolor="' . $color2 . '">' . _('Log not found') . '</td>' . chr(10); } echo ' </tr>' . chr(10); } echo '</table>'; echo '<br><br>' . chr(10); echo '- <a href="new_entries.php?seen_all=1">' . _('Mark all entries in this list as read') . '</a><br>';
echo ' <td><b>' . _('Action') . '</b></td>' . chr(10); echo ' <td><b>' . _('Who') . '</b></td>' . chr(10); echo ' <td><b>' . _('What') . '</b></td>' . chr(10); echo ' </tr>' . chr(10); foreach ($entry_log as $thislog) { echo ' <tr>' . chr(10); echo ' <td><b>' . $thislog['rev_num'] . '</td>' . chr(10); echo ' <td>' . str_replace(" ", " ", date('Y-m-d H:i:s', $thislog['log_time'])) . '</td>' . chr(10); // Action echo ' <td>' . str_replace(" ", " ", printEntryLog($thislog, false, true)) . '</td>' . chr(10); // Who $user = getUser($thislog['user_id']); if (count($user)) { echo ' <td>' . str_replace(" ", " ", $user['user_name']) . '</td>' . chr(10); } else { echo ' <td> </td>' . chr(10); } // What echo ' <td>'; echo '<a href="javascript:switchView(' . $thislog['log_id'] . ');" id="switchlink' . $thislog['log_id'] . '">' . _("hide") . '</a>' . chr(10); echo '<div id="log' . $thislog['log_id'] . '">' . chr(10); echo ' <ul>' . chr(10); echo printEntryLog($thislog, TRUE); echo ' </ul>' . chr(10); echo '</div>' . chr(10); echo '<script type="text/javascript">switchView(' . $thislog['log_id'] . ');</script>' . chr(10); echo '</td>' . chr(10); echo ' </tr>' . chr(10); } echo '</table>' . chr(10); echo '</td></tr></table>';
function templateAssignEntryChanges($var, $entry, $rev_num, $remove_invoice = false) { global ${$var}; $rev_num = (int) $rev_num; if (count($entry) && $rev_num > 0) { $Q_rev = mysql_query("select * from `entry_log` where `entry_id` = '" . $entry['entry_id'] . "' and `rev_num` = '" . $rev_num . "' limit 1"); if (!mysql_num_rows($Q_rev)) { // Assigning all the var with zero value ${$var}->assign('log_time', 0); ${$var}->assign('log_action_real', ''); ${$var}->assign('log_user_id', 0); ${$var}->assign('log_user', ''); ${$var}->assign('log_changes', array()); } else { $thislog = mysql_fetch_assoc($Q_rev); $thislog['log_data'] = unserialize($thislog['log_data']); ${$var}->assign('log_time', $thislog['log_time']); ${$var}->assign('log_action_real', printEntryLog($thislog, false, true)); ${$var}->assign('log_user_id', $thislog['user_id']); $user = getUser($thislog['user_id']); if (count($user)) { ${$var}->assign('log_user', $user['user_name']); } else { ${$var}->assign('log_user', 'ERROR'); } $changes = array(); if ($remove_invoice) { foreach ($thislog['log_data'] as $var2 => $value) { if (substr($var2, 0, 7) == 'invoice') { unset($thislog['log_data'][$var2]); } } } foreach (readEntryLog($thislog) as $change) { $changes[] = strip_tags($change); } ${$var}->assign('log_changes', $changes); } } else { ${$var}->assign('log_time', 0); ${$var}->assign('log_action_real', ''); ${$var}->assign('log_user_id', 0); ${$var}->assign('log_user', ''); ${$var}->assign('log_changes', array()); } }