Bug #5021 - fixing sharing ticket management problems

- fixing sharing ticket expiration on the last day
- fixing a security hole around file sharing
- fixing the displaying of files attached at non valid publications