diff options
| -rw-r--r-- | inc/audit.inc.php | 1 | ||||
| -rw-r--r-- | inc/util.inc.php | 5 | ||||
| -rw-r--r-- | modules-available/eventlog/inc/filterruleprocessor.inc.php | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/inc/audit.inc.php b/inc/audit.inc.php new file mode 100644 index 00000000..b3d9bbc7 --- /dev/null +++ b/inc/audit.inc.php @@ -0,0 +1 @@ +<?php diff --git a/inc/util.inc.php b/inc/util.inc.php index ed0b40ae..91232f46 100644 --- a/inc/util.inc.php +++ b/inc/util.inc.php @@ -335,16 +335,17 @@ class Util * The format depends on how far the timestamp lies in the past. * * @param int $ts unix timestamp + * @param bool $useSmartAbbreviation use words like "yesterday", leave out year, if applicable * @return string human-readable representation */ - public static function prettyTime(int $ts): string + public static function prettyTime(int $ts, bool $useSmartAbbreviation = true): string { settype($ts, 'int'); if ($ts === 0) return '???'; static $TODAY = false, $ETODAY = false, $YESTERDAY = false, $YEARCUTOFF = false; if (!$ETODAY) $ETODAY = strtotime('today 23:59:59'); - if ($ts > $ETODAY) // TODO: Do we need strings for future too? + if (!$useSmartAbbreviation || $ts > $ETODAY) // TODO: Do we need strings for future too? return date('d.m.Y H:i', $ts); if (!$TODAY) $TODAY = strtotime('today 0:00'); if ($ts >= $TODAY) diff --git a/modules-available/eventlog/inc/filterruleprocessor.inc.php b/modules-available/eventlog/inc/filterruleprocessor.inc.php index ae60fb40..33ede356 100644 --- a/modules-available/eventlog/inc/filterruleprocessor.inc.php +++ b/modules-available/eventlog/inc/filterruleprocessor.inc.php @@ -328,7 +328,7 @@ class FilterRuleProcessor case 'b': return Util::readableFileSize((int)$v, -1, $shift); case 'ts': - return Util::prettyTime((int)$v); + return Util::prettyTime((int)$v, false); case 'd': return Util::formatDuration((int)$v); case 'L': |
