Refactor db_helper_compare_days()

The function now accepts 4 parameters
- 2 dates (only strings, constants should be passed as DB parameters
- an SQL operator to use for the comparison
- the number of days to compare against

Returns: date1 [operator] date2 + days

All occurences of the function in MantisBT code base have been updated
accordingly.

Fixes #17980