]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Started new development.
authorwbudic <redacted>
Wed, 23 Mar 2022 22:19:43 +0000 (09:19 +1100)
committerwbudic <redacted>
Wed, 23 Mar 2022 22:19:43 +0000 (09:19 +1100)
Current Development Check List.md
htdocs/cgi-bin/data.cgi
htdocs/cgi-bin/login_ctr.cgi
htdocs/cgi-bin/main.cgi
htdocs/cgi-bin/system/modules/CNFParser.pm
htdocs/cgi-bin/system/modules/Settings.pm
htdocs/cgi-bin/tz.map [new file with mode: 0644]
htdocs/data [deleted symlink]

index 23e48c57f4d5cc214ff745b261f5a870eaa21331..6815e960a5815b65acf9f30395ebd5d4c756c6a4 100644 (file)
@@ -6,7 +6,8 @@
 
 ### New Development v.2.3+
 
-* [x] Fix uninitialized $scalars and warnings. My style of programming uses this as a perl feature, as unutilized is also null or empty. Linter disagrees with that. Empty or null  isn't also 0 for it. Null, empty and zero should be the same thing in scalar context and logic.
+* [x] Fix uninitialized $scalars and warnings. My style of programming uses this as a perl feature, as unutilized is also null or empty. Linter disagrees with that. Empty or null  isn't also 0 for it. Null, empty, undef, and zero should be the same thing in scalar context and logic.
+* [ ] Stats and config page should check github for latest version, as background pull.
 * [ ] Implement template based CGI processing (slower but better separation of concerns).
   * This separation of concern currently not really necessary as at the main.cgi is the whole file, that also incorporates buffering and complex database rendering. Thereby a slight performance penalty would be having to read and process also an template. Buffering is also directly compressed to client. Giving fast pages that some webservers might not have inbuilt or provide (rare). We will see. Templates are good, as the page layout is easier to change and rearrange.
 * [ ] Module installation script should check, on main.cnf and on perl soundness and compatibility.
index 71e788571620c16e59347c20e5c8ae44e0a39766..a7fd104d343a447a267d9be2c95b5fbb0d7fba91 100755 (executable)
@@ -1,11 +1,14 @@
-#!/usr/bin/perl
+#!/usr/local/bin/perl
 #
 # Programed in vim by: Will Budic
 # Open Source License -> https://choosealicense.com/licenses/isc/
 #
+use v5.34; #use diagnostics;
 use warnings;
 use strict;
-use experimental qw( switch );
+no warnings "experimental::smartmatch";
+##no critic qw(Subroutines::RequireFinalReturn)
+##no critic qw(Variables::RequireLocalizedPunctuationVars)
 use Exception::Class ('LifeLogException');
 
 use Syntax::Keyword::Try;
@@ -121,7 +124,7 @@ try{
     foreach my $id ($cgi->param('chk')){
         my $st = Settings::selectRecords($db, 'select RTF from LOG where '.$SQLID.'='.$id);
         my @ra = $st->fetchrow_array();
-        $st1->execute($id) or die "<p>Error->"& $_ &"</p>";        
+        $st1->execute($id) or die "<p>Error->$_</p>";        
         $st2->execute($id) if $ra[0];
     }
    #2021-08-11 Added just in case next an renumeration. 
@@ -209,14 +212,12 @@ try{
             }
             $r_cnt++;
         }
-        my $plural = "";
-        if($r_cnt>1){
-            $plural = "s";
-        }
-
+  
         $tbl .= '<tr class="r0"><td colspan="4"><a name="bottom"></a><a href="#top">&#x219F;</a>
         <center>
-        <h3>Please Confirm You Want<br>The Above Record'.$plural.' Deleted?</h3><br><button onclick="window.history.back()">No Go Back</button></center>
+            <h3>Please Confirm You Want<br>The Above Record'.($r_cnt>1?'s':'').' Deleted?</h3><br>
+           <button onclick="return backToMain()">No Go Back</button>
+        </center>
         </td></tr>
         <tr class="r0"><td colspan="4"><center>
         <input type="submit" value="I AM CONFIRMING!">
@@ -401,7 +402,7 @@ try{
 }
 }
 sub cam {
-    my $am = sprintf( "%.2f", shift @_ );
+    my $am = sprintf( "%.2f", shift);
     # Add one comma each time through the do-nothing loop
     1 while $am =~ s/^(-?\d+)(\d\d\d)/$1,$2/;
     return $am;
index c773334e81037a34360b6f141bc58d1fffc977cf..08d6844b87759f9b2547d9644f496aadd85c8d81 100755 (executable)
@@ -51,6 +51,8 @@ my $LOGOUT_IFRAME = qq|
     <iframe width="60%" height="600px" src="https://www.youtube.com/embed/qTFojoffE78?autoplay=1" frameborder="0" allow="accelerometer; 
             autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
     </iframe>|;
+my %reserved = ('AND'=>1, 'OR'=>1, 'NOT'=>1, 'DATE'=>1,'OLDER_THAN'=>1, 'FROM'=>1,'TO'=>1,'>'=>1,'<'=>1,'>='=>1,'<='=>1,'=='=>1,'!='=>1);
+my %columns  = ('CAT'=>1,'STICKY'=>1, 'RTF'=>1, 'LOG'=>1);    
 try{    
     checkAutologinSet();
     logout() if($cgi->param('logout'));
@@ -593,7 +595,7 @@ sub checkCreateTables {     my ($pst, $sql,$rv, $changed) = ("","","",0);
     # Bypassing auto login. So to start maybe working on another database, and a new session.    
     return 1 if $cgi->param('autologoff') == 1;
  }catch{
-     LifeLogException -> throw(error=>"DSN:".Settings::dsn()." Error:".$@."\nLAST_SQL:".$sql,show_trace=>1);     
+     LifeLogException -> throw(error=>"DSN:".Settings::dsn()." Error:".$@."\nLAST_SQL:".$sql."\npwd:".`pwd`,show_trace=>1);     
  }
  return 0;
 }
@@ -650,8 +652,7 @@ sub createPageViewWhereOverrideSQL {
     
 }
 
-my %reserved = ('AND'=>1, 'OR'=>1, 'NOT'=>1, 'DATE'=>1,'OLDER_THAN'=>1, 'FROM'=>1,'TO'=>1,'>'=>1,'<'=>1,'>='=>1,'<='=>1,'=='=>1,'!='=>1);
-my %columns  = ('CAT'=>1,'STICKY'=>1, 'RTF'=>1, 'LOG'=>1);
+
 sub toTokens {
     my $base = shift;
     my @ret = ();
index bb498d1fd1267b09c65657e6b5ee284dc42bd7e3..a2a65fee374f124da05a9dce5496ad32ea19d819 100755 (executable)
@@ -5,12 +5,15 @@
 #
 use v5.34; #use diagnostics;
 use warnings;
-use strict; no warnings "experimental::smartmatch"; 
+use strict;
+no warnings "experimental::smartmatch";
 use Exception::Class ('LifeLogException');
 use Syntax::Keyword::Try;
 use DBI;
-use DBD::Pg; use DBD::Pg qw(:pg_types);
-use Date::Language; use Date::Parse; 
+use DBD::Pg;
+use DBD::Pg qw(:pg_types);
+use Date::Language;
+use Date::Parse;
 use Time::localtime;
 
 use Regexp::Common qw /URI/;
@@ -25,22 +28,22 @@ require Settings;
 my $db      = Settings::fetchDBSettings();
 my $cgi     = Settings::cgi();
 my $sss     = Settings::session();
-my $sid     = Settings::sid(); 
+my $sid     = Settings::sid();
 my $dbname  = Settings::dbName();
 my $alias   = Settings::alias();
 my $passw   = Settings::pass();
-my $VW_PAGE = Settings->VW_LOG; 
+my $VW_PAGE = Settings->VW_LOG;
 
 my $sssCDB  = session('cdb');
 my ($vmode, $imgw, $imgh );
 
-if ( !$alias ||  !$passw ) {     
-     print $cgi->redirect("alogin_ctr.cgi?CGISESSID=$sid");
-     exit;
+if ( !$alias ||  !$passw ) {
+       print $cgi->redirect("alogin_ctr.cgi?CGISESSID=$sid");
+       exit;
 }
 
 ### Authenticate session to alias passw
-    &authenticate;
+&authenticate;
 #
 my $log_rc      = 0;
 my $log_rc_prev = 0;
@@ -58,22 +61,29 @@ my $rs_dat_to   = param('v_to');
 my $rs_prev     = param('rs_prev');
 my $rs_cur      = param('rs_cur');
 my $rs_page     = param('rs_page');
+
+
 sub param{
-    my $v = $cgi->param(shift);   return 0 if !$v;$v
+       my $v = $cgi->param(shift);
+       return 0 if !$v;
+       $v;
 }
+
+
 sub session{
-    my $v = $sss->param(shift);   return 0 if !$v;$v
+       my $v = $sss->param(shift);
+       return 0 if !$v;
+       $v;
 }
 
 if(Settings::anon('^VW_OVR_WHERE')){
-   if(!$cgi->param('srch_reset')&&!$prm_vc&&!$prm_vc_lst&&!$prm_aa&&!$prm_rtf&&!$prm_xc&&!$prm_xc_lst&&!$rs_dat_from&&!$rs_dat_to&&!$rs_keys){
-       $VW_PAGE = Settings->VW_LOG_OVERRIDE_WHERE;
-    }
-}
-elsif(Settings::anon('^PAGE_EXCLUDES')){
-   if(!$cgi->param('srch_reset')&&!$prm_vc&&!$prm_vc_lst&&!$prm_aa&&!$prm_rtf&&!$prm_xc&&!$prm_xc_lst&&!$rs_dat_from&&!$rs_dat_to&&!$rs_keys){
-       $VW_PAGE = Settings->VW_LOG_WITH_EXCLUDES;
-    }
+       if(!$cgi->param('srch_reset')&&!$prm_vc&&!$prm_vc_lst&&!$prm_aa&&!$prm_rtf&&!$prm_xc&&!$prm_xc_lst&&!$rs_dat_from&&!$rs_dat_to&&!$rs_keys){
+               $VW_PAGE = Settings->VW_LOG_OVERRIDE_WHERE;
+       }
+}elsif(Settings::anon('^PAGE_EXCLUDES')){
+       if(!$cgi->param('srch_reset')&&!$prm_vc&&!$prm_vc_lst&&!$prm_aa&&!$prm_rtf&&!$prm_xc&&!$prm_xc_lst&&!$rs_dat_from&&!$rs_dat_to&&!$rs_keys){
+               $VW_PAGE = Settings->VW_LOG_WITH_EXCLUDES;
+       }
 }
 
 my $sqlView     = 'SELECT ID, ID_CAT, DATE, LOG, RTF, AMOUNT, AFLAG, STICKY, PID FROM '.$VW_PAGE;#Only to be found here, the main SQL select statement.
@@ -82,35 +92,40 @@ my $stmE        = ' LIMIT '.&Settings::viewAllLimit.';';
 my $stmD        = "";
 my $sm_reset_all= "";
 my $rec_limit   = Settings::recordLimit();
+
 #Set to 1 to get debug help. Switch off with 0.
 my $DEBUG       = Settings::debug();
+
 #END OF SETTINGS
 my $rtf_buffer = 0;
 my ($BUFFER, $D_BUFF)=("","");
 
 my $lang  = Date::Language->new(Settings::language());
 my $today = Settings->today();
+
 # We buffer the whole page creation, for speed and control, or to send compressed or not to client.
-sub toBuf { if($DEBUG){$D_BUFF .= shift}else{$BUFFER .= shift} }
+sub toBuf {
+       if($DEBUG){$D_BUFF .= shift}
+       else{$BUFFER .= shift}
+}
 
 if(!$prm_vc && &Settings::keepExcludes){
-    if($prm_xc_lst){
-        Settings::configProperty($db, 201, '^EXCLUDES', $prm_xc_lst);
-    }
-    else{
-       $prm_xc_lst = &Settings::obtainProperty($db, '^EXCLUDES');
-       $prm_xc = $prm_xc_lst if (!$prm_xc && !$cgi->param('srch_reset'));
-    }
+       if($prm_xc_lst){
+               Settings::configProperty($db, 201, '^EXCLUDES', $prm_xc_lst);
+       }else{
+               $prm_xc_lst = &Settings::obtainProperty($db, '^EXCLUDES');
+               $prm_xc = $prm_xc_lst if (!$prm_xc && !$cgi->param('srch_reset'));
+       }
 }
 
 if ( !$rs_dat_to && $rs_dat_from ) {
-    my $dur = $today;
-    $dur->add( months => 1 );
-    $rs_dat_to = DateTime::Format::SQLite->parse_datetime($dur);
+       my $dur = $today;
+       $dur->add( months => 1 );
+       $rs_dat_to = DateTime::Format::SQLite->parse_datetime($dur);
 }
 
 if ( $rs_dat_from && $rs_dat_to ) {
-    $stmD = qq( DATE BETWEEN date('$rs_dat_from') AND date('$rs_dat_to') );
+       $stmD = qq( DATE BETWEEN date('$rs_dat_from') AND date('$rs_dat_to') );
 }
 
 #Toggle if search deployed.
@@ -122,94 +137,107 @@ if ( $rs_keys || $stmD || $prm_vc > 0 || $prm_xc > 0 || $prm_aa > 0) { $toggle =
 $sss->expire(Settings::sessionExprs());
 $sss->param('theme', Settings::theme('css'));
 $sss->param('bgcolor', Settings::theme('colBG'));
+
 #sss->param('sss_main', $today);
 #
 #Reset Clicked
 if(param('srch_reset') == 1){
-   $sss->clear('sss_vc');$sss->clear('sss_xc');$sss->clear('sss_ord_cat');
+       $sss->clear('sss_vc');
+       $sss->clear('sss_xc');
+       $sss->clear('sss_ord_cat');
 }
 
 if($prm_vc &&$prm_vc ne ""){
-#TODO (2020-11-05) This is a subrotine candidate. It gets too complicated. should not have both $prm_vc and $prm_vc_lst;
-   $prm_xc =~ s/^0*//g;$prm_xc_lst=~ s/^\,$//g;
-   if(!$prm_vc_lst||$prm_vc_lst==0){#} && index($prm_xc, ',') > 0){
-        $prm_vc_lst =  $prm_vc;
-   }else{
-        my $f;
-        my @vc_lst = split /\,/, $prm_vc_lst; @vc_lst = uniq(sort { $a <=> $b }  @vc_lst);
-        foreach my $n(@vc_lst){
-            if($n == $prm_vc){ $f=1; last; }
-        }
-        if(!$f){#not found view was clicked changing category but not adding it to vc list. Let's add it to the list.
-            $prm_vc_lst .= ",$prm_vc";
-        }
-        $prm_vc_lst=~ s/\,$//g;$prm_vc_lst=~ s/\,\,/\,/g;
-   }
-
-
-   if ($cgi->param('sss_vc') eq 'on'){
-       $sss->param('sss_vc', $prm_xc);
-       $sss->param('sss_vc_lst', $prm_xc_lst);
-   }
-   else{
-       $sss->clear('sss_vc');
-       $sss->clear('sss_vc_lst');
-   }
+
+       #TODO (2020-11-05) This is a subrotine candidate. It gets too complicated. should not have both $prm_vc and $prm_vc_lst;
+       $prm_xc =~ s/^0*//g;
+       $prm_xc_lst=~ s/^\,$//g;
+       if(!$prm_vc_lst||$prm_vc_lst==0){#} && index($prm_xc, ',') > 0){
+               $prm_vc_lst =  $prm_vc;
+       }else{
+               my $f;
+               my @vc_lst = split /\,/, $prm_vc_lst;
+               @vc_lst = uniq(sort { $a <=> $b }  @vc_lst);
+               foreach my $n(@vc_lst){
+                       if($n == $prm_vc){ $f=1; last; }
+               }
+               if(!$f){#not found view was clicked changing category but not adding it to vc list. Let's add it to the list.
+                       $prm_vc_lst .= ",$prm_vc";
+               }
+               $prm_vc_lst=~ s/\,$//g;
+               $prm_vc_lst=~ s/\,\,/\,/g;
+       }
+
+
+       if ($cgi->param('sss_vc') eq 'on'){
+               $sss->param('sss_vc', $prm_xc);
+               $sss->param('sss_vc_lst', $prm_xc_lst);
+       }else{
+               $sss->clear('sss_vc');
+               $sss->clear('sss_vc_lst');
+       }
 
 }else{
-       $prm_vc = session('sss_vc');
-       $prm_vc_lst = session('sss_vc_lst');
+       $prm_vc = session('sss_vc');
+       $prm_vc_lst = session('sss_vc_lst');
 }
 
 if($prm_xc &&$prm_xc ne ""){
-#TODO (2020-02-23) It gets too complicated. should not have both $prm_xc and $prm_xc_lst;
-    $prm_xc =~ s/^0*//g;$prm_xc_lst=~ s/^\,$//g;
-    if(!$prm_xc_lst||$prm_xc_lst==0){#} && index($prm_xc, ',') > 0){
-        $prm_xc_lst =  $prm_xc;
-    }else{
-        my $f;
-        my @xc_lst = split /\,/, $prm_xc_lst; @xc_lst = uniq(sort { $a <=> $b }  @xc_lst);
-        foreach my $n(@xc_lst){
-            if($n == $prm_xc){ $f=1; last; }
-        }
-        if(!$f){#not found view was clicked changing category but not adding it to ex list. Let's add it to the list.
-            $prm_xc_lst .= ",$prm_xc";
-        }
-        $prm_xc_lst=~ s/\,$//g;$prm_xc_lst=~ s/\,\,/\,/g;
-    }
-    if ($cgi->param('sss_xc') eq 'on'){
-        $sss->param('sss_xc', $prm_xc);
-        $sss->param('sss_xc_lst', $prm_xc_lst);
-    }
-    else{
-            $sss->clear('sss_xc');
-            $sss->clear('sss_xc_lst');
-    }
+
+       #TODO (2020-02-23) It gets too complicated. should not have both $prm_xc and $prm_xc_lst;
+       $prm_xc =~ s/^0*//g;
+       $prm_xc_lst=~ s/^\,$//g;
+       if(!$prm_xc_lst||$prm_xc_lst==0){#} && index($prm_xc, ',') > 0){
+               $prm_xc_lst =  $prm_xc;
+       }else{
+               my $f;
+               my @xc_lst = split /\,/, $prm_xc_lst;
+               @xc_lst = uniq(sort { $a <=> $b }  @xc_lst);
+               foreach my $n(@xc_lst){
+                       if($n == $prm_xc){ $f=1; last; }
+               }
+               if(!$f){#not found view was clicked changing category but not adding it to ex list. Let's add it to the list.
+                       $prm_xc_lst .= ",$prm_xc";
+               }
+               $prm_xc_lst=~ s/\,$//g;
+               $prm_xc_lst=~ s/\,\,/\,/g;
+       }
+       if ($cgi->param('sss_xc') eq 'on'){
+               $sss->param('sss_xc', $prm_xc);
+               $sss->param('sss_xc_lst', $prm_xc_lst);
+       }else{
+               $sss->clear('sss_xc');
+               $sss->clear('sss_xc_lst');
+       }
 
 }else{
-       $prm_xc = session('sss_xc');
-       $prm_xc_lst = session('sss_xc_lst');       
+       $prm_xc = session('sss_xc');
+       $prm_xc_lst = session('sss_xc_lst');
 }
+
 #Either Session or requested.
 if(param('sss_ord_cat') eq 'on'){
-      $stmE = ' ORDER BY ID_CAT '.$stmE;
-      $sss->param('sss_ord_cat', 1);
-}else{$sss->param('sss_ord_cat', 0)}
+       $stmE = ' ORDER BY ID_CAT '.$stmE;
+       $sss->param('sss_ord_cat', 1);
+}else{
+       $sss->param('sss_ord_cat', 0);
+}
 ##
-my @vc_lst = split /\,/, $prm_vc_lst; @vc_lst = uniq(sort { $a <=> $b }  @vc_lst);
-my @xc_lst = split /\,/, $prm_xc_lst; @xc_lst = uniq(sort { $a <=> $b }  @xc_lst);
+my @vc_lst = split /\,/, $prm_vc_lst;
+@vc_lst = uniq(sort { $a <=> $b }  @vc_lst);
+my @xc_lst = split /\,/, $prm_xc_lst;
+@xc_lst = uniq(sort { $a <=> $b }  @xc_lst);
 
 $sss->flush();
 
 #tag related framed sizing.
 my @arrwh = split /x/, &Settings::imgWidthHeight;
 if ( @arrwh == 2 ) {
-    $imgw = $arrwh[0];
-    $imgh = $arrwh[1];
-}
-else {    #defaults
-    $imgw = 210;
-    $imgh = 120;
+       $imgw = $arrwh[0];
+       $imgh = $arrwh[1];
+}else {    #defaults
+       $imgw = 210;
+       $imgh = 120;
 }
 
 my $st;
@@ -229,36 +257,38 @@ my $data_cats = "";
 my $td_cat = "<tr><td><ul>";
 my $td_itm_cnt =0;
 while ( my @row = $st->fetchrow_array() ) {
-    my $n = $row[1];
-    $n =~ s/\s*$//g;
-    $hshCats{$row[0]} = $n;
-    $hshDesc{$row[0]} = $row[2];
-    if($td_itm_cnt>4){
-        $td_cat .= "</ul></td><td><ul>";
-        $td_itm_cnt = 0;
-    }
-    $td_cat .= "<li id='".$row[0]."'><a href='#'>".$row[1]."</a></li>";
-    $td_itm_cnt++
+       my $n = $row[1];
+       $n =~ s/\s*$//g;
+       $hshCats{$row[0]} = $n;
+       $hshDesc{$row[0]} = $row[2];
+       if($td_itm_cnt>4){
+               $td_cat .= "</ul></td><td><ul>";
+               $td_itm_cnt = 0;
+       }
+       $td_cat .= "<li id='".$row[0]."'><a href='#'>".$row[1]."</a></li>";
+       $td_itm_cnt++;
 }
 if($td_itm_cnt<5){#fill spacing.
-    for (my $i=0;$i<5-$td_itm_cnt;$i++){
-        $td_cat .= "<li><a href='#'></a>&nbsp;</li>";
-    }
+       for (my $i=0;$i<5-$td_itm_cnt;$i++){
+               $td_cat .= "<li><a href='#'></a>&nbsp;</li>";
+       }
 }
 $td_cat .= "</ul></td></tr>";
 
 
 for my $key ( keys %hshDesc ) {
-    my $kv = $hshDesc{$key}; next if !$kv;
-    if ( $kv ne ".." && index($key,'HASH(0x')!=0) {
-        my $n = $hshCats{$key};
-        $data_cats .= qq(<meta id="cats[$key]" name="$n" content="$kv">\n);
-    }
+       my $kv = $hshDesc{$key};
+       next if !$kv;
+       if ( $kv ne ".." && index($key,'HASH(0x')!=0) {
+               my $n = $hshCats{$key};
+               $data_cats .= qq(<meta id="cats[$key]" name="$n" content="$kv">\n);
+       }
 }
-my $eh;my $currsymb = &Settings::currenySymbol;
-if($isPUBViewMode){$eh = ""}else{$eh='<th>Edit</th>'}
-my $log_output =
-qq(<FORM id="frm_log" action="data.cgi" onSubmit="return formDelValidation();">
+my $eh;
+my $currsymb = &Settings::currenySymbol;
+if($isPUBViewMode){$eh = ""}
+else{$eh='<th>Edit</th>'}
+my $log_output =qq(<FORM id="frm_log" action="data.cgi" onSubmit="return formDelValidation();">
 <TABLE class="tbl" border="0" width=").&Settings::pagePrcWidth.qq(%">
 <tr class="hdr">
        <th>Date</th>
@@ -268,263 +298,265 @@ qq(<FORM id="frm_log" action="data.cgi" onSubmit="return formDelValidation();">
        <th>Category</th>
     $eh
 </tr>);
-    #We use js+perl, trickery to filter by amount type, as well.
-    if($prm_aa >0){my $s = $prm_aa - 1;$prm_aa = " AFLAG=$s AND";}else{$prm_aa=""}
-    if($prm_rtf){$stmS .= " RTF>0 AND";}
-
-    if($isPUBViewMode){
-        $sqlVWL = $stmS." ".Settings::sqlPubors().$stmE;
-    }
-    elsif ( $rs_keys && $rs_keys ne '*' ) {
-
-        my @keywords = split /\W/, $rs_keys;
-        if ($prm_vc && $prm_vc != $prm_xc) {
-
-                if(@vc_lst){
-                    $stmS .= $prm_aa;
-                    foreach (@vc_lst){
-                            $stmS .= " ID_CAT=$_ OR";
-                    }
-                }
-                else{       $stmS .= $prm_aa . " ID_CAT=$prm_vc AND"; }
-
-        }
-        else {
-            if($prm_xc>0){
-                if(@xc_lst){
-                    $stmS .= $prm_aa;
-                    foreach (@xc_lst){
-                            $stmS .= " ID_CAT!=$_ AND";
-                    }
-                }
-                else{       $stmS .= $prm_aa . " ID_CAT!=$prm_xc AND"; }
-            }
-        }
-
-        if ($stmD) {
-            #was previous an OR?, replace with an AND we filter further by keywords.
-            $stmS =~ s/\sOR$/ and/gi;
-            $stmS .= $stmD . " AND";
-        }
-
-        if (@keywords) {
-            foreach (@keywords) { next if $_ eq "";
-                #was previous an OR?, replace with an AND we filter further by keywords.
-                $stmS =~ s/\sOR$/ and/gi;
-                if(Settings::isProgressDB()){$stmS .= " LOWER(LOG) ~ '" . lc $_ . "'"}
-                else{$stmS .= " LOWER(LOG) REGEXP '\\b" . lc $_ . "\\b'"}        
-                if ( \$_ != \$keywords[-1] ) {
-                    $stmS = $stmS . " and ";
-                }
-            }
-            $sqlVWL = $stmS . $stmE;
-        }
-    }
-    elsif ($prm_vc) {                
-        if(@vc_lst){
-            foreach (@vc_lst){
-                    $stmS .= " ID_CAT=$_ OR";
-            }
-            $sqlVWL = $stmS . $prm_aa; $sqlVWL =~ s/OR$//g;
-            $sqlVWL .= $stmE;
-        }
-        elsif ($stmD) {
-            $sqlVWL = $stmS . $prm_aa . $stmD . " AND ID_CAT=" . $prm_vc . $stmE;
-        }
-        else {
-            $sqlVWL = $stmS . $prm_aa . " ID_CAT=" . $prm_vc . $stmE;
-        }
-    }
-    else {
-        if($prm_xc>0){
-            if(@xc_lst){
-                my $ands = "";
-                foreach (@xc_lst){
-                        $ands .= " ID_CAT!=$_ AND";
-                }
-
-                $ands =~ s/AND$//g;
-                $sqlVWL = $stmS .$prm_aa. $ands . $stmE;
-            }
-            else{
-                $sqlVWL = $stmS . $prm_aa." ID_CAT!=$prm_xc;" . $stmE;
-            }
-        }
-        if ($stmD) {
-            $sqlVWL = $stmS . $prm_aa.' '. $stmD . $stmE;
-        }
-        elsif($prm_aa){
-                    $prm_aa =~ s/AND$//g;
-                    $sqlVWL = $stmS .$prm_aa.' '.$stmE;
-        }
-        elsif($prm_rtf){
-            $stmS   =~ s/AND$//g;
-            $sqlVWL = $stmS.$stmE;
-        }
-    }
+
+#We use js+perl, trickery to filter by amount type, as well.
+if($prm_aa >0){my $s = $prm_aa - 1;$prm_aa = " AFLAG=$s AND";}
+else{$prm_aa=""}
+if($prm_rtf){$stmS .= " RTF>0 AND";}
+
+if($isPUBViewMode){
+       $sqlVWL = $stmS." ".Settings::sqlPubors().$stmE;
+}elsif ( $rs_keys && $rs_keys ne '*' ) {
+
+       my @keywords = split /\W/, $rs_keys;
+       if ($prm_vc && $prm_vc != $prm_xc) {
+
+               if(@vc_lst){
+                       $stmS .= $prm_aa;
+                       foreach (@vc_lst){
+                               $stmS .= " ID_CAT=$_ OR";
+                       }
+               }else{
+                       $stmS .= $prm_aa . " ID_CAT=$prm_vc AND";
+               }
+
+       }else {
+               if($prm_xc>0){
+                       if(@xc_lst){
+                               $stmS .= $prm_aa;
+                               foreach (@xc_lst){
+                                       $stmS .= " ID_CAT!=$_ AND";
+                               }
+                       }else{
+                               $stmS .= $prm_aa . " ID_CAT!=$prm_xc AND";
+                       }
+               }
+       }
+
+       if ($stmD) {
+
+               #was previous an OR?, replace with an AND we filter further by keywords.
+               $stmS =~ s/\sOR$/ and/gi;
+               $stmS .= $stmD . " AND";
+       }
+
+       if (@keywords) {
+               foreach (@keywords) {
+                       next if $_ eq "";
+
+                       #was previous an OR?, replace with an AND we filter further by keywords.
+                       $stmS =~ s/\sOR$/ and/gi;
+                       if(Settings::isProgressDB()){$stmS .= " LOWER(LOG) ~ '" . lc $_ . "'"}
+                       else{$stmS .= " LOWER(LOG) REGEXP '\\b" . lc $_ . "\\b'"}
+                       if ( \$_ != \$keywords[-1] ) {
+                               $stmS = $stmS . " and ";
+                       }
+               }
+               $sqlVWL = $stmS . $stmE;
+       }
+}elsif ($prm_vc) {
+       if(@vc_lst){
+               foreach (@vc_lst){
+                       $stmS .= " ID_CAT=$_ OR";
+               }
+               $sqlVWL = $stmS . $prm_aa;
+               $sqlVWL =~ s/OR$//g;
+               $sqlVWL .= $stmE;
+       }elsif ($stmD) {
+               $sqlVWL = $stmS . $prm_aa . $stmD . " AND ID_CAT=" . $prm_vc . $stmE;
+       }else {
+               $sqlVWL = $stmS . $prm_aa . " ID_CAT=" . $prm_vc . $stmE;
+       }
+}else {
+       if($prm_xc>0){
+               if(@xc_lst){
+                       my $ands = "";
+                       foreach (@xc_lst){
+                               $ands .= " ID_CAT!=$_ AND";
+                       }
+
+                       $ands =~ s/AND$//g;
+                       $sqlVWL = $stmS .$prm_aa. $ands . $stmE;
+               }else{
+                       $sqlVWL = $stmS . $prm_aa." ID_CAT!=$prm_xc;" . $stmE;
+               }
+       }
+       if ($stmD) {
+               $sqlVWL = $stmS . $prm_aa.' '. $stmD . $stmE;
+       }elsif($prm_aa){
+               $prm_aa =~ s/AND$//g;
+               $sqlVWL = $stmS .$prm_aa.' '.$stmE;
+       }elsif($prm_rtf){
+               $stmS   =~ s/AND$//g;
+               $sqlVWL = $stmS.$stmE;
+       }
+}
 
 ###################
-    &processSubmit;
+&processSubmit;
 ###################
 
-    my $tfId      = 0;
-    my $id        = 0;
-    my $log_start = index $sqlVWL, "<=";
-    my $re_a_tag  = qr/<a\s+.*?>.*<\/a>/si; my $regex = 'REGEXP'; $regex = ') ~' if Settings::isProgressDB();
-    my $isInViewMode = rindex ($sqlVWL, 'PID<=') > 0 || rindex ($sqlVWL, 'ID_CAT=') > 0 || $prm_aa || rindex ($sqlVWL, $regex)>0 || $prm_rtf;
-
-    toBuf $cgi->pre("###[Session PARAMS->isV:$isInViewMode|vc=$prm_vc|xc=$prm_xc|aa: $prm_aa|xc_lst=$prm_xc_lst|\@xc_lst=@xc_lst|vrtf=$prm_rtf|keepExcludes=".&Settings::keepExcludes."] -> ".$sqlVWL) if $DEBUG;    
-
-    if ( $log_start > 0 ) {
-
-        #check if we are at the beggining of the LOG table?
-        my $stc = traceDBExe('SELECT PID from '.$VW_PAGE.' LIMIT 1;');
-        my @row = $stc->fetchrow_array();
-            $log_top = $row[0];
-        if ($log_top == $rs_prev && $rs_cur == $rs_prev ) {
-            $log_start = -1;
-        }
-        $stc->finish();
-    }
-    #
-    # Fetch log entries!
-    #
-    my $CID_EVENT = 9;
-    my $tags      = "";
-    my $sum       = 0;
-    my $exp       = 0;
-    my $ass       = 0;
-
-    #place sticky or view param.ed entries first!
-    buildLog(traceDBExe($sqlVWL));
-    #Following is saying is in page selection, not view selection, or accounting on type of sticky entries.
-    if( !$isInViewMode && !$prm_vc  && !$prm_xc && !$rs_keys && !$rs_dat_from ){
-        $sqlVWL = "$stmS STICKY = false $stmE";
-        toBuf $cgi->pre("###2 -> ".$sqlVWL)  if $DEBUG;
-        buildLog(traceDBExe($sqlVWL));
-    }
+my $tfId      = 0;
+my $id        = 0;
+my $log_start = index $sqlVWL, "<=";
+my $re_a_tag  = qr/<a\s+.*?>.*<\/a>/si;
+my $regex = 'REGEXP';
+$regex = ') ~' if Settings::isProgressDB();
+my $isInViewMode = rindex ($sqlVWL, 'PID<=') > 0 || rindex ($sqlVWL, 'ID_CAT=') > 0 || $prm_aa || rindex ($sqlVWL, $regex)>0 || $prm_rtf;
+
+toBuf $cgi->pre("###[Session PARAMS->isV:$isInViewMode|vc=$prm_vc|xc=$prm_xc|aa: $prm_aa|xc_lst=$prm_xc_lst|\@xc_lst=@xc_lst|vrtf=$prm_rtf|keepExcludes=".&Settings::keepExcludes."] -> ".$sqlVWL) if $DEBUG;
+
+if ( $log_start > 0 ) {
+
+       #check if we are at the beggining of the LOG table?
+       my $stc = traceDBExe('SELECT PID from '.$VW_PAGE.' LIMIT 1;');
+       my @row = $stc->fetchrow_array();
+       $log_top = $row[0];
+       if ($log_top == $rs_prev && $rs_cur == $rs_prev ) {
+               $log_start = -1;
+       }
+       $stc->finish();
+}
+#
+# Fetch log entries!
+#
+my $CID_EVENT = 9;
+my $tags      = "";
+my $sum       = 0;
+my $exp       = 0;
+my $ass       = 0;
+
+#place sticky or view param.ed entries first!
+buildLog(traceDBExe($sqlVWL));
+
+#Following is saying is in page selection, not view selection, or accounting on type of sticky entries.
+if( !$isInViewMode && !$prm_vc  && !$prm_xc && !$rs_keys && !$rs_dat_from ){
+       $sqlVWL = "$stmS STICKY = false $stmE";
+       toBuf $cgi->pre("###2 -> ".$sqlVWL)  if $DEBUG;
+       buildLog(traceDBExe($sqlVWL));
+}
 
 
 sub traceDBExe {
-    my $sql = shift;
-    try{
-        toBuf("do:$sql") if ($DEBUG);
-        my $st = $db->prepare($sql);
-           $st -> execute() or LifeLogException->throw("Execute failed [$DBI::errstri]", show_trace=>1);
-        return $st;
-    }catch{
-        #BUG 31 fix.
-        if(Settings::isProgressDB() &&  index($sql,Settings->VW_LOG)>0){
-            $db -> do(Settings::createViewLOGStmt());
-            my $st = $db->prepare($sql);
-               $st -> execute() or LifeLogException->throw("Execute failed [$DBI::errstri]", show_trace=>1);
-            return $st;
-        }
-        LifeLogException->throw(error=>"DSN: [".Settings::dsn()."] Error encountered -> $@", show_trace=>1);
-    }
+       my $sql = shift;
+       try{
+               toBuf("do:$sql") if ($DEBUG);
+               my $st = $db->prepare($sql);
+               $st ->execute() or LifeLogException->throw("Execute failed [$DBI::errstri]", show_trace=>1);
+               return $st;
+       }catch{
+               #BUG 31 fix.
+               if(Settings::isProgressDB() &&  index($sql,Settings->VW_LOG)>0){
+                       $db ->do(Settings::createViewLOGStmt());
+                       my $st = $db->prepare($sql);
+                       $st ->execute() or LifeLogException->throw("Execute failed [$DBI::errstri]", show_trace=>1);
+                       return $st;
+               }
+               LifeLogException->throw(error=>"DSN: [".Settings::dsn()."] Error encountered -> $@", show_trace=>1);
+       }
 }
 
+
 sub buildLog {
-    my $pst = shift;
-    #toBuf "## sqlVWL: $sqlVWL\n";
-    while ( my @row = $pst->fetchrow_array() ) {
-        my $i = 0;
-        $id = $row[$i++]; #ID must be rowid in LOG.
-        my $cid = $row[$i++]; #CID ID_CAT not used.
-        my $ct  = $hshCats{$cid}; #ID_CAT        
-        my $dt  = DateTime::Format::SQLite->parse_datetime( $row[$i++] ); #LOG.DATE
-        my $log = $row[$i++]; #LOG.LOG
-        my $rtf = $row[$i++]; #ID_RTF since v.1.8 but just RTF from v.2.1
-        my $am  = $row[$i++]; $am =0 if !$am; #LOG.AMOUNT
-        my $af  = $row[$i++]; #AFLAG -> Asset as 0, Income as 1, Expense as 2
-        my $sticky = $row[$i++]; #Sticky to top
-        my $pid = $row[$i++]; #PID actual log ID in View.
-
-        $am =~ s/^\D|\,//g; #trim if it is money sql data type formated.
-
-        if ( $af == 1 ) { #AFLAG Income, assets are neutral.
-            $sum += $am;
-        }
-        elsif ( $af == 2 ) {
-            $exp -= $am;
-        }
-        else{
-            $ass += $am;
-        }
-        $am =  &cam($am);
-        #Apostrophe in the log value is doubled to avoid SQL errors.
-        $log =~ s/''/'/g;
-        #
-        if ( !$ct ) {
-            $ct = $hshCats{1};
-        }
-        if ( !$dt ) {
-            $dt = $today;
-        }
-        if ( !$am ) {
-            $am = "0.00";
-        }
-        if ( $log_rc_prev == 0 ) {
-            $log_rc_prev = $id;
-        }
-        if ( $tfId > 0) {
-            $tfId = 0;
-        }
-        else {
-            $tfId = 1;
-        }
-
-        my $sub      = "";
-        my $tagged   = 0;
-        my $log_orig = $log;
-
-#Check for LNK takes precedence here as we also parse plain placed URL's for http protocol later.
-        if ( $log =~ /<<LNK</ ) {
-            my $idx = $-[0] + 5;
-            my $len = index( $log, '>', $idx );
-            $sub = substr( $log, $idx + 1, $len - $idx - 1 );
-            my $url = qq(<a href="$sub" target=_blank>$sub</a>);
-            $tagged = 1;
-            $log =~ s/<<LNK<(.*?)>+/$url/osi;
-        }
-
-        if ( $log =~ /<<IMG</ ) {
-            my $idx = $-[0] + 5;
-            my $len = index( $log, '>', $idx );
-            $sub = substr( $log, $idx + 1, $len - $idx - 1 );
-            my $url = qq(<img src="$sub"/>);
-            $tagged = 1;
-            $log =~ s/<<IMG<(.*?)>+/$url/osi;
-        }
-        elsif ( $log =~ /<<FRM</ ) {
-            my $idx = $-[0] + 5;
-            my $len = index( $log, '>', $idx );
-            $sub = substr( $log, $idx + 1, $len - $idx - 1 );
-            my $lnk = $sub;
-            if ( $lnk =~ /_frm.png/ ) {
-                my $ext = substr( $lnk, index( $lnk, '.' ) );
-                $lnk =~ s/_frm.png/$ext/;
-                if ( not -e "./images/$lnk" ) {
-                    $lnk =~ s/$ext/.jpg/;
-                    if ( not -e "./images/$lnk" ) {
-                        $lnk =~ s/.jpg/.gif/;
-                    }
-                }
-                $lnk =
-                  qq(\n<a href="./images/$lnk" style="border=0;" target="_IMG">
+       my $pst = shift;
+
+       #toBuf "## sqlVWL: $sqlVWL\n";
+       while ( my @row = $pst->fetchrow_array() ) {
+               my $i = 0;
+               $id = $row[$i++]; #ID must be rowid in LOG.
+               my $cid = $row[$i++]; #CID ID_CAT not used.
+               my $ct  = $hshCats{$cid}; #ID_CAT
+               my $dt  = DateTime::Format::SQLite->parse_datetime( $row[$i++] ); #LOG.DATE
+               my $log = $row[$i++]; #LOG.LOG
+               my $rtf = $row[$i++]; #ID_RTF since v.1.8 but just RTF from v.2.1
+               my $am  = $row[$i++];
+               $am =0 if !$am; #LOG.AMOUNT
+               my $af  = $row[$i++]; #AFLAG -> Asset as 0, Income as 1, Expense as 2
+               my $sticky = $row[$i++]; #Sticky to top
+               my $pid = $row[$i++]; #PID actual log ID in View.
+
+               $am =~ s/^\D|\,//g; #trim if it is money sql data type formated.
+
+               if ( $af == 1 ) { #AFLAG Income, assets are neutral.
+                       $sum += $am;
+               }elsif ( $af == 2 ) {
+                       $exp -= $am;
+               }else{
+                       $ass += $am;
+               }
+               $am =  &cam($am);
+
+               #Apostrophe in the log value is doubled to avoid SQL errors.
+               $log =~ s/''/'/g;
+               #
+               if ( !$ct ) {
+                       $ct = $hshCats{1};
+               }
+               if ( !$dt ) {
+                       $dt = $today;
+               }
+               if ( !$am ) {
+                       $am = "0.00";
+               }
+               if ( $log_rc_prev == 0 ) {
+                       $log_rc_prev = $id;
+               }
+               if ( $tfId > 0) {
+                       $tfId = 0;
+               }else {
+                       $tfId = 1;
+               }
+
+               my $sub      = "";
+               my $tagged   = 0;
+               my $log_orig = $log;
+
+               #Check for LNK takes precedence here as we also parse plain placed URL's for http protocol later.
+               if ( $log =~ /<<LNK</ ) {
+                       my $idx = $-[0] + 5;
+                       my $len = index( $log, '>', $idx );
+                       $sub = substr( $log, $idx + 1, $len - $idx - 1 );
+                       my $url = qq(<a href="$sub" target=_blank>$sub</a>);
+                       $tagged = 1;
+                       $log =~ s/<<LNK<(.*?)>+/$url/osi;
+               }
+
+               if ( $log =~ /<<IMG</ ) {
+                       my $idx = $-[0] + 5;
+                       my $len = index( $log, '>', $idx );
+                       $sub = substr( $log, $idx + 1, $len - $idx - 1 );
+                       my $url = qq(<img src="$sub"/>);
+                       $tagged = 1;
+                       $log =~ s/<<IMG<(.*?)>+/$url/osi;
+               }elsif ( $log =~ /<<FRM</ ) {
+                       my $idx = $-[0] + 5;
+                       my $len = index( $log, '>', $idx );
+                       $sub = substr( $log, $idx + 1, $len - $idx - 1 );
+                       my $lnk = $sub;
+                       if ( $lnk =~ /_frm.png/ ) {
+                               my $ext = substr( $lnk, index( $lnk, '.' ) );
+                               $lnk =~ s/_frm.png/$ext/;
+                               if ( not -e "./images/$lnk" ) {
+                                       $lnk =~ s/$ext/.jpg/;
+                                       if ( not -e "./images/$lnk" ) {
+                                               $lnk =~ s/.jpg/.gif/;
+                                       }
+                               }
+                               $lnk =qq(\n<a href="./images/$lnk" style="border=0;" target="_IMG">
                        <img src="./images/$sub" width="$imgw" height="$imgh" class="tag_FRM"/></a>);
-            }
-            else {
-                #TODO fetch from web locally the original image.
-                $lnk =qq(\n<img src="$lnk" width="$imgw" height="$imgh" class="tag_FRM"/>);
-            }
-            $log =~ s/<<FRM<(.*?)>+/$lnk/o;
-            $tagged = 1;
-        }
-
-        #Replace with a full link an HTTP URI
-        if ( $log =~ /<iframe / ) {
-            my $a = q(<iframe width="560" height="315"); my $b;
+                       }else {
+
+                               #TODO fetch from web locally the original image.
+                               $lnk =qq(\n<img src="$lnk" width="$imgw" height="$imgh" class="tag_FRM"/>);
+                       }
+                       $log =~ s/<<FRM<(.*?)>+/$lnk/o;
+                       $tagged = 1;
+               }
+
+               #Replace with a full link an HTTP URI
+               if ( $log =~ /<iframe / ) {
+                       my $a = q(<iframe width="560" height="315");
+                       my $b;
                        given (Settings::frameSize()) {
                                when("0") { $b = q(width="390" height="215") }
                                when("1") { $b = q(width="280" height="180") }
@@ -533,171 +565,168 @@ sub buildLog {
                                        $b = &Settings::frameSize;
                                }
                        }
-            $b = qq(<div><iframe align="center" $b);
-            $log =~ s/$a/$b/o;
-            $a = q(</iframe>);
-            $b = q(</iframe></div>);
-            $log =~ s/$a/$b/o;
-            $tagged = 1;
-        }
-        else {
-            my @chnks = split( /($re_a_tag)/si, $log );
-            foreach my $ch_i (@chnks) {
-                next if $ch_i =~ /$re_a_tag/;
-                next if index( $ch_i, "<img" ) > -1;
-                $ch_i =~ s/https/http/gsi;
-                $ch_i =~
-                  s/($RE{URI}{HTTP})/<a href="$1" target=_blank>$1<\/a>/gsi;
-            }
-            $log = join( '', @chnks );
-        }
-
-        while ( $log =~ /<<B</ ) {
-            my $idx = $-[0];
-            my $len = index( $log, '>', $idx ) - 4;
-            my $sub = "<b>" . substr( $log, $idx + 4, $len - $idx ) . "</b>";
-            $log =~ s/<<B<(.*?)>+/$sub/o;
-            $tagged = 1;
-        }
-        while ( $log =~ /<<I</ ) {
-            my $idx = $-[0];
-            my $len = index( $log, '>', $idx ) - 4;
-            last if $len<6;
-            my $sub = "<i>" . substr( $log, $idx + 4, $len - $idx ) . "</i>";
-            $log =~ s/<<I<(.*?)>+/$sub/o;
-            $tagged = 1;
-        }
-        while ( $log =~ /<<TITLE</ ) {
-            my $idx = $-[0];
-            my $len = index( $log, '>', $idx ) - 8;
-            last if $len<9;
-            my $sub = "<h3>" . substr( $log, $idx + 8, $len - $idx ) . "</h3>";
-            $log =~ s/<<TITLE<(.*?)>+/$sub/o;
-            $tagged = 1;
-        }
-        while ( $log =~ /<<LIST</ ) {
-            my $idx = $-[0];
-            my $len = index( $log, '>', $idx ) - 7;
-            last if $len<9;
-            my $lst = substr( $log, $idx + 7, $len - $idx );
-            my $sub = "";
-            my @arr = split( /\n|\\n/, $lst );
-            my $ml  = "";
-            foreach my $ln (@arr) {
-                $ln =~ s/^\s*//g;
-                if ( $ln =~ /~$/ ) {
-                    $ln =~ s/~$/<br>/g;
-                    $ml .= $ln . ' ';
-                }
-                else {
-                    if ($ml) {
-                        $ml  .= $ln if length($ln) > 0;
-                        $sub .= "<li>$ml</li>\n";
-                        $ml = "";
-                    }
-                    else {
-                        $sub .= "<li>$ln</li>" if length($ln) > 0;
-                    }
-                }
-            }
-
-            $sub = "<div id='rz'><ul>$sub</ul></div>";
-            $log =~ s/<<LIST<(\w*|\s*)*.*(>+?)/$sub/o;
-            $tagged = 1;
-        }
-        #bold on start markup
-        $log =~ s/(^\*)(.*)(\*)(\\n)/<b>$2<\/b><br>/oi;
-        #Decode escaped \\n
-        $log =~ s/\r\n/<br>/gs;
-        $log =~ s/\\n/<br>/gs;
-
-        if ( $CID_EVENT == $row[1] ) {
-            $log = "<font color='#eb4848' style='font-weight:bold'>$log</font>";
-            $tagged = 1;
-        }
-        elsif ( 1 == $row[1] ) {
-            $log =
-"<font class='midnight' style='font-weight:bold;font-style:italic'>$log</font>";
-            $tagged = 1;
-        }
-
-        #Tagged preserve originally stored entry in hidden numbered field.
-        if ($tagged) {
-            $log_orig =~ s/<br>\n/<br>/g;
-            $log_orig =~ s/</&#60;/g;
-            $log_orig =~ s/>/&#62;/g;
-            $log_orig =~ s/\\n/&#10;/g;
-            $log_orig =~ s/\n/&#10;/g;            
-            $log_orig =~ s/\t/&#9;/g;
-            $log_orig =~ s/\"/&#34;/g;
-            $log_orig =~ s/\'/&#39;/g;
-            $tags .= qq(<input type="hidden" id="g$id" value="$log_orig"/>\n);
-        }elsif(not &Settings::displayAll){
-            my $h;
-            if($log =~ m/(.*\s*.*?)<br>/){$h=$1}
-            elsif($log =~ m/(\s*.*\n)/) {$h=$1}
-            if($h){
-               $log = $h.qq(<input type="hidden" id="h$id" value="$log"/><button id='btnRTF' onclick="return dispFullLog($id);" 
+                       $b = qq(<div><iframe align="center" $b);
+                       $log =~ s/$a/$b/o;
+                       $a = q(</iframe>);
+                       $b = q(</iframe></div>);
+                       $log =~ s/$a/$b/o;
+                       $tagged = 1;
+               }else {
+                       my @chnks = split( /($re_a_tag)/si, $log );
+                       foreach my $ch_i (@chnks) {
+                               next if $ch_i =~ /$re_a_tag/;
+                               next if index( $ch_i, "<img" ) > -1;
+                               $ch_i =~ s/https/http/gsi;
+                               $ch_i =~s/($RE{URI}{HTTP})/<a href="$1" target=_blank>$1<\/a>/gsi;
+                       }
+                       $log = join( '', @chnks );
+               }
+
+               while ( $log =~ /<<B</ ) {
+                       my $idx = $-[0];
+                       my $len = index( $log, '>', $idx ) - 4;
+                       my $sub = "<b>" . substr( $log, $idx + 4, $len - $idx ) . "</b>";
+                       $log =~ s/<<B<(.*?)>+/$sub/o;
+                       $tagged = 1;
+               }
+               while ( $log =~ /<<I</ ) {
+                       my $idx = $-[0];
+                       my $len = index( $log, '>', $idx ) - 4;
+                       last if $len<6;
+                       my $sub = "<i>" . substr( $log, $idx + 4, $len - $idx ) . "</i>";
+                       $log =~ s/<<I<(.*?)>+/$sub/o;
+                       $tagged = 1;
+               }
+               while ( $log =~ /<<TITLE</ ) {
+                       my $idx = $-[0];
+                       my $len = index( $log, '>', $idx ) - 8;
+                       last if $len<9;
+                       my $sub = "<h3>" . substr( $log, $idx + 8, $len - $idx ) . "</h3>";
+                       $log =~ s/<<TITLE<(.*?)>+/$sub/o;
+                       $tagged = 1;
+               }
+               while ( $log =~ /<<LIST</ ) {
+                       my $idx = $-[0];
+                       my $len = index( $log, '>', $idx ) - 7;
+                       last if $len<9;
+                       my $lst = substr( $log, $idx + 7, $len - $idx );
+                       my $sub = "";
+                       my @arr = split( /\n|\\n/, $lst );
+                       my $ml  = "";
+                       foreach my $ln (@arr) {
+                               $ln =~ s/^\s*//g;
+                               if ( $ln =~ /~$/ ) {
+                                       $ln =~ s/~$/<br>/g;
+                                       $ml .= $ln . ' ';
+                               }else {
+                                       if ($ml) {
+                                               $ml  .= $ln if length($ln) > 0;
+                                               $sub .= "<li>$ml</li>\n";
+                                               $ml = "";
+                                       }else {
+                                               $sub .= "<li>$ln</li>" if length($ln) > 0;
+                                       }
+                               }
+                       }
+
+                       $sub = "<div id='rz'><ul>$sub</ul></div>";
+                       $log =~ s/<<LIST<(\w*|\s*)*.*(>+?)/$sub/o;
+                       $tagged = 1;
+               }
+
+               #bold on start markup
+               $log =~ s/(^\*)(.*)(\*)(\\n)/<b>$2<\/b><br>/oi;
+
+               #Decode escaped \\n
+               $log =~ s/\r\n/<br>/gs;
+               $log =~ s/\\n/<br>/gs;
+
+               if ( $CID_EVENT == $row[1] ) {
+                       $log = "<font color='#eb4848' style='font-weight:bold'>$log</font>";
+                       $tagged = 1;
+               }elsif ( 1 == $row[1] ) {
+                       $log ="<font class='midnight' style='font-weight:bold;font-style:italic'>$log</font>";
+                       $tagged = 1;
+               }
+
+               #Tagged preserve originally stored entry in hidden numbered field.
+               if ($tagged) {
+                       $log_orig =~ s/<br>\n/<br>/g;
+                       $log_orig =~ s/</&#60;/g;
+                       $log_orig =~ s/>/&#62;/g;
+                       $log_orig =~ s/\\n/&#10;/g;
+                       $log_orig =~ s/\n/&#10;/g;
+                       $log_orig =~ s/\t/&#9;/g;
+                       $log_orig =~ s/\"/&#34;/g;
+                       $log_orig =~ s/\'/&#39;/g;
+                       $tags .= qq(<input type="hidden" id="g$id" value="$log_orig"/>\n);
+               }elsif(not &Settings::displayAll){
+                       my $h;
+                       if($log =~ m/(.*\s*.*?)<br>/){$h=$1}
+                       elsif($log =~ m/(\s*.*\n)/) {$h=$1}
+                       if($h){
+                               $log = $h.qq(<input type="hidden" id="h$id" value="$log"/><button id='btnRTF' onclick="return dispFullLog($id);" 
                                  class="ui-button ui-corner-all ui-widget"><span>&#8691;<span></button>);
-            }
-        }
-
-        my ( $dty, $dtf ) = $dt->ymd;
-        my $dth = $dt->hms;
-        $dth .= " id=($id)" if $DEBUG;
-        if ( &Settings::universalDate == 1 ) {
-            $dtf = $dty;
-        }
-        else {
-            $dtf = $lang->time2str( "%d %b %Y", $dt->epoch, &Settings::timezone);
-        }
-
-        if ( $rtf > 0 ) {
-            $log .= qq(<hr><button id="btnRTF" onClick="return loadRTF(true, $id);">RTF</button>);
-        }
-
-        if($af==2){
-           $am = qq(<font color="maroon">$am</font>);
-        }
-
-        my $ssymb = "Edit";
-        my $ssid  = $tfId;
-        if($sticky){
-           $ssymb = "Edit &#10037;";
-           $ssid = $tfId + 2;
-        }
-
-        $log_output .= qq(<tr class="r$ssid">
+                       }
+               }
+
+               my ( $dty, $dtf ) = $dt->ymd;
+               my $dth = $dt->hms;
+               $dth .= " id=($id)" if $DEBUG;
+               if ( &Settings::universalDate == 1 ) {
+                       $dtf = $dty;
+               }else {
+                       $dtf = $lang->time2str( "%d %b %Y", $dt->epoch, &Settings::timezone);
+               }
+
+               if ( $rtf > 0 ) {
+                       $log .= qq(<hr><button id="btnRTF" onClick="return loadRTF(true, $id);">RTF</button>);
+               }
+
+               if($af==2){
+                       $am = qq(<font color="maroon">$am</font>);
+               }
+
+               my $ssymb = "Edit";
+               my $ssid  = $tfId;
+               if($sticky){
+                       $ssymb = "Edit &#10037;";
+                       $ssid = $tfId + 2;
+               }
+
+               $log_output .= qq(<tr class="r$ssid">
                <td width="15%">$dtf<input id="y$id" type="hidden" value="$dty"/></td>
                <td id="t$id" width="10%" class="tbl">$dth</td>
                <td id="v$id" ><div class="log">$log</div></td>
                <td id="a$id" width="10%" class="tbl">$am</td>
                <td id="c$id" width="10%" class="tbl">$ct</td>
         );
-        if(!$isPUBViewMode){$log_output .= qq(
+               if(!$isPUBViewMode){
+                       $log_output .= qq(
                <td width="10%">
         <input id="r$id" type="hidden" value="$rtf"/>
         <input id="s$id" type="hidden" value="$sticky"/>
         <input id="f$id" type="hidden" value="$af"/>
                <button class="edit" value="Edit" onclick="return edit($id);">$ssymb</button>
                        <input name="chk" type="checkbox" value="$pid"/>
-               </td></tr>)};
+               </td></tr>);
+               }
 
-        if ( $rtf > 0 ) {        
-             $log_output .= qq(<tr id="q-rtf$id" class="r$tfId" style="display:none;">
+               if ( $rtf > 0 ) {
+                       $log_output .= qq(<tr id="q-rtf$id" class="r$tfId" style="display:none;">
                          <td colspan="6">
                           <div id="q-scroll$id" class="ql-editor ql-snow" style="max-height:480px; overflow-x:scroll;">
                             <div id="q-container$id" class="ql-container ql-snow"></div>
                           </div>
                         </td></tr>);
-        }
-        $log_rc += 1;
+               }
+               $log_rc += 1;
 
-        if ( $rec_limit > 0 && $log_rc == $rec_limit ) {
-            last;
-        }
+               if ( $rec_limit > 0 && $log_rc == $rec_limit ) {
+                       last;
+               }
 
-    }    #while end
+       }    #while end
 }#buildLog
 
 if   ( $tfId == 1 ) { $tfId = 0; }
@@ -731,24 +760,24 @@ my $autowords = qq("gas","money","today");
 
 if ( $log_rc == 0 ) {
 
-    if ($stmD) {
-        $log_output .= qq(<tr id="brw_row"><td colspan="5">
+       if ($stmD) {
+               $log_output .= qq(<tr id="brw_row"><td colspan="5">
         <b>Search Failed to Retrive any records on select: [<i>$stmD</i>] !</b></td></tr>');
-    }
-    elsif ($rs_keys) {
-        my $criter = "";
-        if ( $prm_vc > 0 ) {
-            $criter = "->Criteria[" . $hshCats{$prm_vc} . "]";
-        }
-        $log_output .= qq(<tr id="brw_row"><td colspan="5">
+       }elsif ($rs_keys) {
+               my $criter = "";
+               if ( $prm_vc > 0 ) {
+                       $criter = "->Criteria[" . $hshCats{$prm_vc} . "]";
+               }
+               $log_output .= qq(<tr id="brw_row"><td colspan="5">
         <b>Search Failed to Retrive any records on keywords: [<i>$rs_keys</i>]$criter!</b></td></tr>);
-    }
-    else {
-        if ($isInViewMode) { 
-              if($prm_rtf){$log_output .= '<tr id="brw_row"><td colspan="6" class="r1"><b>No RTF records found matching criteria.</b></td></tr>'}
-              else        {$log_output .= '<tr id="brw_row"><td colspan="6" class="r1"><b>You have reached the end of the data view!</b></td></tr>'}
-        }else{ $log_output .= '<tr id="brw_row"><td colspan="6" class="r1"><b>Database is New or Empty!</b></td></tr>'}
-    }
+       }else {
+               if ($isInViewMode) {
+                       if($prm_rtf){$log_output .= '<tr id="brw_row"><td colspan="6" class="r1"><b>No RTF records found matching criteria.</b></td></tr>'}
+                       else        {$log_output .= '<tr id="brw_row"><td colspan="6" class="r1"><b>You have reached the end of the data view!</b></td></tr>'}
+               }else{
+                       $log_output .= '<tr id="brw_row"><td colspan="6" class="r1"><b>Database is New or Empty!</b></td></tr>';
+               }
+       }
 }
 
 
@@ -762,9 +791,8 @@ $std_bck = "background-color:".Settings::theme('colBG').";" if !&Settings::trans
 my $auto_logoff = &Settings::autoLogoff;
 
 if($isPUBViewMode){
-}
-else{
-$log_output .= <<HTML;
+}else{
+       $log_output .= <<HTML;
 <tr class="r0" id="brw_row"><td colspan="2" style="font-size:small;text-align:left;">Show All hidden &#10132;
 <a id="menu_close" href="#" onclick="return showAll();"><span  class="ui-icon ui-icon-heart" style="float:none;"></span></a>
 <a id="to_bottom" href="#top" title="Go to top of page.">&#8613;</a>
@@ -790,10 +818,10 @@ $log_output .= <<HTML;
     </TABLE>
 </form>
 HTML
-};
+}
 
 
-    my $frm = qq(
+my $frm = qq(
 <form id="frm_entry" action="main.cgi" onSubmit="return formValidation();">
        <table class="tbl" border="0" style="$std_bck opacity: 0.9;" width=").&Settings::pagePrcWidth.qq(%">
        <tr class="r0">
@@ -806,7 +834,7 @@ HTML
        <tr class="collpsd">
        <td style="text-align:right; vertical-align:top; width:10%;">Date:</td>
        <td id="al" colspan="2" style="text-align:top; vertical-align:top"><input id="ed" type="text" name="date" size="18" value=")
-      . $today->ymd . " " . $today->hms . qq(">
+  . $today->ymd . " " . $today->hms . qq(">
 
        &nbsp;<button type="button" onclick="return setNow();">Now</button>
                        &nbsp;<button type="reset"  onclick="setNow();resetDoc(); return true;">Reset</button>
@@ -871,7 +899,7 @@ HTML
     </form>
        );
 
-    my $srh = qq(
+my $srh = qq(
        <form id="frm_srch" action="main.cgi">
        <table class="tbl" border="0" style="background-color:).Settings::theme('colBG').qq(" width=").&Settings::pagePrcWidth.qq(%">
          <tr class="r0">
@@ -881,48 +909,53 @@ HTML
         </td>
       </tr>
     );
-    my ($sss_checked, $sss_orderby) = ("","");
-    my ($vc_lst,$xc_lst) = ("","");
-    my $tdivvc = '<td id="divvc_lbl" align="right" style="display:none">Includes:</td><td align="left" id="divvc"></td>';
-    my $tdivxc = '<td id="divxc_lbl" align="right" style="display:none">Excludes:</td><td align="left" id="divxc"></td>';
-    my $catselected  = '<i>&nbsp;&nbsp;&nbsp;<font size=1>-- Select --</font>&nbsp;&nbsp;&nbsp;</i>';
-    my $xcatselected = '<i>&nbsp;&nbsp;&nbsp;<font size=1>-- Select --</font>&nbsp;&nbsp;&nbsp;</i>';
-    if ($isInViewMode) {  $sss_checked = 'checked'}
-    if (session('sss_ord_cat')){  $sss_orderby = 'checked'}
-
-    if($prm_vc){
-        $catselected = $hshCats{$prm_vc}; $catselected ="" if !$catselected;
-         my $n = 16 - length($catselected);
-        $catselected =~ s/^(.*)/'&nbsp;' x $n . $1/e;
-    }
-
-    if(@xc_lst){#Do list of excludes, past from browser in form of category id's.
-        my $xcls ="";
-        foreach(@xc_lst){ $xcls .= $hshCats{$_}.',' if $hshCats{$_}; $xc_lst.=$_.','}
-        $xcls =~ s/\,$//g; $xcls =~ s/\,\,/\,/g; $xc_lst=~ s/^0\,$//g;
-        $xcatselected = $hshCats{$prm_xc};  $xcatselected ="" if !$xcatselected;
-        my $n = 16 - length($xcatselected);
-        $xcatselected =~ s/^(.*)/'&nbsp;' x $n . $1/e;
-        $tdivxc = '<td id="divxc_lbl" align="right">Excludes:</td><td align="left" id="divxc">'.$xcls.'</td>';
-    }
-    elsif($prm_xc){
-        $xcatselected = $hshCats{$prm_xc};
-         my $n = 16 - length($xcatselected);
-        $xcatselected =~ s/^(.*)/'&nbsp;' x $n . $1/e;
-        $tdivxc = '<td id="divxc_lbl" align="right">Excludes:</td><td align="left" id="divxc">'.$hshCats{$prm_xc}.'</td>';
-    }
-    #select options of $prm_aa in dropdown.
-    my $aopts = "";
-    my ($s,$i) = ("",0);
-    my $aa = param('aa');
-    if(!$prm_aa){$aa = 0}else{$aa--};
-    foreach ('Asset','Income','Expense') {
-        if($aa == $i){$s='selected'}else{$s=""}
-        $aopts .= "\t<option value=\"$i\" $s>$_</option>\n";
-        $i++;
-    }
-    $srh .=
-    qq(
+my ($sss_checked, $sss_orderby) = ("","");
+my ($vc_lst,$xc_lst) = ("","");
+my $tdivvc = '<td id="divvc_lbl" align="right" style="display:none">Includes:</td><td align="left" id="divvc"></td>';
+my $tdivxc = '<td id="divxc_lbl" align="right" style="display:none">Excludes:</td><td align="left" id="divxc"></td>';
+my $catselected  = '<i>&nbsp;&nbsp;&nbsp;<font size=1>-- Select --</font>&nbsp;&nbsp;&nbsp;</i>';
+my $xcatselected = '<i>&nbsp;&nbsp;&nbsp;<font size=1>-- Select --</font>&nbsp;&nbsp;&nbsp;</i>';
+if ($isInViewMode) {  $sss_checked = 'checked'}
+if (session('sss_ord_cat')){  $sss_orderby = 'checked'}
+
+if($prm_vc){
+       $catselected = $hshCats{$prm_vc};
+       $catselected ="" if !$catselected;
+       my $n = 16 - length($catselected);
+       $catselected =~ s/^(.*)/'&nbsp;' x $n . $1/e;
+}
+
+if(@xc_lst){#Do list of excludes, past from browser in form of category id's.
+       my $xcls ="";
+       foreach(@xc_lst){ $xcls .= $hshCats{$_}.',' if $hshCats{$_}; $xc_lst.=$_.','}
+       $xcls =~ s/\,$//g;
+       $xcls =~ s/\,\,/\,/g;
+       $xc_lst=~ s/^0\,$//g;
+       $xcatselected = $hshCats{$prm_xc};
+       $xcatselected ="" if !$xcatselected;
+       my $n = 16 - length($xcatselected);
+       $xcatselected =~ s/^(.*)/'&nbsp;' x $n . $1/e;
+       $tdivxc = '<td id="divxc_lbl" align="right">Excludes:</td><td align="left" id="divxc">'.$xcls.'</td>';
+}elsif($prm_xc){
+       $xcatselected = $hshCats{$prm_xc};
+       my $n = 16 - length($xcatselected);
+       $xcatselected =~ s/^(.*)/'&nbsp;' x $n . $1/e;
+       $tdivxc = '<td id="divxc_lbl" align="right">Excludes:</td><td align="left" id="divxc">'.$hshCats{$prm_xc}.'</td>';
+}
+
+#select options of $prm_aa in dropdown.
+my $aopts = "";
+my ($s,$i) = ("",0);
+my $aa = param('aa');
+if(!$prm_aa){$aa = 0}
+else{$aa--}
+foreach ('Asset','Income','Expense') {
+       if($aa == $i){$s='selected'}
+       else{$s=""}
+       $aopts .= "\t<option value=\"$i\" $s>$_</option>\n";
+       $i++;
+}
+$srh .=qq(
     <tr class="collpsd">
      <td align="right" style="width:20%;">View by Category:</td>
      <td align="left">
@@ -996,23 +1029,29 @@ HTML
     </td>
     );
 
-    if ( ( $rs_keys && $rs_keys ne '*' ) || $prm_vc || $stmD || $prm_xc ) {
-        $sm_reset_all = '<a class="a_" onclick="resetView();">Reset View</a><hr>';
-        $srh .= '<tr class="collpsd"><td align="right" colspan="2">
+if ( ( $rs_keys && $rs_keys ne '*' ) || $prm_vc || $stmD || $prm_xc ) {
+       $sm_reset_all = '<a class="a_" onclick="resetView();">Reset View</a><hr>';
+       $srh .= '<tr class="collpsd"><td align="right" colspan="2">
         <input id="srch_reset" name="srch_reset" type="hidden" value="0"/>
         <button onClick="resetView()">Reset Whole View</button><br></td></tr>';
-    }
-    else {$srh .= '</tr>'};
+}else {
+       $srh .= '</tr>';
+}
 
-    $srh .= '</table></form>';
+$srh .= '</table></form>';
 
 my $sideMenu;
 my $tail = q(<div><a class="a_" href="stats.cgi">View Statistics</a>&nbsp;&nbsp;<a class="a_" href="config.cgi">Configure Log</a></div><hr>
              <div><a class="a_" href="login_ctr.cgi?logout=bye" id="btnLogout">LOGOUT</a><hr><a name="bottom"></a></div>);
-if($isPUBViewMode){$sideMenu=$frm=$srh=$tail=""}else{ 
-    my $sql = Settings::dbSrc(); my $s = $sql =~ qr/:/; $s = $`; $' =~ qr/:/; 
-    if(lc $` eq 'pg'){$sql = $s.'&#10132;'.'PostgreSQL'}else{$sql = $s.'&#10132;'.$`};
-    $sideMenu = qq(
+if($isPUBViewMode){$sideMenu=$frm=$srh=$tail=""}
+else{
+       my $sql = Settings::dbSrc();
+       my $s = $sql =~ qr/:/;
+       $s = $`;
+       $' =~ qr/:/;
+       if(lc $` eq 'pg'){$sql = $s.'&#10132;'.'PostgreSQL'}
+       else{$sql = $s.'&#10132;'.$`}
+       $sideMenu = qq(
         <div id="menu" title="To close this menu click on its heart, and wait.">
         <div class="hdr" style="marging=0;padding:0px;">
         <a id="to_top" href="#top" title="Go to top of page."><span class="ui-icon ui-icon-arrowthick-1-n" style="float:none;"></span></a>&nbsp;
@@ -1048,7 +1087,8 @@ my $help = &help;
 #  Final Page Output from here!  #
 ##################################
 
-toBuf (qq(
+toBuf (
+       qq(
 $sideMenu
 <a id="top" name="top"></a>
 <div id="div_log">$frm</div>
@@ -1071,7 +1111,8 @@ $tail
         Your browser does not support the
         <code>audio</code> element.
 </audio>
-));
+)
+);
 
 outputPage();
 
@@ -1080,341 +1121,342 @@ $db->disconnect();
 undef($sss);
 exit;
 
+
 sub castToBool {
-    my $v=shift;
-    if($v eq"1"||$v eq"on"){return 'true'}else{return 'false'}
+       my $v=shift;
+       if($v eq"1"||$v eq"on"){return 'true'}
+       else{return 'false'}
 }
 
+
 sub processSubmit {
 
-    my $date = param('date');
-    my $log  = param('log');
-    my $cat  = param('ec');
-    my $cnt ="";
-    my $am = param('am');
-    my $af = param('amf');
-
-    my $edit_mode = param('submit_is_edit');
-    my $view_mode = param('submit_is_view');
-    my $view_all  = param('rs_all');
-    my $rtf    = param('rtf');
-    my $sticky = param('sticky');
-    my $stm;
-    my $SQLID = 'rowid'; 
-    my @gzero;
-
-    toBuf $cgi->pre("###[loggin entry->cat:$cat log:$log") if $DEBUG;
-
-    if($rtf eq 'on'){$rtf = 1}  else {$rtf = 0}
-    if($sticky eq 'on'){$sticky = 1} else {$sticky = 0}           
-    if(!$am){$am=0}
-    if(Settings::isProgressDB()){$SQLID = 'ID'; $sticky = castToBool($sticky);}
-try {
-#Apostroph's need to be replaced with doubles  and white space to be fixed for the SQL.
-        $log =~ s/'/''/g;
-
-        if ( $edit_mode && $edit_mode != "0" ) {                
-            $date = DateTime::Format::SQLite->parse_datetime($date); $date =~ s/T/ /g;
-            $stm = qq(UPDATE LOG SET ID_CAT='$cat', RTF='$rtf',
+       my $date = param('date');
+       my $log  = param('log');
+       my $cat  = param('ec');
+       my $cnt ="";
+       my $am = param('am');
+       my $af = param('amf');
+
+       my $edit_mode = param('submit_is_edit');
+       my $view_mode = param('submit_is_view');
+       my $view_all  = param('rs_all');
+       my $rtf    = param('rtf');
+       my $sticky = param('sticky');
+       my $stm;
+       my $SQLID = 'rowid';
+       my @gzero;
+
+       toBuf $cgi->pre("###[loggin entry->cat:$cat log:$log") if $DEBUG;
+
+       if($rtf eq 'on'){$rtf = 1}
+       else {$rtf = 0}
+       if($sticky eq 'on'){$sticky = 1}
+       else {$sticky = 0}
+       if(!$am){$am=0}
+       if(Settings::isProgressDB()){$SQLID = 'ID'; $sticky = castToBool($sticky);}
+       try {
+               #Apostroph's need to be replaced with doubles  and white space to be fixed for the SQL.
+               $log =~ s/'/''/g;
+
+               if ( $edit_mode && $edit_mode != "0" ) {
+                       $date = DateTime::Format::SQLite->parse_datetime($date);
+                       $date =~ s/T/ /g;
+                       $stm = qq(UPDATE LOG SET ID_CAT='$cat', RTF='$rtf',
                                         DATE='$date',
                                         LOG='$log',
                                         AMOUNT=$am,
                                         AFLAG = $af,
                                         STICKY=$sticky WHERE $SQLID=$edit_mode;);
-            #
-            toBuf $stm if $DEBUG;
-            #             
-            
-            traceDBExe($stm);
-            return;
-        }
-
-        if ( $view_mode == "1" ) {
-
-            if ($rs_cur) {
-                my $sand = "";
-                if($rs_cur == $rs_prev)
-                {    #Mid page back button if id ordinal.
-                    $rs_cur += $rec_limit;
-                    $rs_prev = $rs_cur;
-                    $rs_page--;
-                }
-                else {
-                    $rs_page++;
-                }
-                if($prm_vc){
-                    $sand = "and ID_CAT == $prm_vc";
-                }
-                elsif($prm_xc){
-
-                    if(@xc_lst){
-                       foreach (@xc_lst){
-                          $sand .= "and ID_CAT!=$_ ";
-                       }
-                    }
-                    else{ $sand = "and ID_CAT != $prm_xc"; }
-
-                }
-                $sqlVWL = qq($stmS PID<=$rs_cur and STICKY=false $sand $stmE);
-                return;
-            }
-        }
-
-            if ( $log && $date && $cat ) {
-                #
-                # After Insert renumeration check
-                #                
-                my $dt    = DateTime::Format::SQLite->parse_datetime($date);
-                my $dtCur = DateTime->now();
-                   $dtCur->set_time_zone(&Settings::timezone);
-                   $dtCur = $dtCur - DateTime::Duration->new( days => 1 );
-                #
-                # check and prevent double entry
-                #
-                $date = $dt;
-                $stm = qq(SELECT DATE,LOG FROM LOG where DATE='$date' AND LOG='$log';);
-                my $st = traceDBExe($stm);
-                if ($st->fetchrow_array() ) {
-                    return;
-                }
-                if ($dtCur > $dt){$sticky = 1; toBuf $cgi->p("<b>Insert forced to be sticky, it is in the past!</b>");}
-                $sticky=castToBool($sticky);
-                $stm = qq(INSERT INTO LOG (ID_CAT, DATE, LOG, RTF, AMOUNT, AFLAG, STICKY) VALUES ($cat,'$date','$log',$rtf, $am,$af,$sticky););
-                $st = traceDBExe($stm);
-                # my $rv = $db->last_insert_id(undef, undef, "log", undef);
-                #  toBuf "\n<b>[".$rv."]</b>";
-                $st->finish();
-                if($sssCDB){
-                    #Allow further new database creation, it is not an login infinite db creation attack.
-                    $sss->param("cdb", 0);
-                }
-                if($rtf){ #Update 0 ground NOTES entry to the just inserted log.
-                   if ($dtCur > $dt){#New entry is set in the past. And wtf; has RTF attached.
-                       if(Settings::isProgressDB()){$stm = "SELECT ID FROM LOG WHERE date = timestamp '$date';"}
-                       else{$stm = 'SELECT ID FROM '.Settings->VW_LOG." WHERE datetime(date) = datetime('$date');"}
-                       $st = traceDBExe($stm); 
-                   }else{
-                       $st = traceDBExe('SELECT ID FROM '.Settings->VW_LOG.' LIMIT 1;');
-                   }
-                   my @lids = $st->fetchrow_array();
-                   $st = traceDBExe('SELECT DOC FROM NOTES WHERE LID = 0;');
-                   my @gzero = $st->fetchrow_array();
-                   if(scalar @lids > 0){
-            #By Notes.LID constraint, there should NOT be an already existing log rowid entry just submitted in the Notes table!
-            #What happened? We must check and delete, regardles. As data is renumerated and shuffled from perl in database. :(
-                      $st = traceDBExe("SELECT LID FROM NOTES WHERE LID=".$lids[0].";");
-                      if($st->fetchrow_array()){
-                          $st = $db->do("DELETE FROM NOTES WHERE LID=".$lids[0].";");
-                          # NOTICE -  There will be disparities here if renumeration failed, to update, run. 
-                          # These are expected after upgrades. And if switching DB engine and SQL compatibilities.
-                          toBuf qq(<p>Warning deleted (possible old) NOTES.LID[$lids[0]] -> lid:@lids</p>);
-                      }
-                      toBuf("\nINSERT INTO NOTES($lids[0], {DOC[$date]})") if ($DEBUG);
-                      $st = $db->prepare("INSERT INTO NOTES(LID, DOC) VALUES (?, ?);");
-                      if(Settings::isProgressDB()){
-                          $st->bind_param(1, $lids[0]);           
-                          $st->bind_param(2, $gzero[0],{ pg_type => DBD::Pg::PG_BYTEA });
-                          $st->execute();
-                      }else{
-                        $st->execute($lids[0], $gzero[0]);
-                      }
-                       #Flatten ground zero
-                      $st = $db->prepare("UPDATE NOTES SET DOC=null WHERE LID=0;");
-                      $st->execute();
-                   }
-                }
-                Settings::renumerate($db) if ( $dtCur > $dt );
-            }
-            if(!@gzero){$st = traceDBExe('SELECT DOC FROM NOTES WHERE LID = 0;');@gzero = $st->fetchrow_array()}            
-            $rtf_buffer = 1 if $gzero[0];
-}
- catch {
+                       #
+                       toBuf $stm if $DEBUG;
+                       #
+
+                       traceDBExe($stm);
+                       return;
+               }
+
+               if ( $view_mode == "1" ) {
+
+                       if ($rs_cur) {
+                               my $sand = "";
+                               if($rs_cur == $rs_prev){    #Mid page back button if id ordinal.
+                                       $rs_cur += $rec_limit;
+                                       $rs_prev = $rs_cur;
+                                       $rs_page--;
+                               }else {
+                                       $rs_page++;
+                               }
+                               if($prm_vc){
+                                       $sand = "and ID_CAT == $prm_vc";
+                               }elsif($prm_xc){
+
+                                       if(@xc_lst){
+                                               foreach (@xc_lst){
+                                                       $sand .= "and ID_CAT!=$_ ";
+                                               }
+                                       }else{
+                                               $sand = "and ID_CAT != $prm_xc";
+                                       }
+
+                               }
+                               $sqlVWL = qq($stmS PID<=$rs_cur and STICKY=false $sand $stmE);
+                               return;
+                       }
+               }
+
+               if ( $log && $date && $cat ) {
+                       #
+                       # After Insert renumeration check
+                       #
+                       my $dt    = DateTime::Format::SQLite->parse_datetime($date);
+                       my $dtCur = DateTime->now();
+                       $dtCur->set_time_zone(&Settings::timezone);
+                       $dtCur = $dtCur - DateTime::Duration->new( days => 1 );
+                       #
+                       # check and prevent double entry
+                       #
+                       $date = $dt;
+                       $stm = qq(SELECT DATE,LOG FROM LOG where DATE='$date' AND LOG='$log';);
+                       my $st = traceDBExe($stm);
+                       if ($st->fetchrow_array() ) {
+                               return;
+                       }
+                       if ($dtCur > $dt){$sticky = 1; toBuf $cgi->p("<b>Insert forced to be sticky, it is in the past!</b>");}
+                       $sticky=castToBool($sticky);
+                       $stm = qq(INSERT INTO LOG (ID_CAT, DATE, LOG, RTF, AMOUNT, AFLAG, STICKY) VALUES ($cat,'$date','$log',$rtf, $am,$af,$sticky););
+                       $st = traceDBExe($stm);
+
+                       # my $rv = $db->last_insert_id(undef, undef, "log", undef);
+                       #  toBuf "\n<b>[".$rv."]</b>";
+                       $st->finish();
+                       if($sssCDB){
+
+                               #Allow further new database creation, it is not an login infinite db creation attack.
+                               $sss->param("cdb", 0);
+                       }
+                       if($rtf){ #Update 0 ground NOTES entry to the just inserted log.
+                               if ($dtCur > $dt){#New entry is set in the past. And wtf; has RTF attached.
+                                       if(Settings::isProgressDB()){$stm = "SELECT ID FROM LOG WHERE date = timestamp '$date';"}
+                                       else{$stm = 'SELECT ID FROM '.Settings->VW_LOG." WHERE datetime(date) = datetime('$date');"}
+                                       $st = traceDBExe($stm);
+                               }else{
+                                       $st = traceDBExe('SELECT ID FROM '.Settings->VW_LOG.' LIMIT 1;');
+                               }
+                               my @lids = $st->fetchrow_array();
+                               $st = traceDBExe('SELECT DOC FROM NOTES WHERE LID = 0;');
+                               my @gzero = $st->fetchrow_array();
+                               if(scalar @lids > 0){
+
+                                       #By Notes.LID constraint, there should NOT be an already existing log rowid entry just submitted in the Notes table!
+                                       #What happened? We must check and delete, regardles. As data is renumerated and shuffled from perl in database. :(
+                                       $st = traceDBExe("SELECT LID FROM NOTES WHERE LID=".$lids[0].";");
+                                       if($st->fetchrow_array()){
+                                               $st = $db->do("DELETE FROM NOTES WHERE LID=".$lids[0].";");
+
+                                               # NOTICE -  There will be disparities here if renumeration failed, to update, run.
+                                               # These are expected after upgrades. And if switching DB engine and SQL compatibilities.
+                                               toBuf qq(<p>Warning deleted (possible old) NOTES.LID[$lids[0]] -> lid:@lids</p>);
+                                       }
+                                       toBuf("\nINSERT INTO NOTES($lids[0], {DOC[$date]})") if ($DEBUG);
+                                       $st = $db->prepare("INSERT INTO NOTES(LID, DOC) VALUES (?, ?);");
+                                       if(Settings::isProgressDB()){
+                                               $st->bind_param(1, $lids[0]);
+                                               $st->bind_param(2, $gzero[0],{ pg_type => DBD::Pg::PG_BYTEA });
+                                               $st->execute();
+                                       }else{
+                                               $st->execute($lids[0], $gzero[0]);
+                                       }
+
+                                       #Flatten ground zero
+                                       $st = $db->prepare("UPDATE NOTES SET DOC=null WHERE LID=0;");
+                                       $st->execute();
+                               }
+                       }
+                       Settings::renumerate($db) if ( $dtCur > $dt );
+               }
+               if(!@gzero){$st = traceDBExe('SELECT DOC FROM NOTES WHERE LID = 0;');@gzero = $st->fetchrow_array()}
+               $rtf_buffer = 1 if $gzero[0];
+       }catch {
 
-my $err = $@;
-my $pwd = `pwd`;
-$pwd =~ s/\s*$//;
+               my $err = $@;
+               my $pwd = `pwd`;
+               $pwd =~ s/\s*$//;
 
-my $dbg = qq(--DEBUG OUTPUT--\n
+               my $dbg = qq(--DEBUG OUTPUT--\n
     DSN:) . Settings::dsn(). qq(
     stm:$stm
     \@DB::args:@DB::args
     \$DBI::err:$DBI::errstr
     cnt:$cnt, cat:$cat, date:$date, log:$log, am:$am, af:$af, rtf:$rtf, sticky:$sticky);
-    print $cgi->header,
-        "<hr><font color=red><b>SERVER ERROR</b></font> on ".DateTime->now.
-        "<hr><pre>$pwd/$0 -> &".caller." -> [<font color=red><b>$DBI::errstr</b></font>] $err\n$dbg</pre>",
-        $cgi->end_html;
+               print $cgi->header,"<hr><font color=red><b>SERVER ERROR</b></font> on ".DateTime->now."<hr><pre>$pwd/$0 -> &".caller." -> [<font color=red><b>$DBI::errstr</b></font>] $err\n$dbg</pre>",$cgi->end_html;
 
-    exit;
-}
+               exit;
+       }
 }
 
-    sub buildNavigationButtons {
-
-        if ( !$log_cur_id ) {
-
-        #Following is a quick hack as previous id as current minus one might not
-        #coincide in the database table!
-            $log_cur_id = $id - 1;
-        }
-        if ( $tfId == 1 ) {
-            $tfId = 0;
-        }
-        else {
-            $tfId = 1;
-        }
-
-        $vmode = qq(<span style="font-size:small;">[In Page Mode]</span>&nbsp;);
-        $vmode = qq(<span style="font-color:red;font-size:x-small">[In View Mode]</span>&nbsp;) if$isInViewMode;
-        if($isPUBViewMode){
-           $log_output .=qq!<tr class="r$tfId" id="brw_row"><td style="text-align:left;">$vmode</td><td colspan="3"></td>!;
-        }
-        elsif($rec_limit == 0){
-            $log_output .= qq!<tr class="r$tfId" id="brw_row"><td style="text-align:left;">$vmode</td><td colspan="3">
+
+sub buildNavigationButtons {
+
+       if ( !$log_cur_id ) {
+
+               #Following is a quick hack as previous id as current minus one might not
+               #coincide in the database table!
+               $log_cur_id = $id - 1;
+       }
+       if ( $tfId == 1 ) {
+               $tfId = 0;
+       }else {
+               $tfId = 1;
+       }
+
+       $vmode = qq(<span style="font-size:small;">[In Page Mode]</span>&nbsp;);
+       $vmode = qq(<span style="font-color:red;font-size:x-small">[In View Mode]</span>&nbsp;) if$isInViewMode;
+       if($isPUBViewMode){
+               $log_output .=qq!<tr class="r$tfId" id="brw_row"><td style="text-align:left;">$vmode</td><td colspan="3"></td>!;
+       }elsif($rec_limit == 0){
+               $log_output .= qq!<tr class="r$tfId" id="brw_row"><td style="text-align:left;">$vmode</td><td colspan="3">
                                <input class="ui-button" type="button" onclick="submitTop($log_top);return false;" value="Back To Page View"/>!;
-        }
-        else{
-                if ($rs_cur < $log_top && $rs_prev && $rs_prev > 0 && $log_start > 0 && $rs_page > 0) {
-                    $log_output .= qq!<tr class="r$tfId" id="brw_row"><td style="text-align:left;">$vmode</td><td colspan="3"><input class="ui-button" type="button" onclick="submitTop($log_top);return false;" value="TOP"/>&nbsp;&nbsp;
+       }else{
+               if ($rs_cur < $log_top && $rs_prev && $rs_prev > 0 && $log_start > 0 && $rs_page > 0) {
+                       $log_output .= qq!<tr class="r$tfId" id="brw_row"><td style="text-align:left;">$vmode</td><td colspan="3"><input class="ui-button" type="button" onclick="submitTop($log_top);return false;" value="TOP"/>&nbsp;&nbsp;
                     <input type="hidden" value="$rs_prev"/>
                     <input class="ui-button" type="button" onclick="submitPrev($log_rc_prev, $rec_limit);return false;" value="&lsaquo;&lsaquo;&nbsp; Previous"/>&nbsp;&nbsp;!;
 
-                }
-                else {
-                    my $v = "<font style='font-size:small'>You Are In &#10132; $vmode</font>";
-                    $log_output .= qq(<tr class="r$tfId" id="brw_row"><td colspan="2" style="text-align:left;">$v</td><td colspan="3"><i>Top</i>&nbsp;&nbsp;&nbsp;&nbsp;);
-                }
+               }else {
+                       my $v = "<font style='font-size:small'>You Are In &#10132; $vmode</font>";
+                       $log_output .= qq(<tr class="r$tfId" id="brw_row"><td colspan="2" style="text-align:left;">$v</td><td colspan="3"><i>Top</i>&nbsp;&nbsp;&nbsp;&nbsp;);
+               }
 
 
-                    $log_output .= '<input class="ui-button" type="button" onclick="viewAll();return false;" value="View All"/>&nbsp;&nbsp;';
+               $log_output .= '<input class="ui-button" type="button" onclick="viewAll();return false;" value="View All"/>&nbsp;&nbsp;';
 
 
-                if ( $log_cur_id == 0 ) {
-                    $log_output = $log_output . '<i>End</i></td>';
-                }
-                else {
+               if ( $log_cur_id == 0 ) {
+                       $log_output = $log_output . '<i>End</i></td>';
+               }else {
 
-                    $log_output .= qq!<input class="ui-button" type="button" onclick="submitNext($log_cur_id, $rec_limit);return false;"
+                       $log_output .= qq!<input class="ui-button" type="button" onclick="submitNext($log_cur_id, $rec_limit);return false;"
                                         value="Next &nbsp;&rsaquo;&rsaquo;"/>&nbsp;&nbsp;
                                         <input class="ui-button" type="button" onclick="submitEnd($rec_limit);return false;" value="END"/></td>!;
 
-                }
-        }
+               }
+       }
+
+       $log_output .= '<td colspan="1"></td></tr>';
+}
 
-        $log_output .= '<td colspan="1"></td></tr>';
-    }
 
 sub authenticate {
-    try {
-
-        my $st = traceDBExe("SELECT alias FROM AUTH WHERE alias='$alias' and passw='$passw';");
-        my @c = $st->fetchrow_array();
-        if (@c && $c[0] eq $alias ) { return; }
-
-        #Check if passw has been wiped for reset?
-        $st = traceDBExe("SELECT * FROM AUTH WHERE alias='$alias';");
-        @c = $st->fetchrow_array();
-        if ( @c && $c[1] == "" ) {
-            #Wiped with -> UPDATE AUTH SET passw='' WHERE alias='$alias';
-            $st = traceDBExe("UPDATE AUTH SET passw='$passw' WHERE alias='$alias';");
-            return;
-        }
-
-        #We log failed possible intruder access.
-        Settings::toLog($db,"User $alias, failed to authenticate!");
-
-        print $cgi->header( -expires => "+0s", -charset => "UTF-8" );
-        print $cgi->start_html(
-            -title => "Personal Log Login",
-            -BGCOLOR => Settings::theme('colBG'),
-            -script =>
-                { -type => 'text/javascript', -src => 'wsrc/main.js' },
-            -style => { -type => 'text/css', -src => 'wsrc/main.css' },
-        );
-        if($DEBUG){
-                print $cgi->center(
-                    $cgi->div("<b>Access Denied!</b> alias:$alias pass:$passw SQL->SELECT * FROM AUTH WHERE alias='$alias' and passw='$passw'; ")
-                );
-        }
-        else{
-                print $cgi->center(
-                    $cgi->div('<h2>Sorry Access Denied!</h2><font color=red><b>The credentials you supplied have failed!</b></font>'),
-                    $cgi->div('<h3>[<a href="login_ctr.cgi">Login</a>]</h3>')
-                );
-        }
-        print $cgi->end_html;
-
-        $db->disconnect();
-        $sss->flush();
-        exit;
-
-    }
-    catch {
-        print $cgi->header( -expires => "+0s", -charset => "UTF-8" );
-        print $cgi->p( "PAGE ERROR:" . $_ );
-        print $cgi->end_html;
-        exit;
-    }
+       try {
+
+               my $st = traceDBExe("SELECT alias FROM AUTH WHERE alias='$alias' and passw='$passw';");
+               my @c = $st->fetchrow_array();
+               if (@c && $c[0] eq $alias ) { return; }
+
+               #Check if passw has been wiped for reset?
+               $st = traceDBExe("SELECT * FROM AUTH WHERE alias='$alias';");
+               @c = $st->fetchrow_array();
+               if ( @c && $c[1] == "" ) {
+
+                       #Wiped with -> UPDATE AUTH SET passw='' WHERE alias='$alias';
+                       $st = traceDBExe("UPDATE AUTH SET passw='$passw' WHERE alias='$alias';");
+                       return;
+               }
+
+               #We log failed possible intruder access.
+               Settings::toLog($db,"User $alias, failed to authenticate!");
+
+               print $cgi->header( -expires => "+0s", -charset => "UTF-8" );
+               print $cgi->start_html(
+                       -title => "Personal Log Login",
+                       -BGCOLOR => Settings::theme('colBG'),
+                       -script =>{ -type => 'text/javascript', -src => 'wsrc/main.js' },
+                       -style => { -type => 'text/css', -src => 'wsrc/main.css' },
+               );
+               if($DEBUG){
+                       print $cgi->center($cgi->div("<b>Access Denied!</b> alias:$alias pass:$passw SQL->SELECT * FROM AUTH WHERE alias='$alias' and passw='$passw'; "));
+               }else{
+                       print $cgi->center($cgi->div('<h2>Sorry Access Denied!</h2><font color=red><b>The credentials you supplied have failed!</b></font>'),$cgi->div('<h3>[<a href="login_ctr.cgi">Login</a>]</h3>'));
+               }
+               print $cgi->end_html;
+
+               $db->disconnect();
+               $sss->flush();
+               exit;
+
+       }catch {
+               print $cgi->header( -expires => "+0s", -charset => "UTF-8" );
+               print $cgi->p( "PAGE ERROR:" . $_ );
+               print $cgi->end_html;
+               exit;
+       }
 }
 
 
 sub fetchAutocomplete {
 
-    my $st = traceDBExe('select LOG from '. $VW_PAGE  . $stmE. '-- > '. &Settings::autoWordLimit.'  < -- fetchAutocomplete');
-    my $awl = Settings::autoWordLength();
-    my %hsh = (); 
-    my $lst = "\"\"";
-    while ( my @row = $st->fetchrow_array() ) {
-        my ($wl,$log) = ("",$row[0]);
-        #Decode escaped \\n
-        $log =~ s/\\n/\n/gs;
-        $log =~ s/''/'/g;
-        my @words = split( /\s/, $log );
-        foreach my $word (sort @words) {
-            #remove all non alphanumerics
-            $word =~ s/[^a-zA-Z]//gs;
-            $wl = length($word);
-            if ( $wl > 2 && $wl < $awl) {# Gas Bootle
-                $word = lc $word;                
-                if(!$hsh{$word}){ 
-                    $hsh{$word}=1;
-                    $lst .= qq(,"$word");
-                } else{
-                    next; 
-                } 
-                if ( $aw_cnt++ > &Settings::autoWordLimit ) {
-                    last;
-                }
-            }
-        }
-        if ( $aw_cnt > Settings::autoWordLimit() ) {
-            last;
-        }
-    }
-    $autowords = $lst if(length($lst)>1);
-    undef %hsh;
+       my $st = traceDBExe('select LOG from '. $VW_PAGE  . $stmE. '-- > '. &Settings::autoWordLimit.'  < -- fetchAutocomplete');
+       my $awl = Settings::autoWordLength();
+       my %hsh = ();
+       my $lst = "\"\"";
+       while ( my @row = $st->fetchrow_array() ) {
+               my ($wl,$log) = ("",$row[0]);
+
+               #Decode escaped \\n
+               $log =~ s/\\n/\n/gs;
+               $log =~ s/''/'/g;
+               my @words = split( /\s/, $log );
+               foreach my $word (sort @words) {
+
+                       #remove all non alphanumerics
+                       $word =~ s/[^a-zA-Z]//gs;
+                       $wl = length($word);
+                       if ( $wl > 2 && $wl < $awl) {# Gas Bootle
+                               $word = lc $word;
+                               if(!$hsh{$word}){
+                                       $hsh{$word}=1;
+                                       $lst .= qq(,"$word");
+                               } else{
+                                       next;
+                               }
+                               if ( $aw_cnt++ > &Settings::autoWordLimit ) {
+                                       last;
+                               }
+                       }
+               }
+               if ( $aw_cnt > Settings::autoWordLimit() ) {
+                       last;
+               }
+       }
+       $autowords = $lst if(length($lst)>1);
+       undef %hsh;
 }
 
-sub cam { my $am = sprintf( "%.2f", shift);
-    $am = sprintf( "%.2f", shift @_ ) if @_;
-    # Add one comma each time through the do-nothing loop
-    1 while $am =~ s/^(-?\d+)(\d\d\d)/$1,$2/;
-    return $am;
+
+sub cam {
+       my $am = sprintf( "%.2f", shift);
+       $am = sprintf( "%.2f", shift @_ ) if @_;
+
+       # Add one comma each time through the do-nothing loop
+       1 while $am =~ s/^(-?\d+)(\d\d\d)/$1,$2/;
+       return $am;
 }
 
-sub quill{
 
-    my ( $log_id, $height ) = shift;
+sub quill{
 
-given ( &Settings::windowRTFSize ) {
-        when("0") { $height = q(height:420px;) }
-        when("1") { $height = q(height:260px;) }
-        when("2") { $height = q(height:140px;) }
-        default  {
-            $height = &Settings::windowRTFSize;
-        }
-}
-return qq(
+       my ( $log_id, $height ) = shift;
+
+       given ( &Settings::windowRTFSize ) {
+               when("0") { $height = q(height:420px;) }
+               when("1") { $height = q(height:260px;) }
+               when("2") { $height = q(height:140px;) }
+               default  {
+                       $height = &Settings::windowRTFSize;
+               }
+       }
+       return qq(
 <table id="tbl_doc" class="tbl" width=").&Settings::pagePrcWidth.qq(%" style="border:1; margin-top: 5px;" hidden>
        <tr class="r0" style="text-align:center"><td><b>* Document *</b>
     <a id="log_close" href="#" onclick="return hide('#tbl_doc');">$sp1</a>
@@ -1476,10 +1518,12 @@ return qq(
     <input type="button" id="btn_save_doc" onclick="saveRTF(0, 'store'); return false;" value="Save"/>
   </div>
   </td></tr></table>
-)}
+);
+}
+
 
 sub help{
-return qq(
+       return qq(
 <table id="tbl_hlp" class="tbl" border="0" width=").&Settings::pagePrcWidth.qq(%" hidden>
        <tr class="r0"><td colspan="3"><b>* HELP *</b>
     <a id="a_close" href="#" onclick="return hide('#tbl_hlp');">$sp1</a>
@@ -1536,58 +1580,61 @@ return qq(
 </td></tr></table>)
 }
 
+
 sub outputPage {
-    #Bug 26 -Fixed here by prefixing to collected html body buffer.    
-    $BUFFER = $cgi->start_html(
-            -title   => "Personal Log",
-            -BGCOLOR => Settings::theme('colBG'),
-            -onload  => "onBodyLoad('$toggle','".&Settings::language."','".&Settings::timezone."','$today','".&Settings::sessionExprs."','$rs_cur',".&Settings::dbVLSZ.");",
-            -style   => [            
-            { -type => 'text/css', -src => 'wsrc/jquery-ui.css' },
-            { -type => 'text/css', -src => 'wsrc/jquery-ui.theme.css' },
-            {
-                -type => 'text/css',
-                -src  => 'wsrc/jquery-ui-timepicker-addon.css'
-            },            
-            {
-                -type => 'text/css',
-                -src  => 'wsrc/tip-yellowsimple/tip-yellowsimple.css'
-            },
-
-            { -type => 'text/css', -src => 'wsrc/quill/katex.min.css' },
-            { -type => 'text/css', -src => 'wsrc/quill/monokai-sublime.min.css' },
-            { -type => 'text/css', -src => 'wsrc/quill/quill.snow.css' },
-            { -type => 'text/css', -src => 'wsrc/jquery.sweet-dropdown.css' },
-            { -type => 'text/css', -src =>  Settings::theme('css') },
-        ],
-        -script => [
-            { -type => 'text/javascript', -src => 'wsrc/main.js' },
-            { -type => 'text/javascript', -src => 'wsrc/jquery.js' },
-            { -type => 'text/javascript', -src => 'wsrc/jquery-ui.js' },
-            { -type => 'text/javascript', -src => 'wsrc/jquery-ui-timepicker-addon.js'},
-            { -type => 'text/javascript', -src => 'wsrc/jquery-ui-sliderAccess.js'},
-            { -type => 'text/javascript', -src => 'wsrc/jquery.poshytip.js' },
-
-            { -type => 'text/javascript', -src => 'wsrc/quill/katex.min.js' },
-            { -type => 'text/javascript', -src => 'wsrc/quill/highlight.min.js' },            
-            { -type => 'text/javascript', -src => 'wsrc/quill/quill.min.js' },        
-            { -type => 'text/javascript', -src => 'wsrc/jscolor.js' },
-            { -type => 'text/javascript', -src => 'wsrc/moment.js' },
-            { -type => 'text/javascript', -src => 'wsrc/moment-timezone-with-data.js' },
-            { -type => 'text/javascript', -src => 'wsrc/jquery.sweet-dropdown.js'}
-
-        ]) . ($DEBUG ?"<div class='debug_output' date='$today'>$D_BUFF</div>":"").
-    $BUFFER;
-            
-    if(Settings->compressPage() && $cgi->http('Accept-Encoding') =~ m/gzip/){        
-        print $cgi->header(-expires => "1s", -charset => "UTF-8", -Content_Encoding => 'gzip');
-        $BUFFER = gzip($BUFFER);
-    }
-    else{
-        print $cgi->header(-expires => "1s", -charset => "UTF-8");
-    }    
-    print $BUFFER;
-    print $cgi->end_html;
+
+       #Bug 26 -Fixed here by prefixing to collected html body buffer.
+       $BUFFER = $cgi->start_html(
+               -title   => "Personal Log",
+               -BGCOLOR => Settings::theme('colBG'),
+               -onload  => "onBodyLoad('$toggle','".&Settings::language."','".&Settings::timezone."','$today','".&Settings::sessionExprs."','$rs_cur',".&Settings::dbVLSZ.");",
+               -style   => [
+                       { -type => 'text/css', -src => 'wsrc/jquery-ui.css' },
+                       { -type => 'text/css', -src => 'wsrc/jquery-ui.theme.css' },
+                       {
+                               -type => 'text/css',
+                               -src  => 'wsrc/jquery-ui-timepicker-addon.css'
+                       },
+                       {
+                               -type => 'text/css',
+                               -src  => 'wsrc/tip-yellowsimple/tip-yellowsimple.css'
+                       },
+
+                       { -type => 'text/css', -src => 'wsrc/quill/katex.min.css' },
+                       { -type => 'text/css', -src => 'wsrc/quill/monokai-sublime.min.css' },
+                       { -type => 'text/css', -src => 'wsrc/quill/quill.snow.css' },
+                       { -type => 'text/css', -src => 'wsrc/jquery.sweet-dropdown.css' },
+                       { -type => 'text/css', -src =>  Settings::theme('css') },
+               ],
+               -script => [
+                       { -type => 'text/javascript', -src => 'wsrc/main.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/jquery.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/jquery-ui.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/jquery-ui-timepicker-addon.js'},
+                       { -type => 'text/javascript', -src => 'wsrc/jquery-ui-sliderAccess.js'},
+                       { -type => 'text/javascript', -src => 'wsrc/jquery.poshytip.js' },
+
+                       { -type => 'text/javascript', -src => 'wsrc/quill/katex.min.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/quill/highlight.min.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/quill/quill.min.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/jscolor.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/moment.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/moment-timezone-with-data.js' },
+                       { -type => 'text/javascript', -src => 'wsrc/jquery.sweet-dropdown.js'}
+
+               ]
+         )
+         . ($DEBUG ?"<div class='debug_output' date='$today'>$D_BUFF</div>":"")
+         .$BUFFER;
+
+       if(Settings->compressPage() && $cgi->http('Accept-Encoding') =~ m/gzip/){
+               print $cgi->header(-expires => "1s", -charset => "UTF-8", -Content_Encoding => 'gzip');
+               $BUFFER = gzip($BUFFER);
+       }else{
+               print $cgi->header(-expires => "1s", -charset => "UTF-8");
+       }
+       print $BUFFER;
+       print $cgi->end_html;
 }
 
 
index 6feaed25afddf5a30ba2bb1719b2e3122b4e571b..a4516e2bdbb0d98e3afe8aced6c984c90dc54084 100644 (file)
@@ -9,6 +9,9 @@ use strict;
 use warnings;
 use Exception::Class ('CNFParserException');
 use Syntax::Keyword::Try;
+# Do not remove the following no critic, no security or object issues possible. 
+# We can use perls default behaviour on return.
+##no critic qw(Subroutines::RequireFinalReturn)
 
 our $VERSION = '2.2';
 
@@ -23,7 +26,6 @@ our %lists  = ();
 our %anons  = ();
 our %properties   = ();
 
-
 sub new { my ($class, $path, $attrs, $self) = @_; 
 
     if ($attrs){
@@ -58,8 +60,9 @@ sub anon {
 sub constant {my $s=shift;if(@_ > 0){$s=shift;} return $consts{$s}}
 sub constants {return \%consts}
 
-sub collections {\%properties}
+sub collections {return \%properties}
 sub collection {my($self, $attr)=@_;return $properties{$attr}}
+sub data {return \%data}
 
 sub listDelimit {                 
     my ($this, $d , $t)=@_;                 
@@ -85,7 +88,7 @@ our $isPostgreSQL = 0;
 sub isPostgreSQL{shift; $isPostgreSQL}# Enabled here to be called externally.
 my %RESERVED_WORDS = (CONST=>1, DATA=>1,  FILE=>1, TABLE=>1, 
                       INDEX=>1, VIEW=>1, SQL=>1, MIGRATE=>1, DO=>1, MACRO=>1 );
-sub isReservedWord {if(defined $_[1]){$RESERVED_WORDS{$_[1]}?1:0}}
+sub isReservedWord {my ($self, $word)=@_; return $RESERVED_WORDS{$word}}
 
 # Adds a list of environment expected list of variables.
 # This is optional and ideally to be called before parse.
@@ -133,8 +136,7 @@ sub template {
            }
        }
        return $val;
-    }
-    return;
+    }    
 }
 
 
@@ -265,11 +267,10 @@ try{
             if($t eq 'CONST'){#Single constant with mulit-line value;
                $v =~ s/^\s// if $v;
                $consts{$e} = $v if not $consts{$e}; # Not allowed to overwrite constant.
-            }elsif($t eq 'DATA'){
-               $st ="";
-               my @tad = ();
+            }elsif($t eq 'DATA'){                            
+
                foreach(split /~\n/,$v){
-                   my $i = "";
+                   my @a;
                    $_ =~ s/\\`/\\f/g;#We escape to form feed  the found 'escaped' backtick so can be used as text.
                    foreach my $d (split /`/, $_){
                         $d =~ s/\\f/`/g; #escape back form feed to backtick.
@@ -283,31 +284,31 @@ try{
                             else{
                                 $v = $d;
                             }
-                            $i .= "'$v',";
+                            push @a, $v;
                         }
                         else{
                             #First is always ID a number and '#' signifies number.
                             if($t eq "\#") {
                                 $d = substr $d, 1;
                                 $d=0 if !$d; #default to 0 if not specified.
-                                $i .= "$d,"
+                                push @a, $d
                             }
                             else{
-                                $i .= "$d,";
+                              push @a, $d;
                             }
                         }
+                   }                   
+                   
+                   my $existing = $data{$e};
+                   if(defined $existing){
+                        my @rows = @$existing;
+                        push @rows, [@a] if scalar @a >0; 
+                        $data{$e} = \@rows
+                   }else{
+                        my @rows; push @rows, [@a];   
+                        $data{$e} = \@rows if scalar @a >0;   
                    }
-                   $i =~ s/,$//;
-                   push @tad, $i if $i;
                }
-                   my @existing = $data{$e};
-                   if(scalar(@existing)>1){
-                       @existing = @{$data{$e}};
-                       foreach my $i(@existing){
-                         push @tad, $i if $i;
-                       }
-                   }
-                   $data{$e} = [@tad] if scalar(@tad)>0;
                next;
             }elsif($t eq 'FILE'){
 
@@ -319,13 +320,13 @@ try{
                     open(my $fh, "<:perlio", $path ) or  CNFParserException->throw("Can't open $path -> $!");
                     read $fh, $content, -s $fh;
                     close $fh;
-                   my @tags = ($content =~ m/<<(\w*<(.*?).*?>>)/gs);
-                   foreach my $tag (@tags){
-                     next if not $tag;
-                            my @kv = split /</,$tag;
-                            $e = $kv[0];
-                            $t = $kv[1];
-                            $i = index $t, "\n";
+                    my @tags = ($content =~ m/<<(\w*<(.*?).*?>>)/gs);
+                    foreach my $tag (@tags){
+                        next if not $tag;
+                        my @kv = split /</,$tag;
+                        $e = $kv[0];
+                        $t = $kv[1];
+                        $i = index $t, "\n";
                         if($i==-1){
                             $t = $v = substr $t, 0, (rindex $t, ">>");
                         }
@@ -333,51 +334,50 @@ try{
                             $v = substr $t, $i+1, (rindex $t, ">>")-($i+1);
                             $t =  substr $t, 0, $i;
                         }
-
                         if($t eq 'DATA'){
-                            $st ="";
-                            my @tad = ();
                             foreach(split /~\n/,$v){
-                                my $i = "";
-                                $_ =~ s/\\`/\\f/g;#We escape to form feed  the escaped in file backtick.
-                                foreach my $d (split /`/, $_){
-                                        $d =~ s/\\f/`/g; #escape back form feed to backtick.
-                                        $t = substr $d, 0, 1;
-                                        if($t eq '$'){
-                                            $v =  $d;            #capture spected value.
-                                            $d =~ s/\$$|\s*$//g; #trim any space and system or constant '$' end marker.
-                                            if($v=~m/\$$/){
-                                                $v = $consts{$d}
-                                            }
-                                            else{
-                                                $v = $d;
-                                            }
-                                            $i .= "'$v',";
+                                my @a;
+                                $_ =~ s/\\`/\\f/g;#We escape to form feed  the found 'escaped' backtick so can be used as text.
+                                foreach my $d (split(/`/, $_)){
+                                    $d =~ s/\\f/`/g; #escape back form feed to backtick.
+                                    $t = substr $d, 0, 1;
+                                    if($t eq '$'){
+                                        $v =  $d;            #capture spected value.
+                                        $d =~ s/\$$|\s*$//g; #trim any space and system or constant '$' end marker.
+                                        if($v=~m/\$$/){
+                                            $v = $consts{$d}; $v="" if not $v;
                                         }
                                         else{
-                                            #First is always ID a number and '#' signifies number.
-                                            if($t eq "\#") {
-                                                $i .= "$d," if $d;
-                                            }
-                                            else{
-                                                $i .= "'$d',";
-                                            }
+                                            $v = $d;
                                         }
-                                }
-                                $i =~ s/,$//;
-                                push @tad, $i if $i;
-                            }
-                            my @existing = $data{$e};
-                            if(scalar(@existing)>1){
-                                @existing = @{$data{$e}};
-                                foreach my $i(@existing){
-                                    push @tad, $i if $i;
-                                }
+                                        push @a, $v;
+                                    }
+                                    else{
+                                        #First is always ID a number and '#' signifies number.
+                                        if($t eq "\#") {
+                                            $d = substr $d, 1;
+                                            $d=0 if !$d; #default to 0 if not specified.
+                                            push @a, $d
+                                        }
+                                        else{
+                                        push @a, $d;
+                                        }                                                
+                                    }                   
+                                    
+                                    my $existing = $data{$e};
+                                    if(defined $existing){
+                                            my @rows = @$existing;
+                                            push @rows, [@a] if scalar @a >0; 
+                                            $data{$e} = \@rows
+                                    }else{
+                                            my @rows; push @rows, [@a];   
+                                            $data{$e} = \@rows if scalar @a >0;   
+                                    }
+                                }   
                             }
-                            $data{$e} = [@tad] if scalar(@tad)>0;
-                        }
-                   }
-                next;
+                        }       
+                    }
+              next  
             }
             elsif($t eq 'TABLE'){
                $st = "CREATE TABLE $e(\n$v);";
@@ -580,8 +580,7 @@ try{
     # Following is not been kept no more for external use.
     undef %tables;
     undef %views;
-    undef %mig;
-    undef %data;
+    undef %mig;   
 }
 catch{
   CNFParserException->throw(error=>$@, show_trace=>1);   
@@ -626,9 +625,9 @@ if(!@r){
 
 sub selectRecords {
     my ($self, $db, $sql) = @_;
-    if(scalar(@_) < 2){
-         die  "Wrong number of arguments, expecting CNFParser::selectRecords(\$db, \$sql) got Settings::selectRecords('@_').\n";
-    }
+    if(!$db||!$sql){
+          die  "Wrong number of arguments, expecting CNFParser::selectRecords(\$db, \$sql) got Settings::selectRecords('@_').\n";
+     }
     try{
         my $pst        = $db->prepare($sql);                
         return 0 if(!$pst);
@@ -720,7 +719,7 @@ undef %mig;
 undef @sql;
 undef @files;
 undef %tables;
-undef %data;
+#undef %data;
 
 }
 
index 394cbe1f8acd4bb9e55e9aa4a46370ea4cba7457..0eae57b48ca9fdf85e9d96d5e7a7a1295d9d9c66 100644 (file)
@@ -1,33 +1,29 @@
 #!/usr/bin/perl
-#
 # Web interaction, reusable tri state of configuration concerns, set of utilities. 
 #
 # Programed by: Will Budic
 # Open Source License -> https://choosealicense.com/licenses/isc/
 #
 package Settings;
-
-use v5.14;
-use strict;
-use warnings;
+use v5.30; #use diagnostics;
+use CGI::Carp qw(fatalsToBrowser set_message);
 use Exception::Class ('SettingsException','LifeLogException','SettingsLimitSizeException');
 use Syntax::Keyword::Try;
+use warnings; no warnings 'experimental';
+use strict;
 use CGI;
 use CGI::Session '-ip_match';
 use CGI::Carp qw ( fatalsToBrowser );
 use DateTime;
 use DateTime::Format::SQLite;
 use DateTime::Duration;
-
 use DBI;
 use Scalar::Util qw(looks_like_number);
-use experimental 'switch';
-use CGI::Carp qw(fatalsToBrowser set_message);
 BEGIN {
    sub handle_errors {
       my $msg = shift;
       print "<html><body><h2>LifeLog Server Error</h2>";
-      print "<pre>@[$ENV{PWD}].Error: $msg</pre></body></html>";
+      print "<pre>@[$ENV{PWD}].Error: $msg</pre></body></html>"; return
  
   }
   set_message(\&handle_errors);
@@ -56,7 +52,7 @@ use constant META => '^CONFIG_META';
 
 
 # DEFAULT SETTINGS HERE! These settings kick in if not found in config file. i.e. wrong config file or has been altered, things got missing.
-our $RELEASE_VER  = '2.4';
+our $RELEASE_VER  = '2.5';
 our $TIME_ZONE    = 'Australia/Sydney';
 our $LANGUAGE     = 'English';
 our $PRC_WIDTH    = '60';
@@ -164,13 +160,13 @@ try {
     $CGI::POST_MAX = 1024 * 1024 * 5;  # max 5GB file post size limit.
     $cgi     = $cgi = CGI->new();
     $sss     = shift; #shift will only and should, ONLY happen for test scripts.
-    $sss= new CGI::Session("driver:File", $cgi, {Directory=>$LOG_PATH, SameSite=>'Lax'}) if !$sss;
+    $sss     = CGI::Session->new("driver:File", $cgi, {Directory=>$LOG_PATH, SameSite=>'Lax'}) if !$sss;
     $sid     = $sss->id();    
     $alias   = $sss->param('alias');
     $pass    = $sss->param('passw');
     $pub     = $cgi->param('pub');$pub = $sss->param('pub') if not $pub; #maybe test script session set in $sss.
     $dbname  = $sss->param('database'); $dbname = $alias if(!$dbname);
-
+    
     ##From here we have data source set, currently Progress DB SQL and SQLite SQL compatible.
     dbSrc($sss->param('db_source'));
 
@@ -233,7 +229,7 @@ sub setTimezone {
     if(!$anons{'auto_set_timezone'}){
        if($TIME_ZONE_MAP){
             if(!%tz_map){
-                %tz_map={}; chomp($TIME_ZONE_MAP);
+                %tz_map=(); chomp($TIME_ZONE_MAP);
                 foreach (split('\n',$TIME_ZONE_MAP)){
                     my @p = split('=', $_);
                     $tz_map{trim($p[0])} = trim($p[1]);
@@ -398,14 +394,11 @@ return qq(
     );
 )}
 #Selects the actual database set configuration for the application, these kick in overwritting those from the config file.
-sub getConfiguration {
-    my ($db, $hsh) = @_;
-    my $fh;
-    my $ftzmap = 'tz.map'; 
+sub getConfiguration { my ($db, $hsh) = @_;
+    my @r; my $ftzmap = 'tz.map';
     try {
-        my $st = $db->prepare("SELECT ID, NAME, VALUE FROM CONFIG;");
-           $st->execute();
-        while ( my @r = $st->fetchrow_array() ){
+        my $st = $db->prepare("SELECT ID, NAME, VALUE FROM CONFIG;");  $st->execute();
+        while ( @r = $st->fetchrow_array() ){
                 given ( $r[1] ) {
                 when ("RELEASE_VER") {$RELEASE_VER  = $r[2]}
                 when ("TIME_ZONE")   {$TIME_ZONE    = $r[2]}
@@ -439,7 +432,7 @@ sub getConfiguration {
             $TIME_ZONE_MAP = $m{'TIME_ZONE_MAP'}; #This can be a large mapping we file it to tz.map, rather then keep in db.
             delete($m{'TIME_ZONE_MAP'});
             if($TIME_ZONE_MAP && !(-e $ftzmap)) {
-                open($fh, '>', $ftzmap) or LifeLogException->throw( "Can't write to $ftzmap: $!");
+                open(my $fh, '>', $ftzmap) or die "Can't write to '$ftzmap': $!";
                 print $fh $TIME_ZONE_MAP;
                 close $fh;
             }#else{
@@ -467,15 +460,15 @@ sub getConfiguration {
 
         }
         elsif #At times not passing in the hash of expected anons we read in the custom tz map file if it exists.
-        (-e $ftzmap){ open($fh, "<:perlio", $ftzmap) or LifeLogException->throw( "Can't open $ftzmap: $!");
+        (-e $ftzmap){ open(my $fh, "<:perlio", $ftzmap) or die "Can't open '$ftzmap': $!";
             read  $fh, $TIME_ZONE_MAP, -s $fh;
             close $fh;
         }
-        &setTimezone;
+        &setTimezone; 
     }
-    catch {
-        SettingsException->throw(error=>"DSN:$DSN &getConfiguration.ERR->[$@]", show_trace=>$DEBUG);
-    };
+    catch {       
+        SettingsException->throw(error=>"DSN:$DSN \@Settings::getConfiguration.ERR ->[$@]", show_trace=>$DEBUG);
+    };return
 }
 
 sub timeFormatSessionValue {
@@ -837,13 +830,13 @@ sub saveCurrentTheme {
         open (my $fh, '>', $LOG_PATH.'current_theme') or die $!;
         print $fh $theme;
         close($fh);
-    }
+    }return;
 }
 sub loadLastUsedTheme {    
     open my $fh, '<', $LOG_PATH.'current_theme' or return $THEME;
     $THEME = <$fh>;
     close($fh);    
-    &setupTheme;
+    &setupTheme; return
 }
 sub saveReserveAnons {
     my $meta = $anons{META}; #since v.2.3
@@ -859,11 +852,11 @@ sub saveReserveAnons {
         while(my @r=$dbs->fetchrow_array()){
             print $fh "$r[0]|$r[1] = $r[2]\n" if $r[0] =~ /^\^/;
         }
-        close($fh);
+        close($fh);return
 
     }catch{           
-       LifeLogException->throw(error=>"<p>Error->$@</p><br><pre>DSN: $DSN</pre>",  show_trace=>1);
-    }
+       LifeLogException->throw(error=>"<p>Error->$@</p><br><pre>DSN: $DSN</pre>",  show_trace=>$DEBUG);
+    }return
 }
 sub loadReserveAnons(){    
     try{        
@@ -877,7 +870,7 @@ sub loadReserveAnons(){
                     while(my @r=$dbs->fetchrow_array()){
                     $reservs{$r[1]} = $r[2] if !$reservs{$r[1]}
                     }
-                    open (my $fh, '<', $LOG_PATH.'config_meta_'.(lc($dr[1])).'_'.$dbname) or return 0;               
+                    open (my $fh, '<', $LOG_PATH.'config_meta_'.(lc($dr[1])).'_'.$dbname);
                     while (my $line = <$fh>) {
                         chomp $line;
                         my @p = $line =~ m[(\S+)\s*=\s*(\S+)]g;
@@ -891,15 +884,15 @@ sub loadReserveAnons(){
                             }
                         }
                     }
+                    close($fh);
         $db->commit();
-        close($fh);
     }catch{       
        LifeLogException->throw(error=>"<p>Error->$@</p><br><pre>DSN: $DSN</pre>",  show_trace=>1);
     }
     return 1;    
 }
 
-sub dump(){
+sub dumpVars {
     # Following will not help, as in perl package variables are codes 
     # and the web container needs sudo permissions for memory access.
     # my $class = shift;    
@@ -907,8 +900,8 @@ sub dump(){
     # use DBG;
     # dmp $self;
     #
-    # We need to do manually:
-    qq/
+    # We need to do it manually:
+    return qq/
 release        {$RELEASE_VER}
 logPath        {$LOG_PATH} 
 logPathSet     {$LOG_PATH}
diff --git a/htdocs/cgi-bin/tz.map b/htdocs/cgi-bin/tz.map
new file mode 100644 (file)
index 0000000..42b8509
--- /dev/null
@@ -0,0 +1,4 @@
+Australia/Marsfield=Australia/Sydney
+Australia/Bondi=Australia/Sydney
+America/Austin=America/Chicago
+America/Texas=America/Chicago
diff --git a/htdocs/data b/htdocs/data
deleted file mode 120000 (symlink)
index fa3d85b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/usr/local/www/data
\ No newline at end of file