From b928ea9f2eefc78da2d496a94aa8955cc3d9cf9a Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 11 Aug 2021 21:22:29 +0200 Subject: [PATCH] Link Annotation --- index.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index 7903b74..695011c 100644 --- a/index.php +++ b/index.php @@ -89,9 +89,11 @@ if ($track_activity) { $txt = $user . ' '; $txt .= date(DATE_ATOM, time()) . ' '; $url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - $link_annotations = array(); - parse_str(parse_url($url, PHP_URL_QUERY), $link_annotations); - if ($link_annotations['broken'] == 'on') $link_annotations['broken'] = 'broken'; + $link_annotations = array('none', 'off', 'nocomment'); + if (parse_url($url, PHP_URL_QUERY)) { + parse_str(parse_url($url, PHP_URL_QUERY), $link_annotations); + if ($link_annotations['broken'] == 'on') $link_annotations['broken'] = 'broken'; + } $txt .= implode(' ', $link_annotations); file_put_contents('activity.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX); } @@ -305,9 +307,9 @@ function get_directory_size($path) return display_size($bytestotal); } -function unix2ago($t) { +function filemtimeago($file) { date_default_timezone_set('Europe/Berlin'); - $sec = (time() - t) / 1000; + $sec = (filemtime('logins.txt') - filemtime($file)) / 1000; if ($sec > 60*60*12) return round($sec / (60*60*24), 1) . ' days ago'; if ($sec > 60*60) return round($sec / (60*60)) . ' hours ago'; if ($sec > 60) return round($sec / 60) . ' minutes ago'; @@ -318,16 +320,26 @@ function unix2ago($t) { function display_flat_link_list() { global $flat_link_list; date_default_timezone_set('Europe/Berlin'); + $acts = file("activity.txt"); $h = "
"; $h .= ""; $h .= ""; $h .= "