X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Flib%2FMAPS.pm;h=b1df12384423d305bb3de6492817daf95d41922d;hb=1f5737d7c0b97ac29c72a9f0cd883bd6211edec9;hp=f1871ffcebc4a5e91bbb66e4bf5e100ba8ba731b;hpb=16babf81ce331af378de565ba73e927ff5491f65;p=clearscm.git diff --git a/maps/lib/MAPS.pm b/maps/lib/MAPS.pm index f1871ff..b1df123 100644 --- a/maps/lib/MAPS.pm +++ b/maps/lib/MAPS.pm @@ -376,7 +376,7 @@ sub CheckOnList ($$;$) { : !defined $domain ? "$email_on_file\@" : $email_on_file; - if ($sender =~ /$search_for/i) { + if ($sender and $sender =~ /$search_for/i) { $rule = "Matching rule: ($listtype:$sequence) \"$email_on_file\""; $rule .= " - $comment" if $comment and $comment ne ''; $status = 1; @@ -702,16 +702,19 @@ sub Encrypt($$) { return $row[0]; } # Encrypt -sub FindEmail(;$) { - my ($sender) = @_; +sub FindEmail(;$$) { + my ($sender, $date) = @_; my $statement; - if (!defined $sender || $sender eq '') { - $statement = "select * from email where userid = '$userid'"; - } else { - $statement = "select * from email where userid = '$userid' and sender = '$sender'"; - } # if + $sender //= ''; + $date //= ''; + + $statement = "select * from email where userid = '$userid'"; + + # Add conditions if present + $statement .= " and sender = '$sender'" if $sender; + $statement .= " and timestamp = '$date'" if $date; my $sth = $DB->prepare($statement) or DBError('FindEmail: Unable to prepare statement', $statement);