show ' . (!empty($type) ? safeHTMLstr($type) : '') . ' entries

'; $q = "SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE `logid`='" . safeSQLstr($_GET['id']) . "'"; $r = ocsql_query($q) or err('Unable to retrieve log entry'); if (mysql_num_rows($r) == 0) { warn('Log entry not found'); } else { $l = mysql_fetch_assoc($r); print 'Date/Time: ' . safeHTMLstr($l['datetime']); if ($l['type'] == 'email') { print '   (view individual messages/status)'; } print '
Type: ' . safeHTMLstr($l['type']) . '
Entry: ' . safeHTMLstr($l['entry']) . '


' . nl2br(safeHTMLstr($l['extra'])) . '

'; } } else { // all entries if (isset($_GET['limit']) && ($_GET['limit'] == 0)) { // limit entries? $limit = ''; } else { $limit = ' LIMIT 30'; print '

show all ' . safeHTMLstr($type) . ' entries

'; } // Get email entries with failed messages $failedMessageAR = array(); $q = "SELECT `queued` FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `sent` IS NULL GROUP BY `queued`"; $r = ocsql_query($q) or err('Unable to retrieve email log entries'); while ($l = mysql_fetch_assoc($r)) { $failedMessageAR[] = $l['queued']; } // retrieve entries $q = "SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE `type`" . (empty($type) ? "!='sql'" : ("='" . safeSQLstr($type) . "'")) . " ORDER BY `datetime` DESC" . $limit; $r = ocsql_query($q) or err('Unable to retrieve log entries'); if (mysql_num_rows($r) == 0) { warn('No log entries were found'); } // display entries print ''; $row = 1; while ($l = mysql_fetch_assoc($r)) { print '\n"; if ($row == 1) { $row = 2; } else { $row = 1; } } print '
Date / TimeTypeEntry
'; if (!empty($l['extra'])) { // extra stuff? if so link it in print '' . safeHTMLstr($l['datetime']) . ''; } else { print safeHTMLstr($l['datetime']); } print '' . safeHTMLstr($l['type']); if (($l['type'] == 'email') && in_array($l['datetime'], $failedMessageAR)) { print ' – failed'; } print '' . safeHTMLstr($l['entry']) . "

Log entries are shown in Coordinated Universal Time (UTC)

'; } printFooter(); ?>