Migrate Google Drive storage app to v1.0.0 of the client library
files_external/3rdparty: update google-api-php-client to 1.0.2-beta
fix a bug in google-api-php-client: generates an auth url that doesn't work

Submitted upstream as https://github.com/google/google-api-php-client/issues/76
Google's php lib has a function to generate a URL for OAuth2 authentication.
It uses http_build_query() to generate the query part of the URL, and in PHP
5.3 or later, this uses an encoded ampersand - &amp; - as the query separator,
not a raw one. However, Google's OAuth server apparently can't handle encoded
ampersands as separators and so it fails.

This patch explicitly sets a raw ampersand as the separator. If Google decides
to fix their OAuth server instead of merging this patch into google-api-php-
client, we can drop this patch as soon as that happens.
google drive: set access type to 'offline' when requesting token

We need to do this in order to be able to refresh the access token without
prompting the user for their credentials every hour. This was the default
in 0.6 of the Google library, but needs to be explicitly specified in 1.0.
bump google lib to c6949531d2 (post 1.0.3-beta, including query separator fix)

This is the upstream commit that merged my query separator fix. It's slightly
after the 1.0.3-beta tag. I eyeballed the other post 1.0.3-beta changes and
none of them looks like any kind of problem, so we may as well just use this
upstream state.
scrutinizer fix: correct @return for getDriveFile()
scrutinizer fix: explicitly declare Google class property $client
update google-api-php-client to 1.0.6-beta

Latest version with various bugfixes, also implements support
for using curl instead of its own io class when available; this
avoids the bug that causes severe excess bandwidth use due to
some kind of zlib issue.
google: disable compression when curl is not available

This is a slightly hacky workaround for
https://github.com/google/google-api-php-client/issues/59 .
There's a bug in the Google library which makes it go nuts on
file uploads and transfer *way* too much data if compression is
enabled and it's using its own IO handler (not curl). Upstream
'fixed' this (by disabling compression) for one upload
mechanism, but not for the one we use. The bug doesn't seem to
happen if the google lib detects that curl is available and
decides to use it instead of its own handler. So, let's disable
compression, but only if it looks like the Google lib's check
for curl is going to fail.
Fix case-sensitivity
Don't disclose relative directory path for single shared files of user

The "dir" key is used within the public sharing template to indicate in which directory the user currently is when sharing a directory with subdirectories. This is needed by the JS scripts.

However, when not accessing a directory then "dir" was set to the relative path of the file (from the user's home directory), meaning that for every public shared file the sharee can see the path.
(For example if you share the file "foo.txt" from "finances/topsecret/" the sharee would still see the path "finances/topsecret/" from the shared HTML template)

This is not the excpected behaviour and can be considered a privacy problem, this patch addresses this by setting "dir" to an empty key.
Remove unused variable and make Scrutinizer happy.
Use a more universal shebang

On FreeBSD, php is usually in /usr/local and I'm sure there are many more exceptions.
fix calculation of expiration date if there is a default expiration date set (but not forced) and the user does not want the link to expire.
Consolidate if statement, and update unit test
Close session only if encryption app is not enabled

Fixes https://github.com/owncloud/core/issues/12389
Fix PHPDoc and deprecated code

Some PHPDocs were incorrect, also used this opportunity to replace some deprecated functions.
Merge pull request #12402 from owncloud/fix-phpdoc

Fix PHPDoc and deprecated code
Merge pull request #12390 from owncloud/use-session-in-case

Close session only if encryption app is not enabled
Merge pull request #12262 from owncloud/removeAbsoluteDirectoryPathFromTemplate

Don't disclose relative directory path for single shared files of user