From: Will Budic Date: Sun, 12 Jan 2020 11:15:18 +0000 (+1100) Subject: Started dev. on multi excludes. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=d21c1020bb5ea636742ba9af77cc7e6e3a41ef95;p=LifeLog.git Started dev. on multi excludes. --- diff --git a/Current Development Check List.md b/Current Development Check List.md index 0f21b33..bed97b1 100644 --- a/Current Development Check List.md +++ b/Current Development Check List.md @@ -8,12 +8,13 @@ This version is not compatible in data structure to prior versions. Data migrati ## LifeLog Development ### v.1.7 Encountered +* Config stored list of excludes. Provide multiple excludes view. * ✔ Settings module requires subroutines for debug logging and db properties access. * ✔ LifeLog codebase release verion upgrade tracking and procedures with older databases. * ✔ JS based session logout timer warning to be implemented. * ✔ Mutli new alias access flood attack security trigger implementation. * ✔ Debug system settings implementaiton. -* ✔ Delete page updated to show better display of entries. +* ✔ Delete page updated to show better display of entries. * Provide sub alias login that sets data visible to only a set of categories. * View specific based login on a different password. * ✔ Login page to indentify host. @@ -48,7 +49,8 @@ This version is not compatible in data structure to prior versions. Data migrati ## Bugs ### v. 1.7 Encountered/Fixed -* Issue 14 Subpages pages links to main, restart main page session counter, making the main page fully usable. + +* ✔ Issue 14 Subpages pages links to main, restart main page session counter, making the main page fully usable. * Not really a bug. Session will expire but time remaining will be displayed wrong on the main page. * All subpages need either to inherit the counter, and jump user to the login screen if expired. * Or update main pages timer countdown. Which is not possible if browsers back button is pressed. @@ -76,5 +78,5 @@ This version is not compatible in data structure to prior versions. Data migrati *** Checked (✔) Are items that have been done and submitted to the branch. - + Project -> diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index 34254ce..f10bd79 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -60,6 +60,7 @@ my $rs_keys = $cgi->param('keywords'); my $rs_cat_idx = $cgi->param('category'); my $prm_vc = $cgi->param("vc"); my $prm_xc = $cgi->param("xc"); +my $prm_xc_lst = $cgi->param("idx_cat_x"); my $rs_dat_from = $cgi->param('v_from'); my $rs_dat_to = $cgi->param('v_to'); my $rs_prev = $cgi->param('rs_prev'); @@ -133,6 +134,8 @@ if($prm_xc){ $prm_xc = $sss->param('sss_xc'); } +my @xc_lst = split /\,/, $prm_xc_lst; + $sss->flush(); @@ -205,10 +208,10 @@ print qq("## Using db -> $dsn) if $DEBUG; $st = $db->prepare($stmtCat); $rv = $st->execute() or die "

Error->" & $DBI::errstri & "

"; -my $cats = qq(hms . qq("> - +     - Category: + Category: $cats

@@ -725,24 +747,24 @@ _TXT Log: - +  Amount:   - Marks as: + Marks as:   RTF Document - Sticky + Sticky   - + @@ -768,25 +790,33 @@ _TXT ); my $sss_checked = 'checked' if &isInViewMode; + my $divxc = 'Excludes:'; + if(@xc_lst){#Do list of excludes, past from browser in form of category id's. + my $xcls =""; + foreach(@xc_lst){ $xcls .= $hshCats{$_}.','} + $xcls =~ s/\,$//g; + $divxc = 'Excludes:'.$xcls.''; + } $srh .= qq( View by Category: - - $cats_v    + $cats_v   Exclude Category: - - $cats_x    - - + $cats_x   + +    +    +    Keep In Seession + $divxc View by Date: @@ -853,7 +883,7 @@ $sm_reset_all
LOGOUT
    $cat_desc -
+ + ); print $cgi->end_html; @@ -878,7 +908,7 @@ sub processSubmit { my $date = $cgi->param('date'); my $log = $cgi->param('log'); my $cat = $cgi->param('ec'); - my $cnt; + my $cnt; my $am = $cgi->param('am'); my $af = $cgi->param('amf'); @@ -906,12 +936,12 @@ try { LOG='$log', AMOUNT='$am', AFLAG = '$af', - RTF='$rtf', + RTF='$rtf', STICKY='$sticky' WHERE rowid="$edit_mode";); - # + # print $stm if $DEBUG; # - + my $dbUpd = DBI->connect( $dsn, $userid, $password, { RaiseError => 1 } ) or die "

Error->" & $DBI::errstri & "

"; my $st = $dbUpd->prepare($stm); $st->execute(); @@ -966,7 +996,7 @@ try { ); print "\n###$stm\n" if $DEBUG; - $st = $db->prepare($stm); + $st = $db->prepare($stm); $st->execute(); if($sssCDB){ #Allow further new database creation, it is not an login infinite db creation attack. @@ -974,35 +1004,35 @@ try { } if($rtf){ #Update 0 ground NOTES entry to the just inserted log. - + $st = $db->prepare('SELECT ID FROM VW_LOG LIMIT 1;'); - $st -> execute(); + $st -> execute(); my @lid = $st->fetchrow_array(); - $st = $db->prepare("SELECT DOC FROM NOTES WHERE LID = '0';"); - $st -> execute(); + $st = $db->prepare("SELECT DOC FROM NOTES WHERE LID = '0';"); + $st -> execute(); my @gzero = $st->fetchrow_array(); - + if(scalar @lid > 0){ - #By Notes.LID contraint, there should NOT be an already existing log rowid entry just submitted in the Notes table! + #By Notes.LID contraint, 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 = $db->prepare("SELECT LID FROM NOTES WHERE LID = '$lid[0]';"); - $st->execute(); - if($st->fetchrow_array()){ + $st->execute(); + if($st->fetchrow_array()){ $st = $db->prepare("DELETE FROM NOTES WHERE LID = '$lid[0]';"); - $st->execute(); + $st->execute(); print qq(

Warning deleted (possible old) NOTES.LID[$lid[0]] -> lid:$lid[0]

); } - $st = $db->prepare("INSERT INTO NOTES(LID, DOC) VALUES (?, ?);"); - # + $st = $db->prepare("INSERT INTO NOTES(LID, DOC) VALUES (?, ?);"); + # $st->execute($lid[0], $gzero[0]); - #Flatten ground zero + #Flatten ground zero $st = $db->prepare("UPDATE NOTES SET DOC='' WHERE LID = 0;"); - $st->execute(); + $st->execute(); } - + } # # After Insert renumeration check @@ -1013,22 +1043,22 @@ try { $dtCur = $dtCur - DateTime::Duration->new( days => 1 ); if ( $dtCur > $dt ) { - print $cgi->p('Insert is in the past!'); - &renumerate; + print $cgi->p('Insert is in the past!'); + Settings::renumerate($db); } } } catch { - + print "ERROR -> " . $_; print qq(
Reached2! -> $cnt, $cat, $date, $log, $am, $af, $rtf, $sticky 
$vmode !; @@ -1062,9 +1092,9 @@ exit; $log_output .= qq($vmodeTop    ); } - + $log_output .= '  '; - + if ( $log_cur_id == 0 ) { $log_output = $log_output . 'End'; @@ -1083,16 +1113,16 @@ exit; sub authenticate { try { - + my $st = $db->prepare( "SELECT alias FROM AUTH WHERE alias='$userid' and passw='$password';"); $st->execute(); - my @c = $st->fetchrow_array(); + my @c = $st->fetchrow_array(); if (@c && $c[0] eq $userid ) { return; } #Check if passw has been wiped for reset? $st = $db->prepare("SELECT * FROM AUTH WHERE alias='$userid';"); $st->execute(); - @c = $st->fetchrow_array(); + @c = $st->fetchrow_array(); if ( @c && $c[1] == "" ) { #Wiped with -> UPDATE AUTH SET passw='' WHERE alias='$userid'; $st = $db->prepare("UPDATE AUTH SET passw='$password' WHERE alias='$userid';"); @@ -1134,71 +1164,71 @@ sub authenticate { } } - sub fetchAutocomplete { - try { +sub fetchAutocomplete { + try { - while ( my @row = $st->fetchrow_array() ) { - my $log = $row[0]; + while ( my @row = $st->fetchrow_array() ) { + my $log = $row[0]; - #Decode escaped \\n - $log =~ s/\\n/\n/gs; - $log =~ s/''/'/g; + #Decode escaped \\n + $log =~ s/\\n/\n/gs; + $log =~ s/''/'/g; - #Replace link to empty string - my @words = split( /($re_a_tag)/si, $log ); - foreach my $ch_i (@words) { - next if $ch_i =~ /$re_a_tag/; - next if index( $ch_i, " -1; - $ch_i =~ s/https//gsi; - $ch_i =~ s/($RE{URI}{HTTP})//gsi; - } - $log = join( ' ', @words ); - @words = split( ' ', $log ); - foreach my $word (@words) { - - #remove all non alphanumerics - $word =~ s/[^a-zA-Z]//gs; - if ( length($word) > 2 ) { - $word = lc $word; - - #parse for already placed words, instead of using an hash. - my $idx = index( $autowords, $word, 0 ); - if ( $idx > 0 ) { - my $end = index( $autowords, '"', $idx ); - my $existing = - substr( $autowords, $idx, $end - $idx ); - next if $word eq $existing; - } - - $autowords .= qq(,"$word"); - if ( $aw_cnt++ > &Settings::autoWordLimit ) { - last; - } + #Replace link to empty string + my @words = split( /($re_a_tag)/si, $log ); + foreach my $ch_i (@words) { + next if $ch_i =~ /$re_a_tag/; + next if index( $ch_i, " -1; + $ch_i =~ s/https//gsi; + $ch_i =~ s/($RE{URI}{HTTP})//gsi; + } + $log = join( ' ', @words ); + @words = split( ' ', $log ); + foreach my $word (@words) { + + #remove all non alphanumerics + $word =~ s/[^a-zA-Z]//gs; + if ( length($word) > 2 ) { + $word = lc $word; + + #parse for already placed words, instead of using an hash. + my $idx = index( $autowords, $word, 0 ); + if ( $idx > 0 ) { + my $end = index( $autowords, '"', $idx ); + my $existing = + substr( $autowords, $idx, $end - $idx ); + next if $word eq $existing; } - } - if ( $aw_cnt > &Settings::autoWordLimit ) { - last; + $autowords .= qq(,"$word"); + if ( $aw_cnt++ > &Settings::autoWordLimit ) { + last; + } } } + if ( $aw_cnt > &Settings::autoWordLimit ) { + last; + } } - catch { - print "SERVER ERROR:" . $_; - } - } - sub cam { - 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; } + catch { + print "SERVER ERROR:" . $_; + } +} +sub cam { + 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; +} - sub isInViewMode { - return $sss->param('sss_vc') || $sss->param('sss_xc'); - } + +sub isInViewMode { + return $sss->param('sss_vc') || $sss->param('sss_xc'); +} sub quill{ @@ -1215,7 +1245,7 @@ switch ( &Settings::windowRTFSize ) { } return qq( - + )} sub help{ @@ -1280,13 +1310,13 @@ return qq(