From 6c7282044757c48c043ae2a8a9e36da16b52669f Mon Sep 17 00:00:00 2001 From: wbudic Date: Fri, 18 Jan 2019 16:44:52 +1100 Subject: [PATCH] Added link parsing within the log, requires Regexp::Common --- htdocs/cgi-bin/main.cgi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index 872519f..dba5d35 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -10,6 +10,7 @@ use DBI; use DateTime; use DateTime::Format::SQLite; use DateTime::Duration; +use Regexp::Common qw /URI/; my $driver = "SQLite"; my $database = "../../dbLifeLog/data_log.db"; @@ -126,6 +127,7 @@ if($rv < 0) { my $tfId = 0; my $id = 0; my $tbl_start = index $stmt, "<="; +my $re_a_tag = qr/.*<\/a>/si ; if($tbl_start>0){ #check if we are at the beggining of the LOG table? @@ -139,6 +141,7 @@ if($tbl_start>0){ $stc->finish(); } + while(my @row = $st->fetchrow_array()) { $id = $row[0]; @@ -162,6 +165,13 @@ if($tbl_start>0){ }else{ $tfId = 1; } + my @chunks = split(/($re_a_tag)/si , $log) ; + + foreach my $chunks_i ( @chunks ) { + next if $chunks_i =~ /$re_a_tag/ ; + $chunks_i =~ s/($RE{URI}{HTTP})/$1<\/a>/gsi; + } + $log = join('' , @chunks) ; $tbl = $tbl . ''. $dt->ymd . ''. '' . $dt->hms . "" . @@ -281,6 +291,7 @@ exit; ### CGI END + sub buildNavigationButtons{ my $is_end_of_rs = shift; -- 2.34.1