sharing api cleanup, first step

Some first steps of the sharing api cleanup. The last weeks it become quite hard to backport bugfixes from master. Therefore I would like to merge this status as an intermediate step.

What did I changed in the first run:

- move code from lib/public/share.php to /lib/private/share/share.php (that's the main reason for the large number of line changes)
- moved some code which is used on various places to helper methods/classes

cc  @PVince81 @DeepDiver1975 @karlitschek