[stable6] Correctly read the full stream in file_get_contents 

Backport of https://github.com/owncloud/core/pull/7979 to stable6.

This works for SMB but has trouble with SFTP.

The SFTP lib is giving strange warnings:
`PHP Warning:  mcrypt_generic(): 192 is not a valid MCrypt resource in /srv/www/htdocs/owncloud/apps/files_external/3rdparty/phpseclib/phpseclib/Crypt/RC4.php on line 360`

The version of phpseclib on stable6 is much older... not sure if we want to risk upgrading it (it's for SFTP)
Note it will be upgraded in OC 7 here: https://github.com/owncloud/core/pull/8003

@bantu @karlitschek