From ba8ba4bc01eaa48a891e6d094071796d69cd0bd3 Mon Sep 17 00:00:00 2001 From: wbudic Date: Sat, 13 Feb 2021 17:09:53 +1100 Subject: [PATCH] exp. car handler. --- htdocs/cgi-bin/system/modules/Settings.pm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/cgi-bin/system/modules/Settings.pm b/htdocs/cgi-bin/system/modules/Settings.pm index 62ea71a..95bb874 100644 --- a/htdocs/cgi-bin/system/modules/Settings.pm +++ b/htdocs/cgi-bin/system/modules/Settings.pm @@ -22,6 +22,16 @@ use DateTime::Duration; use DBI; use experimental 'switch'; +use CGI::Carp qw(fatalsToBrowser set_message); +BEGIN { + sub handle_errors { + my $msg = shift; + print "

LifeLog Server Error

"; + print "
@[$ENV{PWD}].Error: $msg
"; + } + set_message(\&handle_errors); +} + # This is the default developer release key, replace on istallation. As it is not secure. use constant CIPHER_KEY => '95d7a85ba891da'; use constant CIPHER_PADDING => 'fe0a2b6a83e81f13a2d76ab104763773310df6b0a01c7cf9807b4b0ce2a02'; @@ -272,8 +282,8 @@ if($IS_PG_DB){ ID_CAT INT NOT NULL, DATE TIMESTAMP NOT NULL, LOG VARCHAR ($DBI_LVAR_SZ) NOT NULL, - RTF BOOL DEFAULT 0, - AMOUNT money, + RTF SMALLINT DEFAULT 0, + AMOUNT MONEY, AFLAG INT DEFAULT 0, STICKY BOOL DEFAULT FALSE, PRIMARY KEY(ID) @@ -553,7 +563,7 @@ sub toLog { } $log =~ s/'/''/g; if(length($log)>$DBI_LVAR_SZ){SettingsLimitSizeException->throw("Log size limit ($DBI_LVAR_SZ) exceeded, log length is:".length($log))} - $db->do("INSERT INTO LOG (ID_CAT, DATE, LOG) VALUES($cat,'$stamp', '$log');"); + $db->do("INSERT INTO LOG (ID_CAT, DATE, LOG) VALUES($cat, '$stamp', '$log');"); } sub countRecordsIn { @@ -665,7 +675,7 @@ sub connectDB { try{ return DBI->connect($DSN, $u, $p, {AutoCommit => 1, RaiseError => 1, PrintError => 0, show_trace=>1}); }catch{ - LifeLogException->throw(error=>"

Error->$@


$DSN

", show_trace=>1); + LifeLogException->throw(error=>"

Error->$@


DSN: $DSN
", show_trace=>1); } } -- 2.34.1