]> lifelog.hopto.org Git - LifeLog.git/commitdiff
upd.
authorWill Budic <redacted>
Wed, 11 May 2022 19:15:56 +0000 (05:15 +1000)
committerWill Budic <redacted>
Wed, 11 May 2022 19:15:56 +0000 (05:15 +1000)
Current Development Check List.md
Installation_LightHTTPD.txt
htdocs/cgi-bin/config.cgi
htdocs/cgi-bin/data.cgi
htdocs/cgi-bin/main.cgi

index 6815e960a5815b65acf9f30395ebd5d4c756c6a4..1224cac30be6dbe54ed263be1b581d97cff4b94d 100644 (file)
@@ -6,6 +6,9 @@
 
 ### New Development v.2.3+
 
+* [ ] Backup options revisited/retested.
+* [ ] Categories display and intereaction to be bettered.
+* [ ] Bug 37 Keywords only search not wotking on detecting very old items.
 * [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).
@@ -259,6 +262,7 @@ between 2018-08-22 04:13:55 **Moon Stable** production release and this
 
 ### v. 2.3+ Encountered/Fixed
 
+* Bug 37 Keywords only search not wotking on detecting very old items.
 * &#10004; Bug 36.1, Introduced bug, old backup delete not working.
 * &#10004; Bug 36, DBFix not fully working on PG based install and restore not working from backups made with older versions of OpenSSL.
   * Also, restore not working on uploaded backups, from local computer.
index fe8c4b76cb0459c7e19881abcc27c68e06a04120..6bb4e64fcc45cafe8069179220f1bc239b63b83c 100644 (file)
@@ -14,7 +14,7 @@ sudo apt-get install libpcre3-dev -y
 sudo apt-get install libbz2-dev -y
 sudo apt install libssl-dev -y
 
-./configure --prefix=/usr/local/lighttpd --with-openssl --with-sqlite
+./configure --prefix=/usr/local/lighttpd --with-openssl --with-sqlite --with-pgsql
 make
 sudo make install
 
index c615dfe712c263080b9392db1517b7c39bd8b1e9..183583da1712a5e31ceb434714f0b614c670e976 100755 (executable)
@@ -110,7 +110,7 @@ while(my @row = $dbs->fetchrow_array()) {
  }
 
 my $frmCats = qq(
-     <form id="frm_config" action="config.cgi">).$tbl.qq(
+     <form id="frm_config" action="config.cgi#categories">).$tbl.qq(
       <tr class="r1">
          <td><input type="text" name="caid" value="" size="3"/></td>
          <td><input type="text" name="canm" value="" size="12"/></td>
@@ -1247,7 +1247,7 @@ sub backup {
 sub restore {
 
     my $file = shift;
-    my ($tar,$pipe,@br,$stdout,$b_db);
+    my ($tar,$pipe, @br,$stdout,$b_db);
     my $pass = Settings::pass();
     my $hndl = $cgi->param('bck_upload');
     my $dbck = &Settings::logPath."bck/"; `mkdir $dbck` if (!-d $dbck);
@@ -1257,29 +1257,36 @@ sub restore {
     print $fhLog $stamp, "Started restore procedure.\n";
 
 try{
-       getHeader();
-       print $cgi->start_html;
-
-my $stdout = capture_stdout {        
-        print "Restore started: ".Settings::today(), "\n";
-        if($file){ #Open handle on server where backup is to be restored.
-            my $f = &Settings::logPath.$file;
-            open($hndl, '<', $f) or die "Can't open $f: $!";            
-            print $fhLog $stamp, "Reading on server backup file -> $file\n";
-            $tar = $dbck.$file;
-        }        
-        else{
-            print $fhLog $stamp, "Uploading to server backup file -> $hndl\n";
-            $tar = $dbck.$hndl;
-        }
+    getHeader();
+    print $cgi->start_html;
+
+    
+    if($file){ #Open handle on server where backup is to be restored.
+        my $f = &Settings::logPath.$file;
+        open($hndl, '<', $f) or die "Can't open $f: $!";            
+        print $fhLog $stamp, "Reading on server backup file -> $file\n";
+        $tar = $dbck.$file;
+    }        
+    else{
+        print $fhLog $stamp, "Uploading to server backup file -> $hndl\n";
+        $tar = $dbck.$hndl;
+    }
+
+    print $cgi->pre("Restore started: ".Settings::today(), "\n", "Reading $tar ..."); 
+
+    my $stdout = capture_stdout {        
         $tar =~ s/osz$/tar/;
         my $srcIsPg = 0;
         my $passw   = $pass; $passw = uc crypt $pass, hex Settings->CIPHER_KEY if &Settings::isProgressDB;
-        open (my $pipe, "|-", "openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -d -salt -S ".
-                Settings->CIPHER_KEY." -pass pass:$passw-$alias -in /dev/stdin -out $tar 2>/dev/null") or die "Pipe Failed for $tar: $!";                 
+        open ($pipe, "|-", "openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 100000 -d -salt -S ".
+                Settings->CIPHER_KEY." -pass pass:$passw-$alias -in /dev/stdin -out $tar") 
+                or die "Pipe Failed for $tar: $!";
+         
             while(<$hndl>){print $pipe $_; die "bad decoding" if $?;}; 
         close $pipe; 
         close $hndl;
+        
+        
 #cat bck_20210819160848_SQLite_admin.osz | openssl enc -d -des-ede3-cfb -salt -S 95d7a85ba891da -pass pass:42FAP5H0JUSZM-admin -in /dev/stdin > extract.tar
 #openssl des-ede3-cfb -d -salt -S 95d7a85ba891da -pass pass:42FAP5H0JUSZM-admin -pbkdf2 -in bck_20210830133220_NUc_SQLite_admin.osz -out extract.tar
 
@@ -1459,6 +1466,7 @@ catch{
     $ERROR = "<br><font color='red'><b>Full Restore Failed!</b></font><br>$@ \n";
     $ERROR .= "br:[@br]" if(@br);
     $ERROR .= "<br><b>Failed at stage:</b> $stage";
+    print $fhLog $stamp, "Error: $@ at:@br.\n";
     openlog(Settings::dsn(), 'cons,pid', "user");
         syslog('err', '%s', $ERROR);
     closelog();
index a7fd104d343a447a267d9be2c95b5fbb0d7fba91..076bf58b82077c779a64070e4d78f1acd78b5d99 100755 (executable)
@@ -20,7 +20,7 @@ use lib "system/modules";
 require Settings;
 
 my $db        = Settings::fetchDBSettings();
-my $cgi       = Settings::cgi();
+my $cgi       = Settings::cgi(); 
 my $dbname    = Settings::dbName();
 my $human     = DateTime::Format::Human::Duration->new();
 my $PRC_WIDTH = Settings::pagePrcWidth();
@@ -31,6 +31,7 @@ my $imgw      = 210;
 my $imgh      = 120;
 my $opr = $cgi->param("opr");
 my $confirmed = $cgi->param('confirmed');
+
 if ($opr == 1){
         DisplayDateDiffs();
 }
@@ -168,7 +169,8 @@ try{
 
     #Get ids and build confirm table and check
     my $stm = $stmS ." ";
-    foreach my $id ($cgi->param('chk')){
+    my @chks= $cgi->param('chk');
+    foreach my $id (@chks){
         if($opr == 2){
             $stm = $stm . "$SQLID = " . $id . " OR ";
         }
@@ -182,7 +184,7 @@ try{
                  
     if($opr == 0){        
         printHeader('Confirm Deletion');
-        print $cgi->pre("###NotConfirmed()->[stm:$stm]") if($DEBUG);
+        print $cgi->pre("###NotConfirmed()->[stm:$stm]\n]opr:$opr]") if($DEBUG);
 
         my $r_cnt = 0;
         my $rs = "r1";
@@ -338,8 +340,8 @@ try{
     my $stmE = " ORDER BY DATE DESC, ID DESC;";  
 
     #Get ids and build confirm table and check
-    my $stm = " ";
-    foreach my $id ($cgi->param('chk')){
+    my $stm = " "; my @chks= $cgi->param('chk');
+    foreach my $id (@chks){
         if($opr == 2){
             $stm = $stm . "$SQLID = " . $id . " OR ";
         }
index a2a65fee374f124da05a9dce5496ad32ea19d819..3f88b08995d4693bb9e6fb896b07b1268df5a992 100755 (executable)
@@ -3,7 +3,7 @@
 # Programed by: Will Budic
 # Open Source License -> https://choosealicense.com/licenses/isc/
 #
-use v5.34; #use diagnostics;
+use v5.30; #use diagnostics;
 use warnings;
 use strict;
 no warnings "experimental::smartmatch";
@@ -255,27 +255,38 @@ my %hshDesc = ();
 my $c_sel   = 1;
 my $data_cats = "";
 my $td_cat = "<tr><td><ul>";
-my $td_itm_cnt =0;
-while ( my @row = $st->fetchrow_array() ) {
+my $td_itm_cnt;
+# We need to preserve key order of categories by user, no sorting or randomness allowed.
+my @keys;
+while (my @row = $st->fetchrow_array()) {
        my $n = $row[1];
        $n =~ s/\s*$//g;
+       push @keys, $row[0];
        $hshCats{$row[0]} = $n;
        $hshDesc{$row[0]} = $row[2];
-       if($td_itm_cnt>4){
+       $td_itm_cnt++;
+}
+my $present_rows_cnt =  $td_itm_cnt > 20 ? 2+(($td_itm_cnt)/10)*2 : 4;
+$td_itm_cnt = 0;
+foreach my $key(@keys){
+       if($td_itm_cnt>$present_rows_cnt){
                $td_cat .= "</ul></td><td><ul>";
-               $td_itm_cnt = 0;
+               $td_itm_cnt = 0;                
        }
-       $td_cat .= "<li id='".$row[0]."'><a href='#'>".$row[1]."</a></li>";
+       $td_cat .= "<li id='".$key."'><a href='#'>".$hshCats{$key}."</a></li>";
        $td_itm_cnt++;
 }
-if($td_itm_cnt<5){#fill spacing.
-       for (my $i=0;$i<5-$td_itm_cnt;$i++){
+$present_rows_cnt++ if $td_itm_cnt<$present_rows_cnt+1;
+if($td_itm_cnt<$present_rows_cnt){#fill spacing.
+       for (my $i=0;$i<$present_rows_cnt-$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;
@@ -1054,8 +1065,9 @@ else{
        $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;
-        <a id="to_bottom" href="#bottom" title="Go to bottom of page."><span class="ui-icon ui-icon-arrowthick-1-s" style="float:none;"></span></a>
+               <a id="to_bottom" href="#bottom" title="Go to bottom of page."><span class="ui-icon ui-icon-arrowthick-1-s" style="float:none;"></span></a>
+        &nbsp;        
+               <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>
         <a id="menu_close" href="#" onclick="return hideLog();"><span class="ui-icon ui-icon-heart" style="float:none;"></span></a>
         </div>
         <hr>
@@ -1079,7 +1091,6 @@ else{
         );
 }
 
-
 my $quill = &quill( param('submit_is_edit') );
 my $help = &help;