diff --git a/phosta.pl b/phosta.pl
index e0cb3c60ce6cad00d749ef7f623ec7651142cfea..daaab7d6bf3bfc2bfd5e4a2257e69b8e161c9d02 100755
--- a/phosta.pl
+++ b/phosta.pl
@@ -84,7 +84,7 @@ !defined($opt_t) || $opt_t =~ /^([0-9]{8}){0,1}\-([0-9]{8}){0,1}$/ or return 0;
$opt_E =~ /^([a-z]{2,4}){1,}(\,[a-z]{2,4}){0,}$/ or return 0;
- !defined($opt_f) || $opt_f =~ /^[\w]{2,}(!){0,1}=[\w]{1,}(,[\w]{2,}(!){0,1}=[\w]{1,}){0,}$/ or return 0;
+ !defined($opt_f) || $opt_f =~ /^[\w\-]{2,}(!){0,1}=[\w]{1,}(,[\w]{2,}(!){0,1}=[\w\-]{1,}){0,}$/ or return 0;
return 1;
}
@@ -164,6 +164,22 @@
return ($from, $to);
}
+sub get_filters
+{
+ if (defined($opt_f))
+ {
+ my @returnarray;
+ my (@filters) = split /\,/, $opt_f;
+ foreach (@filters)
+ {
+ my @line = split /(!{0,1}=)/, $_;
+ push @returnarray, \@line;
+ }
+ return @returnarray;
+ }
+ return undef;
+}
+
sub get_sql
{
my $fieldlist = '';
@@ -214,14 +230,10 @@ !defined($from) or push @wherearray, "datetimeoriginal >= '$from'";
!defined($to) or push @wherearray, "datetimeoriginal <= '$to'";
}
- if (defined($opt_f))
+
+ foreach (get_filters())
{
- my (@filters) = split /\,/, $opt_f;
- foreach (@filters)
- {
- my ( $sub1, $sub2, $sub3 ) = split /(!){0,1}=/, $_;
- push @wherearray, $sub1 . ($_ =~ /!/ ? ' NOT ' : '') . " LIKE '%$sub3%'";
- }
+ push @wherearray, @{$_}[0] . (@{$_}[1] =~ /!/ ? ' NOT' : '') . " LIKE '%@{$_}[2]%'";
}
my $wherelist = '';
@@ -297,6 +309,10 @@ if (defined($from) && defined($to)) { say ' - images taken between '. color('bold'). $from .color('reset') .' and '. color('bold'). $to . color('reset'); }
if (defined($from) && !defined($to)) { say ' - images taken since '. color('bold'). $from . color('reset'); }
if (defined($to) && !defined($from)) { say ' - images taken till '. color('bold'). $to . color('reset'); }
}
+ foreach (get_filters())
+ {
+ say ' - ' .color('italic') . @{$_}[0] .color('reset') . (@{$_}[1] =~ /!/ ? ' NOT' : '') . ' LIKE ' .color('bold') .@{$_}[2]. color('reset');;
+ }
say '';
}
@@ -306,7 +322,7 @@ say 'Showing '. color('bold'). "top $currentlines". color('reset'). ' results, skipping '. color('italic') . "$skippedlines lines".color('reset') .'.';
}
say 'A total of '. color('bold'). "$sum images". color('reset') .' matched your criteria.';
say '';
- say $tb->draw;
+ if (scalar @$rows) { say $tb->draw; }
}
sub main::VERSION_MESSAGE()