lms: add dtime=0 condition to all queries involving files table