### 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).
### v. 2.3+ Encountered/Fixed
+* Bug 37 Keywords only search not wotking on detecting very old items.
* ✔ Bug 36.1, Introduced bug, old backup delete not working.
* ✔ 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.
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
}
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>
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);
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
$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();
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();
my $imgh = 120;
my $opr = $cgi->param("opr");
my $confirmed = $cgi->param('confirmed');
+
if ($opr == 1){
DisplayDateDiffs();
}
#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 ";
}
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";
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 ";
}
# 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";
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> </li>";
}
}
$td_cat .= "</ul></td></tr>";
+
+
for my $key ( keys %hshDesc ) {
my $kv = $hshDesc{$key};
next if !$kv;
$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>
- <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>
+
+ <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>
);
}
-
my $quill = &quill( param('submit_is_edit') );
my $help = &help;