....
end; // allowedTo
function timeFiltered(filetime: Tdatetime):boolean; //mars time good
var
older, newer, curtime: Tdatetime;
begin
curtime:=now();
if not TryStrToDate(data.urlvars.Values['older'], older) then
older:=incDay(curtime,-strtointdef(data.urlvars.Values['older'],-1));
if not TryStrToDate(data.urlvars.Values['newer'], newer) then
newer:=incDay(curtime,-strtointdef(data.urlvars.Values['newer'],integer(trunc(curtime))));
result:=if_(newer <= older,(newer <= filetime) and (filetime <= older),(filetime < older)or(newer < filetime));
end;
procedure includeFilesFromDisk();
var
.....
procedure includeFilesFromDisk();
......
// we don't list these entries
if (sr.name = '.') or (sr.name = '..')
or isCommentFile(sr.name) or isFingerprintFile(sr.name) or sameText(sr.name, DIFF_TPL_FILE)
or not hasRightAttributes(sr.attr)
or stringExists(sr.name, namesInVFS)
or not timefiltered(filedateToDatetime(sr.Time)) //mars time good
then continue;
filteredOut:=not fileMatch( if_(sr.Attr and faDirectory > 0, foldersFilter, filesFilter), sr.name)
or not fileMatch( if_(sr.Attr and faDirectory > 0, urlFoldersFilter, urlFilesFilter), sr.name);
// if it's a folder, though it was filtered, we need to recur
.....
end; // includeFilesFromDisk
......
procedure includeItemsFromVFS();
......
// filtered out
if not fileMatch( if_(f.isFolder(), foldersfilter, filesfilter), f.name)
or not fileMatch( if_(f.isFolder(), urlFoldersfilter, urlFilesfilter), f.name)
or not timefiltered(f.mtime) //mars time good
then
begin
if recursive then recurOn(f);
continue;
end;
....
two new urlvars:
newer and
older ( than a date or number of days)
usage examples:
files newest since a date to now ?sort=d&reverse&
newer=22/02/2009 files newest since a few days to now ?sort=d&reverse&
newer=20 files oldest that a date ?sort=d&reverse&
older=01/03/2009 files oldest since a few days before now ?sort=d&reverse&
older=15files between two dates or days
?sort=d&reverse&
newer=20&older=15 ?sort=d&reverse&
newer=22/02/2009&older=01/03/2009 ?sort=d&reverse&
newer=20&older=01/03/2009 ?sort=d&reverse&
newer=22/02/2009&older=15only files since never=22/02/2009 to older=01/03/2009
files outside two dates or days
we have to invert values of dates never=01/03/2009 and older=22/02/2009
files are those from 01/01/1889 to oldest than older=22/02/2009 + from newest never=01/03/2009 to now
?sort=d&reverse&
older=22/02/2009&newer=01/03/2009 ?sort=d&reverse&
older=20&newer=15 ?sort=d&reverse&
older=22/02/2009&newer=15 ?sort=d&reverse&
older=20&newer=01/03/2009